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                          |
| 11 |    1 | 100 |        0 | 910000001 |         0 |           |          | sip.somedomain.net:5060               |


And with kamcmd:

kamcmd> dialplan.translate 1 s:910000000
{
Output:
Attributes: 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'

What am I doing wrong? Kind of confused here...


Regards,

David Villasmil
phone: +34669448337

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@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