mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
res_pjsip: Channel variable SIPFROMDOMAIN
In chan_sip, there was variable SIPFROMDOMAIN that allows to set From header URI domain per channel. This patch introduces res_pjsip variable SIPFROMDOMAIN for backward compatibility with chan_sip. ASTERISK-28489 Change-Id: I715133e43172ce2a1e82093538dc39f9e99e5f2e
This commit is contained in:
committed by
George Joseph
parent
15624d9a7a
commit
c7270dca81
@@ -1458,6 +1458,7 @@ static void set_from_header(struct ast_sip_session *session)
|
|||||||
pjsip_sip_uri *dlg_info_uri;
|
pjsip_sip_uri *dlg_info_uri;
|
||||||
pjsip_sip_uri *dlg_contact_uri;
|
pjsip_sip_uri *dlg_contact_uri;
|
||||||
int restricted;
|
int restricted;
|
||||||
|
const char *pjsip_from_domain;
|
||||||
|
|
||||||
if (!session->channel || session->saved_from_hdr) {
|
if (!session->channel || session->saved_from_hdr) {
|
||||||
return;
|
return;
|
||||||
@@ -1501,6 +1502,17 @@ static void set_from_header(struct ast_sip_session *session)
|
|||||||
pj_strdup2(dlg_pool, &dlg_info_uri->host, session->endpoint->fromdomain);
|
pj_strdup2(dlg_pool, &dlg_info_uri->host, session->endpoint->fromdomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Channel variable for compatibility with chan_sip SIPFROMDOMAIN
|
||||||
|
*/
|
||||||
|
ast_channel_lock(session->channel);
|
||||||
|
pjsip_from_domain = pbx_builtin_getvar_helper(session->channel, "SIPFROMDOMAIN");
|
||||||
|
if (!ast_strlen_zero(pjsip_from_domain)) {
|
||||||
|
ast_debug(3, "From header domain reset by channel variable SIPFROMDOMAIN (%s)\n", pjsip_from_domain);
|
||||||
|
pj_strdup2(dlg_pool, &dlg_info_uri->host, pjsip_from_domain);
|
||||||
|
}
|
||||||
|
ast_channel_unlock(session->channel);
|
||||||
|
|
||||||
/* We need to save off the non-anonymized From for RPID/PAI generation (for domain) */
|
/* We need to save off the non-anonymized From for RPID/PAI generation (for domain) */
|
||||||
session->saved_from_hdr = pjsip_hdr_clone(dlg_pool, dlg_info);
|
session->saved_from_hdr = pjsip_hdr_clone(dlg_pool, dlg_info);
|
||||||
ast_sip_add_usereqphone(session->endpoint, dlg_pool, session->saved_from_hdr->uri);
|
ast_sip_add_usereqphone(session->endpoint, dlg_pool, session->saved_from_hdr->uri);
|
||||||
|
Reference in New Issue
Block a user