Strip + character

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

Strip + character

michel freiha
Dear All,

I'm trying to strip + from dialed number that hit the OpenSIPS server, after that I'm using carrierroute that read from database all routes and send the call to the appropriate GW...The issue that the number is sent with the + to the destination GW so i need you to help me please...

The DialPlan is as below:

if($rU =~ "^[+].*" )
{
        strip(1);
    if(!cr_route("default", "0", "$rU", "$rU", "call_id")){

       sl_send_reply("403", "Not allowed");
     } else {
         t_on_failure("1");
          # Relay the request to the gateway
           t_relay();

   }


Regards



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

Re: Strip + character

Adam Twardowski
I've never used strip() before, but you could try $rU=$(rU{s.substr,1,0})

you could also do something similar in your if() statement if you want to get rid of the regular expression and save a couple cpu cycles.

On Mon, Aug 16, 2010 at 9:45 AM, michel freiha <[hidden email]> wrote:
Dear All,

I'm trying to strip + from dialed number that hit the OpenSIPS server, after that I'm using carrierroute that read from database all routes and send the call to the appropriate GW...The issue that the number is sent with the + to the destination GW so i need you to help me please...

The DialPlan is as below:

if($rU =~ "^[+].*" )
{
        strip(1);
    if(!cr_route("default", "0", "$rU", "$rU", "call_id")){

       sl_send_reply("403", "Not allowed");
     } else {
         t_on_failure("1");
          # Relay the request to the gateway
           t_relay();

   }


Regards



_______________________________________________
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: Strip + character

Brett Nemeroff
In reply to this post by michel freiha
On Mon, Aug 16, 2010 at 8:45 AM, michel freiha <[hidden email]> wrote:
if($rU =~ "^[+].*" )
{
        strip(1);

What's the problem with this? Does it not work? Does it report an error? Give us a little more detail on the problem. I would have expected strip to work here..

-Brett
 

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

Re: Strip + character

Pasan Meemaduma
In reply to this post by Adam Twardowski
Hi

Following should work as well.

if (uri=~"sip:\+[0-9]+@.*") {
                 strip(1);

may be you need to \+.


From: Adam Twardowski <[hidden email]>
To: OpenSIPS users mailling list <[hidden email]>
Sent: Monday, August 16, 2010 19:26:07
Subject: Re: [OpenSIPS-Users] Strip + character

I've never used strip() before, but you could try $rU=$(rU{s.substr,1,0})

you could also do something similar in your if() statement if you want to get rid of the regular expression and save a couple cpu cycles.

On Mon, Aug 16, 2010 at 9:45 AM, michel freiha <[hidden email]> wrote:
Dear All,

I'm trying to strip + from dialed number that hit the OpenSIPS server, after that I'm using carrierroute that read from database all routes and send the call to the appropriate GW...The issue that the number is sent with the + to the destination GW so i need you to help me please...

The DialPlan is as below:

if($rU =~ "^[+].*" )
{
        strip(1);
    if(!cr_route("default", "0", "$rU", "$rU", "call_id")){

       sl_send_reply("403", "Not allowed");
     } else {
         t_on_failure("1");
          # Relay the request to the gateway
           t_relay();

   }


Regards



_______________________________________________
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: Strip + character

michel freiha
In reply to this post by Adam Twardowski
Thanks a lot guys...it's working fine

On Mon, Aug 16, 2010 at 4:56 PM, Adam Twardowski <[hidden email]> wrote:
I've never used strip() before, but you could try $rU=$(rU{s.substr,1,0})

you could also do something similar in your if() statement if you want to get rid of the regular expression and save a couple cpu cycles.

On Mon, Aug 16, 2010 at 9:45 AM, michel freiha <[hidden email]> wrote:
Dear All,

I'm trying to strip + from dialed number that hit the OpenSIPS server, after that I'm using carrierroute that read from database all routes and send the call to the appropriate GW...The issue that the number is sent with the + to the destination GW so i need you to help me please...

The DialPlan is as below:

if($rU =~ "^[+].*" )
{
        strip(1);
    if(!cr_route("default", "0", "$rU", "$rU", "call_id")){

       sl_send_reply("403", "Not allowed");
     } else {
         t_on_failure("1");
          # Relay the request to the gateway
           t_relay();

   }


Regards



_______________________________________________
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