Forward Abandoned Queue Calls to Answering Service

I am using Asterisk 18 on a Ubuntu 22.04 server with Grandstream GXP2135 endpoints. Incoming calls go to a queue with a ring all strategy. I would like to forward un-answered (abandoned) calls to our answering service.

I have logic in my extensions.conf to do this, but it only works when the queue timeout is set to 10 seconds. The ring timeout on all of my endpoints is set to 180 seconds.

From what I can tell, the endpoints are timing out before the queue timeout.

One other thing I can’t figure out is that when it does successfully forward it goes back to my inbound time checking context, rings the queue again, then goes to the answering service context.

Asterisk Version: Asterisk 18.10.0~dfsg+~cs6.10.40431411-2

queue.conf

; Queue for all internal endpoints
[all-phones]
strategy=>ringall

member=>PJSIP/0031
member=>PJSIP/0032
member=PJSIP/0033
member=>PJSIP/0034
member=>PJSIP/0035
member=>PJSIP/0036
member=>PJSIP/0037
member=>PJSIP/0050
member=>PJSIP/0060
member=>PJSIP/0070

extensions.conf for incoming calls

exten => ***main-number***,1,Verbose(1,"Inbound call for from ${CALLERID(name)} (${CALLERID(num)})")
 same => n,Queue(all-phones,Cn,,,15)
 same => n,Verbose(1,"Abandoned - forwarding to answering service.")
 same => n,GotoIf($[${ABANDONED} = TRUE]?Answering-Service,s,1)
 same => n,Hangup()

extensions.conf context for answering service

[Answering-Service]
exten => s,1,Verbose(1,"Forward call from ${CALLERID(num)} to answering service")
 same => n,Set(CALLERID(name)=anonymouns)
 same => n,Set(CALLERID(num)=***main-number***)
 same => n,Dial(PJSIP/***answering-service***@sip-provider-trunk)
 same => n,Hangup()

Console of call that failed to forward (15 second queue timeout)

Executing [5551234@Open:2] Queue("PJSIP/sip-provider-trunk-000003e8", "all-phones,Cn,,,15") in new stack
    -- Started music on hold, class 'default', on channel 'PJSIP/sip-provider-trunk-000003e8'
    -- Called PJSIP/0033
    -- Called PJSIP/0036
    -- Called PJSIP/0032
    -- Called PJSIP/0035
    -- Called PJSIP/0031
    -- Called PJSIP/0034
    -- Called PJSIP/0050
    -- Called PJSIP/0060
    -- Called PJSIP/0070
    -- Called PJSIP/0037
    -- PJSIP/0060-000003f0 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0050-000003ef connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0034-000003ee connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0070-000003f1 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0031-000003ed connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0035-000003ec connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0032-000003eb connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0036-000003ea connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0033-000003e9 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0037-000003f2 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003e8
    -- PJSIP/0050-000003ef is ringing
    -- PJSIP/0070-000003f1 is ringing
    -- Stopped music on hold on PJSIP/sip-provider-trunk-000003e8
  == Spawn extension (Open, 5551234, 2) exited non-zero on 'PJSIP/sip-provider-trunk-000003e8'

Console log of call that successfully forwarded

    -- Executing [**main-number**@Inbound:1] Verbose("PJSIP/sip-provider-trunk-000003f5", "1,"Check business hours/holidays", 1") in new stack
 "Check business hours/holidays", 1
    -- Executing [**main-number**@Inbound:2] Verbose("PJSIP/sip-provider-trunk-000003f5", "1,"Time is Fri Apr 26 17:45:37 2024"") in new stack
 "Time is Fri Apr 26 17:45:37 2024"
    -- Executing [**main-number**@Inbound:3] Set("PJSIP/sip-provider-trunk-000003f5", "TESTTIME()=2024/04/22 08:30:00 America/New_York") in new stack
    -- Executing [**main-number**@Inbound:4] Verbose("PJSIP/sip-provider-trunk-000003f5", "1,"Time is 1713789000"") in new stack
 "Time is 1713789000"
    -- Executing [**main-number**@Inbound:5] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "*,*,4,jul?Closed,s,1,s,1") in new stack
    -- Executing [**main-number**@Inbound:6] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "*,mon,1-7,sep?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:7] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "*,thu,15-21,nov?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:8] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "*,fri,16-22,nov,?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:9] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "*,*,25,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:10] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "*,mon,24,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:11] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "*,fri,26,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:12] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "*,*,31,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:13] GotoIfTime("PJSIP/sip-provider-trunk-000003f5", "7:00-17:00,mon-fri,*,*?Open,**main-number**,1:Closed,s,1") in new stack
    -- Goto (Open,**main-number**,1)
    -- Executing [**main-number**@Open:1] Verbose("PJSIP/sip-provider-trunk-000003f5", "1,"Inbound call"") in new stack
    -- Executing [**main-number**@Open:2] Queue("PJSIP/sip-provider-trunk-000003f5", "all-phones,Cn,,,10") in new stack
    -- Started music on hold, class 'default', on channel 'PJSIP/sip-provider-trunk-000003f5'
    -- Called PJSIP/0033
    -- Called PJSIP/0036
    -- Called PJSIP/0032
    -- Called PJSIP/0035
    -- Called PJSIP/0031
    -- Called PJSIP/0034
    -- Called PJSIP/0050
    -- Called PJSIP/0060
    -- Called PJSIP/0070
    -- Called PJSIP/0037
    -- PJSIP/0070-000003fe connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0060-000003fd connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0050-000003fc connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0034-000003fb connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0031-000003fa connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0035-000003f9 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0032-000003f8 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0036-000003f7 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0033-000003f6 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0037-000003ff connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-000003f5
    -- PJSIP/0050-000003fc is ringing
    -- PJSIP/0070-000003fe is ringing
    -- PJSIP/0031-000003fa is ringing
    -- PJSIP/0060-000003fd is ringing
    -- PJSIP/0035-000003f9 is ringing
    -- PJSIP/0032-000003f8 is ringing
    -- PJSIP/0033-000003f6 is ringing
    -- PJSIP/0036-000003f7 is ringing
    -- PJSIP/0037-000003ff is ringing
    -- PJSIP/0034-000003fb is ringing
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Exiting on time-out cycle
    -- Stopped music on hold on PJSIP/sip-provider-trunk-000003f5
    -- Executing [**main-number**@Open:3] Verbose("PJSIP/sip-provider-trunk-000003f5", "1,"Abandoned - forwarding to answering service."") in new stack
 "Abandoned - forwarding to answering service."
    -- Executing [**main-number**@Open:4] GotoIf("PJSIP/sip-provider-trunk-000003f5", "1?Answering-Service,s,1") in new stack
    -- Goto (Answering-Service,s,1)
    -- Executing [s@Answering-Service:1] Verbose("PJSIP/sip-provider-trunk-000003f5", "1,"Forward call from **incoming-call** to answering service"") in new stack
 "Forward call from **incoming-call** to answering service"
    -- Executing [s@Answering-Service:2] Set("PJSIP/sip-provider-trunk-000003f5", "CALLERID(name)=anonymous") in new stack
    -- Executing [s@Answering-Service:3] Set("PJSIP/sip-provider-trunk-000003f5", "CALLERID(num)=**main-number**") in new stack
    -- Executing [s@Answering-Service:4] Dial("PJSIP/sip-provider-trunk-000003f5", "PJSIP/**answering-service**3@sip-provider-trunk") in new stack
    -- Called PJSIP/**answering-service**@sip-provider-trunk
  == Spawn extension (Answering-Service, s, 4) exited non-zero on 'PJSIP/sip-provider-trunk-000003f5'
    -- Executing [**main-number**@Inbound:1] Verbose("PJSIP/sip-provider-trunk-00000401", "1,"Check business hours/holidays", 1") in new stack
 "Check business hours/holidays **incoming-call** -> **main-number**", 1
    -- Executing [**main-number**@Inbound:2] Verbose("PJSIP/sip-provider-trunk-00000401", "1,"Time is Fri Apr 26 17:45:49 2024"") in new stack
 "Time is Fri Apr 26 17:45:49 2024"
    -- Executing [**main-number**@Inbound:3] Set("PJSIP/sip-provider-trunk-00000401", "TESTTIME()=2024/04/22 08:30:00 America/New_York") in new stack
    -- Executing [**main-number**@Inbound:4] Verbose("PJSIP/sip-provider-trunk-00000401", "1,"Time is 1713789000"") in new stack
 "Time is 1713789000"
    -- Executing [**main-number**@Inbound:5] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "*,*,4,jul?Closed,s,1,s,1") in new stack
    -- Executing [**main-number**@Inbound:6] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "*,mon,1-7,sep?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:7] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "*,thu,15-21,nov?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:8] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "*,fri,16-22,nov,?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:9] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "*,*,25,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:10] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "*,mon,24,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:11] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "*,fri,26,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:12] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "*,*,31,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:13] GotoIfTime("PJSIP/sip-provider-trunk-00000401", "7:00-17:00,mon-fri,*,*?Open,**main-number**,1:Closed,s,1") in new stack
    -- Goto (Open,**main-number**,1)
    -- Executing [**main-number**@Open:1] Verbose("PJSIP/sip-provider-trunk-00000401", "1,"Inbound call"") in new stack
    -- Executing [**main-number**@Open:2] Queue("PJSIP/sip-provider-trunk-00000401", "all-phones,Cn,,,10") in new stack
    -- Started music on hold, class 'default', on channel 'PJSIP/sip-provider-trunk-00000401'
    -- Called PJSIP/0033
    -- Called PJSIP/0036
    -- Called PJSIP/0032
    -- Called PJSIP/0035
    -- Called PJSIP/0031
    -- Called PJSIP/0034
    -- Called PJSIP/0050
    -- Called PJSIP/0060
    -- Called PJSIP/0070
    -- Called PJSIP/0037
    -- PJSIP/0070-0000040a connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0060-00000409 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0050-00000408 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0034-00000407 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0031-00000406 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0035-00000405 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0032-00000404 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0036-00000403 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0033-00000402 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0037-0000040b connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-00000401
    -- PJSIP/0050-00000408 is ringing
    -- PJSIP/0070-0000040a is ringing
    -- PJSIP/0034-00000407 is ringing
    -- PJSIP/0032-00000404 is ringing
    -- PJSIP/0035-00000405 is ringing
    -- PJSIP/0031-00000406 is ringing
    -- PJSIP/0037-0000040b is ringing
    -- PJSIP/0033-00000402 is ringing
    -- PJSIP/0036-00000403 is ringing
    -- PJSIP/0060-00000409 is ringing
    -- PJSIP/0036-00000403 is ringing
    -- PJSIP/0060-00000409 is ringing
    -- PJSIP/0060-00000409 is ringing
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Exiting on time-out cycle
    -- Stopped music on hold on PJSIP/sip-provider-trunk-00000401
    -- Executing [**main-number**@Open:3] Verbose("PJSIP/sip-provider-trunk-00000401", "1,"Abandoned - forwarding to answering service."") in new stack
 "Abandoned - forwarding to answering service."
    -- Executing [**main-number**@Open:4] GotoIf("PJSIP/sip-provider-trunk-00000401", "1?Answering-Service,s,1") in new stack
    -- Goto (Answering-Service,s,1)
    -- Executing [s@Answering-Service:1] Verbose("PJSIP/sip-provider-trunk-00000401", "1,"Forward call to answering service"") in new stack
 "Forward call from **incoming-call** to answering service"
    -- Executing [s@Answering-Service:2] Set("PJSIP/sip-provider-trunk-00000401", "CALLERID(name)=anonymous") in new stack
    -- Executing [s@Answering-Service:3] Set("PJSIP/sip-provider-trunk-00000401", "CALLERID(num)=**main-number**") in new stack
    -- Executing [s@Answering-Service:4] Dial("PJSIP/sip-provider-trunk-00000401", "PJSIP/**answering-service**3@sip-provider-trunk") in new stack
    -- Called PJSIP/**answering-service**@sip-provider-trunk
  == Spawn extension (Answering-Service, s, 4) exited non-zero on 'PJSIP/sip-provider-trunk-00000401'
    -- Executing [**main-number**@Inbound:1] Verbose("PJSIP/sip-provider-trunk-0000040d", "1,"Check business hours/holidays", 1") in new stack
     -- Executing [**main-number**@Inbound:2] Verbose("PJSIP/sip-provider-trunk-0000040d", "1,"Time is Fri Apr 26 17:46:02 2024"") in new stack
 "Time is Fri Apr 26 17:46:02 2024"
    -- Executing [**main-number**@Inbound:3] Set("PJSIP/sip-provider-trunk-0000040d", "TESTTIME()=2024/04/22 08:30:00 America/New_York") in new stack
    -- Executing [**main-number**@Inbound:4] Verbose("PJSIP/sip-provider-trunk-0000040d", "1,"Time is 1713789000"") in new stack
 "Time is 1713789000"
    -- Executing [**main-number**@Inbound:5] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "*,*,4,jul?Closed,s,1,s,1") in new stack
    -- Executing [**main-number**@Inbound:6] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "*,mon,1-7,sep?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:7] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "*,thu,15-21,nov?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:8] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "*,fri,16-22,nov,?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:9] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "*,*,25,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:10] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "*,mon,24,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:11] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "*,fri,26,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:12] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "*,*,31,dec?Closed,s,1") in new stack
    -- Executing [**main-number**@Inbound:13] GotoIfTime("PJSIP/sip-provider-trunk-0000040d", "7:00-17:00,mon-fri,*,*?Open,**main-number**,1:Closed,s,1") in new stack
    -- Goto (Open,**main-number**,1)
    -- Executing [**main-number**@Open:1] Verbose("PJSIP/sip-provider-trunk-0000040d", "1,"Inbound call"") in new stack
 "Inbound call for Tallahassee office from (**incoming-call**)"
    -- Executing [**main-number**@Open:2] Queue("PJSIP/sip-provider-trunk-0000040d", "all-phones,Cn,,,10") in new stack
    -- Started music on hold, class 'default', on channel 'PJSIP/sip-provider-trunk-0000040d'
    -- Called PJSIP/0033
    -- Called PJSIP/0036
    -- Called PJSIP/0032
    -- Called PJSIP/0035
    -- Called PJSIP/0031
    -- Called PJSIP/0034
    -- Called PJSIP/0050
    -- Called PJSIP/0060
    -- Called PJSIP/0070
    -- Called PJSIP/0037
    -- PJSIP/0070-00000416 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0060-00000415 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0050-00000414 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0034-00000413 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0031-00000412 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0035-00000411 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0032-00000410 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0036-0000040f connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0033-0000040e connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0037-00000417 connected line has changed. Saving it until answer for PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/0050-00000414 is ringing
    -- PJSIP/0070-00000416 is ringing
    -- PJSIP/0034-00000413 is ringing
    -- PJSIP/0035-00000411 is ringing
    -- PJSIP/0060-00000415 is ringing
    -- PJSIP/0033-0000040e is ringing
    -- PJSIP/0031-00000412 is ringing
    -- PJSIP/0036-0000040f is ringing
    -- PJSIP/0032-00000410 is ringing
    -- PJSIP/0037-00000417 is ringing
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Nobody picked up in 10000 ms
    -- Exiting on time-out cycle
    -- Stopped music on hold on PJSIP/sip-provider-trunk-0000040d
    -- Executing [**main-number**@Open:3] Verbose("PJSIP/sip-provider-trunk-0000040d", "1,"Abandoned - forwarding to answering service."") in new stack
 "Abandoned - forwarding to answering service."
    -- Executing [**main-number**@Open:4] GotoIf("PJSIP/sip-provider-trunk-0000040d", "1?Answering-Service,s,1") in new stack
    -- Goto (Answering-Service,s,1)
    -- Executing [s@Answering-Service:1] Verbose("PJSIP/sip-provider-trunk-0000040d", "1,"Forward call to answering service"") in new stack
    -- Executing [s@Answering-Service:2] Set("PJSIP/sip-provider-trunk-0000040d", "CALLERID(name)=anonymous") in new stack
    -- Executing [s@Answering-Service:3] Set("PJSIP/sip-provider-trunk-0000040d", "CALLERID(num)=**main-number**") in new stack
    -- Executing [s@Answering-Service:4] Dial("PJSIP/sip-provider-trunk-0000040d", "PJSIP/**answering-service**@sip-provider-trunk") in new stack
    -- Called PJSIP/**answering-service**@sip-provider-trunk
    -- PJSIP/sip-provider-trunk-00000418 is making progress passing it to PJSIP/sip-provider-trunk-0000040d
    -- PJSIP/sip-provider-trunk-00000418 answered PJSIP/sip-provider-trunk-0000040d
    -- Channel PJSIP/sip-provider-trunk-00000418 joined 'simple_bridge' basic-bridge <4cffb035-f593-44e1-a0e6-43d0be5b6d0c>
    -- Channel PJSIP/sip-provider-trunk-0000040d joined 'simple_bridge' basic-bridge <4cffb035-f593-44e1-a0e6-43d0be5b6d0c>
    -- Channel PJSIP/sip-provider-trunk-0000040d left 'native_rtp' basic-bridge <4cffb035-f593-44e1-a0e6-43d0be5b6d0c>
    -- Channel PJSIP/sip-provider-trunk-00000418 left 'native_rtp' basic-bridge <4cffb035-f593-44e1-a0e6-43d0be5b6d0c>
  == Spawn extension (Answering-Service, s, 4) exited non-zero on 'PJSIP/sip-provider-trunk-0000040d'

Please do not use screen scrapes when timing is of the essence. Use the full log file, which has timestamps.

“Abandoned” will confuse people, as it normally means the caller gave up, so there is no call to forward.

What is timeoutpriority set to?

David,

Thanks for taking the time to help me. Going forward I will try to post information in the proper format.

I have not set the timeoutpriority in queues.conf, so I assume it is set to the default (app).

I have re-read the documentation for the Queue application and queues.conf, but I am not sure how to configure asterisk to accomplish what I am trying to do. What I am trying to do is to get the Queue application to ring all phones for 15 seconds, then - if no member answers - transfer the call to our answering service.

Currently, if I set the timeout in the Queue application timeout to longer than 10 seconds the following occurs:

  1. the member endpoints ring
  2. the Queue application timeout expires
  3. the Queue application exits with a non-zero status
  4. the caller gets a busy signal

On the other hand, if I set the timeout in the Queue application to 10 seconds, the following occurs:

  1. the member endpoints ring
  2. the Queue application timeout expires
  3. the call re-connects
  4. the Queue application timeout expires for a second time with ABANDONED=True status
  5. the call goes to the next priority in the dial plan, which then forwards the call to our answering service

I think what might be happening in the first scenario is that the ring timeout for our SIP providers session border controller is expiring and it is the session border controller that is dropping the call and not our asterisk server. This is why the Queue application is returning a non-zero exit status.

The second scenario is close to what I want to accomplish, but I would like to eliminate the re-connects. I am not sure what causesthe call to re-connect, but I suspect that it might be the session border controller that is re-connecting when the ring timeout for asterisk is less than the ring timeout for the session border controller. I will have to do a packet capture and see if I can figure this out.

Why do you care here

same => n,GotoIf($[${ABANDONED} = TRUE]?Answering-Service,s,1)

for any status? Just send them to your answering service at the next priority after your queue. Successful calls or callers who give up, will not reach this priority in any way.

A SIP trace would show what is actually happening from a signaling perspective, including what is hanging up and such.

Thanks. You are correct the GotoIf is not needed. However, I don’t think this is what is causing the problem, since it works correctly when the Queue application timeout is 10 seconds but does not work when the Queue applcation timeout is more than 10 seconds.

What exactly does this mean. If a call reconnects it must have disconnected, and, in that case the dialplan will start over from the beginning, with no memory of the first attempt.

I think we do need complete logs to understand what is really happening.

By re-connect I mean that after the Queue application timeout expires, the call starts over in the [Inbound] context (below is a simplified version of our dial plan):

; all inbound calls start in this context
[Inbound]
exten => _X.,1,Verbose(1,"Check business hours")
 same => n,GotoIfTime(holiday ? Closed,s,1)
 ...
 same = n,GotoIfTime(business hours, ? Open,s,1 : Closed,s,1)

[Open]
exten => main-number,1,Verbose("Inbound call from ${CALLERID(num)}")
 same => n,Queue(all-phones,Cn,,,10)
 same => GotoIf($[${ABANDONED} = True]?Answering-Service)
 same => Hangup()

[Closed]
exten => s,1,Verbose("Call from ${CALLERID(num)} received after hours")
 same => n,Goto(Answering-Service,s,1)
 same => Hangup()

[Answering-Service]
exten => s,1,Verbose("Transferring call from ${CALLERID(num)} to answering service")
 same => n,Dial(PJSIP/answering-service@sip-trunk)
 same => Hangup()

When the call re-connects after the Queue application timeout, it goes back to the start of [Inbound] context and executes the time checks again. When this happens, a tone can be heard in the calling phone right before the call re-connects. Also, the second time the call connects it will successfully be transferred to our answering service after the Queue application times out.

I am pretty sure that this behavior is being caused by our SIP provider’s session border controller, but I will have to investigate further.