Asterisk 13.1 vs 13.6 Queue GoSub + PJSIP Outbound INVITE


I’ve upgraded from Asterisk 13.1-cert1 to Asterisk 13.6 to take advantage of the various fixes but encountered a little problem:

I use the Dial b option and the Queue gosub parameter to to set various things on the outbound channel including the SIP Alert-Info header (for distinctive ringing). See these snippets from my dialplan:


exten = 303,1,Dial(PJSIP/303.context3,20,${DIAL_OPTIONS}b(context3^303addheader^1))
exten = 303addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=http://notused.local;info=alert-${ALERT_NAME};x-line-id=0)

exten = 306,1,Queue(2006.context3,C,7200,onanswer,context3,306addheader)
exten = 306addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=http://notused.local;info=alert-${ALERT_NAME};x-line-id=0)[/code]
This works ok for the Dial command but with the Queue it worked under 13.1 but doesn’t work under 13.6. It appears that 13.1 executed the Queue gosub before sending the outbound INVITE but 13.6 executes this on an agent answering (by which point it’s too late to add SIP headers).

I guess my questions are:

  • Am I observing correct behaviour?
  • Can this behaviour be changed?
  • Is there a way of doing what I want (I am aware I can investigate using Local channels)?
  • Would changing the behaviour in source code be straighforward (I’m not that familiar with Asterisk source)?

As an aside, in order to make the Queue gosub jump to the specified context and extension I made the following change:

[code][asterisk-13.6.0]# diff apps/app_queue-orig.c apps/app_queue.c
< if (ast_asprintf(&gosub_args, “%s,%s,1(%s)”, gosubexec, what_is_s, gosub_argstart + 1) < 0) {

                          if (ast_asprintf(&gosub_args, "%s,%s,1", gosubexec, gosub_argstart + 1) < 0) {[/code]

Thanks for your time,


I’m using Gobsub() on Queue(), but this is executed after the agent answered the call, so this is the correct behavior. I think you best chance would be using local channels