Conference Call Implementation

108 views
Skip to first unread message

Usman Akram

unread,
Jun 21, 2021, 5:00:34 PM6/21/21
to JsSIP
Hello Guys,
I want to implement conference call in our project  but I'm unable to find implementation of conference call in document.
Can somebody give me a clue how I can implement conference call.

Regards
Usman Akram 

Mukesh Kumar

unread,
Jun 22, 2021, 12:40:30 AM6/22/21
to js...@googlegroups.com
Yes, of course you can

--
You received this message because you are subscribed to the Google Groups "JsSIP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jssip+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jssip/5d15118e-cd56-4ffa-9d24-c68ed02c1e9fn%40googlegroups.com.

Usman Akram

unread,
Jun 22, 2021, 2:23:58 PM6/22/21
to JsSIP
Hi mukesh, 
Thanks for the reply.
Can you please guide me how I can implement conference call ?
We have successfully implemented 2 person audio call.
This is my code implementation of 2 persons (1 to 1):


var phone;
var session;

if (configuration.uri && configuration.password) {
    JsSIP.debug.enable('JsSIP:*'); // more detailed debug output
    phone = new JsSIP.UA(configuration);
    phone.on('registrationFailed', function (ev) {
        alert(`SIP Registering with UserName: ${sipUserName}  Password: ${sipUserPassword} on SIP server failed with error: ` + ev.cause);
        configuration.uri = null;
        configuration.password = null;
        updateUI();
    });
    phone.on('newRTCSession', function (ev) {
        var newSession = ev.session;
        if (session) { // hangup any existing call
            session.terminate();
        }
        session = newSession;
        var completeSession = function () {
            session = null;
            updateUI();
        };
        session.on('ended', completeSession);
        session.on('failed', completeSession);
        session.on('accepted', updateUI);
        session.on('confirmed', function () {
            var localStream = session.connection.getLocalStreams()[0];
            var dtmfSender = session.connection.createDTMFSender(localStream.getAudioTracks()[0])
            session.sendDTMF = function (tone) {
                dtmfSender.insertDTMF(tone);
            };
            updateUI();
        });
        session.on('peerconnection', (e) => {
            console.log('peerconnection', e);
            let logError = '';
            const peerconnection = e.peerconnection;

            peerconnection.onaddstream = function (e) {
                console.log('addstream', e);
                // set remote audio stream (to listen to remote audio)
                remoteAudio.srcObject = e.stream;
                remoteAudio.play();
            };

            var remoteStream = new MediaStream();
            console.log(peerconnection.getReceivers());
            peerconnection.getReceivers().forEach(function (receiver) {
                console.log(receiver);
                remoteStream.addTrack(receiver.track);
            });
        });

        if (session.direction === 'incoming') {
            //incomingCallAudio.play();
            if ($('#dndSwitch').is(':checked') == false) {
                document.getElementById('incommingCallAudio').play();
            }
        } else {
            console.log('con', session.connection)
            session.connection.addEventListener('addstream', function (e) {
                //incomingCallAudio.pause();
                remoteAudio.srcObject = e.stream;
                if ($('#dndSwitch').is(':checked') == false) {
                    document.getElementById('incommingCallAudio').pause();
                }
            });
        }
        updateUI();
    });
    phone.start();
}

This code is working fine on audio call with 2 persons.
Can you please guide me how I can implement conference call on it ?
From last 2 weeks, we tried many ways but didn't work and we are stuck on it.
 
Thanks in advance.
Reply all
Reply to author
Forward
0 new messages