res_pjsip_refer: Add Referred-By header on INVITE for blind transfers.

Per rfc3892, the Referred-By header in a REFER must be copied into the
referenced request (IE.  The outgoing INVITE to the transfer target).

* Automatically put the Referred-By header in the outgoing INVITE message
if the SIPREFERREDBYHDR channel variable is defined with a value.

* Made chan_sip.c:get_refer_info() set SIPREFERREDBYHDR for inheritance so
chan_pjsip has a better chance to interoperate.

* Fixed refer_blind_callback() and refer_incoming_refer_request() to not
modify the data in the pointer returned by pjsip_msg_find_hdr_by_name().
It seems wrong to modify that data since the calling routine doesn't own
the buffer.

ASTERISK-23501 #close
Reported by: John Bigelow

Review: https://reviewboard.asterisk.org/r/3514/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@413210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2014-05-02 16:33:59 +00:00
parent 0531dd81d4
commit 44d19433d9
3 changed files with 57 additions and 27 deletions

View File

@@ -18203,8 +18203,10 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
peer = ast_channel_bridge_peer(owner_ref);
if (peer) {
pbx_builtin_setvar_helper(peer, "SIPREFERRINGCONTEXT", transferer->context);
pbx_builtin_setvar_helper(peer, "SIPREFERREDBYHDR", p_referred_by);
pbx_builtin_setvar_helper(peer, "SIPREFERRINGCONTEXT",
S_OR(transferer->context, NULL));
pbx_builtin_setvar_helper(peer, "__SIPREFERREDBYHDR",
S_OR(p_referred_by, NULL));
ast_channel_unlock(peer);
}