Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 43 additions & 17 deletions dist/angular-rtcomm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*
* Angular module for Rtcomm
* @version v1.0.3 - 2015-12-07
* @version v1.0.3 - 2016-02-18
* @link https://github.com/WASdev/lib.angular-rtcomm
* @author Brian Pulito <brian_pulito@us.ibm.com> (https://github.com/bpulito)
*/
Expand Down Expand Up @@ -94,6 +94,7 @@
var rtcommDebug = "DEBUG";
var ringtone = null;
var ringbacktone = null;
var trickleICE = true;

var setConfig = function(config){
providerConfig.server = (typeof config.server !== "undefined")? config.server : providerConfig.server;
Expand All @@ -111,9 +112,10 @@

broadcastAudio = (typeof config.broadcastAudio !== "undefined")? config.broadcastAudio: broadcastAudio;
broadcastVideo = (typeof config.broadcastVideo !== "undefined")? config.broadcastVideo: broadcastVideo;
trickleICE = (typeof config.trickleICE !== "undefined")? config.trickleICE: trickleICE;

ringbacktone = (typeof config.ringbacktone !== "undefined")? config.ringbacktone: null;
ringtone = (typeof config.ringtone !== "undefined")? config.ringtone : null;
ringbacktone = (typeof config.ringbacktone !== "undefined")? config.ringbacktone: ringbacktone;
ringtone = (typeof config.ringtone !== "undefined")? config.ringtone : ringtone;

rtcommDebug = (typeof config.rtcommDebug !== "undefined")? config.rtcommDebug: rtcommDebug;

Expand Down Expand Up @@ -145,7 +147,9 @@

getRtcommDebug: function(){return rtcommDebug;},

isRtcommDisabled : function(){return _disableRtcomm;}
isRtcommDisabled : function(){return _disableRtcomm;},

getTrickleICE: function(){return trickleICE;}
};
};

Expand Down Expand Up @@ -179,9 +183,12 @@
var mediaConfig = {
ringbacktone: RtcommConfigService.getRingBackTone(),
ringtone: RtcommConfigService.getRingTone(),
broadcast : {
audio : RtcommConfigService.getBroadcastAudio(),
video : RtcommConfigService.getBroadcastVideo()
webrtcConfig: {
broadcast : {
audio : RtcommConfigService.getBroadcastAudio(),
video : RtcommConfigService.getBroadcastVideo()
},
trickleICE: RtcommConfigService.getTrickleICE()
},
webrtc : RtcommConfigService.getWebRTCEnabled(),
chat : RtcommConfigService.getChatEnabled(),
Expand All @@ -191,7 +198,8 @@
};

myEndpointProvider.on('reset', function(event_object) {
// Should have a reason.
//The Endpoint provider is destroyed on reset
endpointProviderInitialized = false;
_alert({type:'danger', msg: event_object.reason});
});

Expand Down Expand Up @@ -304,6 +312,8 @@

},

'session:connecting' : callback,

// These are all the WebRTC related events.
'webrtc:connected' : function(eventObject) {
$log.debug('<<------rtcomm-service------>> - Event: ' + eventObject.eventName + ' remoteEndpointID: ' + eventObject.endpoint.getRemoteEndpointID());
Expand Down Expand Up @@ -467,7 +477,9 @@
for (var index = 0; index < sessions.length; index++) {
if(sessions[index].endpointUUID === endpointUUID){

_getEndpoint(endpointUUID).destroy();
var endpoint = _getEndpoint(endpointUUID);
if(typeof endpoint !== 'undefined')
endpoint.destroy();

// Remove the disconnected endpoint from the list.
sessions.splice(index, 1);
Expand Down Expand Up @@ -897,7 +909,7 @@

angular
.module('angular-rtcomm-ui', [
'ui.bootstrap',
'ui.bootstrap',
'angular-rtcomm-service'])
.directive('rtcommSessionManager', rtcommSessionManager)
.directive('rtcommRegister', rtcommRegister)
Expand Down Expand Up @@ -987,14 +999,14 @@ function rtcommRegister(RtcommService, $log) {
controller: ["$scope", function ($scope) {

$scope.nextAction = 'Register';

$scope.reguserid = '';

$scope.invalid = false;

var invalidCharacters = /(\$|#|\+|\/|\\)+/i; //Invalid characters for MQTT Topic Path
//Watch for changes in reguserid

//Watch for changes in reguserid
$scope.$watch('reguserid', function(){

if($scope.reguserid.length < 1 || invalidCharacters.test($scope.reguserid)){
Expand Down Expand Up @@ -1252,6 +1264,15 @@ function rtcommEndpointStatus(RtcommService, $log){
}
});

$scope.$on('session:connecting', function (event, eventObject) {
$log.debug('session:connecting received: endpointID = ' + eventObject.endpoint.id);
// if ($scope.epCtrlActiveEndpointUUID != eventObject.endpoint.id){
$scope.sessionState = 'session:connecting';
$scope.epCtrlRemoteEndpointID = eventObject.endpoint.getRemoteEndpointID();
// }
});


$scope.$on('session:queued', function (event, eventObject) {
$log.debug('session:queued received: endpointID = ' + eventObject.endpoint.id);
if ($scope.epCtrlActiveEndpointUUID == eventObject.endpoint.id){
Expand Down Expand Up @@ -1288,7 +1309,12 @@ function rtcommEndpointStatus(RtcommService, $log){
});

$scope.$on('rtcomm::init', function(event, success, details){

if(success === true){
$scope.epCtrlActiveEndpointUUID = RtcommService.getActiveEndpoint();
$scope.epCtrlRemoteEndpointID = RtcommService.getRemoteEndpoint($scope.epCtrlActiveEndpointUUID);
$scope.sessionState = RtcommService.getSessionState($scope.epCtrlActiveEndpointUUID);
$scope.failureReason = '';
}
if(success == false){
$scope.sessionState = 'session:stopped';
$scope.epCtrlRemoteEndpointID = null;
Expand Down Expand Up @@ -1391,7 +1417,7 @@ function rtcommChat(RtcommService, $log) {
//In this else, a notification could be sent
}
},true);
}
}
else {
$log.warn('chatPanel not found: most likely you need to load jquery prior to angular');
}
Expand Down Expand Up @@ -1963,7 +1989,7 @@ angular.module('angular-rtcomm-ui').run(['$templateCache', function($templateCac


$templateCache.put('templates/rtcomm/rtcomm-endpoint-status.html',
"<div class=\"endpoint-status\"><p class=\"endpoint-controls-title navbar-text pull-right\" ng-switch on=\"sessionState\"><span ng-switch-when=\"session:started\">Connected to {{epCtrlRemoteEndpointID}}</span> <span ng-switch-when=\"session:stopped\">No active sessions, waiting...</span> <span ng-switch-when=\"session:alerting\">Inbound call from {{epCtrlRemoteEndpointID}}</span> <span ng-switch-when=\"session:trying\">Attempting to call {{epCtrlRemoteEndpointID}}</span> <span ng-switch-when=\"session:ringing\">Call to {{epCtrlRemoteEndpointID}} is ringing</span> <span ng-switch-when=\"session:queued\">Waiting in queue at: {{queueCount}}</span> <span ng-switch-when=\"session:failed\">Call failed with reason: {{failureReason}}</span></p></div>"
"<div class=\"endpoint-status\"><p class=\"endpoint-controls-title navbar-text pull-right\" ng-switch on=\"sessionState\"><span ng-switch-when=\"session:started\">Connected to {{epCtrlRemoteEndpointID}}</span> <span ng-switch-when=\"session:stopped\">No active sessions, waiting...</span> <span ng-switch-when=\"session:alerting\">Inbound call from {{epCtrlRemoteEndpointID}}</span> <span ng-switch-when=\"session:trying\">Attempting to call {{epCtrlRemoteEndpointID}}</span> <span ng-switch-when=\"session:ringing\">Call to {{epCtrlRemoteEndpointID}} is ringing</span> <span ng-switch-when=\"session:queued\">Waiting in queue at: {{queueCount}}</span> <span ng-switch-when=\"session:failed\">Call failed with reason: {{failureReason}}</span> <span ng-switch-when=\"session:connecting\">Connecting to {{epCtrlRemoteEndpointID}} ...</span></p></div>"
);


Expand Down
6 changes: 3 additions & 3 deletions dist/angular-rtcomm.min.js

Large diffs are not rendered by default.

28 changes: 21 additions & 7 deletions src/js/rtcomm-directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

angular
.module('angular-rtcomm-ui', [
'ui.bootstrap',
'ui.bootstrap',
'angular-rtcomm-service'])
.directive('rtcommSessionManager', rtcommSessionManager)
.directive('rtcommRegister', rtcommRegister)
Expand Down Expand Up @@ -96,14 +96,14 @@ function rtcommRegister(RtcommService, $log) {
controller: function ($scope) {

$scope.nextAction = 'Register';

$scope.reguserid = '';

$scope.invalid = false;

var invalidCharacters = /(\$|#|\+|\/|\\)+/i; //Invalid characters for MQTT Topic Path
//Watch for changes in reguserid

//Watch for changes in reguserid
$scope.$watch('reguserid', function(){

if($scope.reguserid.length < 1 || invalidCharacters.test($scope.reguserid)){
Expand Down Expand Up @@ -361,6 +361,15 @@ function rtcommEndpointStatus(RtcommService, $log){
}
});

$scope.$on('session:connecting', function (event, eventObject) {
$log.debug('session:connecting received: endpointID = ' + eventObject.endpoint.id);
// if ($scope.epCtrlActiveEndpointUUID != eventObject.endpoint.id){
$scope.sessionState = 'session:connecting';
$scope.epCtrlRemoteEndpointID = eventObject.endpoint.getRemoteEndpointID();
// }
});


$scope.$on('session:queued', function (event, eventObject) {
$log.debug('session:queued received: endpointID = ' + eventObject.endpoint.id);
if ($scope.epCtrlActiveEndpointUUID == eventObject.endpoint.id){
Expand Down Expand Up @@ -397,7 +406,12 @@ function rtcommEndpointStatus(RtcommService, $log){
});

$scope.$on('rtcomm::init', function(event, success, details){

if(success === true){
$scope.epCtrlActiveEndpointUUID = RtcommService.getActiveEndpoint();
$scope.epCtrlRemoteEndpointID = RtcommService.getRemoteEndpoint($scope.epCtrlActiveEndpointUUID);
$scope.sessionState = RtcommService.getSessionState($scope.epCtrlActiveEndpointUUID);
$scope.failureReason = '';
}
if(success == false){
$scope.sessionState = 'session:stopped';
$scope.epCtrlRemoteEndpointID = null;
Expand Down Expand Up @@ -500,7 +514,7 @@ function rtcommChat(RtcommService, $log) {
//In this else, a notification could be sent
}
},true);
}
}
else {
$log.warn('chatPanel not found: most likely you need to load jquery prior to angular');
}
Expand Down
28 changes: 20 additions & 8 deletions src/js/rtcomm-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
var rtcommDebug = "DEBUG";
var ringtone = null;
var ringbacktone = null;
var trickleICE = true;

var setConfig = function(config){
providerConfig.server = (typeof config.server !== "undefined")? config.server : providerConfig.server;
Expand All @@ -78,9 +79,10 @@

broadcastAudio = (typeof config.broadcastAudio !== "undefined")? config.broadcastAudio: broadcastAudio;
broadcastVideo = (typeof config.broadcastVideo !== "undefined")? config.broadcastVideo: broadcastVideo;
trickleICE = (typeof config.trickleICE !== "undefined")? config.trickleICE: trickleICE;

ringbacktone = (typeof config.ringbacktone !== "undefined")? config.ringbacktone: null;
ringtone = (typeof config.ringtone !== "undefined")? config.ringtone : null;
ringbacktone = (typeof config.ringbacktone !== "undefined")? config.ringbacktone: ringbacktone;
ringtone = (typeof config.ringtone !== "undefined")? config.ringtone : ringtone;

rtcommDebug = (typeof config.rtcommDebug !== "undefined")? config.rtcommDebug: rtcommDebug;

Expand Down Expand Up @@ -112,7 +114,9 @@

getRtcommDebug: function(){return rtcommDebug;},

isRtcommDisabled : function(){return _disableRtcomm;}
isRtcommDisabled : function(){return _disableRtcomm;},

getTrickleICE: function(){return trickleICE;}
};
};

Expand Down Expand Up @@ -146,9 +150,12 @@
var mediaConfig = {
ringbacktone: RtcommConfigService.getRingBackTone(),
ringtone: RtcommConfigService.getRingTone(),
broadcast : {
audio : RtcommConfigService.getBroadcastAudio(),
video : RtcommConfigService.getBroadcastVideo()
webrtcConfig: {
broadcast : {
audio : RtcommConfigService.getBroadcastAudio(),
video : RtcommConfigService.getBroadcastVideo()
},
trickleICE: RtcommConfigService.getTrickleICE()
},
webrtc : RtcommConfigService.getWebRTCEnabled(),
chat : RtcommConfigService.getChatEnabled(),
Expand All @@ -158,7 +165,8 @@
};

myEndpointProvider.on('reset', function(event_object) {
// Should have a reason.
//The Endpoint provider is destroyed on reset
endpointProviderInitialized = false;
_alert({type:'danger', msg: event_object.reason});
});

Expand Down Expand Up @@ -271,6 +279,8 @@

},

'session:connecting' : callback,

// These are all the WebRTC related events.
'webrtc:connected' : function(eventObject) {
$log.debug('<<------rtcomm-service------>> - Event: ' + eventObject.eventName + ' remoteEndpointID: ' + eventObject.endpoint.getRemoteEndpointID());
Expand Down Expand Up @@ -434,7 +444,9 @@
for (var index = 0; index < sessions.length; index++) {
if(sessions[index].endpointUUID === endpointUUID){

_getEndpoint(endpointUUID).destroy();
var endpoint = _getEndpoint(endpointUUID);
if(typeof endpoint !== 'undefined')
endpoint.destroy();

// Remove the disconnected endpoint from the list.
sessions.splice(index, 1);
Expand Down
2 changes: 2 additions & 0 deletions src/templates/rtcomm/rtcomm-endpoint-status.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
<span ng-switch-when="session:ringing">Call to {{epCtrlRemoteEndpointID}} is ringing</span>
<span ng-switch-when="session:queued">Waiting in queue at: {{queueCount}}</span>
<span ng-switch-when="session:failed">Call failed with reason: {{failureReason}}</span>
<span ng-switch-when="session:connecting">Connecting to {{epCtrlRemoteEndpointID}} ...</span>

</p>
</div>