sincerbex
(sincerbex)
September 9, 2022, 4:42pm
1
hi everyone, i need to run a php script when a call comes in, but whatever i put in extensions_custom.conf is not executed. do you have any ideas?
content of extensions_custom.conf
[incoming]
exten => 600,3,noop(test inserimento riga da extensions_custom.conf)
exten => 600,2,AGI(/var/lib/asterisk/agi-bin/incoming.php,${CALLERID(all)})
[ext-group]
include => incoming
600 is the extensions group
lgaetz
(Lorne Gaetz)
September 9, 2022, 4:52pm
2
Welcome to the forum!
Referencing a block of custom dialplan can be done with a custom destination, like this example: Announce current time as part of call flow - #4 by lgaetz
If your ask is more complex, you might want to look at using a dialplan hook: Hooking for fun and income
sincerbex
(sincerbex)
September 9, 2022, 5:20pm
3
thanks for the support!!
i dont want to send to a custom destination. currently the incoming calls go to a call group, then when the phones ring I would like to run a php script to intercept the sender’s number and send it to a web application. in fact I created incoming.php:
<?php
$query = $argv[1];
$file = fopen("/tmp/phone", "w");
fwrite($file,$query);
fclose($file);
?>
and put it in /var/lib/asterisk/agi-bin
what am I doing wrong?
lgaetz
(Lorne Gaetz)
September 9, 2022, 5:47pm
4
To do this with dialplan alone, you want to use a dialplan hook, see the thread linked above.
sincerbex
(sincerbex)
September 9, 2022, 7:01pm
5
I use FreePBX 15.0.23.17 macros are deprecated?
so i just put this inside extensions_custom.conf?
[macro-dialout-trunk-predial-hook]
exten => 600,2,noop(test insert)
exten => 600,3,AGI(/var/lib/asterisk/agi-bin/incoming.php,${CALLERID(all)})
exten => 600,n,MacroExit
600 is the ring group
sincerbex
(sincerbex)
September 15, 2022, 12:23pm
6
I solved it like this:
[macro-dial-ringall-predial-hook]
exten => s,1,noop(test inserimento riga da extensions_custom.conf)
exten => s,2,AGI(/var/lib/asterisk/agi-bin/incoming.php,${CALLERID(number):2})
exten => s,n,MacroExit
now, in addition to passing the telephone number to the incoming.php file, I would also like to pass the number of the extension that answers the call. it’s possible?
lgaetz
(Lorne Gaetz)
September 15, 2022, 1:42pm
7
Not easy to do in dialplan in FreePBX, unless you want to do it after the channel hangs up with a hangup handler.
vespino
(Wesley van Kuijen)
September 15, 2022, 5:39pm
8
Very curious to what ends you’re using this.
sorvani
(Jared Busch)
September 16, 2022, 1:30am
9
I don’t know any way to get that in dialplan. If you are using desk phones, basiaclly all brands have event handlers. In Yealink, it is called Action URL.
sincerbex
(sincerbex)
September 16, 2022, 8:50am
10
because I need to pass 2 variables: both the callerid and the extension that answers the call
sincerbex
(sincerbex)
September 16, 2022, 8:51am
11
yes I have seen. to centralize the work it would be convenient for me to work with AGI on the pbx
system
(system)
Closed
September 23, 2022, 8:52am
12
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.