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

Steve Edwards asterisk.org at sedwards.com
Fri Jan 24 10:36:38 CST 2020


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: <sip:1000 at 1.2.3.4:5060;user=phone>
>
> I get "<sip:1000 at 1.2.3.4:5060;user=phone>" in the variable $pai.
>
> P-Asserted-Identity: "John Doe" <sip:2000 at 1.2.3.4:5060;user=phone>
>
> 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       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