From 1b5e4b17fee0185162483d14000bc5a5041f6903 Mon Sep 17 00:00:00 2001 From: flashphoner Date: Fri, 27 Sep 2013 12:56:32 +0300 Subject: [PATCH 01/35] [ADD] FPNR-371, added tel uri support. --- client/api/src/com/flashphoner/api/Flash_API.as | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/api/src/com/flashphoner/api/Flash_API.as b/client/api/src/com/flashphoner/api/Flash_API.as index ae4a0788..ba7fcdb9 100644 --- a/client/api/src/com/flashphoner/api/Flash_API.as +++ b/client/api/src/com/flashphoner/api/Flash_API.as @@ -377,6 +377,10 @@ package com.flashphoner.api if (callee.indexOf("@") == -1 || callee.indexOf("@") == callee.length-1){ return 1; } + }else if (callee.indexOf("tel:") == 0){ + if (callee.substring(4).search(reg) != -1){ + return 1; + } }else{ if (callee.search(reg) != -1){ if (callee.indexOf("@") != -1){ From e00c54c994a1e303fff11b291b18b300a6bc6a62 Mon Sep 17 00:00:00 2001 From: flashphoner Date: Fri, 27 Sep 2013 13:35:40 +0300 Subject: [PATCH 02/35] [FIX] FPNR-372, message doubles at receiving side. --- client/client/src/js/ws/Messenger.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/client/src/js/ws/Messenger.js b/client/client/src/js/ws/Messenger.js index 8d7809a9..553cedab 100644 --- a/client/client/src/js/ws/Messenger.js +++ b/client/client/src/js/ws/Messenger.js @@ -28,6 +28,11 @@ Messenger.prototype = { } else if (message.state == "IMDN_FAILED" || message.state == "IMDN_FORBIDDEN" || message.state == "IMDN_ERROR") { this.notifyDeliveryFailed(message.notificationResult); } else if (message.state == "RECEIVED") { + //here we will choose what to display on multiple contacts in "from". + if (message.from.indexOf(",") != -1) { + var fromList = message.from.split(","); + message.from = fromList[0]; + } this.notifyReceived(message, notificationResult); } }, From 5e0f29ad8bd4619378a445d48f95cab5c6bd3940 Mon Sep 17 00:00:00 2001 From: flashphoner Date: Fri, 27 Sep 2013 15:16:36 +0300 Subject: [PATCH 03/35] [ADD] FPNR-367, add msrp support to FLASH api. --- client/api/src/com/flashphoner/api/Flash_API.as | 10 ++++++++++ client/api/src/com/flashphoner/api/PhoneServerProxy.as | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/client/api/src/com/flashphoner/api/Flash_API.as b/client/api/src/com/flashphoner/api/Flash_API.as index ba7fcdb9..9d794e93 100644 --- a/client/api/src/com/flashphoner/api/Flash_API.as +++ b/client/api/src/com/flashphoner/api/Flash_API.as @@ -91,6 +91,7 @@ package com.flashphoner.api ExternalInterface.addCallback("notificationResult",notificationResult); ExternalInterface.addCallback("call",call); ExternalInterface.addCallback("callByToken",callByToken); + ExternalInterface.addCallback("msrpCall",msrpCall); ExternalInterface.addCallback("hangup",hangup); ExternalInterface.addCallback("answer",answer); ExternalInterface.addCallback("subscribe",subscribe); @@ -417,6 +418,15 @@ package com.flashphoner.api phoneServerProxy.callByToken(callObject); return 0; } + + /** + * Create new msrp call + * @param call object + **/ + public function msrpCall(callObject:Object):int{ + phoneServerProxy.msrpCall(callObject); + return 0; + } /** * Get information about logged user diff --git a/client/api/src/com/flashphoner/api/PhoneServerProxy.as b/client/api/src/com/flashphoner/api/PhoneServerProxy.as index 9293df03..03117bd9 100644 --- a/client/api/src/com/flashphoner/api/PhoneServerProxy.as +++ b/client/api/src/com/flashphoner/api/PhoneServerProxy.as @@ -116,8 +116,13 @@ package com.flashphoner.api public function callByToken(callObject:Object):void{ Logger.info("PhoneServerProxy.callByToken()"); - nc.call("call",responder, callObject); - } + nc.call("call", responder, callObject); + } + + public function msrpCall(callObject:Object):void{ + Logger.info("PhoneServerProxy.msrpCall()"); + nc.call("msrpCall", responder, callObject); + } public function disconnect():void { hasDisconnectAttempt = true; From 3ee4395de8f3f0e24762ac94b922cf219cce7aa4 Mon Sep 17 00:00:00 2001 From: flashphoner Date: Mon, 7 Oct 2013 21:59:52 +0700 Subject: [PATCH 04/35] [FIX] FPNR-382 - WCS client fallback to RTMFP doesn't work. --- client/client/src/PhoneJS.html | 2 +- client/client/src/flashphoner_js_api.mxml | 2 +- client/client/src/js/Click2Call.js | 4 ++-- client/client/src/js/FlashphonerLoader.js | 4 +++- client/client/src/js/Phone.js | 15 +++++++++------ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/client/client/src/PhoneJS.html b/client/client/src/PhoneJS.html index 22dce4fd..412d28a6 100644 --- a/client/client/src/PhoneJS.html +++ b/client/client/src/PhoneJS.html @@ -71,7 +71,7 @@ -
+
diff --git a/client/client/src/flashphoner_js_api.mxml b/client/client/src/flashphoner_js_api.mxml index cf7ad790..d37fe1f6 100644 --- a/client/client/src/flashphoner_js_api.mxml +++ b/client/client/src/flashphoner_js_api.mxml @@ -58,7 +58,7 @@ This code and accompanying materials also available under LGPL and MPL license f if (flashAPI.isInitialized()){ Logger.info("FlashAPI has been initialized"); flashAPI.initMedia(); - ExternalInterface.call("notifyFlashReady"); + ExternalInterface.call("notifyConfigLoaded"); } else{ Logger.info("Waiting flashAPI initialization..."); setTimeout(wait,500); diff --git a/client/client/src/js/Click2Call.js b/client/client/src/js/Click2Call.js index 6bc5c19a..f9b4af35 100644 --- a/client/client/src/js/Click2Call.js +++ b/client/client/src/js/Click2Call.js @@ -205,8 +205,8 @@ function addLogMessage(message) { trace('addLogMessage', message); } -function notifyFlashReady() { - trace("notifyFlashReady"); +function notifyConfigLoaded() { + trace("notifyConfigLoaded"); flashphoner = flashphonerLoader.getFlashphoner(); flashphoner_UI = flashphonerLoader.getFlashphonerUI(); if (flashphonerLoader.useWebRTC) { diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 82428a1e..33dd68cc 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -202,7 +202,7 @@ FlashphonerLoader.prototype = { me.urlServer = "ws://" + this.wcsIP + ":" + this.wsPort; me.flashphoner = new WebSocketManager(getElement('localVideoPreview'), getElement('remoteVideo')); me.flashphoner_UI = new UIManagerWebRtc(); - notifyFlashReady(); + notifyConfigLoaded(); } else { me.useWebRTC = false; me.urlServer = "rtmfp://" + this.wcsIP + ":" + this.flashPort + "/" + this.appName; @@ -221,6 +221,8 @@ FlashphonerLoader.prototype = { me.flashphoner = e.ref; me.flashphoner_UI = new UIManagerFlash(); }); + } else { + notifyFlashNotFound(); } } diff --git a/client/client/src/js/Phone.js b/client/client/src/js/Phone.js index 61abf51d..6b05de35 100644 --- a/client/client/src/js/Phone.js +++ b/client/client/src/js/Phone.js @@ -43,8 +43,6 @@ $(document).ready(function () { toLogOffState(); openConnectingView("Loading...", 0); flashphonerLoader = new FlashphonerLoader(); -// openConnectingView("You have old flash player", 0); -// trace("Download flash player from: http://get.adobe.com/flashplayer/"); }); @@ -235,7 +233,13 @@ function addLogMessage(message) { trace(message); } -function notifyFlashReady() { +function notifyFlashNotFound() { + closeConnectingView(); + getElement('phoneScreen2').innerHTML = "Get Adobe Flash player"; +} + +function notifyConfigLoaded() { + notifyReady(); flashphoner = flashphonerLoader.getFlashphoner(); flashphoner_UI = flashphonerLoader.getFlashphonerUI(); messenger = new Messenger(flashphoner); @@ -1008,9 +1012,8 @@ function close(element) { element.css('visibility', 'hidden'); } - /* --------------------- On document load we do... ------------------ */ -$(function () { +function notifyReady() { // open login view $("#loginMainButton").click(function () { @@ -1213,4 +1216,4 @@ $(function () { }); -}); +} From 554dfc77f1a6c1fb4ccdff2c0a2be43e55a0f9ec Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Tue, 8 Oct 2013 14:58:27 +0300 Subject: [PATCH 05/35] [ADD] Send SIP headers to WCS client upon Register. --- client/api/src/com/flashphoner/api/js/APINotifyJS.as | 2 +- client/client/src/js/Phone.js | 2 +- client/client/src/js/ws/WebSocketManager.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/api/src/com/flashphoner/api/js/APINotifyJS.as b/client/api/src/com/flashphoner/api/js/APINotifyJS.as index 3de2463c..a27e420d 100644 --- a/client/api/src/com/flashphoner/api/js/APINotifyJS.as +++ b/client/api/src/com/flashphoner/api/js/APINotifyJS.as @@ -32,7 +32,7 @@ package com.flashphoner.api.js ExternalInterface.call("notifyConnected"); } public function notifyRegistered(_sipObject:Object):void{ - ExternalInterface.call("notifyRegistered"); + ExternalInterface.call("notifyRegistered", _sipObject); } public function notifyBalance(balance:Number,_sipObject:Object):void{ ExternalInterface.call("notifyBalance",String(balance)); diff --git a/client/client/src/js/Phone.js b/client/client/src/js/Phone.js index 6b05de35..81a958bf 100644 --- a/client/client/src/js/Phone.js +++ b/client/client/src/js/Phone.js @@ -293,7 +293,7 @@ function notifyConnected() { //flashphoner.setSpeexQuality(10); } -function notifyRegistered() { +function notifyRegistered(sipObject) { trace("notifyRegistered"); if (registerRequired) { toLogState(); diff --git a/client/client/src/js/ws/WebSocketManager.js b/client/client/src/js/ws/WebSocketManager.js index 956f8815..c381b27e 100644 --- a/client/client/src/js/ws/WebSocketManager.js +++ b/client/client/src/js/ws/WebSocketManager.js @@ -48,7 +48,7 @@ var WebSocketManager = function (localVideoPreview, remoteVideo) { }, registered: function (sipHeader) { - notifyRegistered(); + notifyRegistered(sipHeader); }, ring: function (call, sipHeader) { From 1f8ef6b7e06a3b05fe16918c5d0b231bd88d2a43 Mon Sep 17 00:00:00 2001 From: flashphoner Date: Wed, 9 Oct 2013 14:02:08 +0700 Subject: [PATCH 06/35] WSS Support --- client/client/src/flashphoner.xml | 2 ++ client/client/src/js/FlashphonerLoader.js | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/client/client/src/flashphoner.xml b/client/client/src/flashphoner.xml index 012be828..7d859424 100644 --- a/client/client/src/flashphoner.xml +++ b/client/client/src/flashphoner.xml @@ -14,6 +14,8 @@ 192.168.1.5 8080 + 8443 + false 1935 true diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 33dd68cc..c3029213 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -61,6 +61,15 @@ FlashphonerLoader.prototype = { if (wsPort.length > 0) { this.wsPort = wsPort[0].textContent; } + var wssPort = $(xml).find("wss_port"); + if (wssPort.length > 0) { + this.wssPort = wssPort[0].textContent; + } + var useWss= $(xml).find("use_wss"); + if (useWss.length > 0) { + this.useWss = "true" == useWss[0].textContent; + } + var flashPort = $(xml).find("flash_port"); if (flashPort.length > 0) { this.flashPort = flashPort[0].textContent; @@ -199,7 +208,13 @@ FlashphonerLoader.prototype = { var me = this; if (isWebRTCAvailable) { me.useWebRTC = true; - me.urlServer = "ws://" + this.wcsIP + ":" + this.wsPort; + var protocol = "ws://"; + var port = this.wsPort; + if (this.useWss){ + protocol = "wss://"; + port = this.wssPort; + } + me.urlServer = protocol + this.wcsIP + ":" + port; me.flashphoner = new WebSocketManager(getElement('localVideoPreview'), getElement('remoteVideo')); me.flashphoner_UI = new UIManagerWebRtc(); notifyConfigLoaded(); From 4a4f5e4e821718ae1ea71688cae173a3ded295ce Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Fri, 11 Oct 2013 18:08:58 +0300 Subject: [PATCH 07/35] [ADD] FPNR-374 - add config property to force WebRTC or flash API. --- client/client/src/js/FlashphonerLoader.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 33dd68cc..e2fa034e 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -156,6 +156,21 @@ FlashphonerLoader.prototype = { } } + //variable participating in api load, can bee null, webrtc, flash + var streamingType = $(xml).find("streaming"); + if (streamingType.length > 0) { + if (streamingType.text() == "webrtc") { + console.log("Force WebRTC usage!"); + isWebRTCAvailable = true; + } else if (streamingType.text() == "flash") { + console.log("Force Flash usage!"); + isWebRTCAvailable = false; + } else { + console.log("Bad streaming property " + streamingType.text() + + ", can be wertc or flash. Using default behaviour!") + } + } + //get load balancer url if load balancing enabled if (me.loadBalancerUrl != null) { trace("Retrieve server url from load balancer"); From 24812b813fe79e5cfc5e9d07f6924931c317c002 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Tue, 15 Oct 2013 18:45:43 +0300 Subject: [PATCH 08/35] [FIX] Fallback client support in Safari. --- client/client/src/js/FlashphonerLoader.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 98ae5d36..8166656a 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -241,7 +241,12 @@ FlashphonerLoader.prototype = { params.swliveconnect = "true"; params.allowfullscreen = "true"; params.allowscriptaccess = "always"; - params.wmode = "transparent"; + //in case of Safari wmode should be "window" + if((navigator.userAgent.indexOf("Safari") > -1) && !(navigator.userAgent.indexOf("Chrome") > -1)) { + params.wmode = "window"; + } else { + params.wmode = "transparent"; + } var attributes = {}; var flashvars = {}; flashvars.config = "flashphoner.xml"; From 7532b6d7daaa64bca31b1a02fe1a54c5f819caf1 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 16 Oct 2013 12:48:11 +0300 Subject: [PATCH 09/35] [FIX] Fixed Caller-ID display information. --- client/client/src/js/Phone.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/client/src/js/Phone.js b/client/client/src/js/Phone.js index 81a958bf..4fc07444 100644 --- a/client/client/src/js/Phone.js +++ b/client/client/src/js/Phone.js @@ -787,7 +787,10 @@ function closeInfoView(timeout) { function openIncomingView(call) { trace("openIncomingView", call)// call.caller, call.visibleNameCaller - var displayedCaller = call.caller + " '" + call.visibleNameCaller + "'"; + //form Caller-ID information displayed to user + var displayedCaller = ""; + if (call.caller !== undefined) displayedCaller += call.caller; + if (call.visibleNameCaller !== undefined) displayedCaller += " '" + call.visibleNameCaller + "'"; $('#incomingDiv').show(); $('#callerField').html(displayedCaller); From 4af24589cb63b68e8200da0920691c99a1e488d1 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 16 Oct 2013 14:16:33 +0300 Subject: [PATCH 10/35] [FIX] Stop ringing sound. --- client/client/src/js/ws/WebSocketManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client/src/js/ws/WebSocketManager.js b/client/client/src/js/ws/WebSocketManager.js index c381b27e..cd8bbee0 100644 --- a/client/client/src/js/ws/WebSocketManager.js +++ b/client/client/src/js/ws/WebSocketManager.js @@ -62,7 +62,7 @@ var WebSocketManager = function (localVideoPreview, remoteVideo) { setRemoteSDP: function (call, sdp, isInitiator, sipHeader) { proccessCall(call); - //this.stopSound("RING"); + this.stopSound("RING"); rtcManager.setRemoteSDP(sdp, isInitiator); if (!isInitiator && rtcManager.getConnectionState() == "established") { me.answer(call.id); From f5330347e188bc14b6fcb47058601553e9d8dd14 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 16 Oct 2013 17:00:57 +0300 Subject: [PATCH 11/35] [ADD] Service messages filter. --- client/client/src/js/ws/Messenger.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/client/src/js/ws/Messenger.js b/client/client/src/js/ws/Messenger.js index 553cedab..10eab6c0 100644 --- a/client/client/src/js/ws/Messenger.js +++ b/client/client/src/js/ws/Messenger.js @@ -33,7 +33,12 @@ Messenger.prototype = { var fromList = message.from.split(","); message.from = fromList[0]; } - this.notifyReceived(message, notificationResult); + //Don't show service message to user + if (message.contentType.toLowerCase() == "message/fsservice+xml") { + console.log("Received service message"); + } else { + this.notifyReceived(message, notificationResult); + } } }, From 401c7a4c4a8dc83c08b98a78d7dd7b12d41e60b3 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Thu, 17 Oct 2013 11:27:04 +0300 Subject: [PATCH 12/35] [ADD] Added new content type for service messages. --- client/client/src/js/ws/Messenger.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client/src/js/ws/Messenger.js b/client/client/src/js/ws/Messenger.js index 10eab6c0..b09f528b 100644 --- a/client/client/src/js/ws/Messenger.js +++ b/client/client/src/js/ws/Messenger.js @@ -34,7 +34,7 @@ Messenger.prototype = { message.from = fromList[0]; } //Don't show service message to user - if (message.contentType.toLowerCase() == "message/fsservice+xml") { + if (message.contentType.toLowerCase() == "message/fsservice+xml" || message.contentType.toLowerCase() == "application/fsservice+xml") { console.log("Received service message"); } else { this.notifyReceived(message, notificationResult); From 1917136b6b63dff7eb39a654ef420304af9da1cb Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Thu, 17 Oct 2013 12:15:10 +0300 Subject: [PATCH 13/35] [ADD] FPNR-396, Add client side settings msg_content_type --- client/client/src/js/FlashphonerLoader.js | 8 ++++++++ client/client/src/js/Phone.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 8166656a..0b8ab419 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -35,6 +35,7 @@ FlashphonerLoader = function (config) { this.subscribeEvent = "reg"; this.contactParams = null; this.imdnEnabled = false; + this.msgContentType = "text/plain"; $.ajax({ @@ -165,6 +166,13 @@ FlashphonerLoader.prototype = { } } + //Message content type by default "text/plain", can be "message/cpim" + var msgContentType = $(xml).find("msg_content_type"); + if (msgContentType.length > 0) { + this.msgContentType = msgContentType.text(); + console.log("Message content type: " + this.msgContentType); + } + //variable participating in api load, can bee null, webrtc, flash var streamingType = $(xml).find("streaming"); if (streamingType.length > 0) { diff --git a/client/client/src/js/Phone.js b/client/client/src/js/Phone.js index 4fc07444..9b3fe28c 100644 --- a/client/client/src/js/Phone.js +++ b/client/client/src/js/Phone.js @@ -955,7 +955,7 @@ function createChat(calleeName) { $('#chat' + calleeNameId + ' .messageSend').click(function () { var fullCalleeName = $(this).parent().attr('fullCalleeName'); //parse id of current chatBox, take away chat word from the beginning var messageText = $(this).prev().val(); //parse text from input - sendMessage(calleeName, messageText, 'text/plain'); //send message + sendMessage(calleeName, messageText, flashphonerLoader.msgContentType); //send message $(this).prev().val(''); //clear message input }); From 554d40a68655727914d842a9aeb1b87a7c6db73d Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 23 Oct 2013 14:15:58 +0300 Subject: [PATCH 14/35] [FIX] Load balancer does not work. --- client/client/src/js/FlashphonerLoader.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 0b8ab419..4c14e75d 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -198,7 +198,7 @@ FlashphonerLoader.prototype = { */ setTimeout(function () { //check status of ajax request - if (!this.jsonpSuccess) { + if (!me.jsonpSuccess) { trace("Error occurred while retrieving load balancer data, please check your load balancer url " + me.loadBalancerUrl); me.loadAPI(); @@ -211,10 +211,10 @@ FlashphonerLoader.prototype = { dataType: "jsonp", data: loadBalancerData, success: function (loadBalancerData) { - this.wcsIP = loadBalancerData.server; - this.wsPort = loadBalancerData.ws; - this.flashPort = loadBalancerData.flash; - this.jsonpSuccess = true; + me.wcsIP = loadBalancerData.server; + me.wsPort = loadBalancerData.ws; + me.flashPort = loadBalancerData.flash; + me.jsonpSuccess = true; trace("Connection data from load balancer: " + "wcsIP " + loadBalancerData.server + ", wsPort " + loadBalancerData.ws From cef0e2915d19601559493c20b936567872c9c6ee Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Mon, 28 Oct 2013 17:27:13 +0200 Subject: [PATCH 15/35] [ADD] FPNR-409, Add wss port to load balancer response. --- client/client/src/js/FlashphonerLoader.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 4c14e75d..4973de00 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -184,7 +184,7 @@ FlashphonerLoader.prototype = { isWebRTCAvailable = false; } else { console.log("Bad streaming property " + streamingType.text() + - ", can be wertc or flash. Using default behaviour!") + ", can be webrtc or flash. Using default behaviour!") } } @@ -213,11 +213,13 @@ FlashphonerLoader.prototype = { success: function (loadBalancerData) { me.wcsIP = loadBalancerData.server; me.wsPort = loadBalancerData.ws; + me.wssPort = loadBalancerData.wss; me.flashPort = loadBalancerData.flash; me.jsonpSuccess = true; trace("Connection data from load balancer: " + "wcsIP " + loadBalancerData.server + ", wsPort " + loadBalancerData.ws + + ", wssPort " + loadBalancerData.wss + ", flashPort " + loadBalancerData.flash); me.loadAPI(); } From 68964a81ec58acd60904bcac79bdbd2317e6bb8b Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 30 Oct 2013 19:05:40 +0700 Subject: [PATCH 16/35] [FIX] MCN processing, added unit tests --- client/client/src/PhoneJS.html | 6 +++++ client/client/src/js/Phone.js | 33 ++++++++++++++++++++----- client/client/src/js/UnitTests.js | 10 ++++++++ client/client/src/styles/style_html.css | 25 ++++++++++++++++--- 4 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 client/client/src/js/UnitTests.js diff --git a/client/client/src/PhoneJS.html b/client/client/src/PhoneJS.html index 412d28a6..f573b77d 100644 --- a/client/client/src/PhoneJS.html +++ b/client/client/src/PhoneJS.html @@ -29,6 +29,7 @@ + Phone @@ -216,5 +217,10 @@ + +
Test +
+ + diff --git a/client/client/src/js/Phone.js b/client/client/src/js/Phone.js index 9b3fe28c..f210b48a 100644 --- a/client/client/src/js/Phone.js +++ b/client/client/src/js/Phone.js @@ -553,21 +553,38 @@ function notifyMessageReceived(messageObject) { function convertMessageBody(messageBody, contentType) { trace("convertMessageBody " + contentType); if (contentType == "application/fsservice+xml") { + var missedCallNotification; var xml = $.parseXML(messageBody); var fsService = $(xml).find("fs-services").find("fs-service"); var action = fsService.attr("action"); if (action == "servicenoti-indicate") { - var cawData = fsService.find("caw").find("caw-data"); - if (cawData) { - var sender = $(cawData).attr("sender"); - trace("cawData: " + sender); - return "Missed call " + sender; + var caw = parseMsn(fsService,"caw"); + if (!!caw){ + missedCallNotification = caw; + }else{ + missedCallNotification = parseMsn(fsService,"mcn"); } + return missedCallNotification; } } - return messageBody; +} +function parseMsn(fsService,mcn){ + trace("parseMcn: "+mcn); + var caw = fsService.find(mcn); + var ret = null; + if (!!caw){ + var cawData = caw.find(mcn+"-data"); + if (!!cawData) { + var sender = $(cawData).attr("sender"); + if (!!sender){ + trace("Missed call: " + sender); + ret = "Missed call from " + sender; + } + } + } + return ret; } function addMessageToChat(chatDiv, from, body, className, messageId) { @@ -1153,6 +1170,10 @@ function notifyReady() { } }); + $(".testButton").click(function () { + startUnitTests(); + }); + // this function set changing in button styles when you press any button $(".button").mousedown(function () { $(this).addClass('pressed'); diff --git a/client/client/src/js/UnitTests.js b/client/client/src/js/UnitTests.js new file mode 100644 index 00000000..6c974f0e --- /dev/null +++ b/client/client/src/js/UnitTests.js @@ -0,0 +1,10 @@ +function startUnitTests() { + testConvertMessageBody(); +} + +function testConvertMessageBody(){ + var messageBody=""; + var contentType="application/fsservice+xml"; + var res = convertMessageBody(messageBody,contentType); + trace("testConvertMessageBody "+res); +} \ No newline at end of file diff --git a/client/client/src/styles/style_html.css b/client/client/src/styles/style_html.css index 2306d584..b95d25f7 100644 --- a/client/client/src/styles/style_html.css +++ b/client/client/src/styles/style_html.css @@ -168,10 +168,10 @@ input::-webkit-input-placeholder { opacity: 1; } .transferButton, .holdButton { - top: 97px; - width: 14px; - height: 14px; -} + top: 97px; + width: 14px; + height: 14px; + } .closeButton { background: url(../assets/close.png); right: 3px; @@ -185,6 +185,7 @@ input::-webkit-input-placeholder { right: 27px; visibility:hidden; } + .holdImage { background: url(../assets/hold_big.png); right: 55px; @@ -407,6 +408,22 @@ input::-webkit-input-placeholder { margin: 10px 0 0 15px; width: 80px; } + +#testButton { + position: absolute; + top: 330px; + left: 250px; + height: 20px; + width: 80px; + float: left; + background-color: green; + font: 14px Courier; + color: #ffffff; + padding: 1px; + visibility: hidden; + text-align: center; +} + /* ------------ Video + Security settings view -------------- */ #video_requestUnmuteDiv { top: 32px; From 3c7b5a9546fb586f75da49dd62abb4066bc52c1e Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 30 Oct 2013 17:42:04 +0200 Subject: [PATCH 17/35] [ADD] FPNR-417, add SDP filter. --- client/client/src/flashphoner.xml | 2 + client/client/src/js/FlashphonerLoader.js | 11 +++- client/client/src/js/ws/WebSocketManager.js | 62 +++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/client/client/src/flashphoner.xml b/client/client/src/flashphoner.xml index 7d859424..c3e6b7a8 100644 --- a/client/client/src/flashphoner.xml +++ b/client/client/src/flashphoner.xml @@ -24,6 +24,8 @@ 144 true true + CN + ISAC diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 4973de00..3cf193a6 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -36,7 +36,7 @@ FlashphonerLoader = function (config) { this.contactParams = null; this.imdnEnabled = false; this.msgContentType = "text/plain"; - + this.stripCodecs = new Array(); $.ajax({ type: "GET", @@ -173,6 +173,14 @@ FlashphonerLoader.prototype = { console.log("Message content type: " + this.msgContentType); } + var stripCodecs = $(xml).find("strip_codec"); + if (stripCodecs.length > 0) { + for (i = 0; i < stripCodecs.length; i++) { + if (stripCodecs[i].textContent.length) this.stripCodecs[i] = stripCodecs[i].textContent; + console.log("Codec " + stripCodecs[i].textContent + " will be removed from SDP!"); + } + } + //variable participating in api load, can bee null, webrtc, flash var streamingType = $(xml).find("streaming"); if (streamingType.length > 0) { @@ -241,6 +249,7 @@ FlashphonerLoader.prototype = { } me.urlServer = protocol + this.wcsIP + ":" + port; me.flashphoner = new WebSocketManager(getElement('localVideoPreview'), getElement('remoteVideo')); + if (me.stripCodecs.length) me.flashphoner.setStripCodecs(me.stripCodecs); me.flashphoner_UI = new UIManagerWebRtc(); notifyConfigLoaded(); } else { diff --git a/client/client/src/js/ws/WebSocketManager.js b/client/client/src/js/ws/WebSocketManager.js index cd8bbee0..db6022c8 100644 --- a/client/client/src/js/ws/WebSocketManager.js +++ b/client/client/src/js/ws/WebSocketManager.js @@ -5,6 +5,7 @@ var WebSocketManager = function (localVideoPreview, remoteVideo) { me.configLoaded = false; me.webRtcMediaManager = new WebRtcMediaManager(localVideoPreview, remoteVideo); me.soundControl = new SoundControl(); + me.stripCodecs = new Array(); var rtcManager = this.webRtcMediaManager; var proccessCall = function (call) { for (var i in me.calls) { @@ -187,6 +188,11 @@ WebSocketManager.prototype = { openInfoView("Configuring WebRTC connection...", 0, 60); this.webRtcMediaManager.createOffer(function (sdp) { closeInfoView(); + //here we will strip codecs from SDP if requested + if (me.stripCodecs.length) { + sdp = me.stripCodecsSDP(sdp); + console.log("New SDP: " + sdp); + } callRequest.sdp = sdp; me.webSocket.send("call", callRequest); }, false); @@ -312,6 +318,62 @@ WebSocketManager.prototype = { notificationResult: function (result) { this.webSocket.send("notificationResult",result); + }, + + setStripCodecs: function (array) { + this.stripCodecs = array; + }, + + stripCodecsSDP: function (sdp) { + var sdpArray = sdp.split("\n"); + console.dir(this.stripCodecs); + + //search and delete codecs line + var pt = []; + for (p = 0; p < this.stripCodecs.length; p++) { + console.log("Searching for codec " + this.stripCodecs[p]); + for (i = 0; i < sdpArray.length; i++) { + if (sdpArray[i].search(this.stripCodecs[p]) != -1) { + console.log(this.stripCodecs[p] + " detected"); + pt.push(sdpArray[i].match(/[0-9]+/)[0]); + sdpArray[i] = ""; + } + } + } + + if (pt.length) { + //searching for fmtp + for (p = 0; p < pt.length; p++) { + for (i = 0; i < sdpArray.length; i++){ + if (sdpArray[i].search("a=fmtp:"+pt[p]) != -1) { + console.log("PT "+pt[p]+" detected"); + sdpArray[i] = ""; + } + } + } + + //delete entries from m= line + for (i = 0; i < sdpArray.length; i++) { + if (sdpArray[i].search("m=audio") != -1) { + console.log("m line detected " + sdpArray[i]); + for (p = 0; p < pt.length; p++) { + sdpArray[i] = sdpArray[i].replace(" "+pt[p], ""); + } + console.log("Resulting m= line is: " + sdpArray[i]); + break; + } + } + } + + //normalize sdp after modifications + var result = ""; + for (i = 0; i < sdpArray.length; i++) { + if (sdpArray[i] != "") { + result += sdpArray[i] + "\n"; + } + } + + return result; } }; From 1f940c1ccb6287a84f50268cd9fe10a8dabdb444 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 30 Oct 2013 17:43:28 +0200 Subject: [PATCH 18/35] Removed from default flashphoner.xml --- client/client/src/flashphoner.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/client/src/flashphoner.xml b/client/client/src/flashphoner.xml index c3e6b7a8..7d859424 100644 --- a/client/client/src/flashphoner.xml +++ b/client/client/src/flashphoner.xml @@ -24,8 +24,6 @@ 144 true true - CN - ISAC From 5e5fb28224a75fc89d007b101fc7bc29b99da98d Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Thu, 31 Oct 2013 13:07:09 +0200 Subject: [PATCH 19/35] [ADD] Added sdp filter to callByToken function. --- client/client/src/js/FlashphonerLoader.js | 9 +++++---- client/client/src/js/ws/WebSocketManager.js | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 3cf193a6..6194d66d 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -173,11 +173,12 @@ FlashphonerLoader.prototype = { console.log("Message content type: " + this.msgContentType); } - var stripCodecs = $(xml).find("strip_codec"); + var stripCodecs = $(xml).find("strip_codecs"); if (stripCodecs.length > 0) { - for (i = 0; i < stripCodecs.length; i++) { - if (stripCodecs[i].textContent.length) this.stripCodecs[i] = stripCodecs[i].textContent; - console.log("Codec " + stripCodecs[i].textContent + " will be removed from SDP!"); + var tempCodecs = stripCodecs[0].textContent.split(","); + for (i = 0; i < tempCodecs.length; i++) { + if (tempCodecs[i].length) this.stripCodecs[i] = tempCodecs[i]; + console.log("Codec " + tempCodecs[i] + " will be removed from SDP!"); } } diff --git a/client/client/src/js/ws/WebSocketManager.js b/client/client/src/js/ws/WebSocketManager.js index db6022c8..c3a5d12b 100644 --- a/client/client/src/js/ws/WebSocketManager.js +++ b/client/client/src/js/ws/WebSocketManager.js @@ -163,6 +163,11 @@ WebSocketManager.prototype = { openInfoView("Configuring WebRTC connection...", 0); this.webRtcMediaManager.createOffer(function (sdp) { closeInfoView(); + //here we will strip codecs from SDP if requested + if (me.stripCodecs.length) { + sdp = me.stripCodecsSDP(sdp); + console.log("New SDP: " + sdp); + } callRequest.sdp = sdp; me.webSocket.send("call", callRequest); }, false); From da3b875aee25be75d200409613ed76835dac4fbf Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Mon, 4 Nov 2013 19:19:48 +0200 Subject: [PATCH 20/35] [ADD] Added ability to change stun server address in flashphoner.xml --- client/client/src/js/FlashphonerLoader.js | 9 +++++++++ client/client/src/js/rtc/WebRtcMediaManager.js | 9 +++++++-- client/client/src/js/ws/WebSocketManager.js | 4 ++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 6194d66d..0bc637c9 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -37,6 +37,7 @@ FlashphonerLoader = function (config) { this.imdnEnabled = false; this.msgContentType = "text/plain"; this.stripCodecs = new Array(); + this.stunServer = ""; $.ajax({ type: "GET", @@ -182,6 +183,13 @@ FlashphonerLoader.prototype = { } } + //stun server address + var stunServer = $(xml).find("stun_server"); + if (stunServer.length > 0) { + this.stunServer = stunServer.text(); + console.log("Stun server: " + this.stunServer); + } + //variable participating in api load, can bee null, webrtc, flash var streamingType = $(xml).find("streaming"); if (streamingType.length > 0) { @@ -251,6 +259,7 @@ FlashphonerLoader.prototype = { me.urlServer = protocol + this.wcsIP + ":" + port; me.flashphoner = new WebSocketManager(getElement('localVideoPreview'), getElement('remoteVideo')); if (me.stripCodecs.length) me.flashphoner.setStripCodecs(me.stripCodecs); + if (me.stunServer != "") me.flashphoner.setStunServer(me.stunServer); me.flashphoner_UI = new UIManagerWebRtc(); notifyConfigLoaded(); } else { diff --git a/client/client/src/js/rtc/WebRtcMediaManager.js b/client/client/src/js/rtc/WebRtcMediaManager.js index cbc88fbe..0f2d4898 100644 --- a/client/client/src/js/rtc/WebRtcMediaManager.js +++ b/client/client/src/js/rtc/WebRtcMediaManager.js @@ -7,6 +7,8 @@ var WebRtcMediaManager = function (localVideoPreview, remoteVideo, hasVideo) { me.remoteVideo = remoteVideo; me.localVideo = localVideoPreview; me.isMuted = 1; + //stun server by default + me.stunServer = "stun.l.google.com:19302"; }; WebRtcMediaManager.prototype.init = function () { @@ -38,11 +40,11 @@ WebRtcMediaManager.prototype.createPeerConnection = function () { var application = this; if (webrtcDetectedBrowser == "firefox") { pc_config = {"iceServers": [ - {"url": "stun:23.21.150.121"} + {"url": "stun:" + application.stunServer} ]}; } else { pc_config = {"iceServers": [ - {"url": "stun:stun.l.google.com:19302"} + {"url": "stun:" + application.stunServer} ]}; } this.peerConnection = new RTCPeerConnection(pc_config, {"optional": [ @@ -370,6 +372,9 @@ WebRtcMediaManager.prototype.onCreateAnswerSuccessCallback = function (answer) { } }; +WebRtcMediaManager.prototype.setStunServer = function (server) { + this.stunServer = server; +} WebRtcMediaManager.prototype.onCreateAnswerErrorCallback = function (error) { console.error("WebRtcMediaManager:onCreateAnswerErrorCallback(): error: " + error); diff --git a/client/client/src/js/ws/WebSocketManager.js b/client/client/src/js/ws/WebSocketManager.js index c3a5d12b..500aab8e 100644 --- a/client/client/src/js/ws/WebSocketManager.js +++ b/client/client/src/js/ws/WebSocketManager.js @@ -379,6 +379,10 @@ WebSocketManager.prototype = { } return result; + }, + + setStunServer: function(server) { + this.webRtcMediaManager.setStunServer(server); } }; From a54699dd48b9bd3d24e13a8a52cdf26f752a75d2 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 6 Nov 2013 17:42:57 +0200 Subject: [PATCH 21/35] [ADD] MCN status notification display. --- client/client/src/js/Phone.js | 5 ++++- client/client/src/js/UnitTests.js | 5 +++-- client/client/src/js/ws/Messenger.js | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/client/src/js/Phone.js b/client/client/src/js/Phone.js index f210b48a..7776698b 100644 --- a/client/client/src/js/Phone.js +++ b/client/client/src/js/Phone.js @@ -564,8 +564,11 @@ function convertMessageBody(messageBody, contentType) { }else{ missedCallNotification = parseMsn(fsService,"mcn"); } - return missedCallNotification; + } else if (action == "serviceinfo-confirm") { + //service status confirmation + missedCallNotification = "Service status: " + $(fsService.find("mcn").find("mcn-data")).attr("status"); } + if(missedCallNotification !== undefined) return missedCallNotification; } return messageBody; } diff --git a/client/client/src/js/UnitTests.js b/client/client/src/js/UnitTests.js index 6c974f0e..9cd05562 100644 --- a/client/client/src/js/UnitTests.js +++ b/client/client/src/js/UnitTests.js @@ -3,8 +3,9 @@ function startUnitTests() { } function testConvertMessageBody(){ - var messageBody=""; + //var messageBody=""; + var messageBody="" var contentType="application/fsservice+xml"; var res = convertMessageBody(messageBody,contentType); trace("testConvertMessageBody "+res); -} \ No newline at end of file +} diff --git a/client/client/src/js/ws/Messenger.js b/client/client/src/js/ws/Messenger.js index b09f528b..10eab6c0 100644 --- a/client/client/src/js/ws/Messenger.js +++ b/client/client/src/js/ws/Messenger.js @@ -34,7 +34,7 @@ Messenger.prototype = { message.from = fromList[0]; } //Don't show service message to user - if (message.contentType.toLowerCase() == "message/fsservice+xml" || message.contentType.toLowerCase() == "application/fsservice+xml") { + if (message.contentType.toLowerCase() == "message/fsservice+xml") { console.log("Received service message"); } else { this.notifyReceived(message, notificationResult); From 1005bf7f11dd0f696a2177fa6ee791c6be9de258 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Fri, 8 Nov 2013 23:38:22 +0700 Subject: [PATCH 22/35] Added registerRequired property --- client/client/src/js/FlashphonerLoader.js | 2 +- client/client/src/js/Phone.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 0bc637c9..2e333cce 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -22,7 +22,7 @@ FlashphonerLoader = function (config) { this.loadBalancerUrl = null; this.jsonpSuccess = false; this.token = null; - this.registerRequired = false; + this.registerRequired = true; this.videoWidth = 320; this.videoHeight = 240; this.pushLogEnabled = false; diff --git a/client/client/src/js/Phone.js b/client/client/src/js/Phone.js index 7776698b..2a616193 100644 --- a/client/client/src/js/Phone.js +++ b/client/client/src/js/Phone.js @@ -62,6 +62,7 @@ function login() { loginObject.outboundProxy = $('#outbound_proxy').val(); loginObject.port = $('#port').val(); loginObject.useProxy = $('#checkboxUseProxy').attr("checked") ? true : false; + loginObject.registerRequired = flashphonerLoader.registerRequired; if (flashphonerLoader.contactParams != null && flashphonerLoader.contactParams.length != 0) { loginObject.contactParams = flashphonerLoader.contactParams; } From 4c7181bddbe2aab194fa77e28daf11f42793e40c Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Fri, 8 Nov 2013 23:59:55 +0700 Subject: [PATCH 23/35] Minor fix for previous commit --- client/client/src/js/FlashphonerLoader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 2e333cce..378c39e1 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -90,7 +90,7 @@ FlashphonerLoader.prototype = { } var registerRequired = $(xml).find("register_required"); if (registerRequired.length > 0) { - this.registerRequired = registerRequired[0].textContent; + this.registerRequired = (registerRequired[0].textContent === "true"); } var videoWidth = $(xml).find("video_width"); if (videoWidth.length > 0) { From a37a0a1d8efd3eca2ca559d0415368e5a9766faa Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Mon, 11 Nov 2013 18:46:27 +0200 Subject: [PATCH 24/35] [FIX] FPNR-403, Safari, flash settings panel remains after access granted. --- client/client/src/js/FlashphonerLoader.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index 378c39e1..f4138000 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -273,6 +273,8 @@ FlashphonerLoader.prototype = { //in case of Safari wmode should be "window" if((navigator.userAgent.indexOf("Safari") > -1) && !(navigator.userAgent.indexOf("Chrome") > -1)) { params.wmode = "window"; + //workaround for safari browser, FPNR-403 + swfobject.switchOffAutoHideShow(); } else { params.wmode = "transparent"; } From db3249957093269354e77f7988c8fd6f138118b1 Mon Sep 17 00:00:00 2001 From: flashphoner Date: Wed, 13 Nov 2013 19:05:58 +0600 Subject: [PATCH 25/35] [FIX] FPNR-432 - Bad SDP from WebRTC client --- client/client/src/js/ws/WebSocketManager.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/client/src/js/ws/WebSocketManager.js b/client/client/src/js/ws/WebSocketManager.js index 500aab8e..c1d4650a 100644 --- a/client/client/src/js/ws/WebSocketManager.js +++ b/client/client/src/js/ws/WebSocketManager.js @@ -338,7 +338,7 @@ WebSocketManager.prototype = { for (p = 0; p < this.stripCodecs.length; p++) { console.log("Searching for codec " + this.stripCodecs[p]); for (i = 0; i < sdpArray.length; i++) { - if (sdpArray[i].search(this.stripCodecs[p]) != -1) { + if (sdpArray[i].search(this.stripCodecs[p]) != -1 && sdpArray[i].indexOf("a=rtpmap") == 0) { console.log(this.stripCodecs[p] + " detected"); pt.push(sdpArray[i].match(/[0-9]+/)[0]); sdpArray[i] = ""; @@ -361,9 +361,14 @@ WebSocketManager.prototype = { for (i = 0; i < sdpArray.length; i++) { if (sdpArray[i].search("m=audio") != -1) { console.log("m line detected " + sdpArray[i]); - for (p = 0; p < pt.length; p++) { - sdpArray[i] = sdpArray[i].replace(" "+pt[p], ""); + var mLineSplitted = sdpArray[i].split(" "); + var newMLine = ""; + for (m = 0; m < mLineSplitted.length; m++) { + if (pt.indexOf(mLineSplitted[m]) == -1 || m <= 2){ + newMLine += " " + mLineSplitted[m]; + } } + sdpArray[i] = newMLine.substr(1); console.log("Resulting m= line is: " + sdpArray[i]); break; } From 0f3b95d12fb7d615826a83fcc87f043d3b0523fa Mon Sep 17 00:00:00 2001 From: flashphoner Date: Mon, 25 Nov 2013 11:38:16 +0600 Subject: [PATCH 26/35] [ADD] Logs on close peerconnection --- client/client/src/js/rtc/WebRtcMediaManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/client/src/js/rtc/WebRtcMediaManager.js b/client/client/src/js/rtc/WebRtcMediaManager.js index 0f2d4898..0501922e 100644 --- a/client/client/src/js/rtc/WebRtcMediaManager.js +++ b/client/client/src/js/rtc/WebRtcMediaManager.js @@ -25,9 +25,10 @@ WebRtcMediaManager.prototype.close = function () { if (this.peerConnectionState != 'finished') { this.peerConnectionState = 'finished'; if (this.peerConnection) { + console.debug("WebRtcMediaManager:PeerConnection will be closed"); + this.peerConnection.close(); this.remoteVideo.pause(); this.remoteVideo.src = null; - this.peerConnection.close(); } } else { console.log("peerConnection already closed, do nothing!"); From 90881266c29346239c67e6b993a4a300548040bf Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Tue, 3 Dec 2013 02:45:47 +0700 Subject: [PATCH 27/35] Fixed subscribe_event setting --- client/client/src/js/FlashphonerLoader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client/src/js/FlashphonerLoader.js b/client/client/src/js/FlashphonerLoader.js index f4138000..cda20c63 100644 --- a/client/client/src/js/FlashphonerLoader.js +++ b/client/client/src/js/FlashphonerLoader.js @@ -32,7 +32,7 @@ FlashphonerLoader = function (config) { this.finishSound = "sounds/HANGUP.ogg"; this.xcapUrl = null; this.msrpCallee = null; - this.subscribeEvent = "reg"; + this.subscribeEvent = null; this.contactParams = null; this.imdnEnabled = false; this.msgContentType = "text/plain"; From 14a512b2c761483ad8b8baff5e006b146e3b47b0 Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 4 Dec 2013 18:42:46 +0700 Subject: [PATCH 28/35] Default STUN server is removed to speed up WebRTC connection --- client/client/src/js/rtc/WebRtcMediaManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/client/src/js/rtc/WebRtcMediaManager.js b/client/client/src/js/rtc/WebRtcMediaManager.js index 0501922e..63bd1635 100644 --- a/client/client/src/js/rtc/WebRtcMediaManager.js +++ b/client/client/src/js/rtc/WebRtcMediaManager.js @@ -8,7 +8,8 @@ var WebRtcMediaManager = function (localVideoPreview, remoteVideo, hasVideo) { me.localVideo = localVideoPreview; me.isMuted = 1; //stun server by default - me.stunServer = "stun.l.google.com:19302"; + //commented to speedup WebRTC call establishment + //me.stunServer = "stun.l.google.com:19302"; }; WebRtcMediaManager.prototype.init = function () { From 7a79bee5ea092c844b2a1de61cf86c625a51cf2a Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Sun, 8 Dec 2013 19:29:31 +0700 Subject: [PATCH 29/35] Added debug logs --- client/client/src/js/Phone.js | 4 ++++ .../client/src/js/rtc/WebRtcMediaManager.js | 21 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/client/client/src/js/Phone.js b/client/client/src/js/Phone.js index 2a616193..ae7a0a58 100644 --- a/client/client/src/js/Phone.js +++ b/client/client/src/js/Phone.js @@ -376,6 +376,7 @@ function notifyBalance(balance) { function notify(call) { trace("notify", call); //: callId " + call.id + " --- " + call.anotherSideUser); if (currentCall.id == call.id) { //if we have some call now and notify is about exactly our call + trace("currentCall.id == call.id "+call.id); currentCall = call; if (call.state == STATE_FINISH) { // if that hangup during transfer procedure? @@ -406,6 +407,7 @@ function notify(call) { flashphoner.playSound("BUSY"); } } else if (holdedCall.id == call.id) { + trace("holdedCall.id == call.id "+call.id); if (call.state == STATE_FINISH) { /* that mean if - user1 call user2 @@ -637,8 +639,10 @@ function notifyAddCall(call) { trace("notifyAddCall", call); // call.id, call.anotherSideUser if (currentCall != null && call.incoming == true) { + trace("currentCall != null && call.incoming == true"); hangup(call.id); } else if (currentCall != null && call.incoming == false) { + trace("currentCall != null && call.incoming == false"); holdedCall = currentCall; currentCall = call; createCallView(currentCall); diff --git a/client/client/src/js/rtc/WebRtcMediaManager.js b/client/client/src/js/rtc/WebRtcMediaManager.js index 63bd1635..fbc26fbf 100644 --- a/client/client/src/js/rtc/WebRtcMediaManager.js +++ b/client/client/src/js/rtc/WebRtcMediaManager.js @@ -13,6 +13,7 @@ var WebRtcMediaManager = function (localVideoPreview, remoteVideo, hasVideo) { }; WebRtcMediaManager.prototype.init = function () { + console.debug("WebRtcMediaManager.init"); var me = this; me.hasVideo = false; @@ -153,20 +154,26 @@ WebRtcMediaManager.prototype.createOffer = function (createOfferCallback, hasVid var me = this; try { if (me.getConnectionState() != "established") { + console.debug("Connection state is not established. Initializing..."); me.init(); } function create() { + console.debug("Creating offer..."); if (me.peerConnection == null) { + console.debug("peerConnection is null"); me.createPeerConnection(); me.peerConnection.addStream(me.localAudioStream); } else { + console.debug("peerConnection is not null"); if (hasVideo) { + console.debug("hasVideo"); if (me.localAudioStream) { //me.peerConnection.removeStream(me.localAudioStream); } me.peerConnection.addStream(me.localAudioVideoStream); me.hasVideo = true; } else { + console.debug("do not have video"); if (me.localAudioVideoStream) { me.peerConnection.removeStream(me.localAudioVideoStream); } @@ -208,14 +215,15 @@ WebRtcMediaManager.prototype.createOffer = function (createOfferCallback, hasVid }; WebRtcMediaManager.prototype.createAnswer = function (createAnswerCallback) { - console.debug("WebRtcMediaManager:createAnswer()"); var me = this; + console.debug("WebRtcMediaManager:createAnswer() me.getConnectionState(): "+me.getConnectionState()+" me.hasVideo: "+me.hasVideo); var hasVideo = me.hasVideo; if (me.getConnectionState() != "established") { me.init(); } try { function create() { + console.debug("create() me.peerConnection: "+me.peerConnection); if (me.peerConnection == null) { me.createPeerConnection(); me.peerConnection.addStream(me.localAudioStream); @@ -272,6 +280,7 @@ WebRtcMediaManager.prototype.createAnswer = function (createAnswerCallback) { }; WebRtcMediaManager.prototype.onCreateOfferSuccessCallback = function (offer) { + console.debug("onCreateOfferSuccessCallback this.peerConnection: "+this.peerConnection+" this.peerConnectionState: "+this.peerConnectionState); if (this.peerConnection != null) { if (this.peerConnectionState == 'new' || this.peerConnectionState == 'established') { var application = this; @@ -292,13 +301,16 @@ WebRtcMediaManager.prototype.onCreateOfferSuccessCallback = function (offer) { }; WebRtcMediaManager.prototype.onSetLocalDescriptionSuccessCallback = function (sdp) { + console.debug("onSetLocalDescriptionSuccessCallback"); if (webrtcDetectedBrowser == "firefox") { console.debug("WebRtcMediaManager:onSetLocalDescriptionSuccessCallback: sdp=" + sdp); if (this.peerConnectionState == 'preparing-offer') { + console.debug("Current PeerConnectionState is 'preparing-offer' sending offer..."); this.peerConnectionState = 'offer-sent'; this.createOfferCallback(sdp); } else if (this.peerConnectionState == 'preparing-answer') { + console.debug("Current PeerConnectionState is 'preparing-answer' going to established..."); this.peerConnectionState = 'established'; this.createAnswerCallback(sdp); } @@ -312,7 +324,7 @@ WebRtcMediaManager.prototype.getConnectionState = function () { }; WebRtcMediaManager.prototype.setRemoteSDP = function (sdp, isInitiator) { - console.debug("WebRtcMediaManager:setRemoteSDP: sdp=" + sdp); + console.debug("WebRtcMediaManager:setRemoteSDP: isInitiator: "+isInitiator+" sdp=" + sdp); if (isInitiator) { var sdpAnswer = new RTCSessionDescription({ type: 'answer', @@ -331,11 +343,14 @@ WebRtcMediaManager.prototype.setRemoteSDP = function (sdp, isInitiator) { }; WebRtcMediaManager.prototype.onSetRemoteDescriptionSuccessCallback = function () { + console.debug("onSetRemoteDescriptionSuccessCallback"); if (this.peerConnection != null) { if (this.peerConnectionState == 'answer-received') { + console.debug("Current PeerConnectionState is 'answer-received' changing the PeerConnectionState to 'established'"); this.peerConnectionState = 'established'; } else if (this.peerConnectionState == 'offer-received') { + console.debug("Current PeerConnectionState is 'offer-received' creating appropriate answer..."); var application = this; this.peerConnection.createAnswer(function (answer) { application.onCreateAnswerSuccessCallback(answer); @@ -354,8 +369,10 @@ WebRtcMediaManager.prototype.onSetRemoteDescriptionSuccessCallback = function () WebRtcMediaManager.prototype.onCreateAnswerSuccessCallback = function (answer) { + console.debug("onCreateAnswerSuccessCallback "+this.peerConnection); if (this.peerConnection != null) { if (this.peerConnectionState == 'offer-received') { + console.debug("Current PeerConnectionState is 'offer-received', preparing answer..."); // Prepare answer. var application = this; this.peerConnectionState = 'preparing-answer'; From 0a4c1ca15c46e2d746970edcccfbaae5309432ef Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Sun, 8 Dec 2013 19:33:00 +0700 Subject: [PATCH 30/35] Added SIP delayed offer support. When we receive an incoming call without SDP. Compatible with server 527. --- client/client/src/js/ws/WebSocketManager.js | 24 ++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/client/client/src/js/ws/WebSocketManager.js b/client/client/src/js/ws/WebSocketManager.js index c1d4650a..6fbf9321 100644 --- a/client/client/src/js/ws/WebSocketManager.js +++ b/client/client/src/js/ws/WebSocketManager.js @@ -221,11 +221,29 @@ WebSocketManager.prototype = { answer: function (callId) { var me = this; openInfoView("Configuring WebRTC connection...", 0, 60); - this.webRtcMediaManager.createAnswer(function (sdp) { + /** + * If we receive INVITE without SDP, we should send answer with SDP based on webRtcMediaManager.createOffer because we do not have remoteSdp here + */ + if (this.webRtcMediaManager.lastReceivedSdp !== null && this.webRtcMediaManager.lastReceivedSdp.length==0){ + this.webRtcMediaManager.createOffer(function (sdp) { closeInfoView(); + //here we will strip codecs from SDP if requested + if (me.stripCodecs.length) { + sdp = me.stripCodecsSDP(sdp); + console.log("New SDP: " + sdp); + } me.webSocket.send("answer", {callId: callId, sdp: sdp}); - } - ); + }, false); + } else{ + /** + * If we receive a normal INVITE with SDP we should create answering SDP using normal createAnswer method because we already have remoteSdp here. + */ + this.webRtcMediaManager.createAnswer(function (sdp) { + closeInfoView(); + me.webSocket.send("answer", {callId: callId, sdp: sdp}); + } + ); + } }, hangup: function (callId) { From b8b6c8ce088f4f731c6931b1f6abca111849c8ca Mon Sep 17 00:00:00 2001 From: Flashphoner Date: Wed, 11 Dec 2013 18:33:32 +0700 Subject: [PATCH 31/35] Added minimal support for Phone.html(pure Flash application) --- client/api/src/com/flashphoner/api/PhoneModel.as | 12 ++++++++++++ .../api/src/com/flashphoner/api/data/PhoneConfig.as | 4 ++++ client/client/src/Phone.html | 2 +- .../src/com/flashphoner/phone/views/PhoneButton.mxml | 4 ++++ .../com/flashphoner/phone/views/SipAccountView.mxml | 7 +++++-- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/client/api/src/com/flashphoner/api/PhoneModel.as b/client/api/src/com/flashphoner/api/PhoneModel.as index 3fb6c6d2..f89e2996 100644 --- a/client/api/src/com/flashphoner/api/PhoneModel.as +++ b/client/api/src/com/flashphoner/api/PhoneModel.as @@ -126,6 +126,18 @@ package com.flashphoner.api parameters[node] = String(xml[node]); } + var wcs_server:String = xml.wcs_server; + if (wcs_server!=null && wcs_server.length!=0){ + PhoneConfig.WCS_SERVER = wcs_server; + } + Logger.info("WCS_SERVER: "+PhoneConfig.WCS_SERVER); + + var rtmfp_port:String = xml.rtmfp_port; + if (rtmfp_port!=null && rtmfp_port.length!=0){ + PhoneConfig.RTMFP_PORT = int(rtmfp_port); + } + Logger.info("RTMFP_PORT: "+PhoneConfig.RTMFP_PORT); + var use_enhanced_mic:String = xml.use_enhanced_mic; if (use_enhanced_mic!=null && use_enhanced_mic.length!=0){ diff --git a/client/api/src/com/flashphoner/api/data/PhoneConfig.as b/client/api/src/com/flashphoner/api/data/PhoneConfig.as index 321f872c..57020eb3 100644 --- a/client/api/src/com/flashphoner/api/data/PhoneConfig.as +++ b/client/api/src/com/flashphoner/api/data/PhoneConfig.as @@ -92,6 +92,10 @@ package com.flashphoner.api.data public static var LOAD_BALANCER_URL = null; + public static var WCS_SERVER:String = "192.168.1.5"; + + public static var RTMFP_PORT:int = 1935; + /** * Current version of Flashphoner product **/ diff --git a/client/client/src/Phone.html b/client/client/src/Phone.html index c5649857..51564766 100644 --- a/client/client/src/Phone.html +++ b/client/client/src/Phone.html @@ -4,7 +4,7 @@ Flash phone - +