mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
res_pjsip_session: add new flag use_callerid_contact
Add a new global flag to res_pjsip to allow the callerid to be used as the username in the contact header. This allows chan_pjsip to have the same behavour as chan_sip ASTERISK-28087 #close Change-Id: I9a720e058323f6862a91c62f8a8c1a4b5c087b95
This commit is contained in:
committed by
Torrey Searle
parent
3f4f31fed6
commit
3ba66b8a9d
@@ -1404,8 +1404,10 @@ static void set_from_header(struct ast_sip_session *session)
|
||||
struct ast_party_id connected_id;
|
||||
pj_pool_t *dlg_pool;
|
||||
pjsip_fromto_hdr *dlg_info;
|
||||
pjsip_contact_hdr *dlg_contact;
|
||||
pjsip_name_addr *dlg_info_name_addr;
|
||||
pjsip_sip_uri *dlg_info_uri;
|
||||
pjsip_sip_uri *dlg_contact_uri;
|
||||
int restricted;
|
||||
|
||||
if (!session->channel || session->saved_from_hdr) {
|
||||
@@ -1426,11 +1428,16 @@ static void set_from_header(struct ast_sip_session *session)
|
||||
|
||||
dlg_pool = session->inv_session->dlg->pool;
|
||||
dlg_info = session->inv_session->dlg->local.info;
|
||||
dlg_contact = session->inv_session->dlg->local.contact;
|
||||
dlg_info_name_addr = (pjsip_name_addr *) dlg_info->uri;
|
||||
dlg_info_uri = pjsip_uri_get_uri(dlg_info_name_addr);
|
||||
dlg_contact_uri = (pjsip_sip_uri*)pjsip_uri_get_uri(dlg_contact->uri);
|
||||
|
||||
if (session->endpoint->id.trust_outbound || !restricted) {
|
||||
ast_sip_modify_id_header(dlg_pool, dlg_info, &connected_id);
|
||||
if (ast_sip_get_use_callerid_contact() && ast_strlen_zero(session->endpoint->contact_user)) {
|
||||
pj_strdup2(dlg_pool, &dlg_contact_uri->user, S_COR(connected_id.number.valid, connected_id.number.str, ""));
|
||||
}
|
||||
}
|
||||
|
||||
ast_party_id_free(&connected_id);
|
||||
@@ -1460,6 +1467,10 @@ static void set_from_header(struct ast_sip_session *session)
|
||||
pj_strdup2(dlg_pool, &dlg_info_uri->user, "anonymous");
|
||||
}
|
||||
|
||||
if (ast_sip_get_use_callerid_contact() && ast_strlen_zero(session->endpoint->contact_user)) {
|
||||
pj_strdup2(dlg_pool, &dlg_contact_uri->user, "anonymous");
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(session->endpoint->fromdomain)) {
|
||||
pj_strdup2(dlg_pool, &dlg_info_uri->host, "anonymous.invalid");
|
||||
}
|
||||
|
Reference in New Issue
Block a user