[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openser-users
Subject:    Re: [SR-Users] Forwarding SIP status code to HTTP client
From:       Henning Westerholt <hw () gilawa ! com>
Date:       2022-05-19 7:31:21
Message-ID: AM6PR05MB54091F3C3672E16FC5297341BFD09 () AM6PR05MB5409 ! eurprd05 ! prod ! outlook ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

Hello,

you can send arbitrary status codes back in the http reply, I think. Just get the SIP \
status code and use it. There are async client http modules that offers resume \
functionality for the client side.

Cheers,

Henning

--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com<https://gilawa.com/>

From: sr-users <sr-users-bounces@lists.kamailio.org> On Behalf Of Tim Anderson
Sent: Thursday, May 19, 2022 2:01 AM
To: sr-users@lists.kamailio.org
Subject: [SR-Users] Forwarding SIP status code to HTTP client


Hi,

I have a kamailio that is has an HTTP message server. Is it possible to send the SIP \
status code back in the HTTP reply? Is it possible to suspend an xhttp request while \
some other stuff happens and then send the reply later?

The relevant bit of the config currently looks like

event_route[xhttp:request]{

    if($hu == "/sms"){

        $uac_req(method)="MESSAGE";

        $uac_req(ruri)="sip:1234@example.com"<sip:1234@example.com>;

        $uac_req(furi)="sip:4567@example.com"<sip:4567@example.com>;

        $uac_req(turi)="sip:1234@example.com"<sip:1234@example.com>;

        $uac_req(body)=$rb;

        uac_req_send();

        xhttp_reply("200", "OK", "text/plain", "Sent")

    }

}



Regards,

Tim


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Vorformatiert Zchn";
	margin:0cm;
	font-size:10.0pt;
	font-family:"Courier New";}
span.HTMLVorformatiertZchn
	{mso-style-name:"HTML Vorformatiert Zchn";
	mso-style-priority:99;
	mso-style-link:"HTML Vorformatiert";
	font-family:Consolas;}
span.E-MailFormatvorlage21
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span \
style="mso-fareast-language:EN-US">Hello,<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">you can send \
arbitrary status codes back in the http reply, I think. Just get the SIP status code \
and use it.<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-GB" \
style="mso-fareast-language:EN-US">There are async client http modules that offers \
resume functionality for the client side.<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB" \
style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB" \
style="mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB" \
style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB" \
style="mso-fareast-language:EN-US">Henning<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-GB" \
style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <div>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">-- <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Henning \
Westerholt – </span><span style="mso-fareast-language:EN-US"><a \
href="https://skalatan.de/blog/"><span lang="EN-GB" \
style="color:#0563C1">https://skalatan.de/blog/</span></a></span><span lang="EN-GB" \
style="mso-fareast-language:EN-US"><o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-GB" style="mso-fareast-language:EN-US">Kamailio services – </span><span \
style="mso-fareast-language:EN-US"><a href="https://gilawa.com/"><span lang="EN-GB" \
style="color:#0563C1">https://gilawa.com</span></a></span><span lang="EN-GB" \
style="mso-fareast-language:EN-US"><o:p></o:p></span></p> </div>
<p class="MsoNormal"><span lang="EN-GB" \
style="mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p> <div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b>From:</b> sr-users \
&lt;sr-users-bounces@lists.kamailio.org&gt; <b>On Behalf Of </b>Tim Anderson<br>
<b>Sent:</b> Thursday, May 19, 2022 2:01 AM<br>
<b>To:</b> sr-users@lists.kamailio.org<br>
<b>Subject:</b> [SR-Users] Forwarding SIP status code to HTTP client<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p>&nbsp;</o:p></p>
<p style="margin-left:35.4pt">Hi,<o:p></o:p></p>
<p style="margin-left:35.4pt">I have a kamailio that is has an HTTP message server. \
Is it possible to send the SIP status code back in the HTTP reply? Is it possible to \
suspend an xhttp request while some other stuff happens and then send the reply \
later?<o:p></o:p></p> <p style="margin-left:35.4pt">The relevant bit of the config \
currently looks like<o:p></o:p></p> <pre \
style="margin-left:35.4pt">event_route[xhttp:request]{<o:p></o:p></pre> <pre \
style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp; if($hu == \
&quot;/sms&quot;){<o:p></o:p></pre> <pre \
style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
$uac_req(method)=&quot;MESSAGE&quot;;<o:p></o:p></pre> <pre \
style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
$uac_req(ruri)=<a href="sip:1234@example.com">&quot;sip:1234@example.com&quot;</a>;<o:p></o:p></pre>
 <pre style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
$uac_req(furi)=<a href="sip:4567@example.com">&quot;sip:4567@example.com&quot;</a>;<o:p></o:p></pre>
 <pre style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
$uac_req(turi)=<a href="sip:1234@example.com">&quot;sip:1234@example.com&quot;</a>;<o:p></o:p></pre>
 <pre style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
$uac_req(body)=$rb;<o:p></o:p></pre> <pre \
style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
uac_req_send();<o:p></o:p></pre> <pre \
style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
xhttp_reply(&quot;200&quot;, &quot;OK&quot;, &quot;text/plain&quot;, \
&quot;Sent&quot;)<o:p></o:p></pre> <pre style="margin-left:35.4pt">&nbsp;&nbsp;&nbsp; \
}<o:p></o:p></pre> <pre style="margin-left:35.4pt">}<o:p></o:p></pre>
<p style="margin-left:35.4pt"><o:p>&nbsp;</o:p></p>
<div>
<p style="margin-left:35.4pt">Regards,<o:p></o:p></p>
<p style="margin-left:35.4pt">Tim<o:p></o:p></p>
</div>
</div>
</body>
</html>



__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--===============0289074280==--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic