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
......@@ -64,6 +64,14 @@
{
cls: 'mute',
label: 'Mute Call'
},
{
cls: 'redirect',
label: 'Redirect Call'
},
{
cls: 'private',
label: 'Private Call'
}],
timer: true
},
......@@ -263,7 +271,12 @@
};
self.hold = function () {
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 () {
......@@ -271,6 +284,11 @@
self.call.mute(true);
}
};
self.private = function () {
if (self.call) {
self.call.private();
}
};
self.unmute = function () {
if (self.call) {
self.call.mute(false);
......
......@@ -38,6 +38,11 @@
onHide: function () {
//console.log('removed it');
},
onHangup: function (number) {
window.candybar.call.hangup();
},
onCall: function (number) {
if (window.dialer.getCallLabel() == "Call") {
......@@ -62,6 +67,12 @@
} else if (window.dialer.getCallLabel() == "Unmute") {
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 {
console.error('bad call state');
}
......@@ -259,12 +270,36 @@
},
offMute: function(callId) {
//console.log('offMute ' + callId);
console.log('offMute ' + callId);
window.candybar.setState('active');
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) {
console.error(e);
......
This diff is collapsed.
......@@ -32,6 +32,7 @@ public class Handset extends BaseVerb {
public String mixer = null;
public String group = null;
public String sipuri = null;
public String callId = null;
public Handset(String cryptoSuite, String localCrypto, String remoteCrypto, String codec, String stereo, String mixer)
{
......
......@@ -23,10 +23,7 @@ import org.dom4j.Element;
import org.dom4j.Namespace;
import org.dom4j.QName;
import com.rayo.core.verb.OnHookCommand;
import com.rayo.core.verb.OffHookCommand;
import com.rayo.core.verb.Handset;
import com.rayo.core.verb.SayCompleteEvent;
import com.rayo.core.verb.*;
import com.rayo.core.verb.SayCompleteEvent.Reason;
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 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
protected Object processElement(Element element) throws Exception
......@@ -49,14 +51,54 @@ public class HandsetProvider extends BaseProvider {
} else if (OFFHOOK_QNAME.equals(element.getQName())) {
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)) {
return buildCompleteCommand(element);
}
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);
String reasonValue = reasonElement.getName().toUpperCase();
Reason reason = Reason.valueOf(reasonValue);
......@@ -87,6 +129,7 @@ public class HandsetProvider extends BaseProvider {
}
handset.group = element.attributeValue("group");
handset.callId = element.attributeValue("callid");
OffHookCommand command = new OffHookCommand();
command.setHandset(handset);
......@@ -112,6 +155,24 @@ public class HandsetProvider extends BaseProvider {
} else if (object instanceof SayCompleteEvent) {
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 {
}
private void createOnHookCommand(OnHookCommand command, Document document) throws Exception {
private void createOnHookCommand(OnHookCommand command, Document document) throws Exception
{
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);
}
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 {
private boolean isFirstMember = true;
private boolean privateCall = false;
private String groupName = null;
/*
* If useSingleSender is true, a single
* conferenceSender will be used for all conferences.
......@@ -623,7 +627,8 @@ public class ConferenceManager {
* audio treatment.
* @return true if this is the first member, false otherwise
*/
public boolean isFirstMember() {
public boolean isFirstMember()
{
synchronized (memberList) {
if (isFirstMember == false) {
return false;
......@@ -635,6 +640,26 @@ public class ConferenceManager {
}
}
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
*
......
......@@ -104,6 +104,8 @@ public class RayoPlugin implements Plugin, SessionEventListener {
Log.error("Could NOT load " + component.getName());
}
setup();
component.doStart();
}
private void setup() {
......@@ -191,6 +193,7 @@ public class RayoPlugin implements Plugin, SessionEventListener {
}
closeAllChannels();
executor.shutdownNow();
component.doStop();
}
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