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

Jitsi videobridge - further work

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13990 b35dd754-fafc-0310-a699-88a17e54d16e
parent ab861462
...@@ -43,12 +43,13 @@ ...@@ -43,12 +43,13 @@
Jitsi Video Bridge Plugin Changelog Jitsi Video Bridge Plugin Changelog
</h1> </h1>
<p><b>1.3.0</b> -- March 13th, 2014</p> <p><b>1.3.0</b> -- March 14th, 2014</p>
<ul> <ul>
<li>OF-749: Upgraded bouncy castle libraries from 1.49 to 1.50</li> <li>OF-749: Upgraded bouncy castle libraries from 1.49 to 1.50</li>
<li>Jisti Videobridge plugin: Added latest jitmeet web conference application</li> <li>Jisti Videobridge plugin: Added latest jitmeet web conference application</li>
<li>Jisti Videobridge plugin: Implememted SIP registration and outgoing calls</li> <li>Jisti Videobridge plugin: Implememted SIP registration and outgoing calls</li>
<li>Jisti Videobridge plugin: Added new rayo commands "invite"and "uninvite". Added events "inviteaccepted" and "invitecompleted"</li>
<li>Jisti Videobridge plugin: Implememted media recording</li> <li>Jisti Videobridge plugin: Implememted media recording</li>
<li>Ofmeet: Implememted feature to invite telphone user to conference</li> <li>Ofmeet: Implememted feature to invite telphone user to conference</li>
</ul> </ul>
......
...@@ -601,6 +601,17 @@ function rayoCallback(presence) ...@@ -601,6 +601,17 @@ function rayoCallback(presence)
handleAddSSRC(from, this); handleAddSSRC(from, this);
}); });
$(presence).find('inviteaccepted').each(function()
{
$("#invite").removeClass("fa-spin");
});
$(presence).find('invitecompleted').each(function()
{
$("#invite").removeClass("fa-border");
$("#invite").removeClass("fa-spin");
});
return true; return true;
}; };
...@@ -1279,7 +1290,6 @@ function inviteParticipant() ...@@ -1279,7 +1290,6 @@ function inviteParticipant()
connection.sendIQ($iq({to: connection.domain, type: 'set'}).c('colibri', {xmlns: 'urn:xmpp:rayo:colibri:1', action: 'invite', muc: roomjid, from: "sip:" + roomjid, to: sipUri}), connection.sendIQ($iq({to: connection.domain, type: 'set'}).c('colibri', {xmlns: 'urn:xmpp:rayo:colibri:1', action: 'invite', muc: roomjid, from: "sip:" + roomjid, to: sipUri}),
function (res) { function (res) {
console.log('rayo colibri invite ok'); console.log('rayo colibri invite ok');
$("#invite").removeClass("fa-spin");
}, },
function (err) { function (err) {
...@@ -1301,8 +1311,6 @@ function inviteParticipant() ...@@ -1301,8 +1311,6 @@ function inviteParticipant()
{ {
if(v) if(v)
{ {
$("#invite").removeClass("fa-border fa-spin");
connection.sendIQ($iq({to: connection.domain, type: 'set'}).c('colibri', {xmlns: 'urn:xmpp:rayo:colibri:1', action: 'uninvite', muc: roomjid, callId: sipUri}), connection.sendIQ($iq({to: connection.domain, type: 'set'}).c('colibri', {xmlns: 'urn:xmpp:rayo:colibri:1', action: 'uninvite', muc: roomjid, callId: sipUri}),
function (res) { function (res) {
console.log('rayo colibri uninvite ok'); console.log('rayo colibri uninvite ok');
......
package com.rayo.core.verb;
import org.xmpp.packet.*;
import org.dom4j.*;
public class InviteAcceptedEvent extends AbstractVerbEvent {
private String callId;
public InviteAcceptedEvent(String callId)
{
this.callId = callId;
}
public String getCallId() {
return callId;
}
}
package com.rayo.core.verb;
import org.xmpp.packet.*;
import org.dom4j.*;
public class InviteCompletedEvent extends AbstractVerbEvent {
private String callId;
public InviteCompletedEvent(String callId)
{
this.callId = callId;
}
public String getCallId() {
return callId;
}
}
...@@ -97,6 +97,12 @@ public class ColibriProvider extends BaseProvider { ...@@ -97,6 +97,12 @@ public class ColibriProvider extends BaseProvider {
} else if (object instanceof UnmutedEvent) { } else if (object instanceof UnmutedEvent) {
createUnmutedEvent((UnmutedEvent) object, document); createUnmutedEvent((UnmutedEvent) object, document);
} else if (object instanceof InviteAcceptedEvent) {
createInviteAcceptedEvent((InviteAcceptedEvent) object, document);
} else if (object instanceof InviteCompletedEvent) {
createInviteCompletedEvent((InviteCompletedEvent) object, document);
} }
} }
...@@ -156,4 +162,16 @@ public class ColibriProvider extends BaseProvider { ...@@ -156,4 +162,16 @@ public class ColibriProvider extends BaseProvider {
{ {
document.addElement(new QName("offmute", NAMESPACE)); document.addElement(new QName("offmute", NAMESPACE));
} }
private void createInviteAcceptedEvent(InviteAcceptedEvent accepted, Document document)
{
Element root = document.addElement(new QName("inviteaccepted", NAMESPACE));
root.addAttribute("callid", accepted.getCallId());
}
private void createInviteCompletedEvent(InviteCompletedEvent completed, Document document)
{
Element root = document.addElement(new QName("invitecompleted", NAMESPACE));
root.addAttribute("callid", completed.getCallId());
}
} }
...@@ -41,8 +41,12 @@ import org.slf4j.Logger; ...@@ -41,8 +41,12 @@ import org.slf4j.Logger;
import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.*;
import org.jitsi.util.*; import org.jitsi.util.*;
import org.jitsi.videobridge.*; import org.jitsi.videobridge.*;
import org.jitsi.videobridge.openfire.*;
import org.jitsi.service.libjitsi.*; import org.jitsi.service.libjitsi.*;
import org.xmpp.packet.*;
/** /**
* *
* Represents a call, contains the information for the Jingle as well as the sip side of the call * Represents a call, contains the information for the Jingle as well as the sip side of the call
...@@ -137,11 +141,20 @@ public class CallSession ...@@ -137,11 +141,20 @@ public class CallSession
public String jabberRemote; public String jabberRemote;
public String jabberLocal; public String jabberLocal;
public CallSession(MediaStream mediaStream, String host) private PluginImpl.FocusAgent focusAgent;
private JID owner;
private String callId;
public CallSession(MediaStream mediaStream, String host, JID owner, PluginImpl.FocusAgent focusAgent, String callId)
{ {
Log.info("CallSession creation " + host); Log.info("CallSession creation " + host);
this.mediaStream = mediaStream; this.mediaStream = mediaStream;
this.owner = owner;
this.focusAgent = focusAgent;
this.callId = callId;
internalCallId = "CS" + String.format("%08x", nextInternalCallId++); internalCallId = "CS" + String.format("%08x", nextInternalCallId++);
offerPayloads.add(PAYLOAD_PCMU); offerPayloads.add(PAYLOAD_PCMU);
...@@ -168,6 +181,7 @@ public class CallSession ...@@ -168,6 +181,7 @@ public class CallSession
try try
{ {
mediaStream.stop(); mediaStream.stop();
focusAgent.inviteEvent(false, callId, owner);
} }
finally finally
{ {
...@@ -796,6 +810,8 @@ public class CallSession ...@@ -796,6 +810,8 @@ public class CallSession
} }
} }
} }
focusAgent.inviteEvent(true, callId, owner);
} }
catch (Exception e) catch (Exception e)
{ {
......
...@@ -141,15 +141,18 @@ public class SipService ...@@ -141,15 +141,18 @@ public class SipService
sipAccount = new ProxyCredentials(); sipAccount = new ProxyCredentials();
try { try {
String authusername = JiveGlobals.getProperty("voicebridge.default.proxy.sipauthuser", null);
String server = JiveGlobals.getProperty("voicebridge.default.proxy.sipserver", null);
if (authusername != null && server != null && authusername.equals("") == false && server.equals("") == false)
{
String name = JiveGlobals.getProperty("voicebridge.default.proxy.name", "admin"); String name = JiveGlobals.getProperty("voicebridge.default.proxy.name", "admin");
String username = JiveGlobals.getProperty("voicebridge.default.proxy.username", name); String username = JiveGlobals.getProperty("voicebridge.default.proxy.username", name);
String sipusername = JiveGlobals.getProperty("voicebridge.default.proxy.sipusername", name); String sipusername = JiveGlobals.getProperty("voicebridge.default.proxy.sipusername", name);
String authusername = JiveGlobals.getProperty("voicebridge.default.proxy.sipauthuser", null);
String displayname = JiveGlobals.getProperty("voicebridge.default.proxy.sipdisplayname", name); String displayname = JiveGlobals.getProperty("voicebridge.default.proxy.sipdisplayname", name);
String password = JiveGlobals.getProperty("voicebridge.default.proxy.sippassword", name); String password = JiveGlobals.getProperty("voicebridge.default.proxy.sippassword", name);
String server = JiveGlobals.getProperty("voicebridge.default.proxy.sipserver", null);
String stunServer = JiveGlobals.getProperty("voicebridge.default.proxy.stunserver", localip); String stunServer = JiveGlobals.getProperty("voicebridge.default.proxy.stunserver", localip);
String stunPort = JiveGlobals.getProperty("voicebridge.default.proxy.stunport"); String stunPort = JiveGlobals.getProperty("voicebridge.default.proxy.stunport", "3478");
String voicemail = JiveGlobals.getProperty("voicebridge.default.proxy.voicemail", name); String voicemail = JiveGlobals.getProperty("voicebridge.default.proxy.voicemail", name);
String outboundproxy = JiveGlobals.getProperty("voicebridge.default.proxy.outboundproxy", localip); String outboundproxy = JiveGlobals.getProperty("voicebridge.default.proxy.outboundproxy", localip);
...@@ -163,8 +166,6 @@ public class SipService ...@@ -163,8 +166,6 @@ public class SipService
sipAccount.setProxy(outboundproxy); sipAccount.setProxy(outboundproxy);
sipAccount.setRealm(server); sipAccount.setRealm(server);
if (authusername != null && server != null)
{
Log.info(String.format("VoiceBridge adding SIP registration: %s with user %s host %s", sipAccount.getXmppUserName(), sipAccount.getUserName(), sipAccount.getHost())); Log.info(String.format("VoiceBridge adding SIP registration: %s with user %s host %s", sipAccount.getXmppUserName(), sipAccount.getUserName(), sipAccount.getHost()));
new RegisterProcessing(localip, server, sipAccount); new RegisterProcessing(localip, server, sipAccount);
} }
......
...@@ -526,8 +526,10 @@ public class VideoBridgeSipListener implements SipListener ...@@ -526,8 +526,10 @@ public class VideoBridgeSipListener implements SipListener
{ {
Log.info("[[SIP]] Got in dialog bye"); Log.info("[[SIP]] Got in dialog bye");
CallSession cs = (CallSession) evt.getDialog().getApplicationData(); CallSession cs = (CallSession) evt.getDialog().getApplicationData();
if (cs != null) if (cs != null)
{ {
cs.sendBye();
/* /*
Session sess = SessionManager.findCreateSession(cs.jabberLocal.getDomain(), cs.jabberRemote); Session sess = SessionManager.findCreateSession(cs.jabberLocal.getDomain(), cs.jabberRemote);
if (sess != null) if (sess != null)
...@@ -568,8 +570,10 @@ public class VideoBridgeSipListener implements SipListener ...@@ -568,8 +570,10 @@ public class VideoBridgeSipListener implements SipListener
} }
CallSession cs = (CallSession) evt.getDialog().getApplicationData(); CallSession cs = (CallSession) evt.getDialog().getApplicationData();
if (cs != null) if (cs != null)
{ {
cs.sendBye();
/* /*
Session sess = SessionManager.findCreateSession(cs.jabberLocal.getDomain(), cs.jabberRemote); Session sess = SessionManager.findCreateSession(cs.jabberLocal.getDomain(), cs.jabberRemote);
if (sess != null) if (sess != null)
...@@ -870,6 +874,22 @@ public class VideoBridgeSipListener implements SipListener ...@@ -870,6 +874,22 @@ public class VideoBridgeSipListener implements SipListener
} }
} }
else if (status == Response.PROXY_AUTHENTICATION_REQUIRED || status == Response.UNAUTHORIZED)
{
ClientTransaction clientTransaction = evt.getClientTransaction();
if (SipService.sipAccount != null)
{
try {
SipService.handleChallenge(resp, clientTransaction, SipService.sipAccount).sendRequest();
} catch (Exception e) {
Log.error("Proxy authentification failed", e);
}
}
return;
}
else if (status >= 400) else if (status >= 400)
{ {
Log.info("[[SIP]] Invite failed, ending call"); Log.info("[[SIP]] Invite failed, ending call");
...@@ -883,8 +903,12 @@ public class VideoBridgeSipListener implements SipListener ...@@ -883,8 +903,12 @@ public class VideoBridgeSipListener implements SipListener
CallSession cs = (CallSession) d.getApplicationData(); CallSession cs = (CallSession) d.getApplicationData();
// terminate the jabber side if it hasn't been done already // terminate the jabber side if it hasn't been done already
if (cs != null)
{
cs.sendBye();
/* /*
if (cs != null && CallManager.getSession(cs.jabberSessionId) != null) if (CallManager.getSession(cs.jabberSessionId) != null)
{ {
FromHeader fh = (FromHeader) resp.getHeader("From"); FromHeader fh = (FromHeader) resp.getHeader("From");
String dest = ((SipURI) fh.getAddress().getURI()).getUser(); String dest = ((SipURI) fh.getAddress().getURI()).getUser();
...@@ -893,10 +917,11 @@ public class VideoBridgeSipListener implements SipListener ...@@ -893,10 +917,11 @@ public class VideoBridgeSipListener implements SipListener
Session sess = SessionManager.findCreateSession(host, destination); Session sess = SessionManager.findCreateSession(host, destination);
sess.sendBye(cs); sess.sendBye(cs);
} }
*/ */
} }
}
} }
else if (method.equals(Request.NOTIFY)) else if (method.equals(Request.NOTIFY))
{ {
......
...@@ -1423,6 +1423,28 @@ public class PluginImpl implements Plugin, PropertyEventListener ...@@ -1423,6 +1423,28 @@ public class PluginImpl implements Plugin, PropertyEventListener
reply.setError(PacketError.Condition.not_allowed); reply.setError(PacketError.Condition.not_allowed);
} }
} }
/**
*
*
*/
public void inviteEvent(boolean accepted, String callId, JID owner)
{
Presence presence = new Presence();
presence.setFrom(XMPPServer.getInstance().createJID(focusName, focusName));
presence.setTo(owner);
if (accepted)
{
InviteAcceptedEvent event = new InviteAcceptedEvent(callId);
presence.getElement().add(colibriProvider.toXML(event));
} else {
InviteCompletedEvent event = new InviteCompletedEvent(callId);
presence.getElement().add(colibriProvider.toXML(event));
}
router.route(presence);
}
/** /**
* *
* *
...@@ -1485,7 +1507,7 @@ public class PluginImpl implements Plugin, PropertyEventListener ...@@ -1485,7 +1507,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
initialLocalSSRC = ssrcFactory.doGenerateSSRC() & 0xFFFFFFFFL; initialLocalSSRC = ssrcFactory.doGenerateSSRC() & 0xFFFFFFFFL;
CallSession cs = new CallSession(mediaStream, hostname); CallSession cs = new CallSession(mediaStream, hostname, reply.getTo(), this, toUri.toString());
callSessions.put(toUri.toString(), cs); callSessions.put(toUri.toString(), cs);
cs.jabberRemote = to; cs.jabberRemote = to;
......
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