[asterisk-users] Extracting a SIP Header from a 302 Response

Saint Michael
Sat, 30 May 2020 12:01:25 -0000

I got the response below from a provider. How do I extract the Identity
header and apply it to the next INVITE? Is it possible at all with PJSIP?
SIP/2.0 302 Moved Temporarily
Via: SIP/2.0/UDP 172.16.7.254:52169
;rport=52169;received=XX.205.172.89;branch=z9hG4bK-524287-1---129f4244aaba9f04
Call-ID: 102650Mzg4NmFiNTQzOGY5NDJmNjM3OTYzNmE5MzNlZDIwZmI
From: "Peter Perez" <sip:727XXX3019 at
XXX.124.224.87>;tag=81a25c36
To: <sip:16317918378 at XXX.124.224.87
>;tag=9e198dc4-7ce8-433d-ae23-05b9bc14d55a
Identity:
eyJhbGciOiJFUzI1NiIsInR5cCI6InBhc3Nwb3J0IiwicHB0Ijoic2hha2VuIiwieDV1IjoiaHR0cDovL2NlcnQtYXV0aC5wb2Muc3lzLmNbWNhc3QubmV0L2V4YW1wbGUuY2VydCJ9eyJhdHRlc3QiOiJBIiwiZGVzdC6eyJ0biI6IisxMjE1NTU1MTIxMyJ9LCJpYXQiOiIxNDcxMzc1NDE4Iiwib3JpZyI6eyJ0biI64oCdKzEyMTU1NTUxMjEyIn0sIm9yaWdpZCI6IjEyM2U0NTY3LWU4OWItMTJkMy1hNDU2LTQyNjY1NTQ0MDAwMCJ9._28kAwRWnheXyA6nY4MvmK5JKHZH9hSYkWI4g75mnq9Tj2lW4WPm0PlvudoGaj7wM5XujZUTb_3MA4modoDtCA
;info=<http://cert.example2.net/example.cert>;alg=ES256  CSeq: 1 INVITE
Server: Asterisk PBX 16.10.0
Contact: <sip:16317918378>
Reason: Q.850;cause=0
Content-Length:  0
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20200530/6177ca89/attachment.html>