monotek
September 4, 2009, 1:50pm
1
Hi.
I want that asterisk executes a perl or php script, when a 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.
How can i reach this?
monotek
September 8, 2009, 4:32pm
2
I tried now the following in extensions_custom.conf but it does not work.
If i call an extension the call is automaticly canceled.
I see the execution of the macro in the log but there is no new fil in /tmp.
[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)
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'
plindheimer
(Philippe Lindheimer)
September 8, 2009, 4:39pm
3
have a look at the cidpopup module in the contributed_modules directory. I does exactly this.
It is designed to hook into ringgroups but could clearly be expanded. And although it uses a specific perl script that comes with the module it is designed for you to add additional scripts and they will be populated in the configuration screen.
monotek
September 8, 2009, 5:16pm
4
Thanks for your answer.
I dont have such directory on my server.
Im using Asterisk 1.4.22 and Freepbx 2.5.
Do i need do install something to get this directory?
Does it not work via extensions_custom.conf too?
edit:
found it:
http://www.freepbx.org/trac/browser/contributed_modules/release/cidpopup-2.5.0.2.tgz?rev=7493
have to try it.
monotek
September 8, 2009, 5:42pm
5
OK. I installed and tried it now but i dont know exactly how to use it.
Is there some more documentation or a sample config available?
What IP do i have to configure?
Is it the IP of my Asterisk Server or my CRM/Ticket System?
How can i add other scripts (Script to run:) than cid-fpbx.pl to the config screen?
What exactly does cid-fpbx.pl ?
plindheimer
(Philippe Lindheimer)
September 8, 2009, 6:04pm
6
this module was designed to run with Sugar CRM, I know nothing about the CRM side.
If you add your own PERL script to the module’s agi agi-bin directory it will show up in the configuration menu I think.
You will have to look at the dialplan that gets generated for the existing script, and how that script uses any of the ocnfiguration information to determine if you can take advantage of what is there or need to modify it for your own needs.
monotek
September 9, 2009, 9:04am
7
I allready tried to use anoter script by copieng cid-fpbx.pl to cid-test.pl but it does not shows up.
I could change content of cid-fpbx.pl too, but need to know which variables are send to this script?
I need the caller phone number, the called number and the extension number which takes the call.
If this variables are not available in the script i cant realy use it.
If this is not possible i would like to try to do it via the extensions_custom.conf.
Could you check the log if i done a mistake there please?
monotek
September 9, 2009, 1:55pm
8
I got it work now. There was a missing } after ${CALLERID(num).
Now i have a new problem.
To get it work for external calls i had to change the context. Thats how it looks now.
[from-pstn-custom]
exten => _XXXX.,1,Answer()
exten => _XXXX.,n,Dial(SIP/${EXTEN}||M(test^${CALLERID(num)}^${EXTEN}^${CHANNEL}))
exten => _XXXX.,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 SIP/${EXTEN} becomes now SIP/03514123456 and not SIP/2003 like before.
But i need the number of the sip device which answers the call.
How can i reach this?