• V20: 3CX Re-engineered. Get V20 for increased security, better call management, a new admin console and Windows softphone. Learn More.

Connectio to 3CX WebRTC with Javascript

Status
Not open for further replies.

Siegmar Gieseler

Free User
Joined
Oct 20, 2018
Messages
3
Reaction score
1
Hi,
As 3CX version 15.5 supports WebRTC I am trying to connect using the JsSIP Library.
My goal is to integrate a softphone in my application ( instead of using any 3CX API ) in the same way I have already done with Asterisk, also using JsSIP.
WebRTC works very well and, in my humble opinion, is the most interesting feature in 3CX latest releases.

Below you find an excerpt of my code ( based on my former Asterisk code ):

createUserAgent: function () {
var optionsUserAgent = {
authorization_user: $("#user").val(), // // USER ( 3CX KEY )
password: $("#password").val(), // PASSWORD ( 3CX Authentication ID )
realm: $("#realm").val(), // mysubdomain.3cx.com.br
session_timers: false,
sockets: [ new JsSIP.WebSocketInterface("wss://mysubdomain.3cx.com.br") ], // Secure
//sockets: [ new JsSIP.WebSocketInterface("ws://mysubdomain.3cx.com.br") ],
uri: $("#uri").val() // sip:[email protected] 00 is the extension number
};
MyPhone.userAgent = new JsSIP.UA(optionsUserAgent);
...


It seems to connect but I get the following WebSocket error:

failed: Error during WebSocket handshake: Unexpected response code: 200


Usually this error is related to a wrong WebSocket URL.
I tried the followin URLs but I got the 403 ( Forbidden ) error:

wss://mysubdomain.3cx.com.br/wss
wss://mysubdomain.3cx.com.br/ws

Below you find the JsSIP configuration parameters:

JsSIP JavaScript Library
http://jssip.net
http://jssip.net/documentation/3.2.x/api/ua_configuration_parameters


Does anybody know what could be the problem ?
Does 3CX support WebRTC/WebSocket connections ?
If not will this be available inthe near future ?

Thanks
 
Interesting question. You might want to wait a bit - v16 will allow you to integrate a small softphone in your app by adding just a few lines of javascript code. Fully supported.....
 
Thanks for the answer.
But my code ( currently for Asterisk ) is very customized, so I would need a full WebRTC implementation.
As far as I understood from your answer it does not exist in 3CX: correct ?
So the only solution would be a WebRTC-SIP Gateway.
The problem is that the cost of such a Gateway could double the price a a normal 3CX installation :-(
 
I decided to test the Janus Open Source WebRTC-SIP Gateway ( Soft plugin ) ...

https://janus.conf.meetecho.com/siptest.html

... and it worked perfectly with 3CX :)
So I will give it a try migrating my current Javascript code, after compiling Janus.
 
  • Like
Reactions: electric-momo
Status
Not open for further replies.
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.