<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <br>
    <br>
    On 11/30/10 4:07 PM, marius zbihlei wrote:
    <blockquote cite="mid:4CF51323.7050201@1and1.ro" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      On 11/30/2010 01:58 PM, alex pappas wrote:
      <blockquote
        cite="mid:AANLkTikOryuC8aEMA218ABvsA0jiX43t8MrzDYKuy+yc@mail.gmail.com"
        type="cite">Dear All,<br>
        <br>
        We have some cisco gw that they send to the Kamailio in the
        first
        invite and inside the VIA header an x-route-tag="The Gateway
        that the
        call entered".<br>
        <br>
        I'm trying to add this to the acc module in order to have it
        recorded
        but without sucess.<br>
        My config is this:<br>
        <br>
        if (search("x-route-tag"))<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; avp(s:xroutetag) = $sel(@via);<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("----- We have a x-route-tag in the SIP msg
        avp:
        $avp(s:xroutetag) -----");<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br>
        <br>
        I'm trying to add the VIA header to an avp so I could manipulate
        the
        string but i cannot implement this.<br>
        <br>
        Does anyone can suggest a way to add the <b>x-route-tag</b>
        value to
        an AVP?<br>
        <br>
        Thank you in advance<br>
        <br>
        Alex<br>
        <br>
        sample VIA header:&nbsp; Via: SIP/2.0/UDP&nbsp; <a moz-do-not-send="true"
          href="http://10.0.0.15:5060">10.0.0.15:5060</a>;<b>x-route-tag="tgrp:TANDEM-KOR"</b><br>
        <br>
      </blockquote>
      Hello, <br>
      <br>
      You can use transformations
      <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x">http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x</a>
      . This
      should to the trick: (careful on needed modules)<br>
      <br>
      <pre class="code c">$var<span class="br0">(</span>s:xroutetag<span class="br0">)</span> <span class="sy0">=</span> $<span class="br0">(</span>hdr(Via)<span class="br0">{</span>re.<span class="me1">subst</span><span class="sy0">,/</span><span class="sy0"></span><span class="br0"></span><span class="sy0"></span><span class="br0"></span><span class="br0"></span><span class="sy0"></span><span class="br0">x-route-tag="(.*)"</span><span class="sy0">/</span>\1<span class="sy0">/</span><span class="br0">}</span><span class="br0">)</span><span class="sy0">;


</span></pre>
    </blockquote>
    just as alternative, in this case it should works also with selects
    variables, you can try:<br>
    <br>
    $sel(via.params[x-route-tag])<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
<a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>