phpari icon indicating copy to clipboard operation
phpari copied to clipboard

Read any keypress using asterisk

Open kamranali14 opened this issue 4 years ago • 3 comments

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.

kamranali14 avatar Apr 22 '20 10:04 kamranali14

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.

91Abdullah avatar May 11 '20 01:05 91Abdullah

You can use either. Both will provide you same result.

91Abdullah avatar May 11 '20 01:05 91Abdullah

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.

greenfieldtech-nirs avatar Nov 04 '21 15:11 greenfieldtech-nirs