我想在通话挂断时执行一个脚本,所以我在 extensions_custom.conf 中创建了一个自定义上下文,如下所示:
[coscon]
exten => **5,1,NoOp()
same => n,Answer()
exten => h,1,System(/usr/local/src/myscript.php)
问题是在此上下文中的 hangup h 扩展之后根本没有执行。有什么建议吗?
更新
让我详细说明一下。在 extensions_custom.conf 文件中,我包含 coscon 上下文。这是 extensions_custom.conf 的上下文:
[from-internal-custom]
exten => 1234,1,Playback(demo-congrats) ; extensions can dial 1234
exten => 1234,2,Hangup()
exten => h,1,Hangup()
include => coscon
[coscon]
exten => **5,1,NoOp()
same => n,Answer()
exten => h,1,System(/usr/local/src/myscript.php)
现在,当我从软电话呼叫 **5 时,这是 Astrisk CLI 输出:
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
-- Executing [**5@from-internal:1] NoOp("SIP/102-00000035", "") in new stack
-- Executing [**5@from-internal:2] Answer("SIP/102-00000035", "") in new stack
-- Executing [**5@from-internal:3] Pickup("SIP/102-00000035","5&5@PICKUPMARK") in new stack
[2017-06-13 21:10:39] NOTICE[10676][C-00000035]: app_directed_pickup.c:302 pickup_exec: No target channel found for 5@from-internal.
[2017-06-13 21:10:39] NOTICE[10676][C-00000035]: app_directed_pickup.c:302 pickup_exec: No target channel found for 5@PICKUPMARK.
-- Executing [**5@from-internal:4] Hangup("SIP/102-00000035", "") in new stack
== Spawn extension (from-internal, **5, 4) exited non-zero on 'SIP/102-00000035'
-- Executing [h@from-internal:1] Hangup("SIP/102-00000035", "") in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/102-00000035'
我认为来自内部上下文的默认 h 扩展正在执行,但我不知道如何覆盖它。