Opensips dialplan repl_exp

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Opensips dialplan repl_exp

Alcindo Schleder

I'm using opensips 1.10xeo dialplan module. The user send me the following string: '9675#destinationNumber@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 – [hidden email]

(51) 3564-4156

(51) 9790-9437

Renovare Telecom

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips dialplan repl_exp

kostenftw
are you sure that you can rewrite $rU... i do this by making another variable and then removing the unwanted by using {s.substr,x,y}


2014-04-04 10:24 GMT+02:00 Alcindo Schleder <[hidden email]>:

I'm using opensips 1.10xeo dialplan module. The user send me the following string: '9675#destinationNumber@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 – [hidden email]

<a href="tel:%2851%29%203564-4156" value="+15135644156" target="_blank">(51) 3564-4156

<a href="tel:%2851%29%209790-9437" value="+15197909437" target="_blank">(51) 9790-9437

Renovare Telecom

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Med venlig hilsen
ipnordic A/S

Mike Claudi Pedersen
Tekniker

Telefon: 79301033
www.ipnordic.dk

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips dialplan repl_exp

kostenftw
oh nvm i just saw that you can rewrite $rU. 



2014-04-04 10:31 GMT+02:00 Mike Claudi Pedersen <[hidden email]>:
are you sure that you can rewrite $rU... i do this by making another variable and then removing the unwanted by using {s.substr,x,y}


2014-04-04 10:24 GMT+02:00 Alcindo Schleder <[hidden email]>:

I'm using opensips 1.10xeo dialplan module. The user send me the following string: '9675#destinationNumber@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 – [hidden email]

<a href="tel:%2851%29%203564-4156" value="+15135644156" target="_blank">(51) 3564-4156

<a href="tel:%2851%29%209790-9437" value="+15197909437" target="_blank">(51) 9790-9437

Renovare Telecom

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Med venlig hilsen
ipnordic A/S

Mike Claudi Pedersen
Tekniker

Telefon: 79301033
www.ipnordic.dk



--
Med venlig hilsen
ipnordic A/S

Mike Claudi Pedersen
Tekniker

Telefon: 79301033
www.ipnordic.dk

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips dialplan repl_exp

Bogdan-Andrei Iancu-2
In reply to this post by Alcindo Schleder
Hello,

What is the dialplan entry to have tried (in db) ? I can doublechek it for you.

Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 04.04.2014 11:24, Alcindo Schleder wrote:

I'm using opensips 1.10xeo dialplan module. The user send me the following string: '9675#destinationNumber@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 – [hidden email]

(51) 3564-4156

(51) 9790-9437

Renovare Telecom

 



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Opensips dialplan repl_exp

Liviu Chircu
In reply to this post by Alcindo Schleder
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) = [hidden email];

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

"

...
XXX translated to: [hidden email]
...


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@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 – [hidden email]

(51) 3564-4156

(51) 9790-9437

Renovare Telecom

 



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

RES: Opensips dialplan repl_exp

Alcindo Schleder

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: [hidden email] [mailto:[hidden email]] Em nome de Liviu Chircu
Enviada em: sexta-feira, 4 de abril de 2014 07:27
Para: [hidden email]
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) = [hidden email];

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

"

...
XXX translated to: [hidden email]
...


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@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 – [hidden email]

(51) 3564-4156

(51) 9790-9437

Renovare Telecom

 




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: RES: Opensips dialplan repl_exp

Liviu Chircu
What OpenSIPS version are you using? Are you sure that your specific '^9675...' rule is being applied?

Hint: you can enter the debug mode with opensipsctl fifo debug 4 and look for:

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}

Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 04/04/2014 03:35 PM, Alcindo Schleder wrote:

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: [hidden email] [[hidden email]] Em nome de Liviu Chircu
Enviada em: sexta-feira, 4 de abril de 2014 07:27
Para: [hidden email]
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) = [hidden email];

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

"

...
XXX translated to: [hidden email]
...


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@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 – [hidden email]

(51) 3564-4156

(51) 9790-9437

Renovare Telecom

 




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

RES: Opensips dialplan repl_exp

Alcindo Schleder
In reply to this post by Liviu Chircu

Hi all...

 

Solved.

 

I use how follow:

 

match_exp = ^9675#0[1-9]{2}[1-6][0-9]{7}

subst_exp = ^9675#(.*)

repl_exp = \1

attrs=’fix_pstn’

 

number sended: [hidden email]

$rU=9675#01136359633

if (!dp_translate("0","$rU/$rU")) {

          send_reply("420", "Invalid destination");

          xlog("420: Invalid destination to ru: $rU dest: $avp(s:dest)");

          exit;

}

Result is:

$avp(s:dest) = ‘fix_pstn’

$rU = 01136359633

 

Thank you all....

 

 

De: [hidden email] [mailto:[hidden email]] Em nome de Liviu Chircu
Enviada em: sexta-feira, 4 de abril de 2014 07:27
Para: [hidden email]
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) = [hidden email];

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

"

...
XXX translated to: [hidden email]
...


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@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 – [hidden email]

(51) 3564-4156

(51) 9790-9437

Renovare Telecom

 




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users