phpari
phpari copied to clipboard
Read any keypress using asterisk
Hello. I started using asterisk and phpari and enjoying too much. i have an issue that i am browsing from past one week if someone can please help.
1: I want to call one of our employee number using phpari. 2: Once the person receive call will be asked to press 1 to accept and 2 to hangup. 3: If employee press 1 will give a call to the client and will connect both.
I DON'T KNOW HOW TO GET THE READ VALUE AFTER ORIGINATING CALL AND THE REST OF STUFF. also if someone guid eme to use phpari or phpagi for my this issue.
I think you need to listen for ChannelDtmfReceived event and check if it is the same originated channel . You can get digit value from that input.
You can use either. Both will provide you same result.
Well,
Doing this with ARI is indeed a cool thing - but mildly counter productive (yes, this is an ARI library, but sometimes for simple stuff - Asterisk dialplan is preferred).
Using the dial
application and the U(x^y^z)
option, you can create a situation where a call is received by Asterisk, then a second leg is originated to the receiving party - but a dialplan subroutine is executed on the receiving party channel, prior to bridging
the two channels.
U(x[^arg[^...]]):
x - Name of the subroutine to execute via Gosub
arg - Arguments for the Gosub routine
Execute via Gosub the routine <x> for the *called* channel before
connecting to the calling channel. Arguments can be specified to the Gosub
using '^' as a delimiter. The Gosub routine can set the variable
${GOSUB_RESULT} to specify the following actions after the Gosub returns.
${GOSUB_RESULT}:
ABORT: Hangup both legs of the call.
CONGESTION: Behave as if line congestion was
encountered.
BUSY: Behave as if a busy signal was encountered.
CONTINUE: Hangup the called party and allow the
calling party to continue dialplan execution at the next priority.
GOTO:[[<context>^]<exten>^]<priority>: Transfer the
call to the specified destination.
NOTE: You cannot use any additional action post answer options in
conjunction with this option. Also, pbx services are run on the peer
(called) channel, so you will not be able to set timeouts via the TIMEOUT()
function in this routine.