<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>can you reset the variable before dp_match(), like:</p>
    <p>$var(destination) = 0;</p>
    <p>dp_match("1", "$rU");</p>
    <p>...</p>
    <p>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.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 15.04.20 21:59, David Villasmil
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFGRPVp4ery81KbVZ9Gn8KG_ABVPyt535vCyhNJnhUcFEoY3rA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hello guys,
        <div><br>
        </div>
        <div>So i have the following dialplan (almost literally, 2
          records)</div>
        <div><br>
        </div>
        <div><font face="monospace">+----+------+-----+----------+-----------+-----------+-----------+----------+---------------------------------------+<br>
            | id | dpid | pr  | match_op | match_exp | match_len |
            subst_exp | repl_exp | attrs                                
            |<br>
+----+------+-----+----------+-----------+-----------+-----------+----------+---------------------------------------+<br>
            | 10 |    1 | 100 |        0 | 910000000 |         0 |      
                |          | <a href="http://1.2.3.4:5060"
              moz-do-not-send="true">1.2.3.4:5060</a>                   
                  |<br>
            | 11 |    1 | 100 |        0 | 910000001 |         0 |      
                |          | <a href="http://sip.somedomain.net:5060"
              moz-do-not-send="true">sip.somedomain.net:5060</a>       
                   |</font><br>
        </div>
        <div><br>
        </div>
        <div>And with kamcmd:</div>
        <div><font face="monospace"><br>
          </font></div>
        <div><font face="monospace">kamcmd> dialplan.translate 1
            s:910000000<br>
            {<br>
            Output:<br>
            Attributes: <a href="http://1.2.3.4:5060"
              moz-do-not-send="true">1.2.3.4:5060</a><br>
            }</font><br>
        </div>
        <div><br>
        </div>
        <div>and</div>
        <div><br>
        </div>
        <div><font face="monospace">kamcmd> dialplan.translate 1
            s:910600000<br>
            error: 500 - No translation<br>
          </font></div>
        <div><br>
        </div>
        <div>So that works... now, when i get an INVITE I do:</div>
        <div><br>
        </div>
        <div><font face="monospace">dp_match("1", "$rU");<br>
            xlog("[DIALPLAN] '$rU' was translated to
            '$var(destination)'\n");<br>
            <br>
            if ( $var(destination)!=0 ) {<br>
              $ru = "sip:" + $fU + "@" + $var(destination);<br>
              route(RELAY);<br>
            }</font><br>
        </div>
        <div><br>
        </div>
        <div>And this prints:</div>
        <div><br>
        </div>
        <div><font face="monospace"><script>: [DIALPLAN]
            '910600000' was translated to '<a
              href="http://195.114.216.188:5060" moz-do-not-send="true">195.114.216.188:5060</a>'</font><br>
        </div>
        <div><br>
        </div>
        <div>What am I doing wrong? Kind of confused here...</div>
        <div><br>
        </div>
        <div><br clear="all">
          <div>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr">
                <div>Regards,</div>
                <div><br>
                </div>
                David Villasmil
                <div>email: <a
                    href="mailto:david.villasmil.work@gmail.com"
                    target="_blank" moz-do-not-send="true">david.villasmil.work@gmail.com</a></div>
                <div>phone: +34669448337</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a></pre>
  </body>
</html>