Parsing route header by Pjsip on Asterisk 16

Hello,

a UAS sends one Route header that has 2 route , is separeted by comma. When it read Route header by Function PJSIP_HEADER , it shows only 1st Route . Probably , it is a bug

Yasin CANER

Asterisk version 16.1.1

Dialplan

exten => _X.,1,NooP(Default - 1)
exten => _X.,n,Set(routeheader=${PJSIP_HEADER(read,Route)})
exten => _X.,n,NOOP(Route header :  ${routeheader} )
 

SIP Request

INVITE sip:firat@tester2.test SIP/2.0
Route: <sip:asterisk.test:5060;transport=tcp;lr>, <sip:hello@net1.test:5060;transport=tcp;lr;t=1;k=0;f=0;c=7>

Asterisk console log

   -- Executing [firat@default1:1] NoOp("PJSIP/test-00000008", "Default - 1") in new stack
    -- Executing [firat@default1:2] Set("PJSIP//test-00000008", "routeheader=<sip:asterisk.test:5060;transport=tcp;lr>") in new stack
    -- Executing [firat@default1:3] NoOp("PJSIP/test-00000008", "Route header :  <sip:asterisk.test:5060;transport=tcp;lr> ") in new stack

Conceptually they are two Route headers, and PJSIP likely parses and stores them as such as it simplifies things quite a lot. The PJSIP_HEADER function gets its data from the parsed/stored values, not straight from the SIP request itself.

Hello,
Thanks for reply. i need that route header to pass other side/ B leg. As i understood from your answer, it is not a bug but is a pjsip behavior. Do you have any suggestion to get this route header?

Cheers.

Asterisk is not a SIP proxy, it doesn’t pass traffic like that through - each call leg is independent and in particular passing Route headers through may break the SIP signaling itself on the other side. If you really want to… then the PJSIP_HEADER function does allow you to get multiple instances of the same header[1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_PJSIP_HEADER

Ok i got it. Thanks.

* `number`  - If there's more than 1 header with the same name, this specifies which header to read or update. If not specified, defaults to  `1`  meaning the first matching header. Not valid for  `add`  or  `remove` .