I want to execute a script on call hangup so I created a custom context in extensions_custom.conf as below:
[coscon]
exten => **5,1,NoOp()
same => n,Answer()
exten => h,1,System(/usr/local/src/myscript.php)
the problem is after hangup h extension in this context is not executing at all. any advice?
Update
let me elaborate it. in extensions_custom.conf file I include coscon context. this is the context of 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)
Now when I call **5 from a softphone this is the Astrisk CLI output:
== 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'
I think the default h extension for from-internal context is executing but I don't know how to override it.