openSIPS- Dialplan Manipulation Help

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

openSIPS- Dialplan Manipulation Help

OpenSIPS - Users mailing list
Hi,

I am struggling with openSIPS regex rules to append some prefix before regex. I have this regex rule setup for Israel numbers -

Matching Regular Expression -  ^0[0-9]{8}$

So this rule is catching all the 9 digits DID from my Israeli carrier but now I want to add 972 in front of any DID, for example DID - 021458547
After dp_translate I want to manipulate that DID and add 972 so new DID gonna be - 972021458547

Please help me setting up this dial plan rule. I will appreciate that.

Thanks and regards





_______________________________________________
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 Manipulation Help

Callum Guy
Why not just glue together the strings?

$var(a) = "972" + $rU;

Seems pretty effective to me :)

On Tue, 3 Dec 2019 at 22:02, VOIP Security via Users <[hidden email]> wrote:
Hi,

I am struggling with openSIPS regex rules to append some prefix before regex. I have this regex rule setup for Israel numbers -

Matching Regular Expression -  ^0[0-9]{8}$

So this rule is catching all the 9 digits DID from my Israeli carrier but now I want to add 972 in front of any DID, for example DID - 021458547
After dp_translate I want to manipulate that DID and add 972 so new DID gonna be - 972021458547

Please help me setting up this dial plan rule. I will appreciate that.

Thanks and regards




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


0333 332 0000  |  www.x-on.co.uk  |        

X-on is a trading name of Storacall Technology Ltd a limited company registered in England and Wales.
Registered Office : Avaland House, 110 London Road, Apsley, Hemel Hempstead, Herts, HP3 9SD. Company Registration No. 2578478.
The information in this e-mail is confidential and for use by the addressee(s) only. If you are not the intended recipient, please notify X-on immediately on +44(0)333 332 0000 and delete the
message from your computer. If you are not a named addressee you must not use, disclose, disseminate, distribute, copy, print or reply to this email.
Views or opinions expressed by an individual
within this email may not necessarily reflect the views of X-on or its associated companies. Although X-on routinely screens for viruses, addressees should scan this email and any attachments
for viruses. X-on makes no representation or warranty as to the absence of viruses in this email or any attachments.


_______________________________________________
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 Manipulation Help

Ben Newlin

That will certainly work and is very simple. If you really want to do it using the dialplan module, then you are looking to do “String Translation” as described in detail in Section 1.4.1.1 of the module documentation [1]. In your case, something like:

 

  • match_op = 1
  • match_exp = “^0[0-9]{8}$"
  • match_flags = 0
  • subst_exp = “^(0[0-9]{8})$”
  • repl_exp = "972\1"

 

 

[1] - https://opensips.org/html/docs/modules/3.0.x/dialplan.html#idp4838848

 

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Callum Guy <[hidden email]>
Reply-To: OpenSIPS users mailling list <[hidden email]>
Date: Wednesday, December 4, 2019 at 3:24 AM
To: VOIP Security <[hidden email]>, OpenSIPS users mailling list <[hidden email]>
Subject: Re: [OpenSIPS-Users] openSIPS- Dialplan Manipulation Help

 

Why not just glue together the strings?

 

$var(a) = "972" + $rU;

 

Seems pretty effective to me :)

 

On Tue, 3 Dec 2019 at 22:02, VOIP Security via Users <[hidden email]> wrote:

Hi,

 

I am struggling with openSIPS regex rules to append some prefix before regex. I have this regex rule setup for Israel numbers -

 

Matching Regular Expression -  ^0[0-9]{8}$

 

So this rule is catching all the 9 digits DID from my Israeli carrier but now I want to add 972 in front of any DID, for example DID - 021458547

After dp_translate I want to manipulate that DID and add 972 so new DID gonna be - 972021458547

 

Please help me setting up this dial plan rule. I will appreciate that.

 

Thanks and regards

 

 

 

 

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

 

 

0333 332 0000  |  www.x-on.co.uk  |        

X-on is a trading name of Storacall Technology Ltd a limited company registered in England and Wales.
Registered Office : Avaland House, 110 London Road, Apsley, Hemel Hempstead, Herts, HP3 9SD. Company Registration No. 2578478.
The information in this e-mail is confidential and for use by the addressee(s) only. If you are not the intended recipient, please notify X-on immediately on +44(0)333 332 0000 and delete the
message from your computer. If you are not a named addressee you must not use, disclose, disseminate, distribute, copy, print or reply to this email. Views or opinions expressed by an individual
within this email may not necessarily reflect the views of X-on or its associated companies. Although X-on routinely screens for viruses, addressees should scan this email and any attachments
for viruses. X-on makes no representation or warranty as to the absence of viruses in this email or any attachments.


_______________________________________________
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 Manipulation Help

OpenSIPS - Users mailing list
In reply to this post by OpenSIPS - Users mailing list
Thanks guys. It solved my problem.



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