[asterisk-bugs] [JIRA] (ASTERISK-27833) hangup handlers sometimes called on answer and not on hangup (depending on usage of local channels, bridge, originate, mixmonitor)

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Thu Jun 7 06:29:54 CDT 2018


     [ https://issues.asterisk.org/jira/browse/ASTERISK-27833?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Mudgett closed ASTERISK-27833.
--------------------------------------


The hangup handlers are working AS DESIGNED.  The local channels are hanging up when they are optimized out.  It is you who has the wrong idea of how to use them.  Asterisk has *no* internal concept of what a call is.

> hangup handlers sometimes called on answer and not on hangup (depending on usage of local channels, bridge, originate, mixmonitor)
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-27833
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27833
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Bridging
>    Affects Versions: 15.3.0
>         Environment: Fedora 27, probably all
>            Reporter: Frederic Steinfels
>            Assignee: Unassigned
>              Labels: pjsip
>         Attachments: scenario2 20180502-002816-29-28.wav, scenario3 20180502-003400-29-28.wav
>
>
> The behaviour of the bridge command is different depending on wheter MixMonitor is used. MixMonitor itself does not work if used before the PlayBack(beep) command. MixMonitor works if used after the PlayBack command.
> Scenario 1: Bridge command without MixMonitor
> {noformat}
> exten => s,1001,Set(CALLEDNUM=${SHARED(connecttocid)})
> exten => s,1002,agi(googletts.agi,"Sie werden mit ${ADMIN-${SHARED(connecttoadminid)}-spokenfname} ${ADMIN-${SHARED(connecttoadminid)}-spokenlname} verbunden.",de,,1.4)
> exten => s,1003,Set(CHANNEL(hangup_handler_push)=logoutemployee,s,1(hangup_handler))
> exten => s,1004,Set(CHANNEL(after_bridge_goto)=logoutemployee,s,1(after_bridge))
> exten => s,1005,Playback(beep)
> exten => s,1006,Noop()
> exten => s,1007,Bridge(${SHARED(connecttochannel)},p)
> exten => h,1,Noop(in hangup)
> {noformat}
> This will happen:
> {noformat}
>     -- Executing [s at newanswer:1001] Set("Local/69 at default-000000b8;2", "CALLEDNUM=28") in new stack
>     -- Executing [s at newanswer:1002] AGI("Local/69 at default-000000b8;2", "googletts.agi,"Sie werden mit Frédéric Steinfels verbunden.",de,,1.4") in new stack
>     -- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
>   == Spawn extension (local-sccp-call, s, 14) exited non-zero on 'Local/22 at default-000000b9;2'
>     -- <Local/69 at default-000000b8;2> Playing '/data/Telefon/googletts//9c3c06da9e11b5448585f24c9285641b.1.4.slin16' (escape_digits=) (sample_offset 0) (language 'en')
>     -- <Local/69 at default-000000b8;2>AGI Script googletts.agi completed, returning 0
>     -- Executing [s at newanswer:1003] Set("Local/69 at default-000000b8;2", "CHANNEL(hangup_handler_push)=logoutemployee,s,1(hangup_handler)") in new stack
>     -- Executing [s at newanswer:1004] Set("Local/69 at default-000000b8;2", "CHANNEL(after_bridge_goto)=logoutemployee,s,1(after_bridge)") in new stack
>     -- Executing [s at newanswer:1005] Playback("Local/69 at default-000000b8;2", "beep") in new stack
>     -- <Local/69 at default-000000b8;2> Playing 'beep.gsm' (language 'en')
>     -- Executing [s at newanswer:1006] NoOp("Local/69 at default-000000b8;2", "") in new stack
>     -- Executing [s at newanswer:1007] Bridge("Local/69 at default-000000b8;2", "Local/28 at default-000000ba;1,p") in new stack
>   == Spawn extension (receptionist4, s, 16) exited non-zero on 'Surrogate/Local/28 at default-000000ba;1'
>     -- Channel Local/28 at default-000000ba;1 joined 'simple_bridge' basic-bridge <db41b6a4-3a40-43eb-892e-1d496da479db>
>     -- Channel Local/69 at default-000000b8;2 joined 'simple_bridge' basic-bridge <db41b6a4-3a40-43eb-892e-1d496da479db>
> [May  2 00:06:18] WARNING[22967][C-0000003f]: file.c:1245 ast_streamfile: Unable to open beep (format (slin192)): No such file or directory
>        > Move-swap optimizing Local/28 at default-000000ba;1 <-- PJSIP/28-000000b6.
>     -- Channel PJSIP/28-000000b6 left 'simple_bridge' basic-bridge <b7992456-512e-4047-b4b2-c5a02e4b05ab>
>     -- Channel Local/28 at default-000000ba;1 left 'simple_bridge' basic-bridge <db41b6a4-3a40-43eb-892e-1d496da479db>
>     -- Channel PJSIP/28-000000b6 swapped with Local/28 at default-000000ba;1 into 'simple_bridge' basic-bridge <db41b6a4-3a40-43eb-892e-1d496da479db>
>     -- Channel Local/28 at default-000000ba;2 left 'simple_bridge' basic-bridge <b7992456-512e-4047-b4b2-c5a02e4b05ab>
>   == Spawn extension (local-sip-call, s, 11) exited non-zero on 'Local/28 at default-000000ba;2'
>     -- Executing [s at receptionist4:17] Playback("Local/28 at default-000000ba;1", "beep") in new stack
>     -- <Local/28 at default-000000ba;1> Playing 'beep.gsm' (language 'en')
>        > Move-swap optimizing Local/69 at default-000000b8;2 <-- PJSIP/mobile-000000b4.
>     -- Channel PJSIP/mobile-000000b4 left 'simple_bridge' basic-bridge <f6726fe1-c05f-4d7b-87ad-cf1eb8cfc113>
>     -- Channel Local/69 at default-000000b8;2 left 'simple_bridge' basic-bridge <db41b6a4-3a40-43eb-892e-1d496da479db>
>     -- Channel PJSIP/mobile-000000b4 swapped with Local/69 at default-000000b8;2 into 'simple_bridge' basic-bridge <db41b6a4-3a40-43eb-892e-1d496da479db>
>        > Bridge db41b6a4-3a40-43eb-892e-1d496da479db: switching from simple_bridge technology to native_rtp
>        > Remotely bridged 'PJSIP/mobile-000000b4' and 'PJSIP/28-000000b6' - media will flow directly between them
>     -- Channel Local/69 at default-000000b8;1 left 'simple_bridge' basic-bridge <f6726fe1-c05f-4d7b-87ad-cf1eb8cfc113>
>     -- Executing [h at newanswer:1] NoOp("Local/69 at default-000000b8;2", "in hangup") in new stack
>     -- Local/69 at default-000000b8;2 Internal Gosub(logoutemployee,s,1(hangup_handler)) start
>     -- Executing [s at logoutemployee:1] NoOp("Local/69 at default-000000b8;2", "I am channel Local/69 at default-000000b8;2 and  and hangup_handler") in new stack
>     -- Executing [s at logoutemployee:2] Return("Local/69 at default-000000b8;2", "") in new stack
>   == Spawn extension (newanswer, h, 2) exited non-zero on 'Local/69 at default-000000b8;2'
>     -- Local/69 at default-000000b8;2 Internal Gosub(logoutemployee,s,1(hangup_handler)) complete GOSUB_RETVAL=
> {noformat}
> when hanging up:
> {noformat}
>     -- Channel PJSIP/mobile-000000b4 left 'native_rtp' basic-bridge <db41b6a4-3a40-43eb-892e-1d496da479db>
>     -- Channel PJSIP/28-000000b6 left 'native_rtp' basic-bridge <db41b6a4-3a40-43eb-892e-1d496da479db>
>   == Spawn extension (internal2local, s, 13) exited non-zero on 'PJSIP/mobile-000000b4'
> {noformat}
> Scenario 2: Bridge command with MixMonitor, beep after MixMonitor
> {noformat}
> exten => s,1001,Set(CALLEDNUM=${SHARED(connecttocid)})
> exten => s,1002,agi(googletts.agi,"Sie werden mit ${ADMIN-${SHARED(connecttoadminid)}-spokenfname} ${ADMIN-${SHARED(connecttoadminid)}-spokenlname} verbunden.",de,,1.4)
> exten => s,1003,Set(CHANNEL(hangup_handler_push)=logoutemployee,s,1(hangup_handler))
> exten => s,1004,Set(CHANNEL(after_bridge_goto)=logoutemployee,s,1(after_bridge))
> exten => s,1005,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}-${CALLEDNUM}.wav)
> exten => s,1006,Playback(beep)
> exten => s,1007,Bridge(${SHARED(connecttochannel)},p)
> exten => s,1008,Noop(here ${BRIDGEPEER})
> exten => s,1009,Wait(5)
> exten => s,1010,Hangup()
> exten => h,1,Noop(in hangup)
> {noformat}
> {noformat}
>     -- Executing [s at newanswer:1001] Set("Local/69 at default-000000bb;2", "CALLEDNUM=28") in new stack
>     -- Executing [s at newanswer:1002] AGI("Local/69 at default-000000bb;2", "googletts.agi,"Sie werden mit Frédéric Steinfels verbunden.",de,,1.4") in new stack
>     -- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
>     -- <Local/69 at default-000000bb;2> Playing '/data/Telefon/googletts//9c3c06da9e11b5448585f24c9285641b.1.4.slin16' (escape_digits=) (sample_offset 0) (language 'en')
>     -- <Local/69 at default-000000bb;2>AGI Script googletts.agi completed, returning 0
>     -- Executing [s at newanswer:1003] Set("Local/69 at default-000000bb;2", "CHANNEL(hangup_handler_push)=logoutemployee,s,1(hangup_handler)") in new stack
>     -- Executing [s at newanswer:1004] Set("Local/69 at default-000000bb;2", "CHANNEL(after_bridge_goto)=logoutemployee,s,1(after_bridge)") in new stack
>     -- Executing [s at newanswer:1005] MixMonitor("Local/69 at default-000000bb;2", "20180502-002543-29-28.wav") in new stack
>     -- Executing [s at newanswer:1006] Playback("Local/69 at default-000000bb;2", "beep") in new stack
>   == Begin MixMonitor Recording Local/69 at default-000000bb;2
>     -- <Local/69 at default-000000bb;2> Playing 'beep.gsm' (language 'en')
>     -- Executing [s at newanswer:1007] Bridge("Local/69 at default-000000bb;2", "Local/28 at default-000000bd;1,p") in new stack
>   == Spawn extension (receptionist4, s, 16) exited non-zero on 'Surrogate/Local/28 at default-000000bd;1'
>     -- Channel Local/28 at default-000000bd;1 joined 'simple_bridge' basic-bridge <8e648097-8dcd-451d-9bb6-5cd7a3aa57a9>
>     -- Channel Local/69 at default-000000bb;2 joined 'simple_bridge' basic-bridge <8e648097-8dcd-451d-9bb6-5cd7a3aa57a9>
>     -- <Local/28 at default-000000bd;1> Playing 'beep.slin192' (language 'en')
>        > Move-swap optimizing Local/28 at default-000000bd;1 <-- PJSIP/28-000000b9.
>     -- Channel PJSIP/28-000000b9 left 'simple_bridge' basic-bridge <e08c964b-c6a1-4c37-8322-16118a5644c2>
>     -- Channel Local/28 at default-000000bd;1 left 'simple_bridge' basic-bridge <8e648097-8dcd-451d-9bb6-5cd7a3aa57a9>
>     -- Channel PJSIP/28-000000b9 swapped with Local/28 at default-000000bd;1 into 'simple_bridge' basic-bridge <8e648097-8dcd-451d-9bb6-5cd7a3aa57a9>
>     -- Channel Local/28 at default-000000bd;2 left 'simple_bridge' basic-bridge <e08c964b-c6a1-4c37-8322-16118a5644c2>
>     -- Executing [s at receptionist4:17] Playback("Local/28 at default-000000bd;1", "beep") in new stack
>   == Spawn extension (local-sip-call, s, 11) exited non-zero on 'Local/28 at default-000000bd;2'
>     -- <Local/28 at default-000000bd;1> Playing 'beep.gsm' (language 'en')
> {noformat}
> when hanging up:
> {noformat}
>     -- Channel PJSIP/mobile-000000b7 left 'simple_bridge' basic-bridge <a5a00ca2-c9f0-4943-8ccc-39837695842b>
>     -- Channel Local/69 at default-000000bb;1 left 'simple_bridge' basic-bridge <a5a00ca2-c9f0-4943-8ccc-39837695842b>
>   == Spawn extension (internal2local, s, 13) exited non-zero on 'PJSIP/mobile-000000b7'
>     -- Executing [s at logoutemployee:1] NoOp("Local/69 at default-000000bb;1", "I am channel Local/69 at default-000000bb;1 and  and ") in new stack
>     -- Executing [s at logoutemployee:2] Return("Local/69 at default-000000bb;1", "") in new stack
> [May  2 00:25:49] ERROR[8746][C-00000040]: app_stack.c:389 return_exec: Return without Gosub: stack is unallocated
>   == Spawn extension (logoutemployee, s, 2) exited non-zero on 'Local/69 at default-000000bb;1'
>     -- Channel Local/69 at default-000000bb;2 left 'simple_bridge' basic-bridge <8e648097-8dcd-451d-9bb6-5cd7a3aa57a9>
>     -- Channel PJSIP/28-000000b9 left 'simple_bridge' basic-bridge <8e648097-8dcd-451d-9bb6-5cd7a3aa57a9>
>     -- Executing [h at newanswer:1] NoOp("Local/69 at default-000000bb;2", "in hangup") in new stack
>     -- Local/69 at default-000000bb;2 Internal Gosub(logoutemployee,s,1(hangup_handler)) start
>     -- Executing [s at logoutemployee:1] NoOp("Local/69 at default-000000bb;2", "I am channel Local/69 at default-000000bb;2 and  and hangup_handler") in new stack
>     -- Executing [s at logoutemployee:2] Return("Local/69 at default-000000bb;2", "") in new stack
>   == Spawn extension (newanswer, h, 2) exited non-zero on 'Local/69 at default-000000bb;2'
>     -- Local/69 at default-000000bb;2 Internal Gosub(logoutemployee,s,1(hangup_handler)) complete GOSUB_RETVAL=
>   == Spawn extension (newanswer, h, 2) exited non-zero on 'Local/69 at default-000000bb;2'
>     -- Local/69 at default-000000bb;2 Internal Gosub(kill-originated,s,1) complete GOSUB_RETVAL=
>   == MixMonitor close filestream (mixed)
>   == End MixMonitor Recording Local/69 at default-000000bb;2
> {noformat}
> Scenario 3: Bridge command with MixMonitor, beep before MixMonitor
> {noformat}
> exten => s,1001,Set(CALLEDNUM=${SHARED(connecttocid)})
> exten => s,1002,agi(googletts.agi,"Sie werden mit ${ADMIN-${SHARED(connecttoadminid)}-spokenfname} ${ADMIN-${SHARED(connecttoadminid)}-spokenlname} verbunden.",de,,1.4)
> exten => s,1003,Set(CHANNEL(hangup_handler_push)=logoutemployee,s,1(hangup_handler))
> exten => s,1004,Set(CHANNEL(after_bridge_goto)=logoutemployee,s,1(after_bridge))
> exten => s,1005,Playback(beep)
> exten => s,1006,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)}-${CALLEDNUM}.wav)
> exten => s,1007,Bridge(${SHARED(connecttochannel)},p)
> exten => s,1008,Noop(here ${BRIDGEPEER})
> exten => s,1009,Wait(5)
> exten => s,1010,Hangup()
> exten => h,1,Noop(in hangup)
> {noformat}
> {noformat}
>  -- Executing [s at newanswer:1001] Set("Local/69 at default-000000c1;2", "CALLEDNUM=28") in new stack
>     -- Executing [s at newanswer:1002] AGI("Local/69 at default-000000c1;2", "googletts.agi,"Sie werden mit Frédéric Steinfels verbunden.",de,,1.4") in new stack
>     -- Launched AGI Script /var/lib/asterisk/agi-bin/googletts.agi
>     -- <Local/69 at default-000000c1;2> Playing '/data/Telefon/googletts//9c3c06da9e11b5448585f24c9285641b.1.4.slin16' (escape_digits=) (sample_offset 0) (language 'en')
>     -- <Local/69 at default-000000c1;2>AGI Script googletts.agi completed, returning 0
>     -- Executing [s at newanswer:1003] Set("Local/69 at default-000000c1;2", "CHANNEL(hangup_handler_push)=logoutemployee,s,1(hangup_handler)") in new stack
>     -- Executing [s at newanswer:1004] Set("Local/69 at default-000000c1;2", "CHANNEL(after_bridge_goto)=logoutemployee,s,1(after_bridge)") in new stack
>     -- Executing [s at newanswer:1005] Playback("Local/69 at default-000000c1;2", "beep") in new stack
>     -- <Local/69 at default-000000c1;2> Playing 'beep.gsm' (language 'en')
>     -- Executing [s at newanswer:1006] MixMonitor("Local/69 at default-000000c1;2", "20180502-003048-29-28.wav") in new stack
>     -- Executing [s at newanswer:1007] Bridge("Local/69 at default-000000c1;2", "Local/28 at default-000000c3;1,p") in new stack
>   == Begin MixMonitor Recording Local/69 at default-000000c1;2
>   == Spawn extension (receptionist4, s, 16) exited non-zero on 'Surrogate/Local/28 at default-000000c3;1'
>     -- Channel Local/28 at default-000000c3;1 joined 'simple_bridge' basic-bridge <2702b6fb-41e5-4696-bc54-cd7312b0a68d>
>     -- Channel Local/69 at default-000000c1;2 joined 'simple_bridge' basic-bridge <2702b6fb-41e5-4696-bc54-cd7312b0a68d>
>     -- <Local/28 at default-000000c3;1> Playing 'beep.gsm' (language 'en')
>        > Move-swap optimizing Local/28 at default-000000c3;1 <-- PJSIP/28-000000bf.
>     -- Channel PJSIP/28-000000bf left 'simple_bridge' basic-bridge <9078b1e8-0149-430b-acb2-3b351814be3d>
>     -- Channel Local/28 at default-000000c3;1 left 'simple_bridge' basic-bridge <2702b6fb-41e5-4696-bc54-cd7312b0a68d>
>     -- Channel PJSIP/28-000000bf swapped with Local/28 at default-000000c3;1 into 'simple_bridge' basic-bridge <2702b6fb-41e5-4696-bc54-cd7312b0a68d>
>     -- Channel Local/28 at default-000000c3;2 left 'simple_bridge' basic-bridge <9078b1e8-0149-430b-acb2-3b351814be3d>
>     -- Executing [s at receptionist4:17] Playback("Local/28 at default-000000c3;1", "beep") in new stack
>   == Spawn extension (local-sip-call, s, 11) exited non-zero on 'Local/28 at default-000000c3;2'
>     -- <Local/28 at default-000000c3;1> Playing 'beep.gsm' (language 'en')
> {noformat}
> when hanging up:
> {noformat}
>     -- Channel PJSIP/mobile-000000bd left 'simple_bridge' basic-bridge <bf89b7d9-10af-4586-a6f7-fdc42444bcc9>
>     -- Channel Local/69 at default-000000c1;1 left 'simple_bridge' basic-bridge <bf89b7d9-10af-4586-a6f7-fdc42444bcc9>
>   == Spawn extension (internal2local, s, 13) exited non-zero on 'PJSIP/mobile-000000bd'
>     -- Executing [s at logoutemployee:1] NoOp("Local/69 at default-000000c1;1", "I am channel Local/69 at default-000000c1;1 and  and ") in new stack
>     -- Executing [s at logoutemployee:2] Return("Local/69 at default-000000c1;1", "") in new stack
> [May  2 00:30:53] ERROR[12280][C-00000042]: app_stack.c:389 return_exec: Return without Gosub: stack is unallocated
>   == Spawn extension (logoutemployee, s, 2) exited non-zero on 'Local/69 at default-000000c1;1'
>     -- Channel Local/69 at default-000000c1;2 left 'simple_bridge' basic-bridge <2702b6fb-41e5-4696-bc54-cd7312b0a68d>
>     -- Channel PJSIP/28-000000bf left 'simple_bridge' basic-bridge <2702b6fb-41e5-4696-bc54-cd7312b0a68d>
>     -- Executing [h at newanswer:1] NoOp("Local/69 at default-000000c1;2", "in hangup") in new stack
>     -- Local/69 at default-000000c1;2 Internal Gosub(logoutemployee,s,1(hangup_handler)) start
>     -- Executing [s at logoutemployee:1] NoOp("Local/69 at default-000000c1;2", "I am channel Local/69 at default-000000c1;2 and  and hangup_handler") in new stack
>     -- Executing [s at logoutemployee:2] Return("Local/69 at default-000000c1;2", "") in new stack
>   == Spawn extension (newanswer, h, 2) exited non-zero on 'Local/69 at default-000000c1;2'
>     -- Local/69 at default-000000c1;2 Internal Gosub(logoutemployee,s,1(hangup_handler)) complete GOSUB_RETVAL=
>   == Spawn extension (newanswer, h, 2) exited non-zero on 'Local/69 at default-000000c1;2'
>     -- Local/69 at default-000000c1;2 Internal Gosub(kill-originated,s,1) complete GOSUB_RETVAL=
>   == MixMonitor close filestream (mixed)
>   == End MixMonitor Recording Local/69 at default-000000c1;2
> {noformat}
> I am seeing these errors/facts:
> - In scenario 1, after_bridge_goto is not called at all
> - In scenario 1, hangup_handler_push is called immediately after the Bridge command
> - In scenario 1, h extension is not called at all
> - In scenario 1, for some reason, the Beep command can not be played on one of the channels
> - In scenario 2, after_bridge is ok
> - In scenario 2, hangup_handler_push is ok
> - In scenario 2, h extension is ok
> - In scenario 2, mixmonitor file is too long and contains no audio except the beep
> - In scenario 3, after_bridge is ok
> - In scenario 3, hangup_handler_push is ok
> - In scenario 3, h extension is ok
> - In scenario 3, mixmonitor file is ok
> Btw: The bridge command lacks various flags that the Queue and Dial command have like pre-bridge macros (M and U flags in the dial command).



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list