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

Rayo Plugin - Bug fixing

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13804 b35dd754-fafc-0310-a699-88a17e54d16e
parent 2f20b26c
......@@ -149,7 +149,7 @@
{
window.connection.rayo.phone(
{
codec_name: "OPUS",
codec_name: "PCMU",
stereo_pan: "0",
sip_handset: sipHandset,
......@@ -344,7 +344,7 @@
if (!username) groupname = null;
window.connection.rayo.dial("xmpp:" + window.connection.jid, sipUri, {
codec_name: "OPUS",
codec_name: "PCMU",
//group_name: groupname
});
......
......@@ -98,9 +98,20 @@ Strophe.addConnectionPlugin('rayo',
if (this._isOffhook()) this._onhook();
var that = this;
this._offhook(mixer, headers, function()
{
var iq = $iq({to: mixer + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("join", {xmlns: Strophe.NS.RAYO_CORE, "mixer-name": mixer});
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("join failure " + errorcode);
});
});
});
},
......@@ -108,7 +119,21 @@ Strophe.addConnectionPlugin('rayo',
{
//console.log('Rayo plugin leave ' + mixer);
var that = this;
var iq = $iq({to: mixer + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("unjoin", {xmlns: Strophe.NS.RAYO_CORE, "mixer-name": mixer});
that._connection.sendIQ(iq, function(response)
{
this._onhook();
}, function(error) {
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("unjoin failure " + errorcode);
});
});
},
hold: function(callId)
......@@ -125,7 +150,6 @@ Strophe.addConnectionPlugin('rayo',
that._onhook();
}, function(error) {
//console.log(error);
$('error', error).each(function()
{
......
......@@ -804,13 +804,10 @@ public class ConferenceManager {
/*
* Transfer an incoming call to the target conference.
*/
public void transferMember(ConferenceManager newConferenceManager,
ConferenceMember member) throws IOException {
public void transferMember(ConferenceManager newConferenceManager, ConferenceMember member) throws IOException
{
leave(member, true); // leave the temporary conference
member.reinitialize(newConferenceManager, false);
member.reinitialize(newConferenceManager, true);
newConferenceManager.joinConference(member); // join the new conference
}
......
......@@ -73,7 +73,7 @@ public class IncomingConferenceHandler extends Thread
private IncomingCallHandler incomingCallHandler;
private String lastDtmfKey;
private String lastDtmfKey = "";
private String phoneNo;
/**
......
......@@ -442,15 +442,12 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
return;
}
if (telephoneEventPayload == 0 &&
(cp.dtmfDetection() || cp.getJoinConfirmationTimeout() != 0)) {
//if (telephoneEventPayload == 0 && (cp.dtmfDetection() || cp.getJoinConfirmationTimeout() != 0)) {
if (traceCall || Logger.logLevel >= Logger.LOG_INFO) {
Logger.println("Call " + cp + " starting dtmf Detector...");
}
Logger.println("Call " + cp + " starting dtmf Detector..." + telephoneEventPayload + " " + cp.dtmfDetection());
dtmfDecoder = new DtmfDecoder(this, myMediaInfo);
}
//}
if (myMediaInfo.getEncoding() == RtpPacket.SPEEX_ENCODING) {
try {
......
......@@ -852,13 +852,13 @@ public class RayoComponent extends AbstractComponent
Config.createCallRecord(source, recording, "xmpp:" + iq.getFrom(), cp.getStartTimestamp(), 0, "dialed") ;
Config.createCallRecord(destination, recording, "xmpp:" + callerId, cp.getStartTimestamp(), 0, "received");
sendMessage(new JID(callerId), iq.getFrom(), "Call started", recording);
sendMessage(new JID(callerId), iq.getFrom(), "Call started", recording, "chat");
} else { // incoming SIP
Config.createCallRecord(destination, recording, "sip:" + cp.getPhoneNumber(), cp.getStartTimestamp(), 0, "received") ;
sendMessage(iq.getFrom(), new JID(cp.getCallId() + "@" + getDomain()), "Call started", recording);
sendMessage(iq.getFrom(), new JID(cp.getCallId() + "@" + getDomain()), "Call started", recording, "chat");
}
} catch (ParseException e1) {
......@@ -958,10 +958,19 @@ public class RayoComponent extends AbstractComponent
if (mixer != null)
{
try {
IncomingCallHandler.transferCall(iq.getTo().getNode(), mixer);
ConferenceManager conferenceManager = ConferenceManager.findConferenceManager(mixer);
if (conferenceManager.getMemberList().size() == 1)
{
String recording = mixer + "-" + System.currentTimeMillis() + ".au";
conferenceManager.recordConference(true, recording, "au");
sendMucMessage(mixer, recording, iq.getFrom(), "Started voice recording");
}
sendMucMessage(mixer, null, iq.getFrom(), "Joined voice conversation");
} catch (Exception e) {
reply.setError(PacketError.Condition.internal_server_error);
reply.setError(PacketError.Condition.item_not_found);
}
} else {
......@@ -977,16 +986,59 @@ public class RayoComponent extends AbstractComponent
IQ reply = IQ.createResultIQ(iq);
String mixer = null;
if (command.getType() == JoinDestinationType.CALL) {
// TODO join.getFrom()
} else {
mixer = command.getFrom();
}
if (mixer != null)
{
try {
IncomingCallHandler.transferCall(iq.getTo().getNode(), defaultIncomingConferenceId);
ConferenceManager conferenceManager = ConferenceManager.findConferenceManager(mixer);
if (conferenceManager.getMemberList().size() == 1)
{
conferenceManager.recordConference(false, null, null);
sendMucMessage(mixer, null, iq.getFrom(), "Stopped voice recording");
}
sendMucMessage(mixer, null, iq.getFrom(), "Left voice conversation");
} catch (Exception e) {
reply.setError(PacketError.Condition.internal_server_error);
reply.setError(PacketError.Condition.item_not_found);
}
} else {
reply.setError(PacketError.Condition.feature_not_implemented);
}
return reply;
}
private void sendMucMessage(String mixer, String recording, JID participant, String message)
{
if (XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService("conference").hasChatRoom(mixer)) {
MUCRoom room = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService("conference").getChatRoom(mixer);
if (room != null)
{
for (MUCRole role : room.getOccupants())
{
if (participant.toBareJID().equals(role.getUserAddress().toBareJID()))
{
sendMessage(new JID(mixer + "@conference." + getDomain()), participant, message, recording, "groupchat");
break;
}
}
}
}
}
private IQ handleDialCommand(DialCommand command, IQ iq, boolean transferCall)
{
Log.info("RayoComponent handleHandsetDialCommand " + iq.getFrom());
......@@ -1232,7 +1284,7 @@ public class RayoComponent extends AbstractComponent
conferenceManager.recordConference(true, recording, "au");
Config.createCallRecord(cp.getDisplayName(), recording, cp.getPhoneNumber(), cp.getStartTimestamp(), 0, "dialed") ;
sendMessage(new JID(cp.getCallOwner()), new JID(cp.getCallId() + "@" + getDomain()), "Call started", recording);
sendMessage(new JID(cp.getCallOwner()), new JID(cp.getCallId() + "@" + getDomain()), "Call started", recording, "chat");
} catch (ParseException e1) {
reply.setError(PacketError.Condition.internal_server_error);
......@@ -1418,7 +1470,7 @@ public class RayoComponent extends AbstractComponent
if (target.equals(destination.toString()) == false)
{
sendMessage(new JID(target), destination, "Call ended", null);
sendMessage(new JID(target), destination, "Call ended", null, "chat");
}
} catch (Exception e) {
e.printStackTrace();
......@@ -1432,7 +1484,7 @@ public class RayoComponent extends AbstractComponent
}
private void sendMessage(JID from, JID to, String body, String fileName)
private void sendMessage(JID from, JID to, String body, String fileName, String type)
{
Log.info( "RayoComponent sendMessage " + from + " " + to + " " + body + " " + fileName);
......@@ -1440,12 +1492,13 @@ public class RayoComponent extends AbstractComponent
Message packet = new Message();
packet.setTo(to);
packet.setFrom(from);
packet.setType(Message.Type.chat);
packet.setThread("http://" + getDomain() + ":" + port + "/rayo/recordings/" + fileName);
packet.setType("chat".equals(type) ? Message.Type.chat : Message.Type.groupchat);
if (fileName != null) packet.setThread("http://" + getDomain() + ":" + port + "/rayo/recordings/" + fileName);
packet.setBody(body);
sendPacket(packet);
}
public void sendPacket(Packet packet)
{
try {
......@@ -1461,14 +1514,22 @@ public class RayoComponent extends AbstractComponent
{
Log.info( "RayoComponent notifyConferenceMonitors " + conferenceEvent.toString());
if (defaultIncomingConferenceId.equals(conferenceEvent.getConferenceId())) return;
ConferenceManager conferenceManager = null;
try {
if (conferenceEvent.equals(ConferenceEvent.MEMBER_LEFT) || conferenceEvent.equals(ConferenceEvent.MEMBER_JOINED))
{
Log.info("RayoComponent notifyConferenceMonitors looking for call " + conferenceEvent.getCallId() + " " + conferenceEvent.getMemberCount());
ConferenceManager conferenceManager = ConferenceManager.findConferenceManager(conferenceEvent.getConferenceId());
try {
conferenceManager = ConferenceManager.findConferenceManager(conferenceEvent.getConferenceId());
} catch (Exception e) {}
if (conferenceManager != null)
{
String groupName = conferenceManager.getGroupName();
String callId = conferenceManager.getCallId();
......@@ -1523,7 +1584,7 @@ public class RayoComponent extends AbstractComponent
}
}
if (memberCount == 0)
if (memberCount == 0 && conferenceEvent.equals(ConferenceEvent.MEMBER_LEFT))
{
conferenceManager.recordConference(false, null, null);
conferenceManager.endConference(conferenceEvent.getConferenceId());
......@@ -1550,6 +1611,7 @@ public class RayoComponent extends AbstractComponent
}
}
}
}
} catch (Exception e) {
......@@ -1671,6 +1733,8 @@ public class RayoComponent extends AbstractComponent
CallParticipant fp = farParty.getCallParticipant();
if (callParticipant.isAutoAnswer()) fp.setHeld(true); // sip phone as handset hangup
if (fp.isHeld())
{
Log.info( "RayoComponent routeJoinEvent call held with " + callParticipant);
......
......@@ -98,9 +98,20 @@ Strophe.addConnectionPlugin('rayo',
if (this._isOffhook()) this._onhook();
var that = this;
this._offhook(mixer, headers, function()
{
var iq = $iq({to: mixer + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("join", {xmlns: Strophe.NS.RAYO_CORE, "mixer-name": mixer});
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("join failure " + errorcode);
});
});
});
},
......@@ -108,7 +119,21 @@ Strophe.addConnectionPlugin('rayo',
{
//console.log('Rayo plugin leave ' + mixer);
var that = this;
var iq = $iq({to: mixer + "@" + this._connection.domain, from: this._connection.jid, type: "get"}).c("unjoin", {xmlns: Strophe.NS.RAYO_CORE, "mixer-name": mixer});
that._connection.sendIQ(iq, function(response)
{
this._onhook();
}, function(error) {
$('error', error).each(function()
{
var errorcode = $(this).attr('code');
if (that.callbacks && that.callbacks.onError) that.callbacks.onError("unjoin failure " + errorcode);
});
});
},
hold: function(callId)
......@@ -125,7 +150,6 @@ Strophe.addConnectionPlugin('rayo',
that._onhook();
}, function(error) {
//console.log(error);
$('error', error).each(function()
{
......
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