Hello,

the value for $hdr(P-Asserted-Identity) is not a SIP URI, bit a To-body like format, so you have to use {tobody.user} instead of {uri.user}. Or use $ai instead of $hdr(...) with the uri transformation.

Cheers,
Daniel


On 15.08.17 11:20, Muhammad Zaka wrote:

Hi Daniel,

 

Please find the following log messages with debug=3: -

 

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: DEBUG: app_python [apy_kemi.c:623]: sr_apy_kemi_f_pv_get(): pv get: $ai

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: DEBUG: <core> [core/pvapi.c:293]: pv_cache_add(): pvar [$ai] added in cache

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: DEBUG: <core> [core/parser/parse_addr_spec.c:864]: parse_addr_spec(): end of header reached, state=10

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: DEBUG: <core> [core/parser/msg_parser.c:89]: get_hdr_field(): found end of header

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: DEBUG: app_python [apy_kemi.c:623]: sr_apy_kemi_f_pv_get(): pv get: $(hdr(P-Asserted-Identity){uri.user})

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: DEBUG: pv [pv_core.c:2849]: pv_parse_hdr_name(): using hdr type (51) instead of <P-Asserted-Identity>

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: DEBUG: <core> [core/pvapi.c:293]: pv_cache_add(): pvar [$(hdr(P-Asserted-Identity){uri.user})] added in cache

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: DEBUG: <core> [core/parser/parse_uri.c:1282]: parse_uri(): parse_uri: bad uri,  state 0 parsed: <"+44> (4) / <"+441164966679" <sip:+441164966679@185.28.212.141>> (50)

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: ERROR: pv [pv_trans.c:1162]: tr_eval_uri(): invalid uri ["+441164966679" <sip:+441164966679@185.28.212.141>]

Aug 15 10:12:21 sbc99-kam-dev /usr/sbin/kamailio[32263]: PYT {INVITE}: ERROR: app_python [apy_kemi.c:637]: sr_apy_kemi_f_pv_get(): unable to get pv value for [$(hdr(P-Asserted-Identity){uri.user})]

 

Many Thanks

 

Regards

 

Muhammad Zaka

 

From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: 15 August 2017 09:54
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>; Muhammad Zaka <muhammad.zaka@cloudcall.com>
Subject: Re: [SR-Users] KSR.pv.get("$(hdr(P-Asserted-Identity){uri.user})") returns unable to get pv value

 

Hello,

can you run with debug=3 in kamailio.cfg and send all log messages?

Cheers,
Daniel

 

On 15.08.17 10:43, Muhammad Zaka wrote:

Hi

 

We are experiencing issue with python script KSR.pv.get using branch 5.0.2 as it fails “unable to get pv value”

 

Example Code:

if KSR.pv.get("$ai"):

                              fromid = KSR.pv.get("$(hdr(P-Asserted-Identity){uri.user})")

 

Error:

Aug 14 18:38:23 sbc99-kam-dev /usr/sbin/kamailio[30459]: PYT {INVITE}: ERROR: app_python [apy_kemi.c:637]: sr_apy_kemi_f_pv_get(): unable to get pv value for [$(hdr(P-Asserted-Identity){uri.user})]

 

Is anybody have any idea how to workaround?

 

Many Thanks

 

Regards

 

Muhammad Zaka




_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com