[SR-Users] Weird dialplan result

Daniel-Constantin Mierla miconda at gmail.com
Wed Apr 15 22:17:20 CEST 2020


Hello,

can you reset the variable before dp_match(), like:

$var(destination) = 0;

dp_match("1", "$rU");

...

I think the module updates the attrs variable only on match, so it can
happen that its value is set from a previous config execution.

Cheers,
Daniel

On 15.04.20 21:59, David Villasmil wrote:
> Hello guys,
>
> So i have the following dialplan (almost literally, 2 records)
>
> +----+------+-----+----------+-----------+-----------+-----------+----------+---------------------------------------+
> | id | dpid | pr  | match_op | match_exp | match_len | subst_exp |
> repl_exp | attrs                                 |
> +----+------+-----+----------+-----------+-----------+-----------+----------+---------------------------------------+
> | 10 |    1 | 100 |        0 | 910000000 |         0 |           |    
>      | 1.2.3.4:5060 <http://1.2.3.4:5060>                          |
> | 11 |    1 | 100 |        0 | 910000001 |         0 |           |    
>      | sip.somedomain.net:5060 <http://sip.somedomain.net:5060>       
>        |
>
> And with kamcmd:
>
> kamcmd> dialplan.translate 1 s:910000000
> {
> Output:
> Attributes: 1.2.3.4:5060 <http://1.2.3.4:5060>
> }
>
> and
>
> kamcmd> dialplan.translate 1 s:910600000
> error: 500 - No translation
>
> So that works... now, when i get an INVITE I do:
>
> dp_match("1", "$rU");
> xlog("[DIALPLAN] '$rU' was translated to '$var(destination)'\n");
>
> if ( $var(destination)!=0 ) {
>   $ru = "sip:" + $fU + "@" + $var(destination);
>   route(RELAY);
> }
>
> And this prints:
>
> <script>: [DIALPLAN] '910600000' was translated to
> '195.114.216.188:5060 <http://195.114.216.188:5060>'
>
> What am I doing wrong? Kind of confused here...
>
>
> Regards,
>
> David Villasmil
> email: david.villasmil.work at gmail.com
> <mailto:david.villasmil.work at gmail.com>
> phone: +34669448337
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200415/f53bc9eb/attachment.html>


More information about the sr-users mailing list