Module: sip-router Branch: pd/websocket Commit: 64406b209d8b4fd9ed127a6b4b965e3c1863c3d2 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=64406b20...
Author: Peter Dunkley peter.dunkley@crocodile-rcs.com Committer: Peter Dunkley peter.dunkley@crocodile-rcs.com Date: Sat Jun 23 21:55:34 2012 +0100
modules/websocket: updated example configuration and test scripts
- Added options_rx.xml SIPp script - kamailio.cfg routes OPTIONS to SIPp - websocket_test.html now using WSS (WS over TLS)
---
modules/websocket/example/kamailio.cfg | 16 ++++++++++--- modules/websocket/example/options_rx.xml | 28 +++++++++++++++++++++++++ modules/websocket/example/websocket_test.html | 7 +---- 3 files changed, 42 insertions(+), 9 deletions(-)
diff --git a/modules/websocket/example/kamailio.cfg b/modules/websocket/example/kamailio.cfg index cac432c..c5bfb88 100644 --- a/modules/websocket/example/kamailio.cfg +++ b/modules/websocket/example/kamailio.cfg @@ -97,6 +97,14 @@ modparam("tls", "ca_list", "CA/calist.pem") # - note: this is the same as route { ... } request_route {
+ if ($rm == "OPTIONS") + { + force_rport(); + $du = "sip:192.168.111.2:5080;transport=udp"; + forward(); + exit; + } + # per request initial checks route(REQINIT);
@@ -245,14 +253,14 @@ event_route[xhttp:request] { exit; }
- xlog("L_INFO", "HTTP Request Received\n"); + xlog("L_DBG", "HTTP Request Received\n");
if ($hdr(Upgrade)=~"websocket" && $hdr(Connection)=~"Upgrade" && $rm=~"GET") { - xlog("L_INFO", "WebSocket\n"); - xlog("L_INFO", " Host: $hdr(Host)\n"); - xlog("L_INFO", " Origin: $hdr(Origin)\n"); + xlog("L_DBG", "WebSocket\n"); + xlog("L_DBG", " Host: $hdr(Host)\n"); + xlog("L_DBG", " Origin: $hdr(Origin)\n");
if ($hdr(Host) == $null || !is_myself($hdr(Host))) { xlog("L_WARN", "Bad host $hdr(Host)\n"); diff --git a/modules/websocket/example/options_rx.xml b/modules/websocket/example/options_rx.xml new file mode 100644 index 0000000..d3160b6 --- /dev/null +++ b/modules/websocket/example/options_rx.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE scenario SYSTEM "sipp.dtd"> + +<scenario name="Basic OPTIONS responder"> + <recv request="OPTIONS" crlf="true"> + </recv> + + <send> + <![CDATA[ + + SIP/2.0 200 OK + [last_Via:] + [last_From:] + [last_To:];tag=[pid]SIPpTag01[call_number] + [last_Call-ID:] + [last_CSeq:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + Content-Length: 0 + + ]]> + </send> + + <timewait milliseconds="4000"/> + <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> + <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> + +</scenario> + diff --git a/modules/websocket/example/websocket_test.html b/modules/websocket/example/websocket_test.html index 308b945..a7f9d20 100644 --- a/modules/websocket/example/websocket_test.html +++ b/modules/websocket/example/websocket_test.html @@ -5,7 +5,7 @@ <title>WebSocket Test</title>
<script language="javascript" type="text/javascript"> -var wsUri = "ws://192.168.111.12/"; +var wsUri = "wss://192.168.111.2/"; var output;
function init() @@ -26,10 +26,7 @@ function testWebSocket() function onOpen(evt) { writeToScreen("CONNECTED"); - doSend("WebSocket rocks"); - doSend("WebSocket rolls"); - doSend("012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"); - websocket.close(); + doSend("OPTIONS sip:alice@example.com SIP/2.0\r\nVia: SIP/2.0/WSS abcd1234.invalid;branch=z9hG4bkabcd1234\r\nMax-Forwards: 70\r\nTo: sip:alice@example.com\r\nFrom: sip:bob@example.com;tag=abcd1234\r\nCall-ID: abcd1234\r\nCSeq: 1 OPTIONS\r\nContact: sip:bob@abcd1234;transport=ws\r\n\r\n"); }
function onClose(evt)