[asterisk-users] Websockets on Asterisk 11 and SipML5

mailsvb mailsvb at gmail.com
Tue Aug 14 05:44:12 CDT 2012


Hi,

I was facing the very same issue and created a ticket...

https://issues.asterisk.org/jira/browse/ASTERISK-20221

best regards,
Sven

2012/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
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120814/b64c93b1/attachment-0001.htm>


More information about the asterisk-users mailing list