diff options
author | Joshua Colp <jcolp@digium.com> | 2014-10-17 11:30:23 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2014-10-17 11:30:23 +0000 |
commit | 7144c739e97aca9e69b2067238deeedeafbc478f (patch) | |
tree | acc791f5d1428a24ac0c46ad3ce1ded243daa22e /res/res_pjsip_caller_id.c | |
parent | f91cb1207c7e7d6f0f3db6e207fd34ce3c6e5416 (diff) |
res_pjsip: Add 'user_eq_phone' option to add a 'user=phone' parameter when applicable.
This change adds a configuration option which adds a 'user=phone' parameter if the user
portion of the request URI or the From URI is determined to be a number.
Review: https://reviewboard.asterisk.org/r/4073/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425804 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_caller_id.c')
-rw-r--r-- | res/res_pjsip_caller_id.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c index e22ce6a09..c3757e06f 100644 --- a/res/res_pjsip_caller_id.c +++ b/res/res_pjsip_caller_id.c @@ -669,11 +669,7 @@ static void caller_id_outgoing_request(struct ast_sip_session *session, pjsip_tx ast_party_id_copy(&connected_id, &effective_id); ast_channel_unlock(session->channel); - if (session->inv_session->state < PJSIP_INV_STATE_CONFIRMED && - ast_strlen_zero(session->endpoint->fromuser) && - (session->endpoint->id.trust_outbound || - ((connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED && - (connected_id.number.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED))) { + if (session->inv_session->state < PJSIP_INV_STATE_CONFIRMED) { /* Only change the From header on the initial outbound INVITE. Switching it * mid-call might confuse some UAs. */ @@ -683,8 +679,16 @@ static void caller_id_outgoing_request(struct ast_sip_session *session, pjsip_tx from = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_FROM, tdata->msg->hdr.next); dlg = session->inv_session->dlg; - modify_id_header(tdata->pool, from, &connected_id); - modify_id_header(dlg->pool, dlg->local.info, &connected_id); + if (ast_strlen_zero(session->endpoint->fromuser) && + (session->endpoint->id.trust_outbound || + ((connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED && + (connected_id.number.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED))) { + modify_id_header(tdata->pool, from, &connected_id); + modify_id_header(dlg->pool, dlg->local.info, &connected_id); + } + + ast_sip_add_usereqphone(session->endpoint, tdata->pool, from->uri); + ast_sip_add_usereqphone(session->endpoint, dlg->pool, dlg->local.info->uri); } add_id_headers(session, tdata, &connected_id); ast_party_id_free(&connected_id); |