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,6 +69,10 @@ ...@@ -69,6 +69,10 @@
cls: 'redirect', cls: 'redirect',
label: 'Redirect Call' label: 'Redirect Call'
}, },
{
cls: 'record',
label: 'Record Voice'
},
{ {
cls: 'say', cls: 'say',
label: 'Say Message' label: 'Say Message'
...@@ -293,6 +297,11 @@ ...@@ -293,6 +297,11 @@
self.call.say(prompt("Please enter message:","tts:hello world, i love you")); 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 () { self.pause = function () {
if (self.call.saying) { if (self.call.saying) {
self.call.saying.pause(); self.call.saying.pause();
......
...@@ -211,11 +211,8 @@ ...@@ -211,11 +211,8 @@
//console.log('onAnswer ' + callId); //console.log('onAnswer ' + callId);
//console.log(headers); //console.log(headers);
if (window.candybar.redirect != callId)
{
window.candybar.setState('active'); window.candybar.setState('active');
window.dialer.setCallLabel('Hangup'); window.dialer.setCallLabel('Hangup');
}
stopTone(); stopTone();
}, },
...@@ -294,17 +291,23 @@ ...@@ -294,17 +291,23 @@
}, },
onRedirect: function(callId) { onRedirect: function(callId) {
console.log('onRedirect ' + callId); //console.log('onRedirect ' + callId);
window.candybar.endGently(); window.candybar.endGently();
window.candybar.redirect = callId;
window.dialer.setCallLabel('Call'); window.dialer.setCallLabel('Call');
stopTone(); stopTone();
}, },
onRedirecting: function(callId) {
console.log('onRedirecting ' + callId);
},
onRedirected: function(callId) {
//console.log('onRedirected ' + callId);
},
onSay: function(saying) { onSay: function(saying) {
console.log('Started saying ' + saying.sayId); //console.log('Started saying ' + saying.sayId);
window.candybar.call.saying = saying; window.candybar.call.saying = saying;
}, },
......
...@@ -155,7 +155,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -155,7 +155,7 @@ Strophe.addConnectionPlugin('rayo',
} }
} }
console.log(iq.toString()); //console.log(iq.toString());
that._connection.sendIQ(iq, function(response) that._connection.sendIQ(iq, function(response)
{ {
...@@ -168,7 +168,6 @@ Strophe.addConnectionPlugin('rayo', ...@@ -168,7 +168,6 @@ Strophe.addConnectionPlugin('rayo',
}); });
}, function(error) { }, function(error) {
console.log(error);
$('error', error).each(function() $('error', error).each(function()
{ {
...@@ -234,6 +233,25 @@ Strophe.addConnectionPlugin('rayo', ...@@ -234,6 +233,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) private: function(callId, flag)
{ {
//console.log('Rayo plugin private ' + callId + " " + flag); //console.log('Rayo plugin private ' + callId + " " + flag);
...@@ -358,6 +376,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -358,6 +376,7 @@ Strophe.addConnectionPlugin('rayo',
digit: function(tone) {that.digit(callId, tone);}, digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, headers);}, 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);}, hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);}, hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);}, join: function() {that.join(mixer, headers);},
...@@ -557,7 +576,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -557,7 +576,7 @@ Strophe.addConnectionPlugin('rayo',
_handlePresence: function(presence) _handlePresence: function(presence)
{ {
//console.log('Rayo plugin handlePresence'); //console.log('Rayo plugin handlePresence');
console.log(presence); //console.log(presence);
var that = this; var that = this;
var from = $(presence).attr('from'); var from = $(presence).attr('from');
...@@ -603,6 +622,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -603,6 +622,7 @@ Strophe.addConnectionPlugin('rayo',
digit: function(tone) {that.digit(callId, tone);}, digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, headers);}, 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);}, hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);}, hold: function() {that.hold(callId);},
answer: function() {that.answer(callId, mixer, headers, callFrom);}, answer: function() {that.answer(callId, mixer, headers, callFrom);},
...@@ -773,6 +793,28 @@ Strophe.addConnectionPlugin('rayo', ...@@ -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() $(presence).find('answered').each(function()
{ {
//console.log(presence); //console.log(presence);
...@@ -804,6 +846,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -804,6 +846,7 @@ Strophe.addConnectionPlugin('rayo',
var call = { var call = {
digit: function(tone) {that.digit(callId, tone);}, 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);}, hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);}, hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);}, 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 { ...@@ -173,6 +173,12 @@ public class HandsetProvider extends BaseProvider {
} else if (object instanceof PublicEvent) { } else if (object instanceof PublicEvent) {
createPublicEvent((PublicEvent) object, document); 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 { ...@@ -229,4 +235,13 @@ public class HandsetProvider extends BaseProvider {
document.addElement(new QName("public", NAMESPACE)); 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 { ...@@ -45,7 +45,7 @@ public class MediaInfo {
(byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, false)); (byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo( supportedMedia.add(new MediaInfo(
(byte)101, RtpPacket.PCM_ENCODING, 8000, 1, true)); (byte)101, RtpPacket.PCM_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo( supportedMedia.add(new MediaInfo(
(byte)102, RtpPacket.PCM_ENCODING, 8000, 2, false)); (byte)102, RtpPacket.PCM_ENCODING, 8000, 2, false));
......
...@@ -65,6 +65,8 @@ public class ConferenceManager { ...@@ -65,6 +65,8 @@ public class ConferenceManager {
private boolean privateCall = false; private boolean privateCall = false;
private boolean transferCall = false;
private CallParticipant heldCall = null; private CallParticipant heldCall = null;
private String groupName = null; private String groupName = null;
...@@ -642,6 +644,26 @@ public class ConferenceManager { ...@@ -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() public boolean isPrivateCall()
{ {
return privateCall; return privateCall;
......
...@@ -139,7 +139,7 @@ public class SipUtil { ...@@ -139,7 +139,7 @@ public class SipUtil {
(byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, false)); (byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo( supportedMedia.add(new MediaInfo(
(byte)101, RtpPacket.PCM_ENCODING, 8000, 1, true)); (byte)101, RtpPacket.PCM_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo( supportedMedia.add(new MediaInfo(
(byte)102, RtpPacket.PCM_ENCODING, 8000, 2, false)); (byte)102, RtpPacket.PCM_ENCODING, 8000, 2, false));
......
...@@ -49,7 +49,9 @@ public class Application implements CallEventListener { ...@@ -49,7 +49,9 @@ public class Application implements CallEventListener {
System.setProperty("com.sun.voip.server.PROTOCOL", config.getDefaultProtocol()); 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.SIP_PORT", config.getDefaultSIPPort());
System.setProperty("com.sun.voip.server.Bridge.recordDirectory", webHome + File.separator + "recordings"); 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("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"); System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
Properties properties = new Properties(); Properties properties = new Properties();
......
...@@ -155,7 +155,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -155,7 +155,7 @@ Strophe.addConnectionPlugin('rayo',
} }
} }
console.log(iq.toString()); //console.log(iq.toString());
that._connection.sendIQ(iq, function(response) that._connection.sendIQ(iq, function(response)
{ {
...@@ -168,7 +168,6 @@ Strophe.addConnectionPlugin('rayo', ...@@ -168,7 +168,6 @@ Strophe.addConnectionPlugin('rayo',
}); });
}, function(error) { }, function(error) {
console.log(error);
$('error', error).each(function() $('error', error).each(function()
{ {
...@@ -234,6 +233,25 @@ Strophe.addConnectionPlugin('rayo', ...@@ -234,6 +233,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) private: function(callId, flag)
{ {
//console.log('Rayo plugin private ' + callId + " " + flag); //console.log('Rayo plugin private ' + callId + " " + flag);
...@@ -358,6 +376,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -358,6 +376,7 @@ Strophe.addConnectionPlugin('rayo',
digit: function(tone) {that.digit(callId, tone);}, digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, headers);}, 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);}, hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);}, hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);}, join: function() {that.join(mixer, headers);},
...@@ -557,7 +576,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -557,7 +576,7 @@ Strophe.addConnectionPlugin('rayo',
_handlePresence: function(presence) _handlePresence: function(presence)
{ {
//console.log('Rayo plugin handlePresence'); //console.log('Rayo plugin handlePresence');
console.log(presence); //console.log(presence);
var that = this; var that = this;
var from = $(presence).attr('from'); var from = $(presence).attr('from');
...@@ -603,6 +622,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -603,6 +622,7 @@ Strophe.addConnectionPlugin('rayo',
digit: function(tone) {that.digit(callId, tone);}, digit: function(tone) {that.digit(callId, tone);},
redirect: function(to) {that.redirect(to, headers);}, 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);}, hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);}, hold: function() {that.hold(callId);},
answer: function() {that.answer(callId, mixer, headers, callFrom);}, answer: function() {that.answer(callId, mixer, headers, callFrom);},
...@@ -773,6 +793,28 @@ Strophe.addConnectionPlugin('rayo', ...@@ -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() $(presence).find('answered').each(function()
{ {
//console.log(presence); //console.log(presence);
...@@ -804,6 +846,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -804,6 +846,7 @@ Strophe.addConnectionPlugin('rayo',
var call = { var call = {
digit: function(tone) {that.digit(callId, tone);}, 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);}, hangup: function() {that.hangup(callId);},
hold: function() {that.hold(callId);}, hold: function() {that.hold(callId);},
join: function() {that.join(mixer, headers);}, 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