[asterisk-users] Find out which key ended recording?

Steve Edwards asterisk.org at sedwards.com
Thu Jun 6 19:10:37 CDT 2019


On Fri, 7 Jun 2019, David Cunningham wrote:

> We have a need to record audio and allow the user to press any DTMF key 
> to end the recording. Currently we're using the AGI command "record 
> file" which does allow us to specify which DTMF keys can end the 
> recording.
> 
> However we also need to know which key actually ended the recording. 
> Note that only allowing # or * to end the recording won't work for us.
> 
> Does anyone know how we can tell which key ended the recording? Thanks 
> in advance for any help.

Here's a snippet from one of my AGIs:

// record the voice
                 exec_agi("RECORD FILE"
                           " %s"         // filename
                           " wav"        // format
                           " #*1234567890"
                                         // escape digits
                           " %d000"      // timeout in ms
                           " BEEP"       // BEEP
                         , recorded_path
                         , recording_limit
                         );

// should we abort?
                 if      ('*' == agi_environment.result)
                         {
                         agi_set_variable("STATUS", "*");
                         exit(EXIT_SUCCESS);
                         }

// are we finished?
                 if      ('#' == agi_environment.result)
                         {
                         break;
                         }

Looks like agi_environment.result is your Huckleberry.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
             https://www.linkedin.com/in/steve-edwards-4244281



More information about the asterisk-users mailing list