Oh SIP Client-card does not open websocket

I use an oh-sipclient. I have configured the websocket URL. But openhab does never try to connect to the websocket URL. I have checked this with the firefox network Console “ctrl-shift-E”. I don’t see any outgoing request to the websocket URL. I have entered a filter for the websocket URL but it never is requested for. And also in the websocket server ( an asterix system) I never see any incoming request. I’m pretty shure that the asterisk configuration is correct.
Why does openhab not make an outgoing request ?

I also have enabled SIP Debugging. But I don’t know where I can see the SIP debugging

Debugging means output in the browser console. The widget requires HTTPS, browsers do not allow HTTP. (I do not remember what exactly have browsers prohibited, but the quintessence is that HTTPS is required).

I have created self signed certificates. Firefox has accepted them. But Firefox doesn’t trust them. Therefore I don’t know whether HTTPS is active.

I have opened the Browser Console (ctrl-shift-E). But I don’t see any debugging messages. Where in the Browser Console shall I see the debugging output?

The output in the browser console is in the Console tab, between Inspector and Debugger, in Firefox. It might be a silly advice, but after enabling the SIP Debugging, you have to click on Done and then Save (Page). For me this widget works and under websocket URL property my URL starts with wss:// . I cannot give you more hints, this is all I know.

Also under browser console, Network tab, on the top line there is WS for Websockets, between the Media and Other tabs. The WS tab shows for me a GET. For you there should be also some request visible.

How did you get your SSL certificate ? I can not switch the firefox to https because I onle have selfsigned SSL certificate

Well, I use for the SIP server a public name, public IP address, public DNS. At your place I will look how to convince the browser to trust that particular self-signed certificate. This should be possible, but has to be done explicitly, of course.

whatever I change, I can not get openhab to access the websocket I have entered in the oh-sipclient. In the console I don’t see any request to the ip address of the websocket server. There must be something that prevents openhab from calling the websocket.

When I call the asterisk webserver from the firefox with

https://192.168.2.209:8089/asterisk/httpstatus

I can see in the browser console

get 192.168.2.209:8089/asterisk/httpstatus

But when opening the oh-sipclient in the browser, there is absolutely no request to the configured websocket

wss://192.168.2.209:8089/asterisk/ws

Open the Browsers console and type


const socket = new WebSocket("wss://192.168.2.209:8089/asterisk/ws", "sip")
socket.addEventListener("open", (event) => {
  socket.send("Hello Server!");
})
  • If it works, then the SIP server accepts connections and you have not configured the OH-SIP widget right. For me the widget works, so make sure you have set SIP domain, username, password and websockets URL in the settings.
  • If it does not work, then the problem is with the websockets server.

I see in the console output

get wss://192.168.2.209:8089/asterisk/ws

in asterisk I see an incoming request

  == WebSocket connection from '192.168.2.185:43892' for protocol 'sip' accepted using version '13'
[Sep  6 23:17:58] NOTICE[2473]: res_pjsip/pjsip_transport_management.c:170 idle_sched_cb: Shutting down transport 'WSS to 192.168.2.185:43892' since no request was received in 32 seconds
[Sep  6 23:17:58] ERROR[5107]: res_http_websocket.c:589 ws_safe_read: Error reading from web socket: Broken pipe
[Sep  6 23:17:58] ERROR[2465]: iostream.c:563 ast_iostream_close: SSL_shutdown() failed: error:00000001:lib(0)::reason(1), Internal SSL error
  == WebSocket connection from '192.168.2.185:43892' closed

So there is a request from the statement. But my oh-sipclient do not send any request.

For me this widget was working already in February 2023, thus with OpenHAB 3.4.2.

The browser, which displays the OpenHAB webinterface, must be running in HTTPS - SIP Client cannot be used over insecure HTTP · Issue #1690 · openhab/openhab-webui · GitHub . Whether the websocket connection itself is WS insecure or WSS secure seems irrelevant.

You can try with a different browser from a different vendor. You can try also with a different SIP client using the same asterisks-websocket, to make sure that your VoIP server over websocket does work correctly. I use GitHub - collecttix/ctxSip: ctxSip is a Javascript based SIP client that uses WebRTC and WebSockets to connect to your SIP server. The UI is designed to be launched as a popup from within your application. Works well with Kazoo from 2600hz. You can even use the webserver, provided by OpenHAB, and put ctxSip under /etc/openhab/html.

The snippet I suggested just tries to open a websocket connection, to see if this works. It does not send valid data, so no Asterisk response is expected.

To simplify the setup you can disable REGISTER. Maybe your phonebook string is in wrong format. I use +437200101012=Echo test,+437200101011=Music Test where these numbers are taken from enum-test.at.

I also have no “Local SIP Account Settings”: no “Local SIP username”, no “Local SIP Address”. All my settings fall under “Configure Widget”. Maybe you have different options than me, and that is what makes a difference. In the settings for me all toggles are disabled, except “Disable REGISTER” - here the toggle is ON (so no REGISTER is performed).

I really do not know what else can be done.

Thanks for you help.

I have tried ctxSip. But the browsers (Firefox & Chrome) say

Your browser doesn't support the features required for this phone

Both browsers are the newest versions.

Is it a problem with https ? I don’t have https activated on the openhab webserver just http. The phone can be found in /etc/openhab/static/phone

http:/192.168.2.182:8080/static/phone

But something changed after I have created a complete new pjsip.conf. When I enter local SIP client settings in openhab administration mode (local SIP Username, local SIP Password) the oh-sipclient Icon (the phone) turns green and in asterisk I see.

== WebSocket connection from '192.168.2.185:35598' for protocol 'sip' accepted using version '13'
  == WebSocket connection from '192.168.2.185:35598' closed

But only in the administration mode (openhab settings). When I save the page and call http://192.168.2.182:8080/overview it doesn’t work . The administration mode oh-sipclient requests a websocket. When I enable the “Run mode” in settings (the toggle at the bottom of the settings window on the right ctrl-R) the oh-sipclient does not try to to access the websocket server any more and the phone icon remains in yellow. I don’t understand it

As said numerous times here, HTTPS must be used for the SIP widget to work. The browser must load HTTPS.

ok I used https:192.168.2.182:8443/static/phone and it works.

But when I look at the Browser Console I see

SIP/2.0 401 Unauthorized
Via: SIP/2.0/WSS tk6fg4bodmmf.invalid;rport=49408;received=192.168.2.185;branch=z9hG4bK211279
Call-ID: o0pmovg7vh9brv6cbccaqu
From: "Gob Bleuth" <sip:webrtc_client@192.168.2.209>;tag=qj3ajmdbbb
To: "Gob Bleuth" <sip:webrtc_client@192.168.2.209>;tag=z9hG4bK211279
CSeq: 89 REGISTER
WWW-Authenticate: Digest realm="192.168.2.209",nonce="1757242606/7450be6f186f2ed6c2c3573792fb2dec",opaque="155aa13d1925213c",stale=true,algorithm=MD5,qop="auth"
Server: AsteriskTZ
Content-Length:  0

But I’m very shure that the username/password is correct.

An in asterisk when I call the doorbird from ctxSip, I see

 -- Executing [6001@internal:1] NoOp("PJSIP/webrtc_client-00000012", "Call Doorbird") in new stack
    -- Executing [6001@internal:2] Set("PJSIP/webrtc_client-00000012", "CALLERID(num)=webrtc_client") in new stack
    -- Executing [6001@internal:3] Dial("PJSIP/webrtc_client-00000012", "PJSIP/doorbird,20") in new stack
    -- Called PJSIP/doorbird
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [6001@internal:4] NoOp("PJSIP/webrtc_client-00000012", "Status: 21") in new stack
    -- Executing [6001@internal:5] Hangup("PJSIP/webrtc_client-00000012", "") in new stack

Hangupcause 21 means not authorized. But again, I’m very shure that my username/password are 100% correct in config.js

My reading about the last post is that it is exclusively related to ctxSip. The problem might be that there is no common authentication mechanism between client and server.

In any case, as you see there the SIP messages, it gets out of scope for this forum.

This is strange. Maybe you have not used HTTPS in the above description, which is the key here.

As I said I got it running without local SIP settings (which are enacted only from a particular browser instance). Maybe in HTTP insecure, as the Camera/Microphone API and WebRTC API cannot be used anyway in insecure http, there is no point to contact the websockets server. When I use HTTP and no HTTPS, then also no websocket connections are opened for me. So I think the single problem you have for the lack of Websocket connection was, that you do not use HTTPS on the OpenHAB/overview page.

ok, I finally could solve it with your help. I have configured https access to openhab

https://192.168.2.182:8443/overview

I use nginx as reverse proxy
And now it works.

Thanks. openhab can use the oh-sipclient now and I can open wecksockets to asterisk with the sipclient

Thanks a lot for you patience

Had something like this happen when setting up an OH SIP client once — it turned out the websocket URL wasn’t actually enabled in the Asterisk config for that extension. After adding the correct transport settings and restarting, it started showing requests. For SIP debug in OpenHAB, check logs in the console or log viewer. For another project, using a sip trunk provider like Telxi made the whole connection side far easier to troubleshoot.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.