Commit be865213 authored by Dele Olajide's avatar Dele Olajide Committed by dele

Rayo plugin - Implementing Rayo IQHandlers

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13785 b35dd754-fafc-0310-a699-88a17e54d16e
parent d989eac3
...@@ -60,10 +60,18 @@ ...@@ -60,10 +60,18 @@
{ {
cls: 'hold', cls: 'hold',
label: 'Hold Call' label: 'Hold Call'
}, },
{ {
cls: 'mute', cls: 'mute',
label: 'Mute Call' label: 'Mute Call'
},
{
cls: 'redirect',
label: 'Redirect Call'
},
{
cls: 'private',
label: 'Private Call'
}], }],
timer: true timer: true
}, },
...@@ -263,14 +271,24 @@ ...@@ -263,14 +271,24 @@
}; };
self.hold = function () { self.hold = function () {
if (self.call) { if (self.call) {
self.call.leave(); self.call.hold();
}
};
self.redirect = function () {
if (self.call) {
self.call.redirect(prompt("Please enter new destination:","sip:xxxx@domain.com"));
} }
}; };
self.mute = function () { self.mute = function () {
if (self.call) { if (self.call) {
self.call.mute(true); self.call.mute(true);
} }
}; };
self.private = function () {
if (self.call) {
self.call.private();
}
};
self.unmute = function () { self.unmute = function () {
if (self.call) { if (self.call) {
self.call.mute(false); self.call.mute(false);
......
...@@ -38,6 +38,11 @@ ...@@ -38,6 +38,11 @@
onHide: function () { onHide: function () {
//console.log('removed it'); //console.log('removed it');
}, },
onHangup: function (number) {
window.candybar.call.hangup();
},
onCall: function (number) { onCall: function (number) {
if (window.dialer.getCallLabel() == "Call") { if (window.dialer.getCallLabel() == "Call") {
...@@ -62,6 +67,12 @@ ...@@ -62,6 +67,12 @@
} else if (window.dialer.getCallLabel() == "Unmute") { } else if (window.dialer.getCallLabel() == "Unmute") {
window.candybar.call.mute(false); window.candybar.call.mute(false);
} else if (window.dialer.getCallLabel() == "Private") {
window.candybar.call.private();
} else if (window.dialer.getCallLabel() == "Public") {
window.candybar.call.private();
} else { } else {
console.error('bad call state'); console.error('bad call state');
} }
...@@ -259,12 +270,36 @@ ...@@ -259,12 +270,36 @@
}, },
offMute: function(callId) { offMute: function(callId) {
//console.log('offMute ' + callId); console.log('offMute ' + callId);
window.candybar.setState('active'); window.candybar.setState('active');
window.dialer.setCallLabel('Hangup'); window.dialer.setCallLabel('Hangup');
}, },
onPrivate: function(callId) {
//console.log('onPrivate ' + callId);
window.candybar.call.privateCall = true;
window.dialer.setCallLabel('Public');
},
offPrivate: function(callId) {
//console.log('offPrivate ' + callId);
window.candybar.call.privateCall = false;
window.dialer.setCallLabel('Hangup');
},
onRedirect: function(callId) {
//console.log('onRedirect ' + callId);
window.candybar.endGently();
window.candybar.call = null;
window.dialer.setCallLabel('Call');
stopTone();
},
onError: function(e) { onError: function(e) {
console.error(e); console.error(e);
......
This diff is collapsed.
...@@ -32,6 +32,7 @@ public class Handset extends BaseVerb { ...@@ -32,6 +32,7 @@ public class Handset extends BaseVerb {
public String mixer = null; public String mixer = null;
public String group = null; public String group = null;
public String sipuri = null; public String sipuri = null;
public String callId = null;
public Handset(String cryptoSuite, String localCrypto, String remoteCrypto, String codec, String stereo, String mixer) public Handset(String cryptoSuite, String localCrypto, String remoteCrypto, String codec, String stereo, String mixer)
{ {
......
...@@ -23,10 +23,7 @@ import org.dom4j.Element; ...@@ -23,10 +23,7 @@ import org.dom4j.Element;
import org.dom4j.Namespace; import org.dom4j.Namespace;
import org.dom4j.QName; import org.dom4j.QName;
import com.rayo.core.verb.OnHookCommand; import com.rayo.core.verb.*;
import com.rayo.core.verb.OffHookCommand;
import com.rayo.core.verb.Handset;
import com.rayo.core.verb.SayCompleteEvent;
import com.rayo.core.verb.SayCompleteEvent.Reason; import com.rayo.core.verb.SayCompleteEvent.Reason;
public class HandsetProvider extends BaseProvider { public class HandsetProvider extends BaseProvider {
...@@ -39,6 +36,11 @@ public class HandsetProvider extends BaseProvider { ...@@ -39,6 +36,11 @@ public class HandsetProvider extends BaseProvider {
private static final QName ONHOOK_QNAME = new QName("onhook", NAMESPACE); private static final QName ONHOOK_QNAME = new QName("onhook", NAMESPACE);
private static final QName OFFHOOK_QNAME = new QName("offhook", NAMESPACE); private static final QName OFFHOOK_QNAME = new QName("offhook", NAMESPACE);
private static final QName PRIVATE_QNAME = new QName("private", NAMESPACE);
private static final QName PUBLIC_QNAME = new QName("public", NAMESPACE);
private static final QName MUTE_QNAME = new QName("mute", NAMESPACE);
private static final QName UNMUTE_QNAME = new QName("unmute", NAMESPACE);
private static final QName HOLD_QNAME = new QName("hold", NAMESPACE);
@Override @Override
protected Object processElement(Element element) throws Exception protected Object processElement(Element element) throws Exception
...@@ -49,14 +51,54 @@ public class HandsetProvider extends BaseProvider { ...@@ -49,14 +51,54 @@ public class HandsetProvider extends BaseProvider {
} else if (OFFHOOK_QNAME.equals(element.getQName())) { } else if (OFFHOOK_QNAME.equals(element.getQName())) {
return buildOffHookCommand(element); return buildOffHookCommand(element);
} else if (PRIVATE_QNAME.equals(element.getQName())) {
return buildPrivateCommand(element);
} else if (PUBLIC_QNAME.equals(element.getQName())) {
return buildPublicCommand(element);
} else if (MUTE_QNAME.equals(element.getQName())) {
return buildMuteCommand(element);
} else if (UNMUTE_QNAME.equals(element.getQName())) {
return buildUnmuteCommand(element);
} else if (HOLD_QNAME.equals(element.getQName())) {
return buildHoldCommand(element);
} else if (element.getNamespace().equals(RAYO_COMPONENT_NAMESPACE)) { } else if (element.getNamespace().equals(RAYO_COMPONENT_NAMESPACE)) {
return buildCompleteCommand(element); return buildCompleteCommand(element);
} }
return null; return null;
} }
private Object buildCompleteCommand(Element element) { private Object buildPrivateCommand(Element element)
{
return new PrivateCommand();
}
private Object buildPublicCommand(Element element)
{
return new PublicCommand();
}
private Object buildMuteCommand(Element element)
{
return new MuteCommand();
}
private Object buildUnmuteCommand(Element element)
{
return new UnmuteCommand();
}
private Object buildHoldCommand(Element element)
{
return new HoldCommand();
}
private Object buildCompleteCommand(Element element)
{
Element reasonElement = (Element)element.elements().get(0); Element reasonElement = (Element)element.elements().get(0);
String reasonValue = reasonElement.getName().toUpperCase(); String reasonValue = reasonElement.getName().toUpperCase();
Reason reason = Reason.valueOf(reasonValue); Reason reason = Reason.valueOf(reasonValue);
...@@ -87,6 +129,7 @@ public class HandsetProvider extends BaseProvider { ...@@ -87,6 +129,7 @@ public class HandsetProvider extends BaseProvider {
} }
handset.group = element.attributeValue("group"); handset.group = element.attributeValue("group");
handset.callId = element.attributeValue("callid");
OffHookCommand command = new OffHookCommand(); OffHookCommand command = new OffHookCommand();
command.setHandset(handset); command.setHandset(handset);
...@@ -112,6 +155,24 @@ public class HandsetProvider extends BaseProvider { ...@@ -112,6 +155,24 @@ public class HandsetProvider extends BaseProvider {
} else if (object instanceof SayCompleteEvent) { } else if (object instanceof SayCompleteEvent) {
createHandsetCompleteEvent((SayCompleteEvent) object, document); createHandsetCompleteEvent((SayCompleteEvent) object, document);
} else if (object instanceof OnHoldEvent) {
createOnHoldEvent((OnHoldEvent) object, document);
} else if (object instanceof OffHoldEvent) {
createOffHoldEvent((OffHoldEvent) object, document);
} else if (object instanceof MutedEvent) {
createMutedEvent((MutedEvent) object, document);
} else if (object instanceof UnmutedEvent) {
createUnmutedEvent((UnmutedEvent) object, document);
} else if (object instanceof PrivateEvent) {
createPrivateEvent((PrivateEvent) object, document);
} else if (object instanceof PublicEvent) {
createPublicEvent((PublicEvent) object, document);
} }
} }
...@@ -128,11 +189,44 @@ public class HandsetProvider extends BaseProvider { ...@@ -128,11 +189,44 @@ public class HandsetProvider extends BaseProvider {
} }
private void createOnHookCommand(OnHookCommand command, Document document) throws Exception { private void createOnHookCommand(OnHookCommand command, Document document) throws Exception
{
document.addElement(new QName("onhook", NAMESPACE)); document.addElement(new QName("onhook", NAMESPACE));
} }
private void createHandsetCompleteEvent(SayCompleteEvent event, Document document) throws Exception { private void createHandsetCompleteEvent(SayCompleteEvent event, Document document) throws Exception
{
addCompleteElement(document, event, COMPLETE_NAMESPACE); addCompleteElement(document, event, COMPLETE_NAMESPACE);
} }
private void createOnHoldEvent(OnHoldEvent onHold, Document document)
{
document.addElement(new QName("onhold", NAMESPACE));
}
private void createOffHoldEvent(OffHoldEvent offHold, Document document)
{
document.addElement(new QName("offhold", NAMESPACE));
}
private void createMutedEvent(MutedEvent muted, Document document)
{
document.addElement(new QName("onmute", NAMESPACE));
}
private void createUnmutedEvent(UnmutedEvent unmuted, Document document)
{
document.addElement(new QName("offmute", NAMESPACE));
}
private void createPrivateEvent(PrivateEvent event, Document document)
{
document.addElement(new QName("private", NAMESPACE));
}
private void createPublicEvent(PublicEvent event, Document document)
{
document.addElement(new QName("public", NAMESPACE));
}
} }
...@@ -63,6 +63,10 @@ public class ConferenceManager { ...@@ -63,6 +63,10 @@ public class ConferenceManager {
private boolean isFirstMember = true; private boolean isFirstMember = true;
private boolean privateCall = false;
private String groupName = null;
/* /*
* If useSingleSender is true, a single * If useSingleSender is true, a single
* conferenceSender will be used for all conferences. * conferenceSender will be used for all conferences.
...@@ -623,18 +627,39 @@ public class ConferenceManager { ...@@ -623,18 +627,39 @@ public class ConferenceManager {
* audio treatment. * audio treatment.
* @return true if this is the first member, false otherwise * @return true if this is the first member, false otherwise
*/ */
public boolean isFirstMember() { public boolean isFirstMember()
synchronized (memberList) { {
if (isFirstMember == false) { synchronized (memberList) {
return false; if (isFirstMember == false) {
} return false;
}
isFirstMember = false; isFirstMember = false;
return memberList.isEmpty(); return memberList.isEmpty();
} }
} }
public boolean isPrivateCall()
{
return privateCall;
}
public void setPrivateCall(boolean privateCall)
{
this.privateCall = privateCall;
}
public String getGroupName()
{
return groupName;
}
public void setGroupName(String groupName)
{
this.groupName = groupName;
}
/** /**
* Add a new member to the conference * Add a new member to the conference
* *
......
...@@ -104,6 +104,8 @@ public class RayoPlugin implements Plugin, SessionEventListener { ...@@ -104,6 +104,8 @@ public class RayoPlugin implements Plugin, SessionEventListener {
Log.error("Could NOT load " + component.getName()); Log.error("Could NOT load " + component.getName());
} }
setup(); setup();
component.doStart();
} }
private void setup() { private void setup() {
...@@ -191,6 +193,7 @@ public class RayoPlugin implements Plugin, SessionEventListener { ...@@ -191,6 +193,7 @@ public class RayoPlugin implements Plugin, SessionEventListener {
} }
closeAllChannels(); closeAllChannels();
executor.shutdownNow(); executor.shutdownNow();
component.doStop();
} }
public boolean hasPublicIP() { public boolean hasPublicIP() {
......
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