<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix"><tt>What OpenSIPS version are you
using? Are you sure that your specific '^9675...' rule is being
applied?<br>
<br>
Hint: you can enter the debug mode with <i>opensipsctl fifo
debug 4</i> and look for:<br>
<br>
Apr 4 15:58:44 [9963] DBG:dialplan:translate: Found a matching
rule 0x7fa7b59ae6d0: pr 1, match_exp
^9675#0[1-9]{2}[1-6][0-9]{7}<br>
<br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
On 04/04/2014 03:35 PM, Alcindo Schleder wrote:<br>
</div>
<blockquote
cite="mid:!&!AAAAAAAAAAAYAAAAAAAAAK3O+iK9cmRBl8k+xOm%2F4qDCgAAAEAAAAEWDu9gOrAdNuAZALz%2F1ADABAAAAAA==@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"Pré-formatação HTML Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.Pr-formataoHTMLChar
        {mso-style-name:"Pré-formatação HTML Char";
        mso-style-priority:99;
        mso-style-link:"Pré-formatação HTML";
        font-family:"Consolas","serif";
        color:black;}
span.EstiloDeEmail19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EstiloDeEmail20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi Liviu
Chircu.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">See my dialplan
database table:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">+----+------+----+----------+------------------------------------+-------------+----------------------------------+----------+----------+----------+<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">| id | dpid |
pr | match_op | match_exp |
match_flags | subst_exp | repl_exp |
disabled | attrs |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">+----+------+----+----------+------------------------------------+-------------+----------------------------------+----------+----------+----------+<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">| 6 | 0 |
1 | 1 | ^9675#0[1-9]{2}[1-6][0-9]{7}
| 0 | ^(9675#)(0[1-9]{2})([1-6][0-9]{7}) |
\2\3 | 0 | fix_pstn |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">+----+------+----+----------+------------------------------------+-------------+----------------------------------+----------+----------+----------+<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">And call
db_translate:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">dp_translate("0","$rU/$rU")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">store
“fix_pstn” into $avp(s:dest)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Is all right,
except that the value of $ rU = "23"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">[]s<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:PT-BR">De:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:PT-BR">
<a class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
[<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>] <b>Em nome de
</b>Liviu Chircu<br>
<b>Enviada em:</b> sexta-feira, 4 de abril de 2014 07:27<br>
<b>Para:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
<b>Assunto:</b> Re: [OpenSIPS-Users] Opensips dialplan
repl_exp<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Courier
New"">Hello Alcindo,<br>
<br>
This should work:<br>
<br>
mysql> select * from dialplan where id=3;<br>
+----+------+----+----------+-----------+-------------+-----------+----------+----------+-------+<br>
| id | dpid | pr | match_op | match_exp | match_flags |
subst_exp | repl_exp | disabled | attrs |<br>
+----+------+----+----------+-----------+-------------+-----------+----------+----------+-------+<br>
| 3 | 1 | 1 | 1 | ^\d*#.* | 0 |
^(\d*)#.* | \1 | 0 | |<br>
+----+------+----+----------+-----------+-------------+-----------+----------+----------+-------+</span><br>
<span style="font-family:"Courier New""><br>
It basically matches your input string, and catches the
user id with "(\d*)". It then replaces the $rU with that
data, which is now stored in variable #1: "\1"<br>
<br>
Script usage:<br>
<br>
"<br>
$var(in) = <a moz-do-not-send="true"
href="mailto:9675#1209380123@192.168.2.133">"9675#1209380123@192.168.2.133"</a>;<br>
<br>
if (!dp_translate("1", "$var(in)/$rU"))<br>
xlog("XXX failed to translate\n");<br>
else<br>
xlog("XXX translated to: $ru\n");</span><br>
"<br>
<br>
...<br>
<span style="font-family:"Courier New"">XXX
translated to: <a moz-do-not-send="true"
href="mailto:sip:9675@192.168.2.133:5060">sip:9675@192.168.2.133:5060</a></span><br>
...<br>
<br>
<br>
<span style="font-family:"Courier New"">Best
regards,</span><br>
<br>
<o:p></o:p></p>
<pre>Liviu Chircu<o:p></o:p></pre>
<pre>OpenSIPS Developer<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<p class="MsoNormal">On 04/04/2014 11:24 AM, Alcindo Schleder
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">I'm using opensips 1.10xeo dialplan
module. The user send me the following string:
'9675#destinationNumber@serverip’. <o:p></o:p></p>
<p class="MsoNormal">I want to remove only the # 9675 number
and store in $rU. <o:p></o:p></p>
<p class="MsoNormal">I've tried everything and can not
succeed. I tried with subst_exp, repl_exp and nothing.<o:p></o:p></p>
<p class="MsoNormal">What could be wrong?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:PT-BR">Alcindo
Schleder</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;mso-fareast-language:PT-BR">Gerente
de Negócios – <a moz-do-not-send="true"
href="mailto:comercial@renovaretelecom.com.br">comercial@renovaretelecom.com.br</a>
</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;mso-fareast-language:PT-BR">(51)
3564-4156</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;mso-fareast-language:PT-BR">(51)
9790-9437</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:PT-BR"><a
moz-do-not-send="true"
href="http://www.renovaretelecom.com.br/">Renovare
Telecom</a></span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:PT-BR"><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Users mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif";mso-fareast-language:PT-BR"><o:p> </o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>