[asterisk-users] How to test Websocket support in SIP in Asterisk trunk?
Juan Castro
jcastro at instant.com.br
Mon Aug 20 10:41:16 CDT 2012
On Mon, Aug 20, 2012 at 11:53 AM, Joshua Colp <jcolp at digium.com> wrote:
> ----- Original Message -----
>> On Fri, Aug 17, 2012 at 7:04 PM, Juan Castro <jcastro at instant.com.br>
>> wrote:
>> > On Fri, Aug 17, 2012 at 5:45 PM, Juan Castro
>> > <jcastro at instant.com.br> wrote:
>> >> I still get "unauthorized" from sipml5 with these modifications. I
>> >> used port 80 instead of 8088 (no other webserver listening on 80),
>> >> was
>> >> that wrong?
>> >
>> > Correction. It's actually "Failed to connect to the server". I set
>> > the
>> > proxy address and port correctly in sipml5's call.htm (it registers
>> > on
>> > Kamailio).
>>
>> ...which is in fact a 404 response from Asterisk. Here's the response
>> I received: http://users.vialink.com.br/jcastro/refused.cap
>>
>> I suspect I am configuring something wrong, but what is it?
>
> The complete URL to use is http://<asterisk IP address or host>:8088/ws
>
> Note the /ws at the end. WebSocket support is only available there. Doing otherwise would have required core HTTP server changes, which I wanted to avoid. Depending on what you are testing with you may need to change it slightly to add that in.
Well, I did the following changes in sipml5 and now I get a "Bad
Request" on REGISTER, instead of 404. Clearly, I'm still missing
something. Here are the changes I made:
Index: call.htm
===================================================================
--- call.htm (revision 68)
+++ call.htm (working copy)
@@ -351,8 +351,9 @@
// we will connect to one of them and let the
balancer to choose the right one (less connected sockets)
// each port can accept up to 65K connections which
means that the cloud can manage 325K active connections
// the number of port will be increased or decreased
based on the current trafic
- i_port = 4062 + (((new Date().getTime()) % 5) * 1000);
- s_proxy = "sipml5.org";
+ // i_port = 4062 + (((new Date().getTime()) % 5) * 1000);
+ i_port = 80;
+ s_proxy = "192.168.0.111";
}
// create a new SIP stack. Not mandatory as it's possible
to reuse the same satck
Index: src/tinySIP/src/tsip_stack.js
===================================================================
--- src/tinySIP/src/tsip_stack.js (revision 68)
+++ src/tinySIP/src/tsip_stack.js (working copy)
@@ -351,7 +351,7 @@
return -2;
}
- tsk_utils_log_info("SIP stack start: proxy='" +
this.network.s_proxy_cscf_host + ":" + this.network.i_proxy_cscf_port
+ "', realm='" + this.network.o_uri_realm + "', impi='" +
this.identity.s_impi + "', impu='" + this.identity.o_uri_impu + "'");
+ tsk_utils_log_info("SIP stack start: proxy='" +
this.network.s_proxy_cscf_host + ":" + this.network.i_proxy_cscf_port
+ "/ws', realm='" + this.network.o_uri_realm + "', impi='" +
this.identity.s_impi + "', impu='" + this.identity.o_uri_impu + "'");
this.network.o_transport =
this.o_layer_transport.transport_new(this.network.e_proxy_cscf_type,
this.network.s_proxy_cscf_host, this.network.i_proxy_cscf_port, "SIP
Transport", __tsip_stack_transport_callback);
if (!this.network.o_transport) {
@@ -716,4 +716,4 @@
}
return 0;
-}
\ No newline at end of file
+}
Index: src/tinySIP/src/transports/tsip_transport.js
===================================================================
--- src/tinySIP/src/transports/tsip_transport.js (revision 68)
+++ src/tinySIP/src/transports/tsip_transport.js (working copy)
@@ -368,7 +368,7 @@
return -1;
}
- var s_url = tsk_string_format("{0}://{1}:{2}",o_self.s_protocol,
o_self.s_host, o_self.i_port);
+ var s_url =
tsk_string_format("{0}://{1}:{2}/ws",o_self.s_protocol, o_self.s_host,
o_self.i_port);
tsk_utils_log_info("Connecting to '"+s_url+"'");
o_self.o_ws = new WebSocket(s_url, 'sip');
o_self.o_ws.binaryType = "arraybuffer";
@@ -458,7 +458,7 @@
}
var b_isInternetExplorer = (WebRtc4all_GetType() == WebRtcType_e.IE);
- var s_url = tsk_string_format("{0}://{1}:{2}",o_self.s_protocol,
o_self.s_host, o_self.i_port);
+ var s_url =
tsk_string_format("{0}://{1}:{2}/ws",o_self.s_protocol, o_self.s_host,
o_self.i_port);
tsk_utils_log_info("Connecting to '"+s_url+"'");
if(b_isInternetExplorer){
o_self.o_transport = new ActiveXObject("webrtc4ie.NetTransport");
@@ -480,7 +480,7 @@
if(o_self.o_transport.defaultDestAddr &&
o_self.o_transport.defaultDestPort){
o_self.s_host = o_self.o_transport.defaultDestAddr;
o_self.i_port = o_self.o_transport.defaultDestPort;
- tsk_utils_log_info("Transport default destination=" +
o_self.s_host + ":" + o_self.i_port);
+ tsk_utils_log_info("Transport default destination=" +
o_self.s_host + ":" + o_self.i_port + "/ws");
}
o_self.b_started = true;
o_self.signal(tsip_transport_event_type_e.STARTED, "Network
transport started", null);
Index: src/tinyMEDIA/src/tmedia_session_jsep.js
===================================================================
--- src/tinyMEDIA/src/tmedia_session_jsep.js (revision 68)
+++ src/tinyMEDIA/src/tmedia_session_jsep.js (working copy)
@@ -168,6 +168,8 @@
tmedia_session_jsep.prototype.decorate_lo = function () {
if (this.o_sdp_lo) {
+ this.o_sdp_lo.remove_media("video");
+
/* Session name for debugging */
var o_hdr_S;
if ((o_hdr_S = this.o_sdp_lo.get_header(tsdp_header_type_e.S))) {
@@ -278,4 +280,4 @@
this.o_sdp_ro = null;
return 0;
-}
\ No newline at end of file
+}
More information about the asterisk-users
mailing list