我想在call hangup上执行一个脚本,所以我在extensions_custom.conf中创建了一个自定义上下文,如下所示:
[coscon]
exten => **5,1,NoOp()
same => n,Answer()
exten => h,1,System(/usr/local/src/myscript.php)
问题是在此上下文中挂起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扩展正在执行,但我不知道如何覆盖它。
答案 0 :(得分:1)
您的问题如下:
假设您有2个上下文
[a]
exten => h,1,Noop(a)
exten => 1,1,Noop(1)
include => b
[b]
exten => h,1,Noop(b)
exten => 2,1,Noop(2)
如果您的上下文是[a],则包括[b],是的。但如果[a]中存在扩展名,则将在[a]中执行,而不是在[b]中执行。所以h扩展将从context [a]执行。
如果你想要这项工作,你可以这样做:
[b]
exten =>h,1,Noop(b)
exten => 2,1,Goto(${EXTEN},2); now even if included, you WILL BE in context b
exten => 2,2,Noop(2);this one alway context b