<div dir="ltr"><div>Hi Stefano,</div><div>I have similar rules in my dialplan and they work.</div><div>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!<br></div><div><br></div><div>Patrick Wakano<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, 10 Oct 2018 at 02:21, Stefano Bertuola <<a href="mailto:stefano.bertuola@gmail.com">stefano.bertuola@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(11,83,148)">Hi Experts.</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(11,83,148)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(11,83,148)">I did some tests with DIALPLAN module and I have some doubts about how to define the regular expressions in the database.</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(11,83,148)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(11,83,148)">For example, using the start character '^' (beginning of the string), it looks not working:</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(11,83,148)"><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace">kamcmd> dialplan.dump 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace">{</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> DPID: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> ENTRIES: {</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> ENTRY: {</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> PRIO: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> MATCHOP: 2</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> MATCHEXP: ^(\+39)(.*)$</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> MATCHLEN: 0</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> SUBSTEXP: ^(\+39)(.*)$</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> REPLEXP: \2</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> ATTRS: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> }</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace"> }</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace">}</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace">kamcmd> dialplan.translate 1 "+39123456" </font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font color="#000000" face="monospace, monospace">error: 500 - No translation</font></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(11,83,148)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(11,83,148)">Removing it, it works... but not as desired:</div><div class="gmail_default" style="font-family:verdana,sans-serif"><font color="#000000"><br></font></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">kamcmd> dialplan.dump 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">{</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> DPID: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> ENTRIES: {</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><span style="color:rgb(0,0,0);font-family:monospace,monospace"> ENTRY: {</span></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> PRIO: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> MATCHOP: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> MATCHEXP: (\+39)(.*)$</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> MATCHLEN: 0</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> SUBSTEXP: (\+39)(.*)$</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> REPLEXP: \2</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> ATTRS: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> }</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> }</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">}</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">kamcmd> dialplan.translate 1 "+39123456"</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">{</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> Output: 123456"</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> Attributes: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">}</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">kamcmd> dialplan.translate 1 "xxxxxxx+39123456"</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">{</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> Output: 123456"</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"> Attributes: 1</font></div></div></div></div><div><div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000">}</font></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" color="#000000"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif" color="#0b5394">Can someone help me understand how the regular expression should be used in DIALPLAN, please?</font></div><div class="gmail_default"><font face="verdana, sans-serif" color="#0b5394"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif" color="#0b5394">Br. Stefano</font></div></div></div></div></div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>