Hello,
So I have a dial plan and a simple AMI script to get an agent to call an outside line that’s working great but when I try to add a sound file to play to the caller’s line it’s failing.
AMI Where internalPhoneline is the extension and target is a customer’s phone #
$originateRequest = "Action: Originate\r\n";
$originateRequest .= "Channel: Local/$internalPhoneline@from-internal\r\n";
$originateRequest .= "Callerid: Playit\r\n";
$originateRequest .= "Exten: do_chanspy\r\n";
$originateRequest .= "Context: test-2\r\n";
$originateRequest .= "Variable: ActionID=PlayBack\r\n";
$originateRequest .= "Variable: WhatToPlay=tt-monkeys\r\n";
$originateRequest .= "Variable: WhoHear=DAHDI/i2/1$target\r\n";
$originateRequest .= "Priority: 1\r\n";
$originateRequest .= "Async: yes\r\n\r\n";
$originateRequest .= "ActionID: PlayBack\r\n";
// Send originate request
$originate = stream_socket_sendto($socket, $originateRequest);
Dialplan
[test-2]
exten => do_playback,1,Answer()
exten => do_playback,n,UserEvent(BeforePlayBack,ActionID:${ActionID} & ${UNIQUEID} & ${CHANNEL} & ${WhatToPlay} & ${WhoHear})
exten => do_playback,n,Wait(0.3)
exten => do_playback,n,Playback(${WhatToPlay})
; PLAYBACKSTATUS - SUCCESS FAILED
exten => do_playback,n,UserEvent(AfterPlayBack,ActionID:${ActionID} & ${UNIQUEID} & ${CHANNEL} & ${WhatToPlay} & ${WhoHear} & ${PLAYBACKSTATUS})
exten => do_playback,n,Hangup()
exten => do_chanspy,1,Answer()
exten => do_chanspy,n,NoOp(‘READY TO PLAY’)
exten => do_chanspy,n,UserEvent(BeforeChanSpy,ActionID:${ActionID} & ${UNIQUEID} & ${CHANNEL} & ${WhatToPlay} & ${WhoHear})
exten => do_chanspy,n,ChanSpy(${WhoHear},qW)
exten => do_chanspy,n,UserEvent(AfterChanSpy,ActionID:${ActionID} & ${UNIQUEID} & ${CHANNEL} & ${WhatToPlay} & ${WhoHear})
exten => do_chanspy,n,Hangup()
Logs
[2017-04-28 09:28:02] VERBOSE[2119][C-002bdb1b] pbx.c: – Executing [do_chanspy@scott-test-2:3] UserEvent(“Local/614@from-internal-0004e327;1”, “BeforeChanSpy,ActionID:PlayBack & 1493396880.970099 & Local/614@from-internal-0004e327;1 & tt-monkeys & DAHDI/i2/18315210245”) in new stack
Executing [do_chanspy@scott-test-2:3] UserEvent(“Local/614@from-internal-0004e327;1”, “BeforeChanSpy,ActionID:PlayBack & 1493396880.970099 & Local/614@from-internal-0004e327;1 & tt-monkeys & DAHDI/i2/18315210245”) in new stack
If I change Channel: Local/$internalPhoneline@from-internal
to Channel: Local/$internalPhoneline@do_playback or
I get an error of no dialplan
Looks like chanspy isn’t working. Without the call to the dial plan I get both lines connected
Thanks in advance,