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

2019-06-09 Thread David Cunningham
Hi Steve,

Thank you very much for that information. The result is the key in ascii
perfectly!


On Fri, 7 Jun 2019 at 18:05, Steve Edwards 
wrote:

> On Fri, 7 Jun 2019, David Cunningham wrote:
>
> > We're using Perl and so far I haven't found an equivalent there.
>
> On Thu, 6 Jun 2019, Steve Edwards wrote:
>
> > I'm not much of a Perl programmer...
>
> But you should never turn down an opportunity to develop your skills :)
>
> Try something like:
>
>  my $result = $AGI->record_file(
>'/tmp/foo'# filename
>  , 'wav' # format
>  , '#*0123456789'# escape digits
>  , '5000'# timeout
>  );
>  $AGI->verbose('result =  ' . $result, 0);
>
> Which results in:
>
> AGI Rx << RECORD FILE /tmp/foo wav #*0123456789
> 5000
> AGI Tx >> 200 result=50 (dtmf) endpos=0
> AGI Rx << VERBOSE "result =  50"
>
> when '2' is pressed.
>
> --
> Thanks in advance,
> -
> Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
>  https://www.linkedin.com/in/steve-edwards-4244281
>
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at:
> https://community.asterisk.org/
>
> New to Asterisk? Start here:
>   https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users



-- 
David Cunningham, Voisonics Limited
http://voisonics.com/
USA: +1 213 221 1092
New Zealand: +64 (0)28 2558 3782
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

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

2019-06-07 Thread Steve Edwards

On Fri, 7 Jun 2019, David Cunningham wrote:


We're using Perl and so far I haven't found an equivalent there.


On Thu, 6 Jun 2019, Steve Edwards wrote:


I'm not much of a Perl programmer...


But you should never turn down an opportunity to develop your skills :)

Try something like:

my $result = $AGI->record_file(
  '/tmp/foo'# filename
, 'wav' # format
, '#*0123456789'# escape digits
, '5000'# timeout
);
$AGI->verbose('result =  ' . $result, 0);

Which results in:

AGI Rx << RECORD FILE /tmp/foo wav #*0123456789 5000
AGI Tx >> 200 result=50 (dtmf) endpos=0
AGI Rx << VERBOSE "result =  50"

when '2' is pressed.

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

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

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

2019-06-07 Thread Steve Edwards

On Fri, 7 Jun 2019, David Cunningham wrote:


What language is that please?


C.


We're using Perl and so far I haven't found an equivalent there.


I'm not much of a Perl programmer, but I'd guess something like:

$AGI->result

or

$AGI->lastresult

might yield clues.

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

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

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

2019-06-07 Thread Steve Edwards

On Fri, 7 Jun 2019, David Cunningham wrote:


We're using Perl and so far I haven't found an equivalent there.


On Thu, 6 Jun 2019, Steve Edwards wrote:


I'm not much of a Perl programmer...


But you should never turn down an opportunity to develop your skills :)

Try something like:

my $result = $AGI->record_file(
  '/tmp/foo'# filename
, 'wav' # format
, '#*0123456789'# escape digits
, '5000'# timeout
);
$AGI->verbose('result =  ' . $result, 0);

Which results in:

AGI Rx << RECORD FILE /tmp/foo wav #*0123456789 5000
AGI Tx >> 200 result=50 (dtmf) endpos=0
AGI Rx << VERBOSE "result =  50"

when '2' is pressed.

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

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

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

2019-06-06 Thread David Cunningham
Hi Steve,

What language is that please? We're using Perl and so far I haven't found
an equivalent there.

Thanks for your help.


On Fri, 7 Jun 2019 at 12:10, Steve Edwards 
wrote:

> 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   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
>  https://www.linkedin.com/in/steve-edwards-4244281
>
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at:
> https://community.asterisk.org/
>
> New to Asterisk? Start here:
>   https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users



-- 
David Cunningham, Voisonics Limited
http://voisonics.com/
USA: +1 213 221 1092
New Zealand: +64 (0)28 2558 3782
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

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

2019-06-06 Thread Steve Edwards

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   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

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

2019-06-06 Thread David Cunningham
Hello,

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.

-- 
David Cunningham, Voisonics Limited
http://voisonics.com/
USA: +1 213 221 1092
New Zealand: +64 (0)28 2558 3782
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users