[OpenSIPS-Users] adding and reading a SIP header to a 302 Redirect
Bogdan-Andrei Iancu
bogdan at opensips.org
Fri Jun 12 10:39:06 EST 2020
Take a look at the append_to_reply() [1] function.
[1]
https://opensips.org/docs/modules/3.1.x/sipmsgops.html#func_append_to_reply
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
On 5/30/20 3:14 PM, Saint Michael wrote:
> I need to add a new SIP header to the response below.
>
>
> if ($rm=="INVITE") {
> /* add the redirect destinations as branches */
> $branch = "sip:batman at gotham.com <mailto:sip%3Abatman at gotham.com>";
> $branch = $avp(my_custom_uri);
> /* sending a 3xx reply will automatically push all
> * existing branches as Contact URIs */
> send_reply("302","Moved Temporarily");
> exit;
> }
> the final result should be:
>
> SIP/2.0 302 Moved Temporarily
> Via: SIP/2.0/UDP
> 172.16.7.254:52169;rport=52169;received=47.205.172.89;branch=z9hG4bK-524287-1---129f4244aaba9f04
> Call-ID: 102650Mzg4NmFiNTQzOGY5NDJmNjM3OTYzNmE5MzNlZDIwZmI
> From: "XXXXX" <sip:XXX4433019 at XXX.124.224.87>;tag=81a25c36
> To:
> <sip:16317918378 at XXX.124.224.87>;tag=9e198dc4-7ce8-433d-ae23-05b9bc14d55a
> Identity:eyJhbGciOiJFUzI1NiIsInR5cCI6InBhc3Nwb3J0IiwicHB0Ijoic2hha2VuIiwieDV1IjoiaHR0cHM6Ly9jZXJ0LmV4YW1wbGUub3JnL3Bhc3Nwb3J0LmNlciJ9.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyI2MzE3OTE4Mzc4Il19LCJpYXQiOjE1OTA4MTEyMzgsIm9yaWciOnsidG4iOiI3Mjc0NDMzMDE5In0sIm9yaWdpZCI6IjEyM2U0NTY3LWU4OWItMTJkMy1hNDU2LTQyNjY1NTQ0MDAwMCJ9.AKViDWA3uonP6tt5cKBh0FUPY5zBuJnwZLQNTrp9LCWJ-vLY1Xx5i3_oXGh1ERL4tnD-KK5wsP3FdByDa_cjGw;info=<https://cert.example.org/passport.cer>;alg=ES256;ppt=shaken
> CSeq: 1 INVITE
> Server: Asterisk PBX 16.10.0
> Contact: <sip:16317918378>
> Reason: Q.850;cause=0
> Content-Length: 0
>
> also if I get that packet at my end, how do I extract the Identity
> header and apply it to the next INVITE?
> Is this even doable?
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200612/1538870f/attachment.html>
More information about the Users
mailing list