<h1>Environment</h1>

<p>Kamailio-433 installed behind nat (Amazon EC2 or Google Compute Engine) using config</p>

<div class="highlight highlight-source-ini"><pre><span class="pl-k">listen</span>=PRIVATE_IP:PORT advertise PUBLIC_IP:PORT</pre></div>

<h1>What I wanted to do</h1>

<p>In table <code>location</code>, the column <code>socket</code> will be stored in the form of  "PROTO:<strong>PRIVATE_IP</strong>:PORT" while for some reasons I would like it to be stored as "PROTO:<strong>PUBLIC_IP</strong>:PORT"</p>

<p>Through the <code>registrar</code> document there is the <a href="http://wwwkamailioorg/docs/modules/43x/modules/registrarhtml#registrarpxavp_cfg">xavp_cfg</a> parameter that can be used in conjunction with the attribute "socket" to specify the socket string From my understanding this might be the solution to my requirement</p>

<h1>Problem</h1>

<p>The column <code>location</code><code>socket</code> wasn't changed when setting the custom socket string via <code>xavp_cfg</code></p>

<p>After looking into the source code, firstly, a potential bug (correct me if I'm wrong) that it would reset the <code>sock_flag</code> to -1 (no flags) even if <code>reg_xavp_cfg</code> and <code>sock_flag</code> is set A pull request <a href="https://github.com/kamailio/kamailio/pull/470" class="issue-link js-issue-link" data-url="https://github.com/kamailio/kamailio/issues/470" data-id="125374090" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#470</a> has been opened for this</p>

<p>Secondly, if we pass the above problem, in <code>savec</code> it did grab the socket string from xavp_cfg and in function <code>grep_sock_info()</code> the socket string was checked with all the address we listen on, including the advertised public address via <code>socket_info->useinfo</code> But the returned socket structure still contains the private address info</p>

<h1>Conclusion so far</h1>

<p>So, I wasn't sure if using the parameter <code>xavp_cfg</code> for setting socket string and stores it in location table make sense or not If yes, can you please giving me some hints about the potential way to extend this?</p>

<p>Cheers,<br>
Ian</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/kamailio/kamailio/issues/471">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZUlq7gJ9LcLVtBhTkfK36KNtfWYDks5pXynzgaJpZM4HA6Cj.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/471"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>