PJSIP Transfer with Headers

How do I attached SIP headers to a Transfer (SIP Refer)? According to the second note PJSIP_HEADER wiki, I’m probably attaching the header to the incoming channel. But Transfer doesn’t have a pre-dial handler to attach headers.

same => n,Answer()
same => n,Playback(transfer-message)
same => n,Set(PJSIP_HEADER(add,_test)={test}) same => n,Transfer(PJSIP/sip:{EXTEN}@inbound)

Such functionality does not exist. PJSIP_HEADER only works on INVITE.

That’s a bummer. Transfer is used in some dialplans to get the entire call flow off a particular server. Is this functionality on the development roadmap? And would there be a workaround/different approach to this requirement?

I’m not aware of any individual working on such functionality, and for the specific Transfer use case this is the first time I’ve ever seen anyone actually request it. Without development work there’s no work around built into Asterisk.

Whilst I don’t know if Asterisk supports that either, are you sure you want to add headers to the REFER, or header parameters to the ReferTo header?

Yes. I’m attempting to move a dialplan from chan_sip to pjsip. The chan_sip dialplan would attach headers to the SIP Refer that could then be read on the refered to server. Could we attached custom data onto the ReferTo field via parameters? And how would we read that data from a dialplan?

same => n,Answer()
same => n,Playback(transfer-message)
same => n,SIPAddHeader(_test:{test}) same => n,Transfer({EXTEN})