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

Rayo Plugin - implemented RecordCommand

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13795 b35dd754-fafc-0310-a699-88a17e54d16e
parent 315325ed
......@@ -69,10 +69,14 @@
cls: 'redirect',
label: 'Redirect Call'
},
{
cls: 'record',
label: 'Record Voice'
},
{
cls: 'say',
label: 'Say Message'
},
},
{
cls: 'pause',
label: 'Pause say'
......@@ -292,7 +296,12 @@
if (self.call) {
self.call.say(prompt("Please enter message:","tts:hello world, i love you"));
}
};
};
self.record = function () {
if (self.call) {
self.call.record(prompt("Please enter name:","greeting"));
}
};
self.pause = function () {
if (self.call.saying) {
self.call.saying.pause();
......
......@@ -211,11 +211,8 @@
//console.log('onAnswer ' + callId);
//console.log(headers);
if (window.candybar.redirect != callId)
{
window.candybar.setState('active');
window.dialer.setCallLabel('Hangup');
}
window.candybar.setState('active');
window.dialer.setCallLabel('Hangup');
stopTone();
},
......@@ -294,17 +291,23 @@
},
onRedirect: function(callId) {
console.log('onRedirect ' + callId);
//console.log('onRedirect ' + callId);
window.candybar.endGently();
window.candybar.redirect = callId;
window.dialer.setCallLabel('Call');
stopTone();
},
onRedirecting: function(callId) {
console.log('onRedirecting ' + callId);
},
onRedirected: function(callId) {
//console.log('onRedirected ' + callId);
},
onSay: function(saying) {
console.log('Started saying ' + saying.sayId);
//console.log('Started saying ' + saying.sayId);
window.candybar.call.saying = saying;
},
......
......@@ -155,7 +155,7 @@ Strophe.addConnectionPlugin('rayo',
}
}
console.log(iq.toString());
//console.log(iq.toString());
that._connection.sendIQ(iq, function(response)
{
......@@ -167,8 +167,7 @@ Strophe.addConnectionPlugin('rayo',
if (that.callbacks && that.callbacks.onRedirect) that.callbacks.onRedirect(callId);
});
}, function(error) {
console.log(error);
}, function(error) {
$('error', error).each(function()
{
......@@ -233,6 +232,25 @@ Strophe.addConnectionPlugin('rayo',
});
},
record: function(callId, fileName)
{
var to = "file:" + fileName + ".au";
console.log('Rayo plugin record ' + callId + " " + to);
var that = this;
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("record", {xmlns: Strophe.NS.RAYO_RECORD, to: to});
that._connection.sendIQ(iq, null, function(error)
{
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("record failure " + errorcode);
});
});
},
private: function(callId, flag)
{
......@@ -357,7 +375,8 @@ Strophe.addConnectionPlugin('rayo',
{
digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, headers);},
say: function(message) {that.say(callId, message);},
say: function(message) {that.say(callId, message);},
record: function(file) {that.record(callId, file);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
......@@ -557,7 +576,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');
......@@ -602,7 +621,8 @@ Strophe.addConnectionPlugin('rayo',
var call = {
digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, headers);},
say: function(message) {that.say(callId, message);},
say: function(message) {that.say(callId, message);},
record: function(file) {that.record(callId, file);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
answer: function() {that.answer(callId, mixer, headers, callFrom);},
......@@ -773,6 +793,28 @@ Strophe.addConnectionPlugin('rayo',
}
});
$(presence).find('transferring').each(function()
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_HANDSET)
{
var callId = Strophe.getNodeFromJid(from);
if (that.callbacks && that.callbacks.onRedirecting) that.callbacks.onRedirecting(callId);
}
});
$(presence).find('transferred').each(function()
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_HANDSET)
{
var callId = Strophe.getNodeFromJid(from);
if (that.callbacks && that.callbacks.onRedirected) that.callbacks.onRedirected(callId);
}
});
$(presence).find('answered').each(function()
{
//console.log(presence);
......@@ -803,7 +845,8 @@ Strophe.addConnectionPlugin('rayo',
var call = {
digit: function(tone) {that.digit(callId, tone);},
say: function(message) {that.say(callId, message);},
say: function(message) {that.say(callId, message);},
record: function(file) {that.record(callId, file);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
......
package com.rayo.core.verb;
public class TransferredEvent extends AbstractVerbEvent {
public TransferredEvent() {}
public TransferredEvent(Verb verb) {
super(verb);
}
}
package com.rayo.core.verb;
public class TransferringEvent extends AbstractVerbEvent {
public TransferringEvent() {}
public TransferringEvent(Verb verb) {
super(verb);
}
}
......@@ -173,6 +173,12 @@ public class HandsetProvider extends BaseProvider {
} else if (object instanceof PublicEvent) {
createPublicEvent((PublicEvent) object, document);
} else if (object instanceof TransferredEvent) {
createTransferredEvent((TransferredEvent) object, document);
} else if (object instanceof TransferringEvent) {
createTransferringEvent((TransferringEvent) object, document);
}
}
......@@ -229,4 +235,13 @@ public class HandsetProvider extends BaseProvider {
document.addElement(new QName("public", NAMESPACE));
}
private void createTransferredEvent(TransferredEvent event, Document document)
{
document.addElement(new QName("transferred", NAMESPACE));
}
private void createTransferringEvent(TransferringEvent event, Document document)
{
document.addElement(new QName("transferring", NAMESPACE));
}
}
......@@ -45,7 +45,7 @@ public class MediaInfo {
(byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo(
(byte)101, RtpPacket.PCM_ENCODING, 8000, 1, true));
(byte)101, RtpPacket.PCM_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo(
(byte)102, RtpPacket.PCM_ENCODING, 8000, 2, false));
......
......@@ -65,6 +65,8 @@ public class ConferenceManager {
private boolean privateCall = false;
private boolean transferCall = false;
private CallParticipant heldCall = null;
private String groupName = null;
......@@ -642,6 +644,26 @@ public class ConferenceManager {
}
}
public boolean isTransferCall()
{
return transferCall;
}
public static boolean isTransferCall(String conferenceId)
{
try {
ConferenceManager conferenceManager = findConferenceManager(conferenceId);
return conferenceManager.isTransferCall();
} catch (ParseException e) {
return false;
}
}
public void setTransferCall(boolean transferCall)
{
this.transferCall = transferCall;
}
public boolean isPrivateCall()
{
return privateCall;
......
......@@ -139,7 +139,7 @@ public class SipUtil {
(byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo(
(byte)101, RtpPacket.PCM_ENCODING, 8000, 1, true));
(byte)101, RtpPacket.PCM_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo(
(byte)102, RtpPacket.PCM_ENCODING, 8000, 2, false));
......
......@@ -49,7 +49,9 @@ public class Application implements CallEventListener {
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", webHome + File.separator + "recordings");
System.setProperty("com.sun.voip.server.Bridge.soundsDirectory", webHome + File.separator + "sounds");
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();
......
......@@ -155,7 +155,7 @@ Strophe.addConnectionPlugin('rayo',
}
}
console.log(iq.toString());
//console.log(iq.toString());
that._connection.sendIQ(iq, function(response)
{
......@@ -167,8 +167,7 @@ Strophe.addConnectionPlugin('rayo',
if (that.callbacks && that.callbacks.onRedirect) that.callbacks.onRedirect(callId);
});
}, function(error) {
console.log(error);
}, function(error) {
$('error', error).each(function()
{
......@@ -233,6 +232,25 @@ Strophe.addConnectionPlugin('rayo',
});
},
record: function(callId, fileName)
{
var to = "file:" + fileName + ".au";
console.log('Rayo plugin record ' + callId + " " + to);
var that = this;
var iq = $iq({to: callId + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("record", {xmlns: Strophe.NS.RAYO_RECORD, to: to});
that._connection.sendIQ(iq, null, function(error)
{
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("record failure " + errorcode);
});
});
},
private: function(callId, flag)
{
......@@ -357,7 +375,8 @@ Strophe.addConnectionPlugin('rayo',
{
digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, headers);},
say: function(message) {that.say(callId, message);},
say: function(message) {that.say(callId, message);},
record: function(file) {that.record(callId, file);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
......@@ -557,7 +576,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');
......@@ -602,7 +621,8 @@ Strophe.addConnectionPlugin('rayo',
var call = {
digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, headers);},
say: function(message) {that.say(callId, message);},
say: function(message) {that.say(callId, message);},
record: function(file) {that.record(callId, file);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
answer: function() {that.answer(callId, mixer, headers, callFrom);},
......@@ -773,6 +793,28 @@ Strophe.addConnectionPlugin('rayo',
}
});
$(presence).find('transferring').each(function()
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_HANDSET)
{
var callId = Strophe.getNodeFromJid(from);
if (that.callbacks && that.callbacks.onRedirecting) that.callbacks.onRedirecting(callId);
}
});
$(presence).find('transferred').each(function()
{
//console.log(presence);
if ($(this).attr('xmlns') == Strophe.NS.RAYO_HANDSET)
{
var callId = Strophe.getNodeFromJid(from);
if (that.callbacks && that.callbacks.onRedirected) that.callbacks.onRedirected(callId);
}
});
$(presence).find('answered').each(function()
{
//console.log(presence);
......@@ -803,7 +845,8 @@ Strophe.addConnectionPlugin('rayo',
var call = {
digit: function(tone) {that.digit(callId, tone);},
say: function(message) {that.say(callId, message);},
say: function(message) {that.say(callId, message);},
record: function(file) {that.record(callId, file);},
hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);},
......
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