[OpenSIPS-Users] Dialplan issues: simple strip\prefix cases

Brett Nemeroff brett at nemeroff.com
Mon Oct 19 18:11:31 CEST 2009


Bogdan,
Not to sound too dense here, but I don't get:
^(*4224*)(.+)

If you really wanted to match exactly 4224 wouldn't you just do:
^(4224)(.+)

Alternatively, with the OP requested, isn't it more like:
^([0-9]{4})(.+)

Maybe your *'s are for emphasis and not an expression? :) or perhaps
I'm rusty on my regex. :)
-Brett



On Sun, Oct 18, 2009 at 11:29 PM, Bogdan-Andrei Iancu
<bogdan at voice-system.ro> wrote:
> Hi Sebastian,
>
> So use:
>
> Dpid = 1
> Pr = 0
> match_op = 1
> match_exp = ^4224+
> match_len = 0
> subst_exp = ^(*4224*)(.+)
> repl_exp = \2
>
> Regards,
> Bogdan
>
>
> Sebastian Sastre wrote:
>> Agreed, I followed a previous post from Bogdan but I cant replicate it.
>>
>> In short I have some numbers which I need to strip the first 4 numbers from.
>>
>> How would you do this? I've been playing aroung with the different regexp
>> expressions I know of, but I cant get the result.
>>
>> Any help appreciated.
>>
>> Thanks
>>
>>
>> The previous post was
>>
>> Jul 17, 2009; 07:36am
>> Re: 2 dialplan issues: simple strip\prefix cases and execution with drouting
>> use_next_gw function
>>
>> Hi Ricardo,
>>
>> for stripping some digits, try something like:
>>
>> match: ^55+
>> subst: ^(55)(.+)
>> repl: \2
>>
>> This will strip the 55 prefix from the number....
>>
>> For item 2) - take care as the do_routing() function is computing all
>> the next branches in advances, based on the current URI...The
>> use_next_gw() function will just upload the precomputed RURIs in the new
>> branch.
>>
>> If you want some per branch changes via dialplan, do it after the
>> do_routing() and use_next_gw() functions..
>>
>> Regards,
>> Bogdan
>>
>>
>> Ricardo Martins wrote:
>>
>>
>>> Hi all! I've been working a quite time with dialplan module and need
>>> some orientation from more experienced users. On one case, I need to
>>> strip some digits depending on the dial prefix and on the other case I
>>> need to subst some digits with 0 or 00.
>>>
>>> I could make the subst case to work, replacing the starting 55 with 0,
>>> using the following rule:
>>> match: ^55+
>>> subst: ^(55)(.+)
>>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Sebastian Sastre
>> Next IP
>> sebastian at next-ip.com
>> + 305-507-8722- Main
>> + 305-507-8728- Direct
>>
>> The information transmitted herein is intended only for the person or entity
>> to which it is addressed and may contain confidential and/or privileged
>> material. Any review, retransmission, dissemination or other use of, or
>> taking of any action in reliance upon, this information by persons or
>> entities other than the intended recipient is prohibited. If you received
>> this in error, please contact the sender and delete the material from any
>> computer.
>> La información contenida en este mensaje electrónico tiene carácter
>> CONFIDENCIAL, está dirigida únicamente al destinatario de la misma y sólo
>> podrá ser usada por éste. Si el lector de este mensaje no es el destinatario
>> del mismo, se le notifica que cualquier copia o distribución de éste se
>> encuentra totalmente prohibida. Si usted ha recibido este mensaje por error,
>> por favor notifique inmediatamente al remitente por este mismo medio y borre
>> el mensaje de su sistema.
>>
>>
>> -----Original Message-----
>> From: users-bounces at lists.opensips.org
>> [mailto:users-bounces at lists.opensips.org] On Behalf Of Brett Nemeroff
>> Sent: Friday, October 16, 2009 12:31 AM
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] Dialplan issues: simple strip\prefix cases
>>
>> I don't mean to point out the obvious here, but \4 doesn't exist.
>> that'd refer to the 4th set of parens in your expression. See your
>> exp, you only have 2.
>>
>> As a completely separate issue, I also suspect that "^4224+" is wrong.
>> I'm not an expert in regex, but I think that means "starts with 4224
>> and then continues with 1 or more '4' ". You probably mean "^4224.+"
>>
>> -Brett
>>
>>
>> On Thu, Oct 15, 2009 at 4:38 PM, Sebastian Sastre <sebastian at next-ip.com>
>> wrote:
>>
>>> Hello,
>>>
>>>
>>>
>>> I’m trying to use the Dialplan module to strip the prefix of my calls.
>>>
>>> On the database I have.
>>>
>>>
>>>
>>> Dpid = 1
>>>
>>> Pr = 0
>>>
>>> match_op = 1
>>>
>>> match_exp = ^4224+
>>>
>>> match_len = 0
>>>
>>> subst_exp = ^(4224)(.+)
>>> repl_exp = \4
>>>
>>>
>>>
>>> Oct 15 17:25:32 RouteMe /usr/sbin/opensips[30516]: INFO:dialog:mod_init:
>>> Dialog module - initializing
>>>
>>> Oct 15 17:25:32 RouteMe /usr/sbin/opensips[30516]: INFO:dialplan:mod_init:
>>> initializing module...
>>>
>>> Oct 15 17:25:32 RouteMe /usr/sbin/opensips[30516]:
>>> ERROR:dialplan:build_rule: repl_exp uses a non existing subexpression
>>>
>>> Oct 15 17:25:32 RouteMe /usr/sbin/opensips[30516]:
>>> ERROR:dialplan:init_db_data: failed to load database data
>>>
>>> Oct 15 17:25:32 RouteMe /usr/sbin/opensips[30516]:
>>>
>> ERROR:dialplan:mod_init:
>>
>>> could not initialize data
>>>
>>> Oct 15 17:25:32 RouteMe /usr/sbin/opensips[30516]: ERROR:core:init_mod:
>>> failed to initialize module dialplan
>>>
>>> Oct 15 17:25:32 RouteMe /usr/sbin/opensips[30516]: ERROR:core:main: error
>>> while initializing modules
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>



More information about the Users mailing list