Commit 950acddc authored by Dele Olajide's avatar Dele Olajide Committed by dele

Rayo plugin - implemented call hold/unhold

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13777 b35dd754-fafc-0310-a699-88a17e54d16e
parent 20569c21
......@@ -94,6 +94,20 @@ body {
-ms-filter: progid:DXImageTransform.Microsoft.Shadow(Color=rgba(0, 0, 0, 0.2),Direction=135,Strength=5); }
#callStatus.busy .callerName:before {
content: "Busy: "; }
#callStatus.held {
background-color: #ff7474;
background-image: rgba(255, 255, 255, 0.3);
background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0.3), rgba(50, 50, 50, 0.1));
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgba(255, 255, 255, 0.3)), color-stop(1, rgba(50, 50, 50, 0.1)));
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='$top', EndColorStr='$bottom');
border-top: 2px solid white;
border-bottom: 2px solid #bbbbbb;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 3px 5px;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 3px 5px;
box-shadow: rgba(0, 0, 0, 0.2) 0 3px 5px;
-ms-filter: progid:DXImageTransform.Microsoft.Shadow(Color=rgba(0, 0, 0, 0.2),Direction=135,Strength=5); }
#callStatus.held .callerName:before {
content: "Held: "; }
#callStatus.conferenced {
background-color: #74e0ff;
background-image: rgba(255, 255, 255, 0.3);
......
......@@ -56,15 +56,25 @@
buttons: [{
cls: 'end',
label: 'End Call'
},
{
cls: 'hold',
label: 'Hold Call'
}],
timer: true
},
busy: {
buttons: [{
cls: 'busy',
cls: 'join',
label: 'Join Call'
}],
},
held: {
buttons: [{
cls: 'join',
label: 'Unhold Call'
}],
},
conferenced: {
buttons: [{
cls: 'leave',
......@@ -235,7 +245,12 @@
if (self.call) {
self.call.leave();
}
};
};
self.hold = function () {
if (self.call) {
self.call.leave();
}
};
self.cancel = function () {
if (self.call) {
self.call.hangup();
......
......@@ -56,6 +56,9 @@
} else if (window.dialer.getCallLabel() == "Leave") {
window.candybar.call.leave();
} else if (window.dialer.getCallLabel() == "Unhold") {
window.candybar.call.join();
} else {
console.error('bad call state');
}
......@@ -219,6 +222,13 @@
stopTone();
},
onHold: function(callId) {
//console.log('onHold ' + callId);
window.candybar.setState('held');
window.dialer.setCallLabel('Unhold');
},
onRing: function(callId, headers) {
//console.log('onRing ' + callId);
//console.log(headers);
......
......@@ -51,23 +51,25 @@ Strophe.addConnectionPlugin('rayo',
hangup: function(callId)
{
console.log("hangup " + callId);
//console.log("hangup " + callId);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c("hangup", {xmlns: Strophe.NS.RAYO_CORE});
//console.log(iq.toString());
that._connection.sendIQ(iq, null, function(error)
that._connection.sendIQ(iq, function()
{
this._onhook();
}, function(error) {
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("hangup failure " + errorcode);
});
});
this._onhook();
});
},
digit: function(callId, key)
......@@ -459,8 +461,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('joined').each(function()
{
//console.log('Rayo plugin handlePresence joined');
//console.log(presence);
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
......@@ -478,8 +480,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('unjoined').each(function()
{
//console.log('Rayo plugin handlePresence unjoined');
//console.log(presence);
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
......@@ -496,22 +498,37 @@ Strophe.addConnectionPlugin('rayo',
});
$(presence).find('started-speaking').each(function()
{
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
//if (that.callbacks && that.callbacks.onSpeaking) that.callbacks.onSpeaking(callId, headers);
if (that.callbacks && that.callbacks.onSpeaking) that.callbacks.onSpeaking(callId, headers);
}
});
$(presence).find('stopped-speaking').each(function()
{
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
//if (that.callbacks && that.callbacks.offSpeaking) that.callbacks.offSpeaking(callId, headers);
if (that.callbacks && that.callbacks.offSpeaking) that.callbacks.offSpeaking(callId, headers);
}
});
$(presence).find('onhold').each(function()
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
if (that.callbacks && that.callbacks.onHold) that.callbacks.onHold(callId);
}
});
$(presence).find('ringing').each(function()
{
......@@ -524,8 +541,7 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('answered').each(function()
{
//console.log('Rayo plugin handlePresence answered');
//console.log(presence);
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
......@@ -574,8 +590,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('end').each(function()
{
//console.log('Rayo plugin handlePresence end');
//console.log(presence);
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
......
......@@ -94,6 +94,9 @@ public class CallParticipant {
private long startTimestamp = 0;
private long endTimestamp = 0;
private Map<String, String> headers = new HashMap<String, String>();
private CallParticipant farParty = null;
private CallParticipant handset = null;
private boolean isHeld = false;
/*
* Second party in a two party call or target of migration
......@@ -158,6 +161,26 @@ public class CallParticipant {
this.endTimestamp = endTimestamp;
}
public CallParticipant getFarParty()
{
return farParty;
}
public void setFarParty(CallParticipant farParty)
{
this.farParty = farParty;
}
public CallParticipant getHandset()
{
return handset;
}
public void setHandset(CallParticipant handset)
{
this.handset = handset;
}
public Map<String, String> getHeaders()
{
return headers;
......@@ -351,6 +374,10 @@ public class CallParticipant {
return isMuted;
}
public boolean isHeld() {
return isHeld;
}
/**
* Is the call muted from the whisper group
*/
......@@ -763,6 +790,10 @@ public class CallParticipant {
this.isMuted = isMuted;
}
public void setHeld(boolean isHeld) {
this.isHeld = isHeld;
}
/**
* Set the flag to mute the this call from the whisper group.
*/
......
......@@ -51,23 +51,25 @@ Strophe.addConnectionPlugin('rayo',
hangup: function(callId)
{
console.log("hangup " + callId);
//console.log("hangup " + callId);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c("hangup", {xmlns: Strophe.NS.RAYO_CORE});
//console.log(iq.toString());
that._connection.sendIQ(iq, null, function(error)
that._connection.sendIQ(iq, function()
{
this._onhook();
}, function(error) {
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("hangup failure " + errorcode);
});
});
this._onhook();
});
},
digit: function(callId, key)
......@@ -459,8 +461,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('joined').each(function()
{
//console.log('Rayo plugin handlePresence joined');
//console.log(presence);
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
......@@ -478,8 +480,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('unjoined').each(function()
{
//console.log('Rayo plugin handlePresence unjoined');
//console.log(presence);
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
......@@ -496,22 +498,37 @@ Strophe.addConnectionPlugin('rayo',
});
$(presence).find('started-speaking').each(function()
{
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
//if (that.callbacks && that.callbacks.onSpeaking) that.callbacks.onSpeaking(callId, headers);
if (that.callbacks && that.callbacks.onSpeaking) that.callbacks.onSpeaking(callId, headers);
}
});
$(presence).find('stopped-speaking').each(function()
{
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
//if (that.callbacks && that.callbacks.offSpeaking) that.callbacks.offSpeaking(callId, headers);
if (that.callbacks && that.callbacks.offSpeaking) that.callbacks.offSpeaking(callId, headers);
}
});
$(presence).find('onhold').each(function()
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
if (that.callbacks && that.callbacks.onHold) that.callbacks.onHold(callId);
}
});
$(presence).find('ringing').each(function()
{
......@@ -524,8 +541,7 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('answered').each(function()
{
//console.log('Rayo plugin handlePresence answered');
//console.log(presence);
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
......@@ -574,8 +590,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('end').each(function()
{
//console.log('Rayo plugin handlePresence end');
//console.log(presence);
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment