Asterisk Dial with A and b option

Hello.
I’m trying to use Dial with option A and b together.
Option A to play announcement to called number.
And option b to add custom sip headers.
This options don’t work together, only one of them, which stay first in options.
For example
If I set b otion before A, then only sip headers was added and no announcement to called number.
same => n(dial),Dial(PJSIP/${agent_ext}@kcc-sip1-lp1.hq.bc,30,b(add_sip_header_dialer^s^1(${phone},${callId},${clientId})),A(ascending-2tone:))

If set A option before b then only annoncement was played and no sip headers added.
same => n(dial),Dial(PJSIP/${agent_ext}@kcc-sip1-lp1.hq.bc,30,A(ascending-2tone:),b(add_sip_header_dialer^s^1(${phone},${callId},${clientId})))

How I can make work this options together?
Thanks.

I would suggest setting those options in a subroutine that you call from Dial()

[announcementheader]
exten = addheader,1,Set(PJSIP_HEADER(add,header-name)=value)
same = n,Playack(announcementfile)
same = n,Return()

[yourdialplancontext]
......
same = n(dial),Dial(PJSIP/${agent_ext}@kcc-sip1-lp1.hq.bc,30,b(announcementheader^addheader^1))

There is no delimiter between options, other than the closing parentheses for any parameters, and, even then, only if there are parameters. Your b option has been placed in the URL field!

@david551 Thank you!
It’s my mistake.
Now it works as needed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.