<div dir="ltr"><div><div><div>Hi Razvan,<br><br></div>I need to register some clients in Opensips. Those clients will come from different IP addresses.<br><br>Then, allow Opensips to redirect INVITES to those registered clients to B2BUA gateway. In that B2BUA  server there is an identical location entry as per Opensips received.<br>
<br></div>Scenario is:<br><br></div>WebCliente--------- REGISTER ---------------------Opensips------SipEndpoint<br><div><div>                        \------- REGISTER---B2BUA</div><div><br></div><div>- WebClient is sending now two REGISTER messages to both B2BUA and SipEndpoint<br>
</div><div>- Opensips must save() and replace Contact IP:Port  to point to B2BUA (that&#39;s the Contact change I would like to do)<br></div><div>- Then,  INVITE from SipEndpoint to Opensips must search for this registered user and then send the call to B2BUA <br>
  (not to WebCliente)<br><br></div><div><br></div><div>Do you think, it&#39;s not possible to update contact in location database?<br></div><div><br></div><div><div><br></div></div></div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Thu, Jun 19, 2014 at 5:30 PM, Răzvan Crainea <span dir="ltr">&lt;<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi, Miguel!<br>
<br>
There is no way you can change the contact header - it is something taken from the SIP message. What you are changing there is the AOR username and domain of that customer.<br>
May I ask you what are you trying to achieve? Perhaps there&#39;s a different way of doing it.<div class=""><br>
<br>
Best regards,<br>
<br>
Razvan Crainea<br>
OpenSIPS Core Developer<br>
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<u></u>com</a><br>
<br></div><div class="">
On 06/19/2014 10:13 AM, Miguel Oyarzo wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
<br>
Ok, thanks.<br>
<br>
I did<br>
<br>
if (is_method(&quot;REGISTER&quot;)) # WebRTC  (accepts anything for now)<br>
{<br>
<br>
         $avp(aor) = &quot;sip:&quot; + $tU + &quot;@&quot; + $si + &quot;:5092&quot;;<br>
         if (!save(&quot;location&quot;,&quot;&quot;,&quot;$avp(<u></u>aor)&quot;)) {<br>
                 sl_reply_error();<br>
                 xlog(&quot;Location could not be saved&quot;);<br>
         }<br>
                 xlog(&quot;$si has been registered  [tU:$tU/si:$si]&quot;);<br>
         exit;<br>
}<br>
<br>
restart OK.<br>
log: Jun 19 17:13:04 ip-10-10-1-105 /usr/sbin/opensips[22253]:<br>
10.10.1.120 has been registered  [tU:61370000000/si:10.10.1.<u></u>120]<br>
<br>
But,<br>
balancer=# SELECT username,contact from location;<br>
   username   |                                contact<br>
-------------+----------------<u></u>------------------------------<u></u>-------------------------<br>
  61370000000 |<br>
sips:61370000000@df7jal23ls0d.<u></u>invalid;rtcweb-breaker=no;<u></u>transport=wss<br>
<br>
<br>
Contact is still the original. Any idea?<br>
<br>
<br>
<br>
<br>
<br>
On Thu, Jun 19, 2014 at 5:04 PM, Răzvan Crainea &lt;<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a><br></div><div class="">
&lt;mailto:<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>&gt;&gt; wrote:<br>
<br>
    Hi, Miguel!<br>
<br></div><div class="">
    The save() function[1] only accepts a pseudovariable, not a format<br>
    as parameter. And the way you build the $avp(aor) is not a valid<br>
    syntax. You should have something like:<br>
<br>
    $avp(aor) = &quot;sip:&quot; + $tU + &quot;@&quot; + $si + &quot;:5092&quot;;<br>
<br>
    [1]<br></div>
    <a href="http://www.opensips.org/html/__docs/modules/1.11.x/registrar#__id294034" target="_blank">http://www.opensips.org/html/_<u></u>_docs/modules/1.11.x/<u></u>registrar#__id294034</a><div class=""><br>
    &lt;<a href="http://www.opensips.org/html/docs/modules/1.11.x/registrar#id294034" target="_blank">http://www.opensips.org/html/<u></u>docs/modules/1.11.x/registrar#<u></u>id294034</a>&gt;<br>
<br>
<br>
    Best regards,<br>
<br>
    Razvan Crainea<br>
    OpenSIPS Core Developer<br></div>
    <a href="http://www.opensips-solutions." target="_blank">http://www.opensips-solutions.</a><u></u>__com &lt;<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-<u></u>solutions.com</a>&gt;<br>

<br><div class="">
    On 06/19/2014 10:00 AM, Miguel Oyarzo wrote:<br>
<br>
<br>
        Hi Razvan,<br>
<br>
        Thanks for your reply.<br>
        That was a good question. I want to change the contact in database.<br>
<br>
        Would like to get something like<br>
        balancer=# SELECT username,contact from location;<br>
            username   |                                contact<br></div>
        -------------+----------------<u></u>__----------------------------<u></u>--__-------------------------<div class=""><br>
           61370000000 | <a href="mailto:sips%3A61370000000@10.10.1.120" target="_blank">sips:61370000000@10.10.1.120</a><br>
        &lt;mailto:<a href="mailto:sips%253A61370000000@10.10.1.120" target="_blank">sips%3A61370000000@10.<u></u>10.1.120</a>&gt;<br></div>
        &lt;mailto:<a href="mailto:sips%253A61370000000@10." target="_blank">sips%3A61370000000@10.</a><u></u>__10.1.120<br>
        &lt;mailto:<a href="mailto:sips%25253A61370000000@10.10.1.120" target="_blank">sips%253A61370000000@<u></u>10.10.1.120</a>&gt;&gt;<div class=""><br>
<br>
<br>
        I was thinking in something like  &#39; $avp(aor)=&quot;sip:$tU@$si:5092&quot;  &#39;<br>
        but the variables $tU@$si doesn&#39;t like to be expanded in save().<br>
<br>
        I must be dynamic (not hard-code)<br>
<br>
        Any idea how to do it?<br>
<br>
<br>
<br>
        On Thu, Jun 19, 2014 at 4:39 PM, Răzvan Crainea<br>
        &lt;<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a> &lt;mailto:<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>&gt;<br></div><div class="">
        &lt;mailto:<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a> &lt;mailto:<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>&gt;&gt;&gt; wrote:<br>
<br>
             Hi, Miguel!<br>
<br>
             Do you only want to change the Contact info that is stored in<br>
             OpenSIPS database or change the Contact header in the<br>
        REGISTER message?<br>
             The code you pasted changes only the info in the location<br>
        table. If<br>
             you want to change the header, you can remove it and add a<br>
        new one.<br>
             Something like:<br>
<br>
             remove_hf(&quot;Contact&quot;);<br>
             append_hf(&quot;Contact: &lt;sip:$tU@$si:5092&gt;\r\n&quot;);<br>
<br>
             See [1] for more details.<br>
<br>
             [1]<br></div>
        <a href="http://www.opensips.org/html/____docs/modules/devel/sipmsgops#____id249696" target="_blank">http://www.opensips.org/html/_<u></u>___docs/modules/devel/<u></u>sipmsgops#____id249696</a><br>
        &lt;<a href="http://www.opensips.org/html/__docs/modules/devel/sipmsgops#__id249696" target="_blank">http://www.opensips.org/html/<u></u>__docs/modules/devel/<u></u>sipmsgops#__id249696</a>&gt;<div class=""><br>
<br>
<br>
        &lt;<a href="http://www.opensips.org/html/__docs/modules/devel/sipmsgops#__id249696" target="_blank">http://www.opensips.org/html/<u></u>__docs/modules/devel/<u></u>sipmsgops#__id249696</a><br>
        &lt;<a href="http://www.opensips.org/html/docs/modules/devel/sipmsgops#id249696" target="_blank">http://www.opensips.org/html/<u></u>docs/modules/devel/sipmsgops#<u></u>id249696</a>&gt;&gt;<br>
<br>
             Best regards,<br>
<br>
             Razvan Crainea<br>
             OpenSIPS Core Developer<br></div>
        <a href="http://www.opensips-solutions." target="_blank">http://www.opensips-solutions.</a><u></u>____com<br>
        &lt;<a href="http://www.opensips-__solutions.com" target="_blank">http://www.opensips-__<u></u>solutions.com</a><div class=""><br>
        &lt;<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-<u></u>solutions.com</a>&gt;&gt;<br>
<br>
<br>
<br>
             On 06/19/2014 09:10 AM, Miguel Oyarzo wrote:<br>
<br>
<br>
                 Hi,<br>
<br>
                 How can I change the Contact info in REGISTER messages?<br>
<br>
                 I have tried<br>
                 if (is_method(&quot;REGISTER&quot;))<br>
                 {<br>
<br>
                 if<br></div>
        (!save(&quot;location&quot;,&quot;&quot;,&quot;<a href="http://sip:____61370000000@10.10.1.120:5090" target="_blank">sip:____<u></u>61370000000@10.10.1.120:5090</a><br>
        &lt;<a href="http://sip:__61370000000@10.10.1.120:5090" target="_blank">http://sip:__61370000000@10.<u></u>10.1.120:5090</a>&gt;<div class=""><br>
                 &lt;http://sip:61370000000@10.10.<u></u>__1.120:5090<br>
        &lt;<a href="http://sip:61370000000@10.10.1.120:5090" target="_blank">http://sip:61370000000@10.10.<u></u>1.120:5090</a>&gt;&gt;<br></div>
                 &lt;http://sip:61370000000@10.10.<u></u>____1.120:5090<div class=""><br>
<br>
                 &lt;http://sip:61370000000@10.10.<u></u>__1.120:5090<br>
        &lt;<a href="http://sip:61370000000@10.10.1.120:5090" target="_blank">http://sip:61370000000@10.10.<u></u>1.120:5090</a>&gt;&gt;&gt;&quot;)) { .... }<br>
<br>
                 - and -<br>
                 $avp(aor)=&quot;sip:$tU@$si:5092&quot;;<br></div>
                 if (!save(&quot;location&quot;,&quot;f&quot;,&quot;$avp(__<u></u>__aor))&quot;) { ... }<div class=""><br>
<br>
<br>
                 }<br>
<br>
                 But doesn&#39;t work.<br>
<br>
                 Any suggestion?<br>
<br>
<br>
<br>
                 --<br>
                 &quot;Efficiency is doing things right; effectiveness is<br>
        doing the right<br>
                 things(Peter Drucker)&quot;<br>
<br>
<br>
                 Miguel Oyarzo<br>
                 DevOps &amp; VoIP Engineer<br>
                 Linux User: # 483188 - <a href="http://counter.li.org" target="_blank">counter.li.org</a><br>
        &lt;<a href="http://counter.li.org" target="_blank">http://counter.li.org</a>&gt; &lt;<a href="http://counter.li.org" target="_blank">http://counter.li.org</a>&gt;<br></div>
                 &lt;<a href="http://counter.li.org" target="_blank">http://counter.li.org</a>&gt;<br>
        <a href="http://au.linkedin.com/in/____mikeaustralia" target="_blank">http://au.linkedin.com/in/____<u></u>mikeaustralia</a><br>
        &lt;<a href="http://au.linkedin.com/in/__mikeaustralia" target="_blank">http://au.linkedin.com/in/__<u></u>mikeaustralia</a>&gt;<div class=""><br>
                 &lt;<a href="http://au.linkedin.com/in/__mikeaustralia" target="_blank">http://au.linkedin.com/in/__<u></u>mikeaustralia</a><br>
        &lt;<a href="http://au.linkedin.com/in/mikeaustralia" target="_blank">http://au.linkedin.com/in/<u></u>mikeaustralia</a>&gt;&gt;<br>
                 Melbourne, Australia<br>
<br>
<br></div>
                 ______________________________<u></u>_____________________<div class=""><br>
                 Users mailing list<br>
        <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.<u></u>org</a>&gt;<br></div>
        &lt;mailto:<a href="mailto:Users@lists.opensips." target="_blank">Users@lists.opensips.</a>_<u></u>_org<br>
        &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.<u></u>org</a>&gt;&gt;<br>
        <a href="http://lists.opensips.org/cgi-____bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>____bin/mailman/listinfo/users</a><br>
        &lt;<a href="http://lists.opensips.org/cgi-__bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/<u></u>cgi-__bin/mailman/listinfo/<u></u>users</a>&gt;<br>
<br>
        &lt;<a href="http://lists.opensips.org/__cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/__<u></u>cgi-bin/mailman/listinfo/users</a><br>
        &lt;<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/<u></u>cgi-bin/mailman/listinfo/users</a><u></u>&gt;__&gt;<br>
<br>
<br>
             ______________________________<u></u>_____________________<div class=""><br>
             Users mailing list<br>
        <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.<u></u>org</a>&gt;<br></div>
        &lt;mailto:<a href="mailto:Users@lists.opensips." target="_blank">Users@lists.opensips.</a>_<u></u>_org<br>
        &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.<u></u>org</a>&gt;&gt;<br>
        <a href="http://lists.opensips.org/cgi-____bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>____bin/mailman/listinfo/users</a><br>
        &lt;<a href="http://lists.opensips.org/cgi-__bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/<u></u>cgi-__bin/mailman/listinfo/<u></u>users</a>&gt;<br>
<br>
             &lt;<a href="http://lists.opensips.org/__cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/__<u></u>cgi-bin/mailman/listinfo/users</a><br>
        &lt;<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/<u></u>cgi-bin/mailman/listinfo/users</a><u></u>&gt;__&gt;<div><div class="h5"><br>
<br>
<br>
<br>
<br>
        --<br>
        &quot;Efficiency is doing things right; effectiveness is doing the right<br>
        things(Peter Drucker)&quot;<br>
<br>
        Miguel Oyarzo<br>
        DevOps &amp; VoIP Engineer<br>
        Linux User: # 483188 - <a href="http://counter.li.org" target="_blank">counter.li.org</a> &lt;<a href="http://counter.li.org" target="_blank">http://counter.li.org</a>&gt;<br>
        &lt;<a href="http://counter.li.org" target="_blank">http://counter.li.org</a>&gt;<br>
        <a href="http://au.linkedin.com/in/__mikeaustralia" target="_blank">http://au.linkedin.com/in/__<u></u>mikeaustralia</a><br>
        &lt;<a href="http://au.linkedin.com/in/mikeaustralia" target="_blank">http://au.linkedin.com/in/<u></u>mikeaustralia</a>&gt;<br>
        Melbourne, Australia<br>
<br>
<br>
        ______________________________<u></u>___________________<br>
        Users mailing list<br>
        <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.<u></u>org</a>&gt;<br>
        <a href="http://lists.opensips.org/cgi-__bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>__bin/mailman/listinfo/users</a><br>
        &lt;<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/<u></u>cgi-bin/mailman/listinfo/users</a><u></u>&gt;<br>
<br>
<br>
    ______________________________<u></u>___________________<br>
    Users mailing list<br>
    <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.<u></u>org</a>&gt;<br>
    <a href="http://lists.opensips.org/cgi-__bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>__bin/mailman/listinfo/users</a><br>
    &lt;<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/<u></u>cgi-bin/mailman/listinfo/users</a><u></u>&gt;<br>
<br>
<br>
<br>
<br>
--<br>
&quot;Efficiency is doing things right; effectiveness is doing the right<br>
things(Peter Drucker)&quot;<br>
<br>
Miguel Oyarzo<br>
DevOps &amp; VoIP Engineer<br>
Linux User: # 483188 - <a href="http://counter.li.org" target="_blank">counter.li.org</a> &lt;<a href="http://counter.li.org" target="_blank">http://counter.li.org</a>&gt;<br>
<a href="http://au.linkedin.com/in/mikeaustralia" target="_blank">http://au.linkedin.com/in/<u></u>mikeaustralia</a><br>
Melbourne, Australia<br>
<br>
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>bin/mailman/listinfo/users</a><br>
<br>
</div></div></blockquote><div class="HOEnZb"><div class="h5">
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">&quot;Efficiency is doing things right; effectiveness is doing the right things</span><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> (Peter Drucker)</span>&quot;<br>
</span></div><br><div><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Miguel Oyarzo</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">DevOps &amp; VoIP Engineer</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Linux User: # 483188 - </span><font color="#888888" face="arial, sans-serif"><a href="http://counter.li.org" target="_blank">counter.li.org</a></font><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="background-color:rgb(255,255,255)"><font color="#888888" face="arial, sans-serif"><a href="http://au.linkedin.com/in/mikeaustralia" target="_blank">http://au.linkedin.com/in/mikeaustralia</a> </font><br><font color="#888888" face="arial, sans-serif">Melbourne, Australia</font></span>
</div></div>
</div>