Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Camera, microphone and sound output devices management

Selection and switching input and output devices

Like a video stream capture, camera, microphone and (in Chrome browser only) sound output device can be selected while making a SIP call from browser. Besides, devices can be switched during a call.

...

3. Swithching microphone during a call code:

Code Block
languagejs
themeRDark
    $("#switchMicBtn").click(function() {
        if (currentCall) {
            currentCall.switchMic().then(function(id) {
                $('#micList option:selected').prop('selected', false);
                $("#micList option[value='"+ id +"']").prop('selected', true);
            }).catch(function(e) {
                console.log("Error " + e);
            });
        }
    }).prop('disabled', true);

4. Switching camera during a call code:

Code Block
languagejs
themeRDark
    $("#switchCamBtn").click(function() {
       if (currentCall) {
           currentCall.switchCam().then(function(id) {
               $('#cameraList option:selected').prop('selected', false);
               $("#cameraList option[value='"+ id +"']").prop('selected', true);
           }).catch(function(e) { console.log("Error " + e); }); }
               console.log("Error " + e);
           });
       }
    }).prop('disabled', true);

Known issues

1. It's impossible to make a SIP call if 'SIP Login' and 'SIP Authentification name' fields are incorrect

Symptoms: SIP call stucks in PENDING state.

Solution: according to the standard, 'SIP Login' and 'SIP Authentification name' should not contain any of unescaped spaces and special symbols and should not be enclosed in angle brackets '<>'.

For example, this is not allowed by the standard

Code Block
languagejs
themeRDark
sipLogin='Ralf C12441@host.com'
sipAuthenticationName='Ralf C'
sipPassword='demo'
sipVisibleName='null'

and this is allowed

Code Block
languagejs
themeRDark
sipLogin='Ralf_C12441'
sipAuthenticationName='Ralf_C'
sipPassword='demo'
sipVisibleName='Ralf C'

2. There are some problems with sound while SIP calls from Edge browser.

Symptoms:

a) The outgoing sound is sometimes abruptly muffled, then it goes normally.

b) The incoming sound is heard only if you speak into the microphone.

Решение:

...

Video size setting

An outgoing video size can be specified while making a call

Image Added

code:

Code Block
languagejs
themeRDark
function getConstraints() {
    var constraints = {
        ...
        video: {
            deviceId: {exact: $('#cameraList').find(":selected").val()},
            width: parseInt($('#sendWidth').val()),
            height: parseInt($('#sendHeight').val())
        }
    };
    if (Browser.isSafariWebRTC() && Browser.isiOS() && Flashphoner.getMediaProviders()[0] === "WebRTC") {
        constraints.video.width = {min: parseInt($('#sendWidth').val()), max: 640};
        constraints.video.height = {min: parseInt($('#sendHeight').val()), max: 480};
    }
    return constraints;
}

Making a call without microphone and camera

In some cases, when a call supposes no two-way communication, e.g. when calling to voice menu, it is possible to make a call without using microphone and camera.

To do this RTP activity timer should be disabled with following parameter in flashphoner.properties file

Code Block
languagebash
themeRDark
rtp_activity_detecting=false

and turn off audio and video in outgoing call constraints for Chrome, Safari and MS Edge browsers

Code Block
languagejs
themeRDark
    var constraints = {
        audio: false,
        video: false
    };

    var outCall = session.createCall({
		callee: $("#callee").val(),
        visibleName: $("#sipLogin").val(),
        constraints: constraints,
        ...
	})

In addition to it, an empty audio stream should be created for Firefox browser:

Code Block
languagejs
themeRDark
    var constraints = {
        audio: false,
        video: false
    };
    if(Browser.isFirefox()) {
        var audioContext = new AudioContext();
        var emptyAudioStream = audioContext.createMediaStreamDestination().stream;
        constraints.customStream = emptyAudioStream;
    }
    var outCall = session.createCall({
		callee: $("#callee").val(),
        visibleName: $("#sipLogin").val(),
        constraints: constraints,
        ...
	})

WebRTC statistics displaying

A client application can get WebRTC statistics according to the standard during a SIP call. The statistics can be displayed in browser, for example:

Image Added

Note that in Safari browser audio only statistics can be displayed.

1. Statistics displaying during a SIP call

call.getStats() code:

Code Block
languagejs
themeRDark
        currentCall.getStats(function (stats) {
            if (stats && stats.outboundStream) {
                if (stats.outboundStream.videoStats) {
                    $('#videoStatBytesSent').text(stats.outboundStream.videoStats.bytesSent);
                    $('#videoStatPacketsSent').text(stats.outboundStream.videoStats.packetsSent);
                    $('#videoStatFramesEncoded').text(stats.outboundStream.videoStats.framesEncoded);
                } else {
                    ...
                }

                if (stats.outboundStream.audioStats) {
                    $('#audioStatBytesSent').text(stats.outboundStream.audioStats.bytesSent);
                    $('#audioStatPacketsSent').text(stats.outboundStream.audioStats.packetsSent);
                } else {
                    ...
                }
            }
        });

Supported codecs setting

WCS sets the codecs supported to INVITE SDP according to the following parameters in flashphoner.properties file

1. The codecs specified with codecs parameter are included to INVITE SDP, by default

Code Block
languagebash
themeRDark
codecs=opus,alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone-event,h264,vp8,flv,mpv

2. The codecs specified with codecs_exclude_sip parameter are excluded from INVITE SDP, by default

Code Block
languagebash
themeRDark
codecs_exclude_sip=mpeg4-generic,flv,mpv

3. The codecs specified by browser are excluded from INVITE SDP if this parameter is set

Code Block
languagebash
themeRDark
allow_outside_codecs=false

4. The codecs specified with stripCodecs parameter in client application are excluded from INVITE SDP, for example:

Code Block
languagejs
themeRDark
var outCall = session.createCall({
    callee: $("#callee").val(),
    ...
    stripCodecs: "SILK,G722"
    ...
});

outCall.call();

Additional SDP parameters passing in INVITE request and 200 OK response

When call is made with JavaScript API, an additional parameters can be passed to control bandwith via SDP, for outgoing calls (to INVITE request)

Code Block
languagejs
themeRDark
var sdpAttributes = ["b=AS:3000","b=TIAS:2500000","b=RS:1000","b=RR:3000"];
var outCall = session.createCall({
        sipSDP: sdpAttributes,
        ...
    });

and incoming calls (to 200 OK response)

Code Block
languagejs
themeRDark
        var sdpAttributes = ["b=AS:3000","b=TIAS:2500000","b=RS:1000","b=RR:3000"];
		inCall.answer({
            sipSDP: sdpAttributes,
            ...
        });

Those parameters will be added to SDP after connection information ("c=IN IP4 <WCS IP>") and before time description ("t=0 0"):

Code Block
languagejs
themeRDark
v=0
o=Flashphoner 0 1541068898263 IN IP4 192.168.1.5
s=Flashphoner/1.0
c=IN IP4 192.168.1.5
b=AS:3000
b=TIAS:2500000
b=RS:1000
b=RR:3000
t=0 0
m=audio

Known issues

1. It's impossible to make a SIP call if 'SIP Login' and 'SIP Authentification name' fields are incorrect

Symptoms: SIP call stucks in PENDING state.

Solution: according to the standard, 'SIP Login' and 'SIP Authentification name' should not contain any of unescaped spaces and special symbols and should not be enclosed in angle brackets '<>'.

For example, this is not allowed by the standard

Code Block
languagejs
themeRDark
sipLogin='Ralf C12441@host.com'
sipAuthenticationName='Ralf C'
sipPassword='demo'
sipVisibleName='null'

and this is allowed

Code Block
languagejs
themeRDark
sipLogin='Ralf_C12441'
sipAuthenticationName='Ralf_C'
sipPassword='demo'
sipVisibleName='Ralf C'

2. There are some problems with sound while SIP calls from Edge browser.

Symptoms:

a) The outgoing sound is sometimes abruptly muffled, then it goes normally.

b) The incoming sound is heard only if you speak into the microphone.

Solution:

Switch SILK and G.722 codecs usage off in SIP calls for Edge browser with stripCodecs option:

Code Block
languagejs
themeRDark
var outCall = session.createCall({
    callee: $("#callee").val(),
    visibleName: $("#sipLogin").val(),
    localVideoDisplay: localDisplay,
    remoteVideoDisplay: remoteDisplay,
    constraints: constraints,
    receiveAudio: true,
    receiveVideo: false,
    stripCodecs: "silk,g722"
    ...
});

outCall.call();

or with server setting

Code Block
themeRDark
codecs_exclude_sip=g722,mpeg4-generic,flv,mpv

3. Microphone swithing does not work in Safari browser.

Symptoms: microphone does not switch using switchMic() WCS WebSDK method.

Solution: use another browser, because Safari always uses sound input microphone, that is chosen in system sound menu (hold down the option (alt) button and click on the sound icon in the menu bar). When microphone is chosen in sound menu, Mac reboot is required.

If Logitech USB camers microphone does not work (when it is chosen in sound menu), format / sample rate changing in Audio MIDI Setup and rebooting can help.

4. Outgoing video SIP call cannot be established if INVITE SDP size exceeds MTU

Symptoms: SIP server return 408 Reques timeout when trying to establish video SIP call, audio calls can be established successfully through the same server.

Solution: reduce the number of codecs in the INVITE SDP so that the SDP fit into the packet size defined by MTU (usually 1500 bytes) using the following settings

Code Block
themeRDark
codecs_exclude_sip=mpeg4-generic,flv,mpv,opus,ulaw,h264,g722,g729
allow_outside_codecs=false

Only codecs supported by both sides of the call should be left, in this case it is VP8 and PCMA (alaw).