[Kamailio-Users] Dialplan regular expressions

alex pappas rebel.pappas at gmail.com
Thu Nov 26 22:15:56 CET 2009


Daniel hi,

mysql output:

 select * from dialplan;
+----+------+-----+----------+-----------+-----------+-------------+----------+-------+
| id | dpid | pr  | match_op | match_exp | match_len | subst_exp   |
repl_exp | attrs |
+----+------+-----+----------+-----------+-----------+-------------+----------+-------+
|  2 |    9 | 100 |        0      |   ^123+      |         0       |
^(123.+)        | 0030\1   | 111   |
|  4 |    9 | 100 |        0      | ^1234.*      |         0       |
^(1234)(.+)    | 0030\2   | 111   |
+----+------+-----+----------+-----------+-----------+-------------+----------+-------+

The dialed number has prefix 123 and we don't now the excact number of
digit's. maybe is 10 or maybe is 12 and so on ... Also the number after the
prefix could include a #.

Thanks for the dispatcher con BTW, was very nice ;-)

P.S. Because some times numbers are arriving in our network with many kind
of prefixes (a confusing situation) we want to have the ability to
manipulate them before we send them(the numbers) to the dispatcher.


Alex


On Thu, Nov 26, 2009 at 11:07 PM, Daniel-Constantin Mierla <
miconda at gmail.com> wrote:

> Hello,
>
>
> On 26.11.2009 21:58 Uhr, alex pappas wrote:
>
>> Dear Panagiotis,
>>
>> I tried your sugestions but without result :-(
>> having in my kamailio.cfg this line fo code:
>>
>>        xlog("----------- The $ruri.user  ----------\n");
>>        dp_translate("10", "$ruri.user/$ruri.user");
>>
>
> first, $ruri.user is obsoleted, use $rU.
>
> Send here the output of 'select * from dialplan' and the dialed number.
>
> Cheers,
> Daniel
>
>
>         xlog("----------- The $ruri.user  ----------\n");
>>
>> When a call a number with length more than 6 digit the dialplan module
>> does not match the prefix of the number. I also tried changing the
>> *match_exp ^123+ to match_exp ^123.** but still with no success. The prefix
>> match if I call a 7 digit number only in the second case.
>>
>> Any other suggestions are welcomed.
>>
>> Alex
>>
>>
>> 2009/11/26 Panagiotis Skoulikaritis <pskoul at algonet.gr <mailto:
>> pskoul at algonet.gr>>
>>
>>
>>    Hi Alex
>>
>>    Use the following if you just want to add the prefix 0030 in front
>>    of the 123
>>
>>
>>    dpid 10
>>    pr    100
>>    match_op 1
>>    match_exp ^123+
>>    match_len 0
>>    subst_exp ^(123.+)
>>    repl_exp 0030\1
>>
>>    if you want to replace the 123 with the 0030 use the following
>>
>>    dpid 10
>>    pr    100
>>    match_op 1
>>    match_exp ^123+
>>    match_len 0
>>    subst_exp ^(123)(.+)
>>    repl_exp 0030\2
>>
>>    and so on ..
>>
>>    Regards
>>
>>    Panagiotis
>>
>>    alex pappas wrote:
>>
>>>    Dear all,
>>>
>>>    I'm having difficulties in the dialplan module. My problem is in
>>>    the regular expressions added to the database. I tried some
>>>    examples from previous users but they don't work for me.
>>>    example:
>>>
>>>    dpid 10
>>>    pr    100
>>>    match_op 0
>>>    match_exp ^123(.*)$
>>>    match_len 0
>>>    subst_exp ^123
>>>    repl_exp 0030
>>>
>>>
>>>    Previous example from Daniel that I found in user lists:
>>>
>>>    s/subst_exp/repl_exp/
>>>
>>>
>>>          subst_exp - is regular expression that can be used to group
>>> parts
>>>    of the input
>>>    repl_exp - is used to build the output
>>>
>>>    Example: you want to remove the first 0 and prefix +44 to a number:
>>>
>>>    subst_exp=^0(.+)$
>>>    repl_exp=+44\1
>>>
>>>
>>>          Can someone provide an example that works with the latest
>>>  kamailio please? Also where I can find more docs about dialplan?
>>>
>>>    Thank you all
>>>
>>>    Alex
>>>
>>>  ------------------------------------------------------------------------
>>>
>>>    _______________________________________________
>>>    Kamailio (OpenSER) - Users mailing list
>>>    Users at lists.kamailio.org <mailto:Users at lists.kamailio.org>
>>>
>>>    http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>>>    http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> _______________________________________________
>> Kamailio (OpenSER) - Users mailing list
>> Users at lists.kamailio.org
>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>> http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
>>
>
> --
> Daniel-Constantin Mierla
> * http://www.asipto.com/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/users/attachments/20091126/a5257a47/attachment-0001.htm>


More information about the Users mailing list