<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>You can send custom headers from Asterisk to OpenSIPS using:<br>
</p>
<p><a moz-do-not-send="true"
href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_HEADER"
class="moz-txt-link-freetext">https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_HEADER</a></p>
<p>If you need Asterisk to receive customer headers from OpenSIPS,
you can read custom headers added by OpenSIPS to its 200 response
using:</p>
<p><a moz-do-not-send="true"
href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_RESPONSE_HEADER"
class="moz-txt-link-freetext">https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_RESPONSE_HEADER</a></p>
<p><br>
</p>
<p>If you are already midway through a call, you can force an UPDATE
or re-INVITE using:</p>
<p><a moz-do-not-send="true"
href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_SEND_SESSION_REFRESH"
class="moz-txt-link-freetext">https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_SEND_SESSION_REFRESH</a></p>
<p><br>
</p>
<p>While I haven't personally tested, I'd expect that you should be
able to signal custom information midway through a call with a
Set(PJSIP_HEADER(add,X-MyHeader)=myvalue) followed by a
Set(PJSIP_SEND_SESSION_REFRESH()=invite). This should then trigger
a re-INVITE carrying the new X-MyHeader within it.<br>
</p>
<p>Similarly, after triggering the a re-INVITE or UPDATE, you should
then be able to do a
Set(MYVAR=PJSIP_RESPONSE_HEADER(read,X-MyHeader)) to extract what
OpenSIPS has sent back to Asterisk in its 200 response.<br>
</p>
<p><br>
</p>
<p>Although more messy, there are also other tricks that you can
use, including the CONNECTEDLINE function:</p>
<p><a moz-do-not-send="true"
href="https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information"
class="moz-txt-link-freetext">https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information</a></p>
<p><a moz-do-not-send="true"
href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_CONNECTEDLINE"
class="moz-txt-link-freetext">https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_CONNECTEDLINE</a></p>
<p>e.g. If you did a
Set(CONNECTEDLINE(name)=Information_I_wish_to_share_with_OpenSIPS),
then this will, in one step, trigger an UPDATE or re-INVITE
carrying the new connected party name in the SIP headers, detail
which you can then extract from OpenSIPS. Similarly, you can also
use this approach read information that OpenSIPS has sent to
Asterisk, with a Set(MYVAR=CONNECTEDLINE(name)).</p>
<p>I mention this in case, for whatever reason, the first approach
(described above) doesn't work as planned, however, the first
approach is definitely preferable as you can carry the information
in your own X- header, making it far easier to send/receive
multiple headers.<br>
</p>
<blockquote type="cite"
cite="mid:MR1P264MB3585877AA84782075CCAB181CEF29@MR1P264MB3585.FRAP264.PROD.OUTLOOK.COM">
<div class="WordSection1">
<div>
<p class="MsoNormal">
On Tue, Dec 27, 2022 at 8:55 AM Wadii ELMAJDI | Evenmedia
<<a href="mailto:wadii@evenmedia.fr"
moz-do-not-send="true" class="moz-txt-link-freetext">wadii@evenmedia.fr</a>>
wrote:<br>
><br>
> Hello,<br>
><br>
><br>
> I am using Asterisk as a media server behind OpenSIPS.<br>
> I need to send some additional data to opensips during
the call or at the latest during the hangup. For instance a
custom hang up reason.<br>
> Asterisk does not allow neither to send a sequential
request withing an ongoing dialog, nor add headers to a BYE
method.<br>
> The current solution I’m using is pushing a dialog var
(dlg_push_var) using Call-ID via (mi_http), but that means I
rely on a curl http request during my call…<br>
> Is there any better option for a direct communication
between the two boxes during a call ? without any
intermediate server (Redis DB …)<br>
><br>
> Thank you<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org"
moz-do-not-send="true" class="moz-txt-link-freetext">Users@lists.opensips.org</a><br>
> <a
href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
moz-do-not-send="true" class="moz-txt-link-freetext">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></p>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<div class="moz-signature"><span
style="font-size:11.0pt;font-family:Assistant;color:#32444B"><br>
</span></div>
</body>
</html>