<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/12760">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Channel variable SIPFROMDOMAIN<br><br>In chan_sip, there was variable SIPFROMDOMAIN that allows to set<br>From header URI domain per channel. This patch introduces res_pjsip<br>variable SIPFROMDOMAIN for backward compatibility with chan_sip.<br><br>ASTERISK-28489<br><br>Change-Id: I715133e43172ce2a1e82093538dc39f9e99e5f2e<br>---<br>M res/res_pjsip_session.c<br>1 file changed, 12 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index ee12099..0cc514a 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -766,6 +766,7 @@</span><br><span>     pjsip_sip_uri *dlg_info_uri;</span><br><span>         pjsip_sip_uri *dlg_contact_uri;</span><br><span>      int restricted;</span><br><span style="color: hsl(120, 100%, 40%);">+       const char *pjsip_from_domain;</span><br><span> </span><br><span>   if (!session->channel || session->saved_from_hdr) {</span><br><span>            return;</span><br><span>@@ -809,6 +810,17 @@</span><br><span>               pj_strdup2(dlg_pool, &dlg_info_uri->host, session->endpoint->fromdomain);</span><br><span>       }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+     * Channel variable for compatibility with chan_sip SIPFROMDOMAIN</span><br><span style="color: hsl(120, 100%, 40%);">+      */</span><br><span style="color: hsl(120, 100%, 40%);">+   ast_channel_lock(session->channel);</span><br><span style="color: hsl(120, 100%, 40%);">+        pjsip_from_domain = pbx_builtin_getvar_helper(session->channel, "SIPFROMDOMAIN");</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!ast_strlen_zero(pjsip_from_domain)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            ast_debug(3, "From header domain reset by channel variable SIPFROMDOMAIN (%s)\n", pjsip_from_domain);</span><br><span style="color: hsl(120, 100%, 40%);">+               pj_strdup2(dlg_pool, &dlg_info_uri->host, pjsip_from_domain);</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+     ast_channel_unlock(session->channel);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>   /* We need to save off the non-anonymized From for RPID/PAI generation (for domain) */</span><br><span>       session->saved_from_hdr = pjsip_hdr_clone(dlg_pool, dlg_info);</span><br><span>    ast_sip_add_usereqphone(session->endpoint, dlg_pool, session->saved_from_hdr->uri);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/12760">change 12760</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/+/12760"/><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: I715133e43172ce2a1e82093538dc39f9e99e5f2e </div>
<div style="display:none"> Gerrit-Change-Number: 12760 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </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: Stas Kobzar <stas@modulis.ca> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>