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] Dial(${PJSIP_DIAL_CONTACTS(Alice)} & ${PJSIP_DIAL_CONTACTS(Bob)}) how not to fail if one endpoint has no registered AOR?

2019-06-09 Thread Administrator TOOTAI

Le 09/06/2019 à 13:19, Benoit Panizzon a écrit :

Dear List


Hello



It's probably been more than a year now I switched from chan_sip to
pjsip. pjsip works much cleaner than chan_sip.

But!

I have come across a Problem I was not able to solve with Asterisk
Dialplan Logic.

With pjsip an endpoint can have multiple AOR, so you need to expand
them with ${PJSIP_DIAL_CONTACTS()} to be able to Dial() all of them
simultaneously.

But there are also situation where you need to Dial() not only one
endpoint, but multiple ones, even mixing technologies like IAX and SIP.

You can specify those multiple endpoints with the & separator in the
Dial() function.

Unfortunately if an pjsip endpoint has NO registered AORs,
${PJSIP_DIAL_CONTACTS()} returns an empty sting.

So consider:

same => n,Dial(IAX2/gu...@pbx.digium.com/s@default &
${PJSIP_DIAL_CONTACTS(Guest)})

If there is no Guest registered, the resulting string to dial passed to
Dial() is: "IAX2/gu...@pbx.digium.com/s@default &" which Dial complains
is not valid, because of a missing second line to dial after the &.


What about to put eveything in a variable and the remove the last 
character if it equal &


Something like

same = 
n,Set(toDial=IAX2/gu...@pbx.digium.com/s@default&${PJSIP_DIAL_CONTACTS(Guest)})

same = n,ExecIf($["${toDial:-1}"=="&"]?Set(toDial=${toDial:0:-1}))
same = n,Dial(${toDial})

[...]
--
Daniel

--
_
-- 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] Dial(${PJSIP_DIAL_CONTACTS(Alice)} & ${PJSIP_DIAL_CONTACTS(Bob)}) how not to fail if one endpoint has no registered AOR?

2019-06-09 Thread Benoit Panizzon
Dear List

It's probably been more than a year now I switched from chan_sip to
pjsip. pjsip works much cleaner than chan_sip.

But!

I have come across a Problem I was not able to solve with Asterisk
Dialplan Logic.

With pjsip an endpoint can have multiple AOR, so you need to expand
them with ${PJSIP_DIAL_CONTACTS()} to be able to Dial() all of them
simultaneously.

But there are also situation where you need to Dial() not only one
endpoint, but multiple ones, even mixing technologies like IAX and SIP.

You can specify those multiple endpoints with the & separator in the
Dial() function.

Unfortunately if an pjsip endpoint has NO registered AORs,
${PJSIP_DIAL_CONTACTS()} returns an empty sting.

So consider:

same => n,Dial(IAX2/gu...@pbx.digium.com/s@default &
${PJSIP_DIAL_CONTACTS(Guest)})

If there is no Guest registered, the resulting string to dial passed to
Dial() is: "IAX2/gu...@pbx.digium.com/s@default &" which Dial complains
is not valid, because of a missing second line to dial after the &.

Well, I could try to expand all the PJSIP Endpoints in a perl AGI
script and then compose a variable to contain a valid string for
Dial(), but I would prefer to do this with Asterisk Logic.

(Yes, with only two endpoints this can somehow be done with Set(if and
compare for empty string), but the more endpoints to ring the more
complicated it is getting.

Anyone having figured an 'easy' way to do this? Or is there even an
alternative to ${PJSIP_DIAL_CONTACTS(Guest)} which would Dial all AOR,
and still work if no AOR is present?

Sidenote:

Set Variable IF(string emptry) constructions also return en empty sting
if the condition does NOT match, is there a reversed way to do it?
IF(string empty) SET variable= ?

-Benoît-

-- 
_
-- 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