<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
there is a new module named xhttp which provides an embedded http
server inside the SIP server. It reuses the transport layer from the
core, so you can send http requests via TCP and TLS. The port is the
same as for SIP traffic. The documentation of the module is available
at:<br>
<br>
<a class="moz-txt-link-freetext" href="http://sip-router.org/docbook/sip-router/branch/master/modules/xhttp/xhttp.html">http://sip-router.org/docbook/sip-router/branch/master/modules/xhttp/xhttp.html</a><br>
<br>
Since sip and http are very similar, you can use other modules in
handling the http requests. For example, you can do www-authentication:<br>
<br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
event_route[xhttp:request] {<br>
&nbsp;&nbsp;&nbsp; if (!www_authorize("xcap", "subscriber")) <br>
&nbsp;&nbsp; { <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www_challenge("sip-router.org", "0");
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>
&nbsp;&nbsp;&nbsp; }<br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
&nbsp;&nbsp;&nbsp; xhttp_reply("200", "OK", "text/html",
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "&lt;html&gt;&lt;body&gt;Welcome $au, you are connected from
$si:$sp&lt;/body&gt;&lt;/html&gt;");<br>
}<br>
<br>
allowing in this way only local SIP users to do http requests.<br>
<br>
For now supports only http 1.0, meaning it cannot take chunked requests
(usually happening in PUT requests with large body). Hope it is useful
for some of you. Its main goal right now is to offer the transport
layer for embedded xcap server (the new xcap_server module), but it can
be used for service monitoring, server control, etc.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Miami, Fl, USA - June 21-23, 2010
<a class="moz-txt-link-freetext" href="http://www.asipto.com/index.php/kamailio-advanced-training/">http://www.asipto.com/index.php/kamailio-advanced-training/</a>
</pre>
</body>
</html>