<div dir="ltr">Hello Daniel<div><br></div><div>I forgot to mention when I sent the capture file.</div><div>There is only single Kamailio instance running but It listens multiple ports.</div><div>5090 for outside traffic and 5060 for inside traffic (other Kamailio servers, FS servers, etc.) </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 7:49 PM, huseyin kalyoncu <span dir="ltr"><<a href="mailto:hkalyoncu@gmail.com" target="_blank">hkalyoncu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Daniel<div><br></div><div>Attachment is the full ngrep output for the sample call.</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 6:51 PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p>can you make the full ngrep trace for the call (from initial
      invite sent by kamailio, with all following sip messages) and send
      it over here?<br>
    </p>
    Cheers,<br>
    Daniel<div><div><br>
    <br>
    <div>On 27/04/16 17:16, huseyin kalyoncu
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hello Daniel
        <div><br>
        </div>
        <div>I did some more tests and my previous statement is wrong.</div>
        <div>Actually it do call set_contact_alias on 200 reply for
          INVITEs </div>
        <div>but somehow it has no change. </div>
        <div>I really missing something here.</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Wed, Apr 27, 2016 at 3:35 PM,
          huseyin kalyoncu <span dir="ltr"><<a href="mailto:hkalyoncu@gmail.com" target="_blank"></a><a href="mailto:hkalyoncu@gmail.com" target="_blank">hkalyoncu@gmail.com</a>></span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Hello Daniel
              <div><br>
              </div>
              <div>You are right. 200OK messages are also with private
                IPs.</div>
              <div>I think the problem is that </div>
              <div>since I call dlg_bridge with Kamailio's own IP </div>
              <div>It sends INVITE messages to itself first then it
                routes INVITE msg to user location.</div>
              <div>Because of this i see two record routes in the INTIVE
                headers and 200 reply headers.</div>
              <div><br>
              </div>
              <div>        if (is_reply()) {</div>
              <div>                if(isbflagset(FLB_NATB)) {</div>
              <div>                        if(is_first_hop())</div>
              <div>                                set_contact_alias();</div>
              <div>                }</div>
              <div>        }</div>
              <div><br>
              </div>
              <div>But according to this code in NATMANAGE block, it
                only set contact if it is first hope.</div>
              <div>Since these messages have two record routes, this
                code block does not modify contact field</div>
              <div>Am I right? or Am I missing something else?</div>
              <div><br>
              </div>
              <div>Thanks</div>
              <span><font color="#888888">
                  <div>Huseyin</div>
                  <div> </div>
                </font></span></div>
            <div>
              <div>
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Wed, Apr 27, 2016 at 12:50
                    PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank"></a><a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div bgcolor="#FFFFFF" text="#000000">
                        <p>Hello,</p>
                        <p>dlg_bridge is not using the location table at
                          all, because it has to use the contact from
                          200ok of INVITE.</p>
                        <p>Have you used set_contact_alias() for natted
                          200ok received for INVITE?</p>
                        <p>Cheers,<br>
                          Daniel<br>
                        </p>
                        <div>
                          <div> <br>
                            <div>On 27/04/16 11:15, huseyin kalyoncu
                              wrote:<br>
                            </div>
                            <blockquote type="cite">
                              <div dir="ltr">Hello Daniel
                                <div><br>
                                </div>
                                <div>This is the sample output from our
                                  location table;</div>
                                <div><br>
                                </div>
                                <div>
                                  <div>kamailio=# select
                                    username,contact,received,user_agent
                                    from location where
                                    username='5678*0012';</div>
                                  <div> username  |             contact
                                                |       received      
                                     |     user_agent      </div>
                                  <div>-----------+---------------------------------+-----------------------+---------------------</div>
                                  <div> 5678*0012 | <a></a><a>sip:5678*</a><a href="http://0012@192.168.1.21:5090" target="_blank"></a><a href="mailto:0012@192.168.1.21:5090" target="_blank">0012@192.168.1.21:5090</a>
                                    | <a>sip:DEVICE_PUBLIC_ADDRESS:5090</a>
                                    | Cisco/SPA504G-7.6.1</div>
                                  <div>(1 row)</div>
                                  <div><br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>After calling dlg_bridge Kamailio
                                    firing INVITE and rings the device.</div>
                                  <div>After answering on this device
                                    Kamailio firing REFER message.</div>
                                  <div>But as you can see from ngrep
                                    output below, Kamailio is trying to
                                    send this message to address in the
                                    contact field which is a private
                                    IP. </div>
                                  <div><br>
                                  </div>
                                  <div>U 2016/04/27 10:58:25.745935
                                    KAMAILIO_PUBLIC_ADDRESS:5090 -> <a href="http://192.168.1.21:5090" target="_blank">192.168.1.21:5090</a></div>
                                  <div>REFER <a>sip:5678*</a><a href="http://0012@192.168.1.21:5090" target="_blank"></a><a href="mailto:0012@192.168.1.21:5090" target="_blank">0012@192.168.1.21:5090</a>
                                    SIP/2.0.</div>
                                  <div>Via: SIP/2.0/UDP
KAMAILIO_PUBLIC_ADDRESS:5090;branch=z9hG4bK0ab8.1c5e622e4af6b7b6c9ede7ade4a50bf8.0.</div>
                                  <div>Via: SIP/2.0/UDP
KAMAILIO_PUBLIC_ADDRESS;rport=5060;branch=z9hG4bK0ab8.c8a54413000000000000000000000000.0.</div>
                                  <div>To: <a><sip:5678*0012@KAMAILIO_PUBLIC_ADDRESS></a>;tag=199aaa02310a0799i1.</div>
                                  <div>From:
                                    <a><sip:click2call@KAMAILIO_PUBLIC_ADDRESS></a>;tag=0d71401ca91009b00be5953e2813d7e4-7471.</div>
                                  <div>CSeq: 11 REFER.</div>
                                  <div>Call-ID:
                                    63dc8c8a5ea88a30-868@KAMAILIO_PUBLIC_ADDRESS.</div>
                                  <div>Max-Forwards: 69.</div>
                                  <div>Content-Length: 0.</div>
                                  <div>User-Agent: Kamailio.</div>
                                  <div>Referred-By: <a></a><a>sip:click2call@KAMAILIO_PUBLIC_ADDRESS</a>.</div>
                                  <div>Refer-To: <a></a><a>sip:5678*0002@KAMAILIO_PUBLIC_ADDRESS</a>.</div>
                                  <div>Contact: <a></a><a><sip:click2call@KAMAILIO_PUBLIC_ADDRESS:5060></a>.</div>
                                </div>
                                <div><br>
                                </div>
                                <div><br>
                                </div>
                              </div>
                              <div class="gmail_extra"><br>
                                <div class="gmail_quote">On Wed, Apr 27,
                                  2016 at 10:47 AM, Daniel-Constantin
                                  Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank"></a><a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span>
                                  wrote:<br>
                                  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                    <div bgcolor="#FFFFFF" text="#000000">
                                      <p>Hello,</p>
                                      <p>can you send the ngrep trace
                                        for such case? I would like to
                                        look at the headers to
                                        understand properly what do you
                                        mean.</p>
                                      <p>Cheers,</p>
                                      <p>Daniel<br>
                                      </p>
                                      <div>
                                        <div> <br>
                                          <div>On 26/04/16 15:23,
                                            huseyin kalyoncu wrote:<br>
                                          </div>
                                        </div>
                                      </div>
                                      <blockquote type="cite">
                                        <div>
                                          <div>
                                            <div dir="ltr">Hello
                                              <div><br>
                                              </div>
                                              <div>I am trying to
                                                implement click 2 call
                                                functionality on
                                                Kamailio
                                                with dlg_bridge.</div>
                                              <div>But It seems that
                                                Kamailio routes REFER
                                                messages to devices
                                                according to Contact
                                                field of location table
                                                instead of Received
                                                field. </div>
                                              <div>But if the the IP in
                                                the Contact field is
                                                private REFER messages
                                                are failing so </div>
                                              <div>does the dlg_bridge.</div>
                                              <div><br>
                                              </div>
                                              <div><br>
                                              </div>
                                              <div>I called dlg_bridge
                                                in the config like this:</div>
                                              <div><br>
                                              </div>
                                              <div>dlg_bridge(<a></a><a>"sip:$param1"</a>,
                                                <a></a><a>"sip:$param2"</a>,
                                                <a></a><a>"sip:IP_ADDRESS_OF_KAMAILIO:5060"</a>);<br>
                                              </div>
                                              <div><br>
                                              </div>
                                              <div>It rings the device
                                                in $param1 but after
                                                answering on that device</div>
                                              <div>Kamailio fails to
                                                send REFER if the
                                                Contact field for that
                                                device is Private IP.</div>
                                              <div>So it fails to
                                                initiate a call.</div>
                                              <div><br>
                                              </div>
                                              <div>How can I force
                                                Kamailio to use Received
                                                field for REFER messages
                                                instead of Contact
                                                field?<br>
                                              </div>
                                              <div><br>
                                              </div>
                                              <div>Thanks</div>
                                              <div>Huseyin</div>
                                              <div><br>
                                              </div>
                                              <div> </div>
                                            </div>
                                            <br>
                                            <fieldset></fieldset>
                                            <br>
                                          </div>
                                        </div>
                                        <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span><font color="#888888">
</font></span></pre>
                                        <span><font color="#888888"> </font></span></blockquote>
                                      <span><font color="#888888"> <br>
                                          <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, Berlin, May 18-20, 2016 - <a href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a></pre>
                                        </font></span></div>
                                    <br>
_______________________________________________<br>
                                    SIP Express Router (SER) and
                                    Kamailio (OpenSER) - sr-users
                                    mailing list<br>
                                    <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                    <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                    <br>
                                  </blockquote>
                                </div>
                                <br>
                              </div>
                              <br>
                              <fieldset></fieldset>
                              <br>
                              <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
                            </blockquote>
                            <br>
                            <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, Berlin, May 18-20, 2016 - <a href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a></pre>
                          </div>
                        </div>
                      </div>
                      <br>
                      _______________________________________________<br>
                      SIP Express Router (SER) and Kamailio (OpenSER) -
                      sr-users mailing list<br>
                      <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                      <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                      <br>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, Berlin, May 18-20, 2016 - <a href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a></pre>
  </div></div></div>

<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>