Merge "res_pjsip_caller_id: Add "party" parameter to RPID header." into 16
This commit is contained in:
commit
c03ab4c4b1
|
@ -542,6 +542,33 @@ static void add_pai_header(const struct ast_sip_session *session, pjsip_tx_data
|
|||
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *)pai_hdr);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Add party parameter to a Remote-Party-ID header.
|
||||
*
|
||||
* \param tdata The message where the Remote-Party-ID header is
|
||||
* \param hdr The header on which the parameters are being added
|
||||
* \param session The session involved
|
||||
*/
|
||||
static void add_party_param(pjsip_tx_data *tdata, pjsip_fromto_hdr *hdr, const struct ast_sip_session *session)
|
||||
{
|
||||
static const pj_str_t party_str = { "party", 5 };
|
||||
static const pj_str_t calling_str = { "calling", 7 };
|
||||
static const pj_str_t called_str = { "called", 6 };
|
||||
pjsip_param *party;
|
||||
|
||||
/* The party value can't change throughout the lifetime, so it is set only once */
|
||||
party = pjsip_param_find(&hdr->other_param, &party_str);
|
||||
if (party) {
|
||||
return;
|
||||
}
|
||||
|
||||
party = PJ_POOL_ALLOC_T(tdata->pool, pjsip_param);
|
||||
party->name = party_str;
|
||||
party->value = (session->inv_session->role == PJSIP_ROLE_UAC) ? calling_str : called_str;
|
||||
pj_list_insert_before(&hdr->other_param, party);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Add privacy and screen parameters to a Remote-Party-ID header.
|
||||
|
@ -631,6 +658,7 @@ static void add_rpid_header(const struct ast_sip_session *session, pjsip_tx_data
|
|||
pj_list_erase(old_rpid);
|
||||
} else {
|
||||
ast_sip_modify_id_header(tdata->pool, old_rpid, id);
|
||||
add_party_param(tdata, old_rpid, session);
|
||||
add_privacy_params(tdata, old_rpid, id);
|
||||
return;
|
||||
}
|
||||
|
@ -646,6 +674,7 @@ static void add_rpid_header(const struct ast_sip_session *session, pjsip_tx_data
|
|||
if (!rpid_hdr) {
|
||||
return;
|
||||
}
|
||||
add_party_param(tdata, rpid_hdr, session);
|
||||
add_privacy_params(tdata, rpid_hdr, id);
|
||||
pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *)rpid_hdr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue