<p>George Joseph <strong>uploaded patch set #4</strong> to this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/12824">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_nat: Restore original contact for REGISTER responses<br><br>RFC3261 Section 10 "Registrations", specifically paragraph<br>"10.2.4: Refreshing Bindings", states that a user agent compares<br>each contact address (in a 200 REGISTER response) to see if it<br>created the contact.  If the Asterisk endpoint has the<br>rewrite_contact option set however, the contact host and port sent<br>back in the 200 response will be the rewritten one and not the<br>one sent by the user agent.  This prevents the user agent from<br>matching its own contact.  Some user agents get very upset when<br>this happens and will not consider the registration successful.<br>While this is rare, it is acceptable behavior especially if more<br>than 1 user agent is allowed to register to a single endpoint/aor.<br><br>This commit updates res_pjsip_nat (where rewrite_contact is<br>implemented) to store the original incoming Contact header in<br>a new "x-ast-orig-host" URI parameter before rewriting it, and to<br>restore the original host and port to the Contact headers in the<br>outgoing response.<br><br>This is only done if the request is a REGISTER and rewrite_contact<br>is enabled.<br><br>pjsip_message_filter was also updated to ensure that if a request<br>comes in with any existing x-ast-* URI parameters, we remove them<br>so they don't conflict.  Asterisk will never send a request<br>with those headers in it but someone might just decide to add them<br>to a request they craft and send to Asterisk.<br><br>ASTERISK-28502<br>Reported-by: Ross Beer<br><br>Change-Id: Idc263ad2d2d7bd8faa047e5804d96a5fe1cd282e<br>---<br>M res/res_pjsip/pjsip_message_filter.c<br>M res/res_pjsip_nat.c<br>2 files changed, 98 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/24/12824/4</pre><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: 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-CC: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>