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 { ...@@ -94,6 +94,20 @@ body {
-ms-filter: progid:DXImageTransform.Microsoft.Shadow(Color=rgba(0, 0, 0, 0.2),Direction=135,Strength=5); } -ms-filter: progid:DXImageTransform.Microsoft.Shadow(Color=rgba(0, 0, 0, 0.2),Direction=135,Strength=5); }
#callStatus.busy .callerName:before { #callStatus.busy .callerName:before {
content: "Busy: "; } 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 { #callStatus.conferenced {
background-color: #74e0ff; background-color: #74e0ff;
background-image: rgba(255, 255, 255, 0.3); background-image: rgba(255, 255, 255, 0.3);
......
...@@ -56,15 +56,25 @@ ...@@ -56,15 +56,25 @@
buttons: [{ buttons: [{
cls: 'end', cls: 'end',
label: 'End Call' label: 'End Call'
},
{
cls: 'hold',
label: 'Hold Call'
}], }],
timer: true timer: true
}, },
busy: { busy: {
buttons: [{ buttons: [{
cls: 'busy', cls: 'join',
label: 'Join Call' label: 'Join Call'
}], }],
}, },
held: {
buttons: [{
cls: 'join',
label: 'Unhold Call'
}],
},
conferenced: { conferenced: {
buttons: [{ buttons: [{
cls: 'leave', cls: 'leave',
...@@ -236,6 +246,11 @@ ...@@ -236,6 +246,11 @@
self.call.leave(); self.call.leave();
} }
}; };
self.hold = function () {
if (self.call) {
self.call.leave();
}
};
self.cancel = function () { self.cancel = function () {
if (self.call) { if (self.call) {
self.call.hangup(); self.call.hangup();
......
...@@ -56,6 +56,9 @@ ...@@ -56,6 +56,9 @@
} else if (window.dialer.getCallLabel() == "Leave") { } else if (window.dialer.getCallLabel() == "Leave") {
window.candybar.call.leave(); window.candybar.call.leave();
} else if (window.dialer.getCallLabel() == "Unhold") {
window.candybar.call.join();
} else { } else {
console.error('bad call state'); console.error('bad call state');
} }
...@@ -219,6 +222,13 @@ ...@@ -219,6 +222,13 @@
stopTone(); stopTone();
}, },
onHold: function(callId) {
//console.log('onHold ' + callId);
window.candybar.setState('held');
window.dialer.setCallLabel('Unhold');
},
onRing: function(callId, headers) { onRing: function(callId, headers) {
//console.log('onRing ' + callId); //console.log('onRing ' + callId);
//console.log(headers); //console.log(headers);
......
...@@ -51,23 +51,25 @@ Strophe.addConnectionPlugin('rayo', ...@@ -51,23 +51,25 @@ Strophe.addConnectionPlugin('rayo',
hangup: function(callId) hangup: function(callId)
{ {
console.log("hangup " + callId); //console.log("hangup " + callId);
var that = this; 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}); 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()); //console.log(iq.toString());
that._connection.sendIQ(iq, null, function(error) that._connection.sendIQ(iq, function()
{ {
this._onhook();
}, function(error) {
$('error', error).each(function() $('error', error).each(function()
{ {
var errorcode = $(this).attr('code'); var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("hangup failure " + errorcode); if (that.callbacks && that.callbacks.onError) that.callbacks.onError("hangup failure " + errorcode);
}); });
}); });
this._onhook();
}, },
digit: function(callId, key) digit: function(callId, key)
...@@ -459,8 +461,8 @@ Strophe.addConnectionPlugin('rayo', ...@@ -459,8 +461,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('joined').each(function() $(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) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); var callId = Strophe.getNodeFromJid(from);
...@@ -478,8 +480,8 @@ Strophe.addConnectionPlugin('rayo', ...@@ -478,8 +480,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('unjoined').each(function() $(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) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); var callId = Strophe.getNodeFromJid(from);
...@@ -497,19 +499,34 @@ Strophe.addConnectionPlugin('rayo', ...@@ -497,19 +499,34 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('started-speaking').each(function() $(presence).find('started-speaking').each(function()
{ {
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); 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() $(presence).find('stopped-speaking').each(function()
{ {
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); 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);
} }
}); });
...@@ -524,7 +541,6 @@ Strophe.addConnectionPlugin('rayo', ...@@ -524,7 +541,6 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('answered').each(function() $(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) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
...@@ -574,8 +590,8 @@ Strophe.addConnectionPlugin('rayo', ...@@ -574,8 +590,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('end').each(function() $(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) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); var callId = Strophe.getNodeFromJid(from);
......
...@@ -94,6 +94,9 @@ public class CallParticipant { ...@@ -94,6 +94,9 @@ public class CallParticipant {
private long startTimestamp = 0; private long startTimestamp = 0;
private long endTimestamp = 0; private long endTimestamp = 0;
private Map<String, String> headers = new HashMap<String, String>(); 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 * Second party in a two party call or target of migration
...@@ -158,6 +161,26 @@ public class CallParticipant { ...@@ -158,6 +161,26 @@ public class CallParticipant {
this.endTimestamp = endTimestamp; 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() public Map<String, String> getHeaders()
{ {
return headers; return headers;
...@@ -351,6 +374,10 @@ public class CallParticipant { ...@@ -351,6 +374,10 @@ public class CallParticipant {
return isMuted; return isMuted;
} }
public boolean isHeld() {
return isHeld;
}
/** /**
* Is the call muted from the whisper group * Is the call muted from the whisper group
*/ */
...@@ -763,6 +790,10 @@ public class CallParticipant { ...@@ -763,6 +790,10 @@ public class CallParticipant {
this.isMuted = isMuted; this.isMuted = isMuted;
} }
public void setHeld(boolean isHeld) {
this.isHeld = isHeld;
}
/** /**
* Set the flag to mute the this call from the whisper group. * Set the flag to mute the this call from the whisper group.
*/ */
......
...@@ -51,23 +51,25 @@ Strophe.addConnectionPlugin('rayo', ...@@ -51,23 +51,25 @@ Strophe.addConnectionPlugin('rayo',
hangup: function(callId) hangup: function(callId)
{ {
console.log("hangup " + callId); //console.log("hangup " + callId);
var that = this; 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}); 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()); //console.log(iq.toString());
that._connection.sendIQ(iq, null, function(error) that._connection.sendIQ(iq, function()
{ {
this._onhook();
}, function(error) {
$('error', error).each(function() $('error', error).each(function()
{ {
var errorcode = $(this).attr('code'); var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("hangup failure " + errorcode); if (that.callbacks && that.callbacks.onError) that.callbacks.onError("hangup failure " + errorcode);
}); });
}); });
this._onhook();
}, },
digit: function(callId, key) digit: function(callId, key)
...@@ -459,8 +461,8 @@ Strophe.addConnectionPlugin('rayo', ...@@ -459,8 +461,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('joined').each(function() $(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) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); var callId = Strophe.getNodeFromJid(from);
...@@ -478,8 +480,8 @@ Strophe.addConnectionPlugin('rayo', ...@@ -478,8 +480,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('unjoined').each(function() $(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) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); var callId = Strophe.getNodeFromJid(from);
...@@ -497,19 +499,34 @@ Strophe.addConnectionPlugin('rayo', ...@@ -497,19 +499,34 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('started-speaking').each(function() $(presence).find('started-speaking').each(function()
{ {
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); 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() $(presence).find('stopped-speaking').each(function()
{ {
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); 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);
} }
}); });
...@@ -524,7 +541,6 @@ Strophe.addConnectionPlugin('rayo', ...@@ -524,7 +541,6 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('answered').each(function() $(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) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
...@@ -574,8 +590,8 @@ Strophe.addConnectionPlugin('rayo', ...@@ -574,8 +590,8 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('end').each(function() $(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) if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{ {
var callId = Strophe.getNodeFromJid(from); 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