Re: [asterisk-dev] Transfer cmd (PJSIP not sending Referred-By but chan_sip does)

2015-08-25 Thread Dan Cropp
In doing a little research, it seems the Referred-By header could be added after the pjsip_xfer_initiate. This is the approach PJSIP did for some code as far back as PJSIP 1.6. /* * Create REFER request. */ status = pjsip_xfer_initiate(sub, dest, tdata); if (status

[asterisk-dev] Transfer cmd (PJSIP not sending Referred-By but chan_sip does)

2015-08-25 Thread Dan Cropp
I asked the question on asterisk-users but did not receive a response, so I am sending the question here. I am running Asterisk 13.5.0. A call comes in, Asterisk answers it. After some actions, the call needs to be Transferred (SIP REFER) to another number. The other switch is responsible

Re: [asterisk-dev] Transfer cmd (PJSIP not sending Referred-By but chan_sip does)

2015-08-25 Thread Mark Michelson
The answer to this is actually pretty simple: adding Referred-By in outgoing SIP REFERs is simply not implemented in chan_pjsip's chan_pjsip_transfer() function. As far as the syntax required for the Transfer() application, that's probably a case where that needs to be clarified in

Re: [asterisk-dev] Transfer cmd (PJSIP not sending Referred-By but chan_sip does)

2015-08-25 Thread Dan Cropp
Thank you Mark From: asterisk-dev-boun...@lists.digium.com [mailto:asterisk-dev-boun...@lists.digium.com] On Behalf Of Mark Michelson Sent: Tuesday, August 25, 2015 10:30 AM To: Asterisk Developers Mailing List Subject: Re: [asterisk-dev] Transfer cmd (PJSIP not sending Referred-By but chan_sip

Re: [asterisk-dev] Transfer cmd (PJSIP not sending Referred-By but chan_sip does)

2015-08-25 Thread Mark Michelson
That code gets you about 95% of the way there. The biggest difference would be that the pjsip_msg_add_hdr() call may need to be broken up based on whether the SIPREFERREDBYHDR channel variable is set or not. To determine that, you can use the pbx_builtin_getvar_helper() function call declared

Re: [asterisk-dev] Transfer cmd (PJSIP not sending Referred-By but chan_sip does)

2015-08-25 Thread Mark Michelson
Yep, that looks like what I would expect it to look like. The only thing that immediately jumps out as unnecessary is the if (ref_by_val !ast_strlen_zero(ref_by_val)) line. You can get rid of the initial NULL check because ast_strlen_zero() does that for you. If you wanted to submit

Re: [asterisk-dev] Transfer cmd (PJSIP not sending Referred-By but chan_sip does)

2015-08-25 Thread Dan Cropp
Thank you Mark for the tips. Is the code below close to what you were thinking? I ran some initial tests and it seems to be working. I can override the default Referred-By value by setting the SIPREFERREDBYHDR variable. static void transfer_refer(struct ast_sip_session *session, const char