[OpenSIPS-Users] DialPlan Module Nested dp_translate

Bogdan-Andrei Iancu bogdan at opensips.org
Sat May 5 09:17:27 CEST 2012


Hi Jamuel,

And idea will be to simulate sub-levels by groups. Like top level rules 
(with wider regexps) are in group 1 and they point (via attributes) to 
another group of rules (tighter).

Like in your case:

Group 1
Matching Regular Expression: ^\+1.*
Substitution Regular Expression: ^\+(1.*)
Replacement Expression: \1
Attribute: 100

Group 100:
Matching Regular Expression: 1415.*
Attribute: 415

Matching Regular Expression: 1800.*
Attribute: 800

Code will be:

if (dp_translate("0","$ruri.user/$ruri.user") && 
is_avp_set("$avp(dp_attr)"))
     dp_translate("$avp(dp_attr)","$ruri.user/$ruri.user")

Regards,
Bogdan

On 05/02/2012 07:38 AM, Jamuel Starkey wrote:
> Hi,
>
> I'm using OpenSIPs v1.7.2 and trying to come up with a way to nest dialplan dp_translate.  I'd like to match against a fairly broad regex and do a replacement and then match the resulting replacement with a narrower regex this time just set an attribute (no replacement).  I don't see how this could be done.  Is there a way to emulate this in the routing block instead?
>
> Pseudo code:
>
> $avp(dpid)=0;
> dp_translate("$avp(dpid)", "$ruri.user/$ruri.user");
>
> Broad match:
> Matching Regular Expression: ^\+1.*
> Substitution Regular Expression: ^\+(1.*)
> Replacement Expression: \1
> Attribute:<Don't Care>
>
> Narrower Match 1:
> Matching Regular Expression: 1415.*
> Attribute: 415
>
> Narrower Match 2:
> Matching Regular Expression: 1800.*
> Attribute: 800
>
> Any help would be greatly appreciated.
>
>
> Cheers,
>
> JPS
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>


-- 
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com




More information about the Users mailing list