Use of Background in a dial out conference connection

Hi,

I’m trying to get the dialed out called party to press 1 to accept the incoming call to conference.
Unfortunately it does not work as expected as any pressed digits lead to conference connection. There is also NOTICE about abnormal exit that I don’t quite understand as well.
Any help is appreciated.

[confdialout]
...
    same => n,Dial(PJSIP/test/sip:${EXTEN}@test.com,,b(pre-dial-test^addheader^1)U(confdialout_bann))

[confdialout_bann]
exten => s,1,NoOp()
    same => n,Background(press-1)
    same => n,WaitExten(10);

exten => 1,1,Return()
exten => i,1,Playback(vm-goodby)
exten => i,2,Hangup()
exten => t,1,Playback(vm-goodby)
exten => t,2,Hangup()
Executing [s@confdialout_bann:1] NoOp("PJSIP/test-0000001c", "") in new stack
    -- Executing [s@confdialout_bann:2] BackGround("PJSIP/test-0000001c", "press-1") in new stack
    -- <PJSIP/test-0000001c> Playing 'press-1.alaw' (language 'en')
       > 0x7f460c0233f0 -- Strict RTP switching to RTP target address 46.236.1.2:19546 as source
    -- Executing [s@confdialout_bann:3] WaitExten("PJSIP/test-0000001c", "10") in new stack
  == Spawn extension (confdialout_bann, s, 3) exited non-zero on 'PJSIP/test-0000001c'
[Apr  9 22:09:52] NOTICE[24208][C-00000012]: app_stack.c:1080 gosub_run: PJSIP/test-0000001c Abnormal 'Gosub(confdialout_bann,s,1)' exit.  Popping routine return locations.

related to this warning

Missing the return return after same => n,WaitExten(10)

Every GoSub routine should end with a Return application
execution so that the stack remains balanced.
http://lists.digium.com/pipermail/asterisk-dev/2013-September/062428.html

Hi,

thank for an advice, unfortunately it did not help with the notice:

[confdialout_bann]
exten => s,1,NoOp()
    same => n,Background(press-1)
    same => n,WaitExten(10)
    same => n,Return()

exten => 1,1,Return
exten => i,1,Playback(conf-errormenu)
exten => i,2,Hangup
exten => t,1,Playback(conf-errormenu)
exten => t,2,Hangup

 Executing [s@confdialout_bann:3] BackGround("PJSIP/test-00000029", "press-1") in new stack
    -- <PJSIP/test-00000029> Playing 'press-1.alaw' (language 'de')
       > 0x7f45e800cfb0 -- Strict RTP switching to RTP target address 1.2.3.4:15734 as source
       > 0x7f45e800cfb0 -- Strict RTP learning complete - Locking on source address 46.236.204.217:15734
    -- Executing [s@confdialout_bann:4] WaitExten("PJSIP/test-00000029", "10") in new stack
  == Spawn extension (confdialout_bann, s, 4) exited non-zero on 'PJSIP/test-00000029'
[Apr 13 14:52:25] NOTICE[12515][C-0000001a]: app_stack.c:1080 gosub_run: PJSIP/test-00000029 Abnormal 'Gosub(confdialout_bann,s,1)' exit.  Popping routine return locations.

EDIT: I also added Return after every hangup and it did not help either.

Checking your code carefully adding return() after ,WaitExten(10) won’t make sense because after that it will goes to the trigger extension add it to t and i before hangup() app

Hm,

I actually want to hangup the dialout call if B-Side does not press 1. Returning before hangup will brake this logic.

I did try you proposal, but it did not work either. same problem with notice and pressing any other digit but 1 still gets the call connected:

Executing [s@confdialout_bann:3] BackGround("PJSIP/test-00000024", "press-1") in new stack
    -- <PJSIP/test-00000024> Playing 'press-1.alaw' (language 'de')
       > 0x7f4fa0018380 -- Strict RTP switching to RTP target address 1.2.3.4:20130 as source
    -- Executing [s@confdialout_bann:4] WaitExten("PJSIP/test-00000024", "10") in new stack
  == Spawn extension (confdialout_bann, s, 4) exited non-zero on 'PJSIP/test-00000024'
[Apr 13 17:47:29] NOTICE[4774][C-00000024]: app_stack.c:1080 gosub_run: PJSIP/test-00000024 Abnormal 'Gosub(confdialout_bann,s,1)' exit.  Popping routine return locations.

I havent tested your code but This hangup is not terminating the call, it just quit from the gosub(), then the normal bridge continue

exten => i,2,Hangup

1 Like

Ah thank, I did not realize that hangup wont terminate the call if called from gosub. What should I call to end the call in this case?

There is something wrong with background and waitexten. if i press 7 it does not get to the [1-9] exten:

[confdialout_bann]
exten => s,1,NoOp()
    same => n,Set(CHANNEL(language)=de)
    same => n,Background(press-0)
    same => n,WaitExten(10)
    same => n,Return()

exten => 0,1,Return()

exten => [1-9],1,Playback(conf-errormenu)
    same => n,SoftHangup(${ARG1})
    same => n,Return()

exten => t,1,Playback(conf-errormenu)
    same => n,SoftHangup(${ARG1})
    same => n,Return()

Executing [s@confdialout_bann:1] NoOp("PJSIP/tele-00000014", "") in new stack
    -- Executing [s@confdialout_bann:2] Set("PJSIP/tele-00000014", "CHANNEL(language)=de") in new stack
    -- Executing [s@confdialout_bann:3] BackGround("PJSIP/tele-00000014", "press-0") in new stack
    -- <PJSIP/tele-00000014> Playing 'press-0.alaw' (language 'de')
       > 0x7f989000bb30 -- Strict RTP switching to RTP target address 1.2.3.4:12760 as source
    -- Executing [s@confdialout_bann:4] WaitExten("PJSIP/tele-00000014", "10") in new stack
       > 0x7f989000bb30 -- Strict RTP learning complete - Locking on source address 1.2.3.4:12760
  == Spawn extension (confdialout_bann, s, 4) exited non-zero on 'PJSIP/tele-00000014'
[Apr 15 21:13:19] NOTICE[27073][C-0000000c]: app_stack.c:1080 gosub_run: PJSIP/tele-00000014 Abnormal 'Gosub(confdialout_bann,s,1(s,1(Local/+1234567@confdialout-00000012;2)))' exit.  Popping routine return locations.

Found solution:
WaitExten does not work in subs, but Read does.