...
Code Block | ||||
---|---|---|---|---|
| ||||
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; } |
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:
Note that in Safari browser audio only statistics can be displayed.
1. Statistics displaying during a SIP call
call.getStats() code:
...
language | js |
---|---|
theme | RDark |
...
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 | ||||
---|---|---|---|---|
| ||||
rtp_activity_detecting=false |
and turn off audio and video in outgoing call constraints for Chrome, Safari and MS Edge browsers
Code Block | ||||
---|---|---|---|---|
| ||||
var constraints = { if (stats && stats.outboundStream) { audio: false, video: false }; var outCall if= (stats.outboundStream.videoStats) {session.createCall({ callee: $("#callee").val(), $('#videoStatBytesSent').text(stats.outboundStream.videoStats.bytesSent);visibleName: $("#sipLogin").val(), constraints: constraints, $('#videoStatPacketsSent').text(stats.outboundStream.videoStats.packetsSent);... }) |
In addition to it, an empty audio stream should be created for Firefox browser:
Code Block | ||||
---|---|---|---|---|
| ||||
var constraints = { audio: false, video: $('#videoStatFramesEncoded').text(stats.outboundStream.videoStats.framesEncoded);false }; if(Browser.isFirefox()) { var audioContext = } else {new AudioContext(); var emptyAudioStream ...= audioContext.createMediaStreamDestination().stream; constraints.customStream = emptyAudioStream; } var outCall = session.createCall({ callee: $("#callee").val(), ifvisibleName: $(stats.outboundStream.audioStats) {"#sipLogin").val(), constraints: constraints, $('#audioStatBytesSent').text(stats.outboundStream.audioStats.bytesSent); . }) |
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:
Note that in Safari browser audio only statistics can be displayed.
1. Statistics displaying during a SIP call
call.getStats() code:
Code Block | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
allow_outside_codecs=false |
4. The codecs specified with stripCodecs
parameter in client application are excluded from INVITE SDP, for example:
Code Block | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
var sdpAttributes $('#audioStatPacketsSent').text(stats.outboundStream.audioStats.packetsSent); = ["b=AS:3000","b=TIAS:2500000","b=RS:1000","b=RR:3000"]; inCall.answer({ sipSDP: sdpAttributes, } else { ... }); |
Those parameters will be added to SDP after connection information ("c=IN IP4 <WCS IP>") and before time description ("t=0 0"):
Code Block | ||||
---|---|---|---|---|
| ||||
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
...
Code Block | ||||
---|---|---|---|---|
| ||||
var outCall = session.createCall({ callee: $("#callee").val(), visibleName: $("#sipLogin").val(), localVideoDisplay: localDisplay, remoteVideoDisplay: remoteDisplay, constraints: constraints, receiveAudio: true, constraintsreceiveVideo: false, stripCodecs: constraints"silk,g722" receiveAudio: true, receiveVideo: false, stripCodecs: "silk,g722" ... }); outCall.call(); |
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.
...
...
});
outCall.call(); |
or with server setting
Code Block | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
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).