Commit 315325ed authored by Dele Olajide's avatar Dele Olajide Committed by dele

Rayo plugin - Implemented SayCommand

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13794 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5b146019
......@@ -68,10 +68,18 @@
{
cls: 'redirect',
label: 'Redirect Call'
},
{
cls: 'say',
label: 'Say Message'
},
{
cls: 'pause',
label: 'Pause say'
},
{
cls: 'private',
label: 'Private Call'
cls: 'resume',
label: 'Resume say'
}],
timer: true
},
......@@ -98,6 +106,7 @@
cls: 'leave',
label: 'Leave Call'
}],
timer: true
},
inactive: {
buttons: [],
......@@ -278,7 +287,22 @@
if (self.call) {
self.call.redirect(prompt("Please enter new destination:","sip:xxxx@domain.com"));
}
};
self.say = function () {
if (self.call) {
self.call.say(prompt("Please enter message:","tts:hello world, i love you"));
}
};
self.pause = function () {
if (self.call.saying) {
self.call.saying.pause();
}
};
self.resume = function () {
if (self.call.saying) {
self.call.saying.resume();
}
};
self.mute = function () {
if (self.call) {
self.call.mute(true);
......
......@@ -149,7 +149,7 @@
{
window.connection.rayo.phone(
{
codec_name: "PCMU",
codec_name: "OPUS",
stereo_pan: "0",
sip_handset: sipHandset,
......@@ -211,8 +211,11 @@
//console.log('onAnswer ' + callId);
//console.log(headers);
window.candybar.setState('active');
window.dialer.setCallLabel('Hangup');
if (window.candybar.redirect != callId)
{
window.candybar.setState('active');
window.dialer.setCallLabel('Hangup');
}
stopTone();
},
......@@ -270,7 +273,7 @@
},
offMute: function(callId) {
console.log('offMute ' + callId);
//console.log('offMute ' + callId);
window.candybar.setState('active');
window.dialer.setCallLabel('Hangup');
......@@ -291,15 +294,27 @@
},
onRedirect: function(callId) {
//console.log('onRedirect ' + callId);
console.log('onRedirect ' + callId);
window.candybar.endGently();
window.candybar.call = null;
window.candybar.redirect = callId;
window.dialer.setCallLabel('Call');
stopTone();
},
onSay: function(saying) {
console.log('Started saying ' + saying.sayId);
window.candybar.call.saying = saying;
},
onSayComplete: function(sayId) {
console.log('Finished saying ' + sayId);
window.candybar.call.saying = null;
},
onError: function(e) {
console.error(e);
......@@ -326,8 +341,8 @@
if (!username) groupname = null;
window.connection.rayo.dial("xmpp:" + window.connection.jid, sipUri, {
codec_name: "PCMU",
group_name: groupname
codec_name: "OPUS",
//group_name: groupname
});
window.candybar.setUser({
......
......@@ -63,7 +63,9 @@ Strophe.addConnectionPlugin('rayo',
that._onhook();
}, function(error) {
that._onhook();
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
......@@ -77,7 +79,7 @@ Strophe.addConnectionPlugin('rayo',
//console.log("Rayo plugin digit " + callId + " " + key);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c("dtmf", {xmlns: Strophe.NS.RAYO_CORE, tones: key});
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("dtmf", {xmlns: Strophe.NS.RAYO_CORE, tones: key});
that._connection.sendIQ(iq, null, function(error)
{
......@@ -114,7 +116,7 @@ Strophe.addConnectionPlugin('rayo',
//console.log("hold " + callId);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c("hold", {xmlns: Strophe.NS.RAYO_HANDSET});
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("hold", {xmlns: Strophe.NS.RAYO_HANDSET});
//console.log(iq.toString());
......@@ -133,12 +135,12 @@ Strophe.addConnectionPlugin('rayo',
});
},
redirect: function(to, mixer, headers)
redirect: function(to, headers)
{
//console.log("redirect " + to + " " + mixer);
//console.log("redirect " + to);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c("redirect", {xmlns: Strophe.NS.RAYO_CORE, to: to});
var iq = $iq({to: this._connection.domain, from: this._connection.jid, type: "get"}).c("redirect", {xmlns: Strophe.NS.RAYO_CORE, to: to});
if (headers)
{
......@@ -176,12 +178,68 @@ Strophe.addConnectionPlugin('rayo',
});
},
say: function(callId, message)
{
//console.log('Rayo plugin say ' + callId + " " + message);
var that = this;
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c( "say", {xmlns: Strophe.NS.RAYO_SAY}).t(message);
that._connection.sendIQ(iq, function(response)
{
$('ref', response).each(function()
{
var sayId = $(this).attr('id');
var node = Strophe.escapeNode(callId + "@" + that._connection.domain + "/" + sayId);
if (that.callbacks && that.callbacks.onSay) that.callbacks.onSay(
{
sayId: sayId,
pause: function()
{
that._connection.sendIQ($iq({to: node + "@" + that._connection.domain, from: that._connection.jid, type: "get"}).c( "pause", {xmlns: Strophe.NS.RAYO_SAY}), function(response){}, null, function(error){
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("pause failure " + errorcode);
});
});
},
resume: function()
{
that._connection.sendIQ($iq({to: node + "@" + that._connection.domain, from: that._connection.jid, type: "get"}).c( "resume", {xmlns: Strophe.NS.RAYO_SAY}), null, function(error){
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("resume failure " + errorcode);
});
});
}
});
});
}, function(error) {
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("say failure " + errorcode);
});
});
},
private: function(callId, flag)
{
//console.log('Rayo plugin private ' + callId + " " + flag);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c( flag ? "private" : "public", {xmlns: Strophe.NS.RAYO_HANDSET});
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c( flag ? "private" : "public", {xmlns: Strophe.NS.RAYO_HANDSET});
that._connection.sendIQ(iq, null, function(error)
{
......@@ -192,14 +250,14 @@ Strophe.addConnectionPlugin('rayo',
});
});
},
},
mute: function(callId, flag)
{
//console.log('Rayo plugin mute ' + callId + " " + flag);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c( flag ? "mute" : "unmute", {xmlns: Strophe.NS.RAYO_HANDSET});
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c( flag ? "mute" : "unmute", {xmlns: Strophe.NS.RAYO_HANDSET});
that._connection.sendIQ(iq, null, function(error)
{
......@@ -227,7 +285,7 @@ Strophe.addConnectionPlugin('rayo',
this._offhook(mixer, headers, function()
{
var iq = $iq({to: callId + "@rayo." + that._connection.domain, from: that._connection.jid, type: "get"}).c("answer", {xmlns: Strophe.NS.RAYO_CORE});
var iq = $iq({to: callId + "@" + that._connection.domain, from: that._connection.jid, type: "get"}).c("answer", {xmlns: Strophe.NS.RAYO_CORE});
var hdrs = Object.getOwnPropertyNames(headers)
......@@ -298,7 +356,8 @@ Strophe.addConnectionPlugin('rayo',
that.callbacks.onAccept(
{
digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, mixer, headers);},
redirect: function(to) {that.redirect(to, headers);},
say: function(message) {that.say(callId, message);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
......@@ -498,7 +557,7 @@ Strophe.addConnectionPlugin('rayo',
_handlePresence: function(presence)
{
//console.log('Rayo plugin handlePresence');
//console.log(presence);
console.log(presence);
var that = this;
var from = $(presence).attr('from');
......@@ -516,11 +575,17 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('complete').each(function()
{
$(this).find('success').each(function()
{
{
if ($(this).attr('xmlns') == Strophe.NS.RAYO_HANDSET_COMPLETE)
{
that._onhook();
}
if ($(this).attr('xmlns') == Strophe.NS.RAYO_SAY_COMPLETE)
{
var sayId = Strophe.getResourceFromJid(from);
if (that.callbacks && that.callbacks.onSayComplete) that.callbacks.onSayComplete(sayId);
}
});
});
......@@ -536,7 +601,8 @@ Strophe.addConnectionPlugin('rayo',
var call = {
digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, mixer, headers);},
redirect: function(to) {that.redirect(to, headers);},
say: function(message) {that.say(callId, message);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
answer: function() {that.answer(callId, mixer, headers, callFrom);},
......@@ -737,12 +803,13 @@ Strophe.addConnectionPlugin('rayo',
var call = {
digit: function(tone) {that.digit(callId, tone);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
leave: function() {that.leave(mixer);},
mute: function(flag) {that.mute(callId, flag);},
private: function() {that.private(callId, !this.privateCall);},
say: function(message) {that.say(callId, message);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
leave: function() {that.leave(mixer);},
mute: function(flag) {that.mute(callId, flag);},
private: function() {that.private(callId, !this.privateCall);},
id: callId,
from: Strophe.getNodeFromJid(jid),
......
......@@ -50,8 +50,7 @@ public class TreatmentManager implements MixDataSource {
private static String[] soundPath;
static {
String s = System.getProperty("com.sun.voip.server.Bridge.soundPath",
"/com/sun/voip/server/sounds");
String s = System.getProperty("com.sun.voip.server.Bridge.soundPath", "/com/sun/voip/server/sounds");
String[] sp = s.split(":");
......@@ -124,6 +123,8 @@ public class TreatmentManager implements MixDataSource {
public void pause(boolean isPaused) {
this.isPaused = isPaused;
Logger.println("TreatmentManager paused " + isPaused);
}
public boolean isPaused() {
......@@ -185,6 +186,11 @@ public class TreatmentManager implements MixDataSource {
}
public int[] getLinearData(int sampleTime) {
if (isPaused) {
return null;
}
synchronized (treatments) {
audioSource = getAudioSource();
......
......@@ -160,6 +160,8 @@ public class RayoComponent extends AbstractComponent
@Override
protected IQ handleIQGet(IQ iq) throws Exception {
Log.info("RayoComponent handleIQGet \n" + iq.toString());
final Element element = iq.getChildElement();
final String namespace = element.getNamespaceURI();
......@@ -450,7 +452,7 @@ public class RayoComponent extends AbstractComponent
childElement.addAttribute(LOCAL_PORT, Integer.toString(channel.getPortA()));
childElement.addAttribute(REMOTE_PORT, Integer.toString(channel.getPortB()));
childElement.addAttribute(ID, channel.getAttachment());
childElement.addAttribute(URI, "handset:" + channel.getAttachment() + "@" + getDomain() + "/" + iq.getFrom().getNode());
childElement.addAttribute(URI, "xmpp:" + channel.getAttachment() + "@" + getDomain() + "/webrtc");
Log.debug("Created WebRTC handset channel {}:{}, {}:{}, {}:{}", new Object[]{HOST, LocalIPResolver.getLocalIP(), LOCAL_PORT, Integer.toString(channel.getPortA()), REMOTE_PORT, Integer.toString(channel.getPortB())});
......@@ -465,7 +467,7 @@ public class RayoComponent extends AbstractComponent
final Element childElement = reply.setChildElement("ref", RAYO_CORE);
childElement.addAttribute(ID, handsetId);
childElement.addAttribute(URI, "handset:" + handsetId + "@" + getDomain() + "/" + iq.getFrom().getNode());
childElement.addAttribute(URI, handset.sipuri);
Log.info("Created SIP handset channel " + handset.sipuri);
......@@ -578,10 +580,12 @@ public class RayoComponent extends AbstractComponent
callHandler.playTreatmentToCall(treatmentId, this);
final Element childElement = reply.setChildElement("ref", RAYO_CORE);
childElement.addAttribute(ID, treatmentId);
childElement.addAttribute(URI, (String) "xmpp:" + entityId + "@" + getDomain() + "/" + treatmentId);
} catch (Exception e1) {
reply.setError(PacketError.Condition.internal_server_error);
e1.printStackTrace();
reply.setError(PacketError.Condition.not_allowed);
}
} catch (NoSuchElementException e) { // not call, lets try mixer
......@@ -593,14 +597,15 @@ public class RayoComponent extends AbstractComponent
conferenceManager.addTreatment(treatmentId);
final Element childElement = reply.setChildElement("ref", RAYO_CORE);
childElement.addAttribute(ID, treatmentId);
childElement.addAttribute(URI, (String) "xmpp:" + entityId + "@" + getDomain() + "/" + treatmentId);
} catch (Exception e2) {
reply.setError(PacketError.Condition.internal_server_error);
e2.printStackTrace();
reply.setError(PacketError.Condition.not_allowed);
}
} catch (ParseException e1) {
reply.setError(PacketError.Condition.item_not_found);
}
}
......@@ -610,32 +615,37 @@ public class RayoComponent extends AbstractComponent
private IQ handlePauseCommand(boolean flag, IQ iq)
{
Log.info("RayoComponent handlePauseCommand " + iq.getFrom());
Log.info("RayoComponent handlePauseCommand " + iq.getFrom() + " " + iq.getTo());
IQ reply = IQ.createResultIQ(iq);
final String entityId = iq.getTo().getNode();
final String treatmentId = iq.getTo().getResource();
final JID entityId = getJID(iq.getTo().getNode());
try {
CallHandler callHandler = CallHandler.findCall(entityId);
if (entityId != null)
{
final String treatmentId = entityId.getResource();
final String callId = entityId.getNode();
try {
callHandler.getMember().pauseTreatment(treatmentId, flag);
CallHandler callHandler = CallHandler.findCall(callId);
} catch (Exception e1) {
reply.setError(PacketError.Condition.internal_server_error);
}
if (callHandler != null)
{
callHandler.getMember().pauseTreatment(treatmentId, flag);
} catch (NoSuchElementException e) { // not call, lets try mixer
} else { // not call, lets try mixer
try {
ConferenceManager conferenceManager = ConferenceManager.findConferenceManager(entityId);
conferenceManager.getWGManager().pauseConferenceTreatment(treatmentId, flag);
try {
ConferenceManager conferenceManager = ConferenceManager.findConferenceManager(callId);
conferenceManager.getWGManager().pauseConferenceTreatment(treatmentId, flag);
} catch (ParseException e1) {
} catch (ParseException e1) {
reply.setError(PacketError.Condition.item_not_found);
reply.setError(PacketError.Condition.item_not_found);
}
}
} else {
reply.setError(PacketError.Condition.item_not_found);
}
return reply;
......@@ -1208,9 +1218,11 @@ public class RayoComponent extends AbstractComponent
sendPacket(presence);
} else if ("230 TREATMENT DONE".equals(myEvent)) {
//presence.getElement().add(rayoProvider.toXML(new DtmfEvent(callEvent.getCallId(), callEvent.getDtmfKey())));
//sendPacket(presence);
Log.info("230 TREATMENT DONE");
presence.setFrom(callEvent.getCallId() + "@" + getDomain() + "/" + callEvent.getTreatmentId());
SayCompleteEvent complete = new SayCompleteEvent();
complete.setReason(SayCompleteEvent.Reason.valueOf("SUCCESS"));
presence.getElement().add(sayProvider.toXML(complete));
sendPacket(presence);
}
}
}
......
......@@ -37,6 +37,8 @@ public class Application implements CallEventListener {
config = Config.getInstance();
config.initialise();
String webHome = pluginDirectory.getAbsolutePath() + File.separator + ".." + File.separator + ".." + File.separator + "resources" + File.separator + "spank" + File.separator + "rayo";
System.setProperty("com.sun.voip.server.LOGLEVEL", "99");
System.setProperty("com.sun.voip.server.FIRST_RTP_PORT", "3200");
System.setProperty("com.sun.voip.server.LAST_RTP_PORT", "3299");
......@@ -46,7 +48,8 @@ public class Application implements CallEventListener {
System.setProperty("com.sun.voip.server.PUBLIC_IP_ADDRESS", config.getPublicHost());
System.setProperty("com.sun.voip.server.PROTOCOL", config.getDefaultProtocol());
System.setProperty("com.sun.voip.server.SIP_PORT", config.getDefaultSIPPort());
System.setProperty("com.sun.voip.server.Bridge.recordDirectory", pluginDirectory.getAbsolutePath() + File.separator + ".." + File.separator + ".." + File.separator + "resources" + File.separator + "spank" + File.separator + "rayo" + File.separator + "recordings");
System.setProperty("com.sun.voip.server.Bridge.recordDirectory", webHome + File.separator + "recordings");
System.setProperty("com.sun.voip.server.Bridge.soundPath", "/com/sun/voip/server/sounds:" + webHome + File.separator + "sounds");
System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
Properties properties = new Properties();
......
......@@ -63,7 +63,9 @@ Strophe.addConnectionPlugin('rayo',
that._onhook();
}, function(error) {
that._onhook();
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
......@@ -77,7 +79,7 @@ Strophe.addConnectionPlugin('rayo',
//console.log("Rayo plugin digit " + callId + " " + key);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c("dtmf", {xmlns: Strophe.NS.RAYO_CORE, tones: key});
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("dtmf", {xmlns: Strophe.NS.RAYO_CORE, tones: key});
that._connection.sendIQ(iq, null, function(error)
{
......@@ -114,7 +116,7 @@ Strophe.addConnectionPlugin('rayo',
//console.log("hold " + callId);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c("hold", {xmlns: Strophe.NS.RAYO_HANDSET});
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("hold", {xmlns: Strophe.NS.RAYO_HANDSET});
//console.log(iq.toString());
......@@ -133,12 +135,12 @@ Strophe.addConnectionPlugin('rayo',
});
},
redirect: function(to, mixer, headers)
redirect: function(to, headers)
{
//console.log("redirect " + to + " " + mixer);
//console.log("redirect " + to);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c("redirect", {xmlns: Strophe.NS.RAYO_CORE, to: to});
var iq = $iq({to: this._connection.domain, from: this._connection.jid, type: "get"}).c("redirect", {xmlns: Strophe.NS.RAYO_CORE, to: to});
if (headers)
{
......@@ -176,12 +178,68 @@ Strophe.addConnectionPlugin('rayo',
});
},
say: function(callId, message)
{
//console.log('Rayo plugin say ' + callId + " " + message);
var that = this;
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c( "say", {xmlns: Strophe.NS.RAYO_SAY}).t(message);
that._connection.sendIQ(iq, function(response)
{
$('ref', response).each(function()
{
var sayId = $(this).attr('id');
var node = Strophe.escapeNode(callId + "@" + that._connection.domain + "/" + sayId);
if (that.callbacks && that.callbacks.onSay) that.callbacks.onSay(
{
sayId: sayId,
pause: function()
{
that._connection.sendIQ($iq({to: node + "@" + that._connection.domain, from: that._connection.jid, type: "get"}).c( "pause", {xmlns: Strophe.NS.RAYO_SAY}), function(response){}, null, function(error){
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("pause failure " + errorcode);
});
});
},
resume: function()
{
that._connection.sendIQ($iq({to: node + "@" + that._connection.domain, from: that._connection.jid, type: "get"}).c( "resume", {xmlns: Strophe.NS.RAYO_SAY}), null, function(error){
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("resume failure " + errorcode);
});
});
}
});
});
}, function(error) {
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("say failure " + errorcode);
});
});
},
private: function(callId, flag)
{
//console.log('Rayo plugin private ' + callId + " " + flag);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c( flag ? "private" : "public", {xmlns: Strophe.NS.RAYO_HANDSET});
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c( flag ? "private" : "public", {xmlns: Strophe.NS.RAYO_HANDSET});
that._connection.sendIQ(iq, null, function(error)
{
......@@ -192,14 +250,14 @@ Strophe.addConnectionPlugin('rayo',
});
});
},
},
mute: function(callId, flag)
{
//console.log('Rayo plugin mute ' + callId + " " + flag);
var that = this;
var iq = $iq({to: callId + "@rayo." + this._connection.domain, from: this._connection.jid, type: "get"}).c( flag ? "mute" : "unmute", {xmlns: Strophe.NS.RAYO_HANDSET});
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c( flag ? "mute" : "unmute", {xmlns: Strophe.NS.RAYO_HANDSET});
that._connection.sendIQ(iq, null, function(error)
{
......@@ -227,7 +285,7 @@ Strophe.addConnectionPlugin('rayo',
this._offhook(mixer, headers, function()
{
var iq = $iq({to: callId + "@rayo." + that._connection.domain, from: that._connection.jid, type: "get"}).c("answer", {xmlns: Strophe.NS.RAYO_CORE});
var iq = $iq({to: callId + "@" + that._connection.domain, from: that._connection.jid, type: "get"}).c("answer", {xmlns: Strophe.NS.RAYO_CORE});
var hdrs = Object.getOwnPropertyNames(headers)
......@@ -298,7 +356,8 @@ Strophe.addConnectionPlugin('rayo',
that.callbacks.onAccept(
{
digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, mixer, headers);},
redirect: function(to) {that.redirect(to, headers);},
say: function(message) {that.say(callId, message);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
......@@ -498,7 +557,7 @@ Strophe.addConnectionPlugin('rayo',
_handlePresence: function(presence)
{
//console.log('Rayo plugin handlePresence');
//console.log(presence);
console.log(presence);
var that = this;
var from = $(presence).attr('from');
......@@ -516,11 +575,17 @@ Strophe.addConnectionPlugin('rayo',
$(presence).find('complete').each(function()
{
$(this).find('success').each(function()
{
{
if ($(this).attr('xmlns') == Strophe.NS.RAYO_HANDSET_COMPLETE)
{
that._onhook();
}
if ($(this).attr('xmlns') == Strophe.NS.RAYO_SAY_COMPLETE)
{
var sayId = Strophe.getResourceFromJid(from);
if (that.callbacks && that.callbacks.onSayComplete) that.callbacks.onSayComplete(sayId);
}
});
});
......@@ -536,7 +601,8 @@ Strophe.addConnectionPlugin('rayo',
var call = {
digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, mixer, headers);},
redirect: function(to) {that.redirect(to, headers);},
say: function(message) {that.say(callId, message);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
answer: function() {that.answer(callId, mixer, headers, callFrom);},
......@@ -737,12 +803,13 @@ Strophe.addConnectionPlugin('rayo',
var call = {
digit: function(tone) {that.digit(callId, tone);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
leave: function() {that.leave(mixer);},
mute: function(flag) {that.mute(callId, flag);},
private: function() {that.private(callId, !this.privateCall);},
say: function(message) {that.say(callId, message);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
leave: function() {that.leave(mixer);},
mute: function(flag) {that.mute(callId, flag);},
private: function() {that.private(callId, !this.privateCall);},
id: callId,
from: Strophe.getNodeFromJid(jid),
......
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