<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9865">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_caller_id: Add "party" parameter to RPID header.<br><br>This change adds the "party" parameter to the Remote-Party-ID header<br>which indicates which party the header information is applicable<br>to. In Asterisk this is determined on whether we are the calling<br>or called party. This is added to improve interoperability with some<br>implementations.<br><br>ASTERISK-28006<br><br>Change-Id: I1eec3e377ffff8633b5c1dd59a05e9533122cfca<br>---<br>M res/res_pjsip_caller_id.c<br>1 file changed, 29 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c</span><br><span>index f15a66c..2481a3f 100644</span><br><span>--- a/res/res_pjsip_caller_id.c</span><br><span>+++ b/res/res_pjsip_caller_id.c</span><br><span>@@ -544,6 +544,33 @@</span><br><span> </span><br><span> /*!</span><br><span> * \internal</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Add party parameter to a Remote-Party-ID header.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param tdata The message where the Remote-Party-ID header is</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param hdr The header on which the parameters are being added</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param session The session involved</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static void add_party_param(pjsip_tx_data *tdata, pjsip_fromto_hdr *hdr, const struct ast_sip_session *session)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ static const pj_str_t party_str = { "party", 5 };</span><br><span style="color: hsl(120, 100%, 40%);">+ static const pj_str_t calling_str = { "calling", 7 };</span><br><span style="color: hsl(120, 100%, 40%);">+ static const pj_str_t called_str = { "called", 6 };</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_param *party;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* The party value can't change throughout the lifetime, so it is set only once */</span><br><span style="color: hsl(120, 100%, 40%);">+ party = pjsip_param_find(&hdr->other_param, &party_str);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (party) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ party = PJ_POOL_ALLOC_T(tdata->pool, pjsip_param);</span><br><span style="color: hsl(120, 100%, 40%);">+ party->name = party_str;</span><br><span style="color: hsl(120, 100%, 40%);">+ party->value = (session->inv_session->role == PJSIP_ROLE_UAC) ? calling_str : called_str;</span><br><span style="color: hsl(120, 100%, 40%);">+ pj_list_insert_before(&hdr->other_param, party);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \internal</span><br><span> * \brief Add privacy and screen parameters to a Remote-Party-ID header.</span><br><span> *</span><br><span> * If privacy is requested, then the privacy and screen parameters need to</span><br><span>@@ -631,6 +658,7 @@</span><br><span> pj_list_erase(old_rpid);</span><br><span> } else {</span><br><span> ast_sip_modify_id_header(tdata->pool, old_rpid, id);</span><br><span style="color: hsl(120, 100%, 40%);">+ add_party_param(tdata, old_rpid, session);</span><br><span> add_privacy_params(tdata, old_rpid, id);</span><br><span> return;</span><br><span> }</span><br><span>@@ -646,6 +674,7 @@</span><br><span> if (!rpid_hdr) {</span><br><span> return;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ add_party_param(tdata, rpid_hdr, session);</span><br><span> add_privacy_params(tdata, rpid_hdr, id);</span><br><span> pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *)rpid_hdr);</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9865">change 9865</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/9865"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I1eec3e377ffff8633b5c1dd59a05e9533122cfca </div>
<div style="display:none"> Gerrit-Change-Number: 9865 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>