mysql> select * from dialplan;+----+------+----+----------+--------------+-----------+--------------+----------+-------+| id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs |+----+------+----+----------+--------------+-----------+--------------+----------+-------+| 1 | 1 | 1 | 1 | ^(\+39)(.*)$ | 0 | ^(\+39)(.*)$ | \2 | 1 |+----+------+----+----------+--------------+-----------+--------------+----------+-------+NOTICE: <script>: +3912345|Before DialplanNOTICE: <script>: 12345|After Dialplan
Hi Stefano,I have similar rules in my dialplan and they work.However the kamcmd dialplan.translate command also fails for me (Kamailio 5.0.4), but I guess it is a problem with the command itself and not with the translation done by the dp_translate(), because for real calls it does work!Patrick Wakano_______________________________________________On Wed, 10 Oct 2018 at 02:21, Stefano Bertuola <stefano.bertuola@gmail.com> wrote:_______________________________________________Hi Experts.I did some tests with DIALPLAN module and I have some doubts about how to define the regular expressions in the database.For example, using the start character '^' (beginning of the string), it looks not working:kamcmd> dialplan.dump 1{DPID: 1ENTRIES: {ENTRY: {PRIO: 1MATCHOP: 2MATCHEXP: ^(\+39)(.*)$MATCHLEN: 0SUBSTEXP: ^(\+39)(.*)$REPLEXP: \2ATTRS: 1}}}kamcmd> dialplan.translate 1 "+39123456"error: 500 - No translationRemoving it, it works... but not as desired:kamcmd> dialplan.dump 1{DPID: 1ENTRIES: {ENTRY: {PRIO: 1MATCHOP: 1MATCHEXP: (\+39)(.*)$MATCHLEN: 0SUBSTEXP: (\+39)(.*)$REPLEXP: \2ATTRS: 1}}}kamcmd> dialplan.translate 1 "+39123456"{Output: 123456"Attributes: 1}kamcmd> dialplan.translate 1 "xxxxxxx+39123456"{Output: 123456"Attributes: 1}Can someone help me understand how the regular expression should be used in DIALPLAN, please?Br. Stefano
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users