PJSIP ADD HEADER : in INVITE with auth = doesn't work

Hello all :slight_smile:

I have a problem with a pjsip add header:
it is indeed sent during the first INVITE but not during the INVITE with auth:

[from-trunk-teams-test]
exten = _+333651.,1,NoOp(prepare Privacy)
same = n,Dial(PJSIP/+33${EXTEN:8}@trunk-csips-test,300,Ib(header-modify-test-out^addheaderprivacy^1))
same = n,Hangup()

[header-modify-test-out]
exten = addheaderprivacy,1,Set(PJSIP_HEADER(add,Privacy)=id,user)
same = n,Return()

Asterisk Log :

 -- Executing [+333651067100xxxx@from-trunk-teams-test:3] Dial("PJSIP/trunk-teams-test-000000b4", "PJSIP/+3367100xxxx@trunk-csips-test,300,Ib(header-modify-test-out^addheaderprivacy^1)") in new stack
    -- PJSIP/trunk-csips-test-000000b5 Internal Gosub(header-modify-test-out,addheaderprivacy,1) start
    -- Executing [addheaderprivacy@header-modify-test-out:1] Set("PJSIP/trunk-csips-test-000000b5", "PJSIP_HEADER(add,Privacy)=id,user") in new stack
    -- Executing [addheaderprivacy@header-modify-test-out:2] Return("PJSIP/trunk-csips-test-000000b5", "") in new stack
  == Spawn extension (from-trunk-csips-test, +333651067100xxxx, 1) exited non-zero on 'PJSIP/trunk-csips-test-000000b5'
    -- PJSIP/trunk-csips-test-000000b5 Internal Gosub(header-modify-test-out,addheaderprivacy,1) complete GOSUB_RETVAL=

SIP Log :

INVITE sip:+3367100xxxx@193.201.xx.xx:5060 SIP/2.0
Via: SIP/2.0/UDP 10.44.56.11:5060;rport;branch=z9hG4bKPje322b8d4-becc-4098-85a5-d1e61eaaab5e
From: <sip:+3397487xxxx@192.168.41.91>;tag=b06162cb-4445-4e92-916c-a27b7ea0f114
To: <sip:+3367100xxxx@193.201.xx.xx>
Contact: <sip:asterisk@10.44.56.11:5060>
Call-ID: f291fad7-3729-4964-a757-fba6e5057d96
CSeq: 6350 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: <sip:+3397487xxxx@192.168.41.91>
Privacy: id,user
Max-Forwards: 70
User-Agent: SBC1
Content-Type: application/sdp
Content-Length:   241

SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 10.44.56.11:5060;rport=5060;branch=z9hG4bKPje322b8d4-becc-4098-85a5-d1e61eaaab5e;received=193.201.146.45
From: <sip:+3397487xxxx@192.168.41.91>;tag=b06162cb-4445-4e92-916c-a27b7ea0f114
To: <sip:+3367100xxxx@193.201.xx.xx>;tag=b27e1a1d33761e85846fc98f5f3a7e58.9ec3
Call-ID: f291fad7-3729-4964-a757-fba6e5057d96
CSeq: 6350 INVITE
Proxy-Authenticate: Digest realm="192.168.41.91", nonce="YipcBmIqW8rNzsiVc/bxAdzECZll8KKQwkUykO4lsiwmkCgGAEfsvcxvD5OA", qop="auth"
Content-Length: 0

<--- Transmitting SIP request (1365 bytes) to UDP:193.201.xx.xx:5060 --->
INVITE sip:+3367100xxxx@193.201.xx.xx:5060 SIP/2.0
Via: SIP/2.0/UDP 10.44.56.11:5060;rport;branch=z9hG4bKPj091e2b33-9123-4ec5-9175-6d09869ab034
From: "toto" <sip:+3397487xxxx@192.168.41.91>;tag=89170cd0-45b1-43f1-a00e-92d9f172f6a1
To: <sip:+3367100xxxx@193.201.xx.xx>
Contact: <sip:asterisk@10.44.56.11:5060>
Call-ID: f6d6807e-ae15-4172-ad46-a7b27c3917fb
CSeq: 15419 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: tel:+3397487xxxx
Max-Forwards: 70
User-Agent: SBC1
Proxy-Authorization: Digest username="test.dr-teams.toto.net", realm="192.168.41.91", nonce="Yioe6WIqHq1uO7bCuKx6GUpyRBvZNdd3wkUykO4lsiwmkCgGAEfsvcfFW4SA", uri="sip:+3367100xxxx@193.201.xx.xx:5060", response="cf8c569444262c80ccf8e8ab55bae2ee", qop=auth, nc=00000001
P-Asserted-Identity: "toto" <sip:+3397487xxxx@192.168.41.91>
Content-Type: application/sdp
Content-Length:   241

the field “Privacy” is present in first INVITE but not in second INVITE :
no “Privacy” !!!

any idea ???
Regards

Are you using P-Asserted-Identity support within PJSIP? If so, it expects to manage that header as part of PAI so setting it manually goes into undefined behavior territory for it I’d expect.

Your second INVITE also has a second P-Asserted-Identity header too.

when I think I spent the afternoon there !!!
indeed, on the trunk I have the send-pai=yes
I just removed it and it works
thank you :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.