Hi.
Im running Asterisk 1.4 and FreePBX 2.5 on a Ubuntu Server.
I want that asterisk executes a perl or php script, when an incoming call is answered by one of my sip devices.
The script should get the caller phone number, the called number and the extension number which takes the call via variables.
This is what i tried until now. Of cause this is not the final script. I only want to use /bin/echo to test functionality:
[from-internal-custom]
exten => _X.,1,Answer()
exten => _X.,n,Dial(SIP/${EXTEN}||M(test^${CALLERID(num)^${EXTEN}^${CHANNEL}))
exten => _X.,n,Hangup()
[macro-test]
exten => s,1,NoOp(Macro test)
exten => s,n,System(/bin/echo "caller=${ARG1} exten=${ARG2} called=${ARG3}" >> /tmp/test)
Unfortunately it does not work. If i make a call its automaticly canceled.
There is no new file created in /tmp.
This is my log:
-- Executing [2003@from-internal:1] Answer("SIP/2000-082fd8b8", "") in new stack
-- Executing [2003@from-internal:2] Dial("SIP/2000-082fd8b8", "SIP/2003||M(test^2000") in new stack
== Spawn extension (from-internal, 2003, 2) exited non-zero on 'SIP/2000-082fd8b8'
-- Executing [h@from-internal:1] Macro("SIP/2000-082fd8b8", "hangupcall") in new stack
-- Executing [s@macro-hangupcall:1] GotoIf("SIP/2000-082fd8b8", "1?skiprg") in new stack
-- Goto (macro-hangupcall,s,4)
-- Executing [s@macro-hangupcall:4] GotoIf("SIP/2000-082fd8b8", "1?skipblkvm") in new stack
-- Goto (macro-hangupcall,s,7)
-- Executing [s@macro-hangupcall:7] GotoIf("SIP/2000-082fd8b8", "1?theend") in new stack
-- Goto (macro-hangupcall,s,9)
-- Executing [s@macro-hangupcall:9] Hangup("SIP/2000-082fd8b8", "") in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/2000-082fd8b8' in macro 'hangupcall'
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/2000-082fd8b8'
What is wrong?
Thanks in advance.
Greetz
André