Re: [asterisk-users] Perl AGI: read variable with quotes

2020-01-27 Thread Benoit Panizzon
Hi Gang

Thank you for the replies.

I sorted this out. I got tricked by $AGI->verbose(Pai: $pai) which
cripples the output.

The variable passed on is complete. My regex to extract the phone
number from that variable was broken when there was a quoted string
before the URI.

Mit freundlichen Grüssen

-Benoît Panizzon-
-- 
I m p r o W a r e   A G-Leiter Commerce Kunden
__

Zurlindenstrasse 29 Tel  +41 61 826 93 00
CH-4133 PrattelnFax  +41 61 826 93 01
Schweiz Web  http://www.imp.ch
__

-- 
_
-- 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] Perl AGI: read variable with quotes

2020-01-24 Thread Steve Edwards

On Fri, 24 Jan 2020, Steve Edwards wrote:


2) How about doing 'GET FULL VARIABLE' in your Perl script?


Sorry. After a couple more cups of tea I think this was a bit vague.

Try whatever call/method in your library that does 'GET FULL VARIABLE' on 
'${PJSIP_HEADER(read,P-Asserted-Identity)}' in your AGI.


--
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] Perl AGI: read variable with quotes

2020-01-24 Thread Tony Mountifield
In article <20200124154749.46da5...@go.imp.ch>,
Benoit Panizzon  wrote:
> Hi Gang
> 
> I have stumbled of this problem.
> 
> I need the P-Asserted-Identity header in an AGI scrip.
> 
> In the Dial-Plan I do:
> 
> same => n,Set(PAI=${PJSIP_HEADER(read,P-Asserted-Identity)})
> 
> In the AGI I do:
> 
> my $pai = $AGI->get_variable(PAI);
> 
> This works fine, unless the PAI contains quotes:
> 
> P-Asserted-Identity: 
> 
> I get "" in the variable $pai.
> 
> P-Asserted-Identity: "John Doe" 
> 
> Is getting me $pai containing just "John".
> 
> Anyone a clue how I could get the whole header?

First you need to identify whether the problem is in the Set()
or in the $AGI->get_variable(PAI) (shouldn't that be ("PAI")?)

Add a line to your dialplan just after the line you quoted:

same => n,NoOp(PAI=${PAI})

Then turn on verbose logging and try the call. Look at the logged
NoOp line and see if it contains just the 'John' or the whole value
'"John Doe" '

If it contains the whole value, then the problem is in the AGI library
reading the variable. If it just contains John, the problem is in the
Set() operation in the dialplan.

Cheers
Tony
-- 
Tony Mountifield
Work: t...@softins.co.uk - http://www.softins.co.uk
Play: t...@mountifield.org - http://tony.mountifield.org

-- 
_
-- 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] Perl AGI: read variable with quotes

2020-01-24 Thread Steve Edwards

On Fri, 24 Jan 2020, Benoit Panizzon wrote:


I have stumbled of this problem.

I need the P-Asserted-Identity header in an AGI scrip.

In the Dial-Plan I do:

same => n,Set(PAI=${PJSIP_HEADER(read,P-Asserted-Identity)})

In the AGI I do:

my $pai = $AGI->get_variable(PAI);

This works fine, unless the PAI contains quotes:

P-Asserted-Identity: 

I get "" in the variable $pai.

P-Asserted-Identity: "John Doe" 

Is getting me $pai containing just "John".

Anyone a clue how I could get the whole header?


1) Does the PAI channel variable contain the full header? Try 'verbose(PAI 
= ${PAI})' or something similar.


2) How about doing 'GET FULL VARIABLE' in your Perl script? You can set 
the channel variable PAI in the AGI if needed back in the dialplan.


--
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] Perl AGI: read variable with quotes

2020-01-24 Thread Benoit Panizzon
Hi Gang

I have stumbled of this problem.

I need the P-Asserted-Identity header in an AGI scrip.

In the Dial-Plan I do:

same => n,Set(PAI=${PJSIP_HEADER(read,P-Asserted-Identity)})

In the AGI I do:

my $pai = $AGI->get_variable(PAI);

This works fine, unless the PAI contains quotes:

P-Asserted-Identity: 

I get "" in the variable $pai.

P-Asserted-Identity: "John Doe" 

Is getting me $pai containing just "John".

Anyone a clue how I could get the whole header?

Mit freundlichen Grüssen

-Benoît Panizzon-
-- 
I m p r o W a r e   A G-Leiter Commerce Kunden
__

Zurlindenstrasse 29 Tel  +41 61 826 93 00
CH-4133 PrattelnFax  +41 61 826 93 01
Schweiz Web  http://www.imp.ch
__

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