AGI EXEC can call Dial, so you could do this in an AGI. I have used Dial successfully via AGI EXEC, although I haven’t tried it using the ‘b’ option.
Anyway, here’s a simple dialplan example of setting custom headers on the outbound leg of a PJSIP Dial:
[outboundheaders]
exten => 12345,1,Verbose(Dialing with headers sub)
exten => 12345,n,SET(_MYSESSIONVAR=123456789)
exten => 12345,n,Dial(PJSIP/5551212@my_pj_peer,b(headers))
exten => 12345,n,Hangup()
exten => 12345,n(headers),NoOp(pre-dial channel setup)
exten => 12345,n,Set(PJSIP_HEADER(add,x-language)=en_US)
exten => 12345,n,Set(PJSIP_HEADER(add,x-session)=${MYSESSIONVAR})
exten => 12345,n,Return()
On Mon, Apr 15, 2024 at 8:41 AM david551 via Asterisk Community <notifications@asterisk.discoursemail.com> wrote:
SipAddHeader questions should be considered academic, as you should not be using chan_sip. However, the way it works, it doesn’t need to be run on the B side channel, as it sets inheritable channel variables, which pass through to the B side when Dial creates the channel. That won’t work for the chan_pjsip equivalent.
Personally I wouldn’t make AGI my primary driver for control flow, and would use it to augment dialplan, not the other way round.
Visit Topic or reply to this email to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from these emails, click here.