[asterisk-users] Websockets on Asterisk 11 and SipML5
James Mortensen
james.mortensen at a-cti.com
Tue Aug 14 12:20:12 CDT 2012
mailsvb <mailsvb <at> gmail.com> writes:
>
>
> Hi,
>
> I was facing the very same issue and created a ticket...
>
>
> https://issues.asterisk.org/jira/browse/ASTERISK-20221
>
> best regards,
> Sven2012/8/13 James Mortensen <james.mortensen <at> a-cti.com>
> Andrew Latham <lathama <at> gmail.com> writes:
> >
> > On Mon, Aug 13, 2012 at 2:58 PM, James Mortensen
>
> > <james.mortensen <at> a-cti.com> wrote:
> > > Hello,
> > >
> > > I'm trying to register a user using sipml5 on Asterisk 11. I followed the
> > > instructions here:
> > > http://thr3ads.net/asterisk-users/2012/08/1972342-Asterisk-Websockets
> > >
> > > I added transport=ws to my sip.conf file:
> > >
> > > [3002]
> > > username=3002
> > > secret=XXXXXXXXX
> > > host=dynamic
> > > type=friend
> > > context=test
> > > disallow=all
> > > allow=g729
> > > ;allow=all ; Allow codecs in order of preference
> > > allow=ilbc
> > > allow=silk8
> > > allow=gsm
> > > transport=ws
> > >
> > >
> > > I also modified the sipml5 library so that the URL looks like this:
> > > ws://example.org:8088/ws with the /ws at the end, as instructed.
> > >
> > > Now, where I get confused is here:
> > >
> > > "You will need to change sipml5 to use http://<hostname or IP address of
> > >
> > > Asterisk>:8088/ws as the URL. WebSocket is only available on the /ws
path."
> > >
> > >
> > > Did Joshua mean to say ws:// instead of http://? Because I'm not aware of
> > > WebSockets working with http protocols, only ws protocols. Is there
> > > something I'm missing here?
> > >
> > >
> > >
> > > The error that I'm getting in the sipml5 client is: "Disconnected: Failed
> > > to connet to the server" And that typo is not mine.
> > >
> > >
> > >
> > >
> > > On the server, here is what I see from a tcpdump. The port appears to be
> > > open, but I'm not convinced that Asterisk is actually listening for
> > > WebSocket traffic:
> > >
> > >
> > >
> > >
> > > tcpdump -v port 8088
> > >
> > >
> > >
> > >
> > > 18:57:03.051712 IP (tos 0x0, ttl 243, id 21320, offset 0, flags [DF],
proto
> > > TCP (6), length 60)
> > > static-50-43-101-83.bvtn.or.frontiernet.net.63036 >
> > > ip-10-168-151-65.us-west-1.compute.internal.omniorb: Flags [S], cksum
0x4f7a
> > > (correct), seq 4055598050, win 14600, options [mss
> > > 1380,sackOK,nop,nop,nop,nop,nop,nop,nop,nop,nop,nop,nop,nop,nop,nop],
length
> > > 0
> > > 18:57:03.051758 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP
> > > (6), length 40)
> > > ip-10-168-151-65.us-west-1.compute.internal.omniorb >
> > > static-50-43-101-83.bvtn.or.frontiernet.net.63036: Flags [R.], cksum
0xeaf4
> > > (correct), seq 0, ack 4055598051, win 0, length 0
> > >
> > >
> > >
> > > Is there something else I'm missing? Please let me know what additional
> > > information you need from me.
> > >
> > > Thank you!
> > >
> > > --
> > > James Mortensen
> > >
> >
> > Look to see if the /ws is showing in an "http show status"
> >
> > '''
> > *CLI> http show status
> > HTTP Server Status:
> > Prefix:
> > Server Enabled and Bound to 0.0.0.0:8088
> >
> > Enabled URI's:
> > /httpstatus => Asterisk HTTP General Status
> > /phoneprov/... => Asterisk HTTP Phone Provisioning Tool
> > /amanager => HTML Manager Event Interface w/Digest authentication
> > /uploads => HTTP POST mapping
> > /arawman => Raw HTTP Manager Event Interface w/Digest authentication
> > /manager => HTML Manager Event Interface
> > /rawman => Raw HTTP Manager Event Interface
> > /static/... => Asterisk HTTP Static Delivery
> > /amxml => XML Manager Event Interface w/Digest authentication
> > /mxml => XML Manager Event Interface
> > /ws => Asterisk HTTP WebSocket
> >
> > Enabled Redirects:
> > / => /static/admin.html
> > *CLI>
> > '''
> >
> Hi Andrew,
> I uncommented enabled=yes in http.conf and now see the /ws => Asterisk HTTP
> WebSocket. I also modified bindaddr=0.0.0.0 as it was previously 127.0.0.1. I
> can connect and I do see the following output in my Chrome NET tab:
> Request URL:ws://example.org:8088/ws
> Request Method:GET
> Status Code:101 Switching Protocols
> Request Headersview source
> Connection:Upgrade
> Host:example.org:8088
> Origin:http://local:8888
> Sec-WebSocket-Extensions:x-webkit-deflate-frame
> Sec-WebSocket-Key:fazgtURy132RAFXGRiT9TA==
> Sec-WebSocket-Protocol:sip
> Sec-WebSocket-Version:13
> Upgrade:websocket
> (Key3):00:00:00:00:00:00:00:00
> Response Headersview source
> Connection:Upgrade
> Sec-WebSocket-Accept:fQA1LFnbYFSxFYAr7Ls1Keh54KY=
> Sec-WebSocket-Protocol:sip
> Upgrade:websocket
> (Challenge Response):00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
> However, the Asterisk server dies afterwards and must be restarted. The
> /var/log/messages file has no helpful information; I was tailing it as I made
> one of my connect attempts.
> If it helps, I have a local Asterisk 11 setup in verbose mode, and I did see
the
> following warning message when trying to connect to it instead:
> *CLI> [Aug 13 13:17:39] WARNING[567]: res_http_websocket.c:533
> websocket_callback: WebSocket connection from '127.0.0.1:53845' could not be
> accepted - no protocols out of 'sip' supported
> Also, here is what I see in the Chrome NET tab: (I hope this doesn't confuse
> the problem. Keep in mind that these are 2 separate Asterisk 11 instances, one
> at example.org and one at 127.0.0.1):
> Request URL:ws://127.0.0.1:8088/ws
> Request Headersview source
> Connection:Upgrade
> Cookie:__utma=96992031.124949559.1343691697.1343691697.1343691697.1;
> __utmz=96992031.1343691697.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
> Host:127.0.0.1:8088
> Origin:http://local:8888
> Sec-WebSocket-Extensions:x-webkit-deflate-frame
> Sec-WebSocket-Key:UnhnlavzW/Gk6mwJMdLU/w==
> Sec-WebSocket-Protocol:sip
> Sec-WebSocket-Version:13
> Upgrade:websocket
> (Key3):00:00:00:00:00:00:00:00
> Let me know if there is any other information you need. Thanks again for your
> help!
> James
>
> --
> _____________________________________________________________________
Hi All,
I applied the patch and reinstalled, but the issue with Asterisk terminating
still exists.
I turned up my debug logging so we could see more of what's happening when I try
to connect from the sipml5 client.
Before the disconnect, I'm getting a SIP/2.0 401 Unauthorized. The same
credentials work when using the sipml5.org:4062 Websocket server. If anyone
knows what I'm missing, I'd appreciate some insight. Thanks again!
Here is what I see:
<--- SIP read from WS:50.43.101.83:2807 --->
REGISTER sip:example.org SIP/2.0
Via: SIP/2.0/WS
df7jal23ls0d.invalid;branch=z9hG4bKPhRKToHsHAU18BcfrkMkTrEuli21WRNN;rport
From: <sip:3002 at example.org>;tag=zlmPlTESDfSSHTJ1kJcq
To: <sip:3002 at example.org>
Contact: "Jaymes"
<sip:3002 at df7jal23ls0d.invalid;transport=ws>;expires=200;+g.oma.sip-
im;+audio;language="en,fr"
Call-ID: 15a7e7be-6dda-0d29-3048-c18ae39aa9cb
CSeq: 56621 REGISTER
Content-Length: 0
Max-Forwards: 70
User-Agent: IM-client/OMA1.0 sipML5/v0.0.0000.0
Organization: Doubango Telecom
Supported: path
<------------->
--- (12 headers 0 lines) ---
<--- Transmitting (no NAT) to 50.43.101.83:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/WS
df7jal23ls0d.invalid;branch=z9hG4bKPhRKToHsHAU18BcfrkMkTrEuli21WRNN;rport;receiv
ed=50.43.101.83
From: <sip:3002 at example.org>;tag=zlmPlTESDfSSHTJ1kJcq
To: <sip:3002 at example.org>;tag=as76bbb28c
Call-ID: 15a7e7be-6dda-0d29-3048-c18ae39aa9cb
CSeq: 56621 REGISTER
Server: Asterisk PBX 11.0.0-beta1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO,
PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="3ed6b126"
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog '15a7e7be-6dda-0d29-3048-c18ae39aa9cb' in
32000 ms (Method: REGISTER)
<--- SIP read from WS:50.43.101.83:2807 --->
REGISTER sip:example.org SIP/2.0
Via: SIP/2.0/WS
df7jal23ls0d.invalid;branch=z9hG4bKkI8uGewpCFHwqxCtmUDDwbhTdBNQpNBe;rport
From: <sip:3002 at example.org>;tag=zlmPlTESDfSSHTJ1kJcq
To: <sip:3002 at example.org>
Contact: "Jaymes"
<sip:3002 at df7jal23ls0d.invalid;transport=ws>;expires=200;+g.oma.sip-
im;+audio;language="en,fr"
Call-ID: 15a7e7be-6dda-0d29-3048-c18ae39aa9cb
CSeq: 56622 REGISTER
Content-Length: 0
Max-Forwards: 70
Authorization: Digest
username="3002",realm="asterisk",nonce="3ed6b126",uri="sip:example.org",response
="96dd23c4248b600374b78307013d9d00",algorithm=MD5
User-Agent: IM-client/OMA1.0 sipML5/v0.0.0000.0
Organization: Doubango Telecom
Supported: path
<------------->
--- (13 headers 0 lines) ---
ip-10-168-151-65*CLI>
Disconnected from Asterisk server
Executing last minute cleanups
Asterisk cleanly ending (0).
Asterisk ending (0).
More information about the asterisk-users
mailing list