Hello,
given it was asked about couple of times, I added a note and example in
the docs to show using the 's:' prefix for the second parameter.
Cheers,
Daniel
On 11.10.18 08:40, Stefano Bertuola wrote:
> Hi Daniel.
>
> Thanks for your suggestion. It worked:
>
> kamcmd> dialplan.dump 2
> {
> DPID: 2
> ENTRIES: {
> ENTRY: {
> PRIO: 1
> MATCHOP: 1
> MATCHEXP: ^\+39.....
> MATCHLEN: 0
> SUBSTEXP: ^\+(.*)$
> REPLEXP: \1
> ATTRS: 1
> }
> }
> }
> kamcmd> dialplan.translate 2 s:+3912345
> {
> Output: 6212345
> Attributes: 1
> }
> kamcmd> dialplan.translate 2 '+3912345'
> error: 500 - No translation
> kamcmd> dialplan.translate 2 "+3912345"
> error: 500 - No translation
>
>
> Instead, with single or double quotes, it doesn't.
>
> Br. Stefano
>
> On Wed, Oct 10, 2018 at 12:55 PM David Villasmil
> <[email protected]
> <mailto:[email protected]>> wrote:
>
> Or single-quotes
>
>
> On Wed, Oct 10, 2018, 11:50 Daniel-Constantin Mierla
> <[email protected] <mailto:[email protected]>> wrote:
>
> Hello,
>
> this might be due to automatic translation of kamcmd for its
> parameters that look like numbers, can you try with:
>
> kamcmd dialplan.translate 1 s:+39123456
>
>
> If still fails, send here the log messages with debug=3 when
> running the rpc command.
>
> Cheers,
> Daniel
>
>
> On 10.10.18 10:00, Stefano Bertuola wrote:
>> Hi Patrick.
>>
>> Thanks for your replay.
>>
>> I also verified an issue with *dialplan.translate* command in
>> *kamcmd*.
>>
>> Running a live test it is working.
>>
>> mysql> select * from dialplan;
>>
>>
>> +----+------+----+----------+--------------+-----------+--------------+----------+-------+
>> | id | dpid | pr | match_op | match_exp | match_len |
>> subst_exp | repl_exp | attrs |
>>
>> +----+------+----+----------+--------------+-----------+--------------+----------+-------+
>> | 1 | 1 | 1 | 1 | ^(\+39)(.*)$ | 0 |
>> ^(\+39)(.*)$ | \2 | 1 |
>>
>> +----+------+----+----------+--------------+-----------+--------------+----------+-------+
>>
>> NOTICE: <script>: +3912345|Before Dialplan
>> NOTICE: <script>: 12345|After Dialplan
>>
>>
>> Br. Stefano
>>
>>
>> On Wed, Oct 10, 2018 at 6:50 AM Patrick Wakano
>> <[email protected] <mailto:[email protected]>> wrote:
>>
>> Hi Stefano,
>> I have similar rules in my dialplan and they work.
>> However the kamcmd dialplan.translate command also fails
>> for me (Kamailio 5.0.4), but I guess it is a problem with
>> the command itself and not with the translation done by
>> the dp_translate(), because for real calls it does work!
>>
>> Patrick Wakano
>>
>> On Wed, 10 Oct 2018 at 02:21, Stefano Bertuola
>> <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Hi Experts.
>>
>> I did some tests with DIALPLAN module and I have some
>> doubts about how to define the regular expressions in
>> the database.
>>
>> For example, using the start character '^' (beginning
>> of the string), it looks not working:
>>
>> kamcmd> dialplan.dump 1
>> {
>> DPID: 1
>> ENTRIES: {
>> ENTRY: {
>> PRIO: 1
>> MATCHOP: 2
>> MATCHEXP: ^(\+39)(.*)$
>> MATCHLEN: 0
>> SUBSTEXP: ^(\+39)(.*)$
>> REPLEXP: \2
>> ATTRS: 1
>> }
>> }
>> }
>> kamcmd> dialplan.translate 1 "+39123456"
>> error: 500 - No translation
>>
>>
>> Removing it, it works... but not as desired:
>>
>> kamcmd> dialplan.dump 1
>> {
>> DPID: 1
>> ENTRIES: {
>> ENTRY: {
>> PRIO: 1
>> MATCHOP: 1
>> MATCHEXP: (\+39)(.*)$
>> MATCHLEN: 0
>> SUBSTEXP: (\+39)(.*)$
>> REPLEXP: \2
>> ATTRS: 1
>> }
>> }
>> }
>> kamcmd> dialplan.translate 1 "+39123456"
>> {
>> Output: 123456"
>> Attributes: 1
>> }
>> kamcmd> dialplan.translate 1 "xxxxxxx+39123456"
>> {
>> Output: 123456"
>> Attributes: 1
>> }
>>
>>
>> Can someone help me understand how the regular
>> expression should be used in DIALPLAN, please?
>>
>> Br. Stefano
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> [email protected]
>> <mailto:[email protected]>
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> [email protected]
>> <mailto:[email protected]>
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> [email protected] <mailto:[email protected]>
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com>
> www.twitter.com/miconda <http://www.twitter.com/miconda> --
> www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
> Kamailio World Conference -- www.kamailioworld.com
> <http://www.kamailioworld.com>
> Kamailio Advanced Training, Nov 12-14, 2018, in Berlin --
> www.asipto.com <http://www.asipto.com>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> [email protected] <mailto:[email protected]>
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference -- www.kamailioworld.com
Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- www.asipto.com
_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users