<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 4:</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 4:</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 4:</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 4:</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 4:</p><p style="white-space: pre-wrap; word-wrap: break-word;">It's worse, it writes asterisk's ip-address to contact host<br>This happens when set external_signaling_address on transport.</p></blockquote></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Are you sure? It's working for me and I do have external_signalling_address set on the transport.  The code takes exactly what's in the incoming contact header.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;"><br>Sure.<br>I even placed a debug before and after<br>pj_strdup2(tdata->pool, &uri->host, ast_sockaddr_stringify_host(&transport_state->external_signaling_address));<br>to check it.</p><p style="white-space: pre-wrap; word-wrap: break-word;">If set external_signaling_address<br>res_pjsip_nat.c: Saving contact 'endpoint-private-ip:65160'<br>res_pjsip_nat.c: got contact endpoint-public-ip:65160<br>res_pjsip_nat.c: Found orig host: endpoint-private-ip:65160<br>res_pjsip_nat.c: Before Contact URI host:port endpoint-private-ip:65160<br>res_pjsip_nat.c: After Contact URI host:port external_signaling_address:65160</p><p style="white-space: pre-wrap; word-wrap: break-word;">SIP 200 REGISTER<br>Contact: <sip:endpoint@external_signaling_address:65160>;expires=179</p><p style="white-space: pre-wrap; word-wrap: break-word;">If not set external_signaling_address<br>res_pjsip_nat.c: Saving contact 'endpoint-private-ip:65160'<br>res_pjsip_nat.c: got contact endpoint-public-ip:65160<br>res_pjsip_nat.c: Found orig host: endpoint-private-ip:65160</p><p style="white-space: pre-wrap; word-wrap: break-word;">SIP 200 REGISTER<br>Contact: <sip:endpoint@endpoint-private-ip:65160>;expires=179</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Are endpoint-private-ip and endpoint-public-ip the addresses of the device or the pbx?  Are you testing from the same machine as the pbx?  I think you discovered a completely separate bug.  If you look further down in nat_on_tx_message we're setting the Contact host to the external_signalling_address but we should only be doing that for outgoing requests, not responses.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;"><br>"should only be doing that for outgoing requests", but because<br>.on_tx_request = nat_on_tx_message,<br>.on_tx_response = nat_on_tx_message,<br>we use the same function for request and response</p><p style="white-space: pre-wrap; word-wrap: break-word;">this bug exists with or without your patch.<br>But it's related to this issue "the contact host and port sent<br>back in the 200 response will be not the one sent by the user agent".<br>So I think it should be fixed in this patch</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/12824">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/12824">change 12824</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/12824"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: Idc263ad2d2d7bd8faa047e5804d96a5fe1cd282e </div>
<div style="display:none"> Gerrit-Change-Number: 12824 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 13 Sep 2019 18:39:30 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>