Javascript code to Register SIP endpoint from browser

702 Views Asked by At

I just want to Register a SIP or PJSIP endpoint of asterisk from browser. I know some libraries which can do this for me.

But I want to know the core code in javascript to register a SIP end point.

It is done like below in jssip.js library

    var socket = new JsSIP.WebSocketInterface('wss://' + domain + ':8089/ws')
    var configuration = {
        sockets: [socket],
        uri: 'sip:'+ localUser.value +'@' + domain,
        authorization_user: localUser.value,
        password: '123456'
    }

    ua = new JsSIP.UA(configuration)

    ua.start()

But in pure/core/plain javascript how will the same be done.

1

There are 1 best solutions below

0
On

In "Pure Javascript" you have do all what implemented in pjsip library. You can check source code.

You also can use WebRTC code, it slightly less required JS code, but still tens of KB.