[OpenSIPS-Users] RES: Opensips dialplan repl_exp

Alcindo Schleder alcindoschleder at gmail.com
Fri Apr 4 14:35:14 CEST 2014


Hi Liviu Chircu.

 

See my dialplan database table:

 

+----+------+----+----------+------------------------------------+----------
---+----------------------------------+----------+----------+----------+

| id | dpid | pr | match_op | match_exp                          |
match_flags | subst_exp                        | repl_exp | disabled | attrs
|

+----+------+----+----------+------------------------------------+----------
---+----------------------------------+----------+----------+----------+

|  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 |

+----+------+----+----------+------------------------------------+----------
---+----------------------------------+----------+----------+----------+

 

And call db_translate:

dp_translate("0","$rU/$rU")

 

store “fix_pstn” into $avp(s:dest)

 

Is all right, except that the value of $ rU = "23"

 

[]s

 

De: users-bounces at lists.opensips.org
[mailto:users-bounces at lists.opensips.org] Em nome de Liviu Chircu
Enviada em: sexta-feira, 4 de abril de 2014 07:27
Para: users at lists.opensips.org
Assunto: Re: [OpenSIPS-Users] Opensips dialplan repl_exp

 

Hello Alcindo,

This should work:

mysql> select * from dialplan where id=3;
+----+------+----+----------+-----------+-------------+-----------+---------
-+----------+-------+
| id | dpid | pr | match_op | match_exp | match_flags | subst_exp | repl_exp
| disabled | attrs |
+----+------+----+----------+-----------+-------------+-----------+---------
-+----------+-------+
|  3 |    1 |  1 |        1 | ^\d*#.*   |           0 | ^(\d*)#.* | \1
|        0 |       |
+----+------+----+----------+-----------+-------------+-----------+---------
-+----------+-------+

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"

Script usage:

"
$var(in) =  <mailto:9675#1209380123 at 192.168.2.133>
"9675#1209380123 at 192.168.2.133";

if (!dp_translate("1", "$var(in)/$rU"))
    xlog("XXX failed to translate\n");
else
    xlog("XXX translated to: $ru\n");
"

...
XXX translated to: sip:9675 at 192.168.2.133:5060
...


Best regards,



Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 04/04/2014 11:24 AM, Alcindo Schleder wrote:

I'm using opensips 1.10xeo dialplan module. The user send me the following
string: '9675#destinationNumber at serverip’. 

I want to remove only the # 9675 number and store in $rU. 

I've tried everything and can not succeed. I tried with subst_exp, repl_exp
and nothing.

What could be wrong?

 

Alcindo Schleder

Gerente de Negócios – comercial at renovaretelecom.com.br 

(51) 3564-4156

(51) 9790-9437

Renovare Telecom <http://www.renovaretelecom.com.br/> 

 






_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140404/c729afc2/attachment.htm>


More information about the Users mailing list