Commit 8124c0ee authored by Dele Olajide's avatar Dele Olajide Committed by dele

Jitsi videobridge plugin - added support for password protection of apps

Rayo plugin - misc changes

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13976 b35dd754-fafc-0310-a699-88a17e54d16e
parent 9c10e1f9
......@@ -41,6 +41,10 @@
<a class="button" onclick='openPDFDialog();'><i id="pdf" title="Share PDF" class="fa fa-file fa-lg"></i></a>
<div class="header_button_separator"></div>
<a class="button" onclick='goFullScreen();'><i id="pdf" title="Full Screen" class="fa fa-arrows-alt fa-lg"></i></a>
<!--
<div class="header_button_separator"></div>
<a class="button" onclick='goAltView();'><i id="altview" title="Alternate View" class="fa fa-stop fa-lg"></i></a>
-->
</div>
</div>
......
......@@ -7,6 +7,7 @@ var screenShare = false;
var pdfShare = null;
var pdfFrame = null;
var pdfPage = "1";
var altView = false;
$(document).ready(function ()
{
......@@ -219,6 +220,7 @@ $(document).bind('remotestreamadded.rayo', function(event, data, nick)
if (sel.attr('id') && sel.attr('id').indexOf('mixedmslabel') == -1) {
// ignore mixedmslabela0 and non room members
sel.attr("title", unescape(nick))
sel.attr("class", "remotevideo")
sel.show();
document.getElementById('largeVideo').volume = 1;
......@@ -441,10 +443,35 @@ function getConstraints(um, resolution, bandwidth, fps)
}
}
function goAltView()
{
if (altView)
{
$("#altview").addClass("fa-stop");
$("#altview").removeClass("fa-th");
$('#largeVideo').css("display", "");
resizeLarge();
} else {
$("#altview").removeClass("fa-stop");
$("#altview").addClass("fa-th");
arrangeVideos();
}
altView = !altView;
}
function arrangeVideos()
{
}
function resizeLarge()
{
var availableHeight = window.innerHeight;
var numvids = $('#remoteVideos>video:visible').length;
if (numvids < 5)
availableHeight -= 100; // min thumbnail height for up to 4 videos
else
......@@ -461,7 +488,9 @@ function resizeLarge()
$('#largeVideo').height(availableWidth/aspectRatio);
if (availableWidth <= 450) $('#chatspace').width(availableWidth);
resizeThumbnails() ;
}
function resizeThumbnails()
......@@ -484,6 +513,8 @@ function resizeThumbnails()
$('#remoteVideos').height(availableHeight + 36); // add the 2*18px border used for highlighting shadow.
$('#remoteVideos>video:visible').width(availableWidth);
$('#remoteVideos>video:visible').height(availableHeight);
$('#remoteVideos>video:visible').css('position', 'relative');
$('#remoteVideos>video:visible').css({top: '18px', left: '0px', right: '0px', bottom: '0px'});
}
function urlParam(name)
......
......@@ -9,3 +9,7 @@ config.page.configuration.error.minport=Invalid min port value
config.page.configuration.error.maxport=Invalid max port value
config.page.configuration.username=Username for web applications
config.page.configuration.password=Password for web applications
config.page.configuration.record.enabled=Enabled
config.page.configuration.record.enabled_description=Audio and Video Recording enabled
config.page.configuration.record.disabled=Disabled
config.page.configuration.record.disabled_description=Audio and Video Recording disabled
package org.ifsoft;
public class ArrayExtensions
{
public ArrayExtensions()
{
}
public static Integer getLength(Object array[])
{
return Integer.valueOf(array.length);
}
public static void reverse(Object array[])
{
for(int i = 0; i < array.length / 2; i++)
{
Object temp = array[i];
array[i] = array[array.length - i - 1];
array[array.length - i - 1] = temp;
}
}
public static void copy(Object source[], int sourceIndex, Object destination[], int destinationIndex, int length)
{
for(int i = 0; i < length; i++)
destination[destinationIndex + i] = source[sourceIndex + i];
}
}
package org.ifsoft;
import java.util.*;
public class ArrayListExtensions
{
public ArrayListExtensions()
{
}
public static Integer getCount(ArrayList array)
{
return Integer.valueOf(array.size());
}
public static ArrayList getItem(ArrayList array)
{
return array;
}
public static void copyTo(ArrayList array, Object target[], int index)
{
for(int i = 0; i < array.size(); i++)
target[index + i] = array.get(i);
}
public static void insert(ArrayList array, int index, Object value)
{
array.add(index, value);
}
public static void removeAt(ArrayList array, int index)
{
array.remove(index);
}
public static ArrayList createArray(Object elements[])
{
ArrayList array = new ArrayList(elements.length);
Object arr$[] = elements;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
Object element = arr$[i$];
array.add(element);
}
return array;
}
public static ArrayList createArray(Iterable elements)
{
ArrayList array = new ArrayList();
Object element;
for(Iterator i$ = elements.iterator(); i$.hasNext(); array.add(element))
element = i$.next();
return array;
}
public static void addRange(ArrayList array, Iterable elements)
{
Object element;
for(Iterator i$ = elements.iterator(); i$.hasNext(); array.add(element))
element = i$.next();
}
public static void addRange(ArrayList array, Object elements[])
{
Object arr$[] = elements;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
Object element = arr$[i$];
array.add(element);
}
}
public static ArrayList getRange(ArrayList array, int index, int count)
{
ArrayList sublist = new ArrayList(count);
for(int i = 0; i < count; i++)
sublist.add(array.get(index + i));
return sublist;
}
public static void insertRange(ArrayList array, int index, Iterable elements)
{
int i = 0;
for(Iterator i$ = elements.iterator(); i$.hasNext();)
{
Object element = i$.next();
array.add(index + i, element);
i++;
}
}
public static void insertRange(ArrayList array, int index, Object elements[])
{
int i = 0;
Object arr$[] = elements;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
Object element = arr$[i$];
array.add(index + i, element);
i++;
}
}
public static void removeRange(ArrayList array, int index, int count)
{
for(int i = 0; i < count; i++)
array.remove(index);
}
}
package org.ifsoft.rtp;
import org.ifsoft.*;
import java.util.ArrayList;
public class RTPPacket
{
private Byte __payload[];
private Byte __payloadType;
private Long _contributingSources[];
private Long _extension[];
private Integer _extensionHeader;
private Boolean _marker;
private Boolean _padding;
private Integer _sequenceNumber;
private Long _synchronizationSource;
private Long _timestamp;
public RTPPacket(Byte payload[])
{
__payloadType = Byte.valueOf((byte)0);
_extensionHeader = Integer.valueOf(0);
_marker = Boolean.valueOf(false);
_padding = Boolean.valueOf(false);
_sequenceNumber = Integer.valueOf(0);
_synchronizationSource = Long.valueOf(0L);
_timestamp = Long.valueOf(0L);
setPayload(payload);
}
public Byte[] getBytes()
{
return getBytes(this);
}
public static Byte[] getBytes(RTPPacket packet)
{
Boolean flag = Boolean.valueOf(packet.getExtensionHeader().intValue() != 0 || packet.getExtension() != null);
ArrayList list = new ArrayList();
Byte num = packet.getContributingSources() != null ? new Byte((byte)(BitAssistant.getShortBytesFromIntegerNetwork(ArrayExtensions.getLength(packet.getContributingSources()))[1].byteValue() & 0xf)) : new Byte((byte)0);
list.add(new Byte((new Byte((new Integer(0x80 | (packet.getPadding().booleanValue() ? 0x20 : 0) | (flag.booleanValue() ? 0x10 : 0) | num.byteValue())).byteValue())).byteValue()));
list.add(new Byte((new Byte((new Integer((packet.getMarker().booleanValue() ? 0x80 : 0) | packet.getPayloadType().byteValue() & 0x7f)).byteValue())).byteValue()));
ArrayListExtensions.addRange(list, BitAssistant.getShortBytesFromIntegerNetwork(packet.getSequenceNumber()));
ArrayListExtensions.addRange(list, BitAssistant.getIntegerBytesFromLongNetwork(packet.getTimestamp()));
ArrayListExtensions.addRange(list, BitAssistant.getIntegerBytesFromLongNetwork(packet.getSynchronizationSource()));
for(Integer num2 = Integer.valueOf(0); num2.intValue() < num.byteValue();)
{
ArrayListExtensions.addRange(list, BitAssistant.getIntegerBytesFromLongNetwork(packet.getContributingSources()[num2.intValue()]));
Integer integer = num2;
Integer integer1 = num2 = Integer.valueOf(num2.intValue() + 1);
Integer _tmp = integer;
}
if(flag.booleanValue())
{
Integer num3 = Integer.valueOf(packet.getExtension() != null ? ArrayExtensions.getLength(packet.getExtension()).intValue() : 0);
ArrayListExtensions.addRange(list, BitAssistant.getShortBytesFromIntegerNetwork(packet.getExtensionHeader()));
ArrayListExtensions.addRange(list, BitAssistant.getShortBytesFromIntegerNetwork(num3));
for(Integer num2 = Integer.valueOf(0); num2.intValue() < num3.intValue();)
{
ArrayListExtensions.addRange(list, BitAssistant.getIntegerBytesFromLongNetwork(packet.getExtension()[num2.intValue()]));
Integer integer2 = num2;
Integer integer3 = num2 = Integer.valueOf(num2.intValue() + 1);
Integer _tmp1 = integer2;
}
}
ArrayListExtensions.addRange(list, packet.getPayload());
return (Byte[])list.toArray(new Byte[0]);
}
public Long[] getContributingSources()
{
return _contributingSources;
}
public Long[] getExtension()
{
return _extension;
}
public Integer getExtensionHeader()
{
return _extensionHeader;
}
public Boolean getMarker()
{
return _marker;
}
public Boolean getPadding()
{
return _padding;
}
public Byte[] getPayload()
{
return __payload;
}
public Byte getPayloadType()
{
return __payloadType;
}
public Integer getSequenceNumber()
{
return _sequenceNumber;
}
public Long getSynchronizationSource()
{
return _synchronizationSource;
}
public Long getTimestamp()
{
return _timestamp;
}
public static RTPPacket parseBytes(Byte bytes[])
throws Exception
{
if(ArrayExtensions.getLength(bytes).intValue() < 12 || (bytes[0].byteValue() & 0xc0) != 128)
return null;
Boolean flag = Boolean.valueOf((bytes[0].byteValue() & 0x20) == 32);
Boolean flag2 = Boolean.valueOf((bytes[0].byteValue() & 0x10) == 16);
Byte num = new Byte((byte)(bytes[0].byteValue() & 0xf));
Boolean flag3 = Boolean.valueOf((bytes[1].byteValue() & 0x80) == 128);
Byte num2 = new Byte((byte)(bytes[1].byteValue() & 0x7f));
Integer num3 = BitAssistant.toIntegerFromShortNetwork(bytes, Integer.valueOf(2));
Long num4 = BitAssistant.toLongFromIntegerNetwork(bytes, Integer.valueOf(4));
Long num5 = BitAssistant.toLongFromIntegerNetwork(bytes, Integer.valueOf(8));
Integer startIndex = Integer.valueOf(12);
Long numArray[] = null;
if(num.byteValue() > 0)
{
numArray = new Long[num.byteValue()];
for(Integer num7 = Integer.valueOf(0); num7.intValue() < num.byteValue();)
{
numArray[num7.intValue()] = BitAssistant.toLongFromIntegerNetwork(bytes, startIndex);
startIndex = Integer.valueOf(startIndex.intValue() + 4);
Integer integer = num7;
Integer integer1 = num7 = Integer.valueOf(num7.intValue() + 1);
Integer _tmp = integer;
}
}
Integer num8 = Integer.valueOf(0);
Long numArray2[] = null;
if(flag2.booleanValue())
{
num8 = BitAssistant.toIntegerFromShortNetwork(bytes, startIndex);
startIndex = Integer.valueOf(startIndex.intValue() + 2);
Integer num9 = BitAssistant.toIntegerFromShortNetwork(bytes, startIndex);
startIndex = Integer.valueOf(startIndex.intValue() + 2);
if(num9.intValue() > 0)
{
numArray2 = new Long[num9.intValue()];
for(Integer num7 = Integer.valueOf(0); num7.intValue() < num9.intValue();)
{
numArray2[num7.intValue()] = BitAssistant.toLongFromIntegerNetwork(bytes, startIndex);
startIndex = Integer.valueOf(startIndex.intValue() + 4);
Integer integer2 = num7;
Integer integer3 = num7 = Integer.valueOf(num7.intValue() + 1);
Integer _tmp1 = integer2;
}
}
}
RTPPacket packet = new RTPPacket(BitAssistant.subArray(bytes, startIndex));
packet.setPayloadType(num2);
packet.setPadding(flag);
packet.setMarker(flag3);
packet.setSequenceNumber(num3);
packet.setTimestamp(num4);
packet.setSynchronizationSource(num5);
packet.setContributingSources(numArray);
packet.setExtensionHeader(num8);
packet.setExtension(numArray2);
return packet;
}
public void setContributingSources(Long value[])
{
_contributingSources = value;
}
public void setExtension(Long value[])
{
_extension = value;
}
public void setExtensionHeader(Integer value)
{
_extensionHeader = value;
}
public void setMarker(Boolean value)
{
_marker = value;
}
public void setPadding(Boolean value)
{
_padding = value;
}
public void setPayload(Byte value[])
{
if(value == null)
__payload = new Byte[0];
else
__payload = value;
}
public void setPayloadType(Byte value)
throws Exception
{
if(value.byteValue() < 0)
{
throw new Exception("Payload type is invalid.");
} else
{
__payloadType = value;
return;
}
}
public void setSequenceNumber(Integer value)
{
_sequenceNumber = value;
}
public void setSynchronizationSource(Long value)
{
_synchronizationSource = value;
}
public void setTimestamp(Long value)
{
_timestamp = value;
}
}
......@@ -67,7 +67,10 @@
JiveGlobals.setProperty(PluginImpl.USERNAME_PROPERTY_NAME, username);
String password = request.getParameter("password");
JiveGlobals.setProperty(PluginImpl.PASSWORD_PROPERTY_NAME, password);
JiveGlobals.setProperty(PluginImpl.PASSWORD_PROPERTY_NAME, password);
String enabled = request.getParameter("enabled");
JiveGlobals.setProperty(PluginImpl.RECORD_PROPERTY_NAME, enabled);
}
%>
......@@ -125,7 +128,19 @@
<input name="password" type="password" maxlength="16" size="16"
value="<%=JiveGlobals.getProperty(PluginImpl.PASSWORD_PROPERTY_NAME, "jitsi")%>"/>
</td>
</tr>
</tr>
<tr>
<td nowrap colspan="2">
<input type="radio" value="false" name="enabled" <%= ("false".equals(JiveGlobals.getProperty(PluginImpl.RECORD_PROPERTY_NAME, "false")) ? "checked" : "") %>>
<b><fmt:message key="config.page.configuration.record.disabled" /></b> - <fmt:message key="config.page.configuration.record.disabled_description" />
</td>
</tr>
<tr>
<td nowrap colspan="2">
<input type="radio" value="true" name="enabled" <%= ("true".equals(JiveGlobals.getProperty(PluginImpl.RECORD_PROPERTY_NAME, "false")) ? "checked" : "") %>>
<b><fmt:message key="config.page.configuration.record.enabled" /></b> - <fmt:message key="config.page.configuration.record.enabled_description" />
</td>
</tr>
<tr>
<th colspan="2"><input type="submit" name="update"
value="<fmt:message key="config.page.configuration.submit" />"></th>
......
/**
* $Revision $
* $Date $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rayo.core.verb;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
public class CreateSpeakerCommand extends BaseVerb
{
public String codec = null;
public String mixer = null;
public String sipuri = null;
public CreateSpeakerCommand(String sipuri, String mixer, String codec)
{
this.sipuri = sipuri;
this.mixer = mixer;
this.codec = codec;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
.append("callId", getCallId())
.append("verbId", getVerbId())
.append("codec",codec)
.append("mixer",mixer)
.append("sipuri",sipuri)
.toString();
}
}
/**
* $Revision $
* $Date $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rayo.core.verb;
public class DestroySpeakerCommand extends AbstractVerbCommand {
}
/**
* $Revision $
* $Date $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rayo.core.verb;
public class PutOnSpeakerCommand extends AbstractVerbCommand {
public PutOnSpeakerCommand()
{
}
}
/**
* $Revision $
* $Date $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rayo.core.verb;
public class TakeOffSpeakerCommand extends AbstractVerbCommand {
public TakeOffSpeakerCommand()
{
}
}
/**
* $Revision $
* $Date $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rayo.core.verb;
public class TalkCommand extends AbstractVerbCommand {
public TalkCommand()
{
}
}
/**
* $Revision $
* $Date $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rayo.core.verb;
public class UntalkCommand extends AbstractVerbCommand {
public UntalkCommand()
{
}
}
......@@ -41,6 +41,12 @@ public class HandsetProvider extends BaseProvider {
private static final QName MUTE_QNAME = new QName("mute", NAMESPACE);
private static final QName UNMUTE_QNAME = new QName("unmute", NAMESPACE);
private static final QName HOLD_QNAME = new QName("hold", NAMESPACE);
private static final QName TALK_QNAME = new QName("talk", NAMESPACE);
private static final QName UNTALK_QNAME = new QName("untalk", NAMESPACE);
private static final QName ONSPEAKER_QNAME = new QName("onspeaker", NAMESPACE);
private static final QName OFFSPEAKER_QNAME = new QName("offspeaker", NAMESPACE);
private static final QName CREATE_SPEAKER_QNAME = new QName("createspeaker", NAMESPACE);
private static final QName DESTROY_SPEAKER_QNAME = new QName("destroyspeaker", NAMESPACE);
@Override
protected Object processElement(Element element) throws Exception
......@@ -66,6 +72,24 @@ public class HandsetProvider extends BaseProvider {
} else if (HOLD_QNAME.equals(element.getQName())) {
return buildHoldCommand(element);
} else if (TALK_QNAME.equals(element.getQName())) {
return buildTalkCommand(element);
} else if (UNTALK_QNAME.equals(element.getQName())) {
return buildUntalkCommand(element);
} else if (ONSPEAKER_QNAME.equals(element.getQName())) {
return buildOnSpeakerCommand(element);
} else if (OFFSPEAKER_QNAME.equals(element.getQName())) {
return buildOffSpeakerCommand(element);
} else if (CREATE_SPEAKER_QNAME.equals(element.getQName())) {
return buildCreateSpeakerCommand(element);
} else if (DESTROY_SPEAKER_QNAME.equals(element.getQName())) {
return buildDestroySpeakerCommand(element);
} else if (element.getNamespace().equals(RAYO_COMPONENT_NAMESPACE)) {
return buildCompleteCommand(element);
}
......@@ -141,6 +165,36 @@ public class HandsetProvider extends BaseProvider {
return new OnHookCommand();
}
private Object buildTalkCommand(Element element)
{
return new TalkCommand();
}
private Object buildUntalkCommand(Element element)
{
return new UntalkCommand();
}
private Object buildOnSpeakerCommand(Element element)
{
return new PutOnSpeakerCommand();
}
private Object buildOffSpeakerCommand(Element element)
{
return new TakeOffSpeakerCommand();
}
private Object buildCreateSpeakerCommand(Element element)
{
return new CreateSpeakerCommand(element.attributeValue("sipuri"), element.attributeValue("mixer"), element.attributeValue("codec"));
}
private Object buildDestroySpeakerCommand(Element element)
{
return new DestroySpeakerCommand();
}
// Object -> XML
// ================================================================================
......
......@@ -25,7 +25,8 @@ package com.sun.voip;
import java.net.InetSocketAddress;
import org.voicebridge.*;
import org.xmpp.jnodes.RelayChannel;
import org.xmpp.jnodes.IChannel;
import com.sun.voip.server.*;
import java.util.*;
......@@ -89,7 +90,7 @@ public class CallParticipant {
private boolean handleSessionProgress = false;
private String remoteMediaInfo = null;
private ProxyCredentials proxyCredentials = null;
private RelayChannel relayChannel = null;
private IChannel channel = null;
private boolean autoAnswer = false;
private long startTimestamp = 0;
private long endTimestamp = 0;
......@@ -110,6 +111,7 @@ public class CallParticipant {
private boolean secondPartyVoiceDetection = false;
private String rtmfpSendStream = null;
private String rtmfpRecieveStream = null;
private CallHandler otherCall = null;
/**
* Constructor
......@@ -131,15 +133,24 @@ public class CallParticipant {
this.proxyCredentials = proxyCredentials;
}
public CallHandler getOtherCall()
{
return otherCall;
}
public void setOtherCall(CallHandler otherCall)
{
this.otherCall = otherCall;
}
public RelayChannel getRelayChannel()
public IChannel getChannel()
{
return relayChannel;
return channel;
}
public void setRelayChannel(RelayChannel relayChannel)
public void setChannel(IChannel channel)
{
this.relayChannel = relayChannel;
this.channel = channel;
}
public long getStartTimestamp()
......
......@@ -42,10 +42,10 @@ public class MediaInfo {
static {
supportedMedia.add(new MediaInfo(
(byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, false));
(byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, true));
supportedMedia.add(new MediaInfo(
(byte)101, RtpPacket.PCM_ENCODING, 8000, 1, false));
//supportedMedia.add(new MediaInfo(
// (byte)101, RtpPacket.PCM_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo(
(byte)102, RtpPacket.PCM_ENCODING, 8000, 2, false));
......
......@@ -236,24 +236,38 @@ public class SdpManager {
+ " channels " + channels, 0);
}
public String generateSdp(String name, InetSocketAddress isa) {
String sdp =
"v=0\r\n"
+ "o=" + name + " 1 1 IN IP4 "
+ isa.getAddress().getHostAddress() + "\r\n"
+ "s=SIP Call\r\n"
+ "c=IN IP4 "
+ isa.getAddress().getHostAddress() + "\r\n"
+ "t=0 0 \r\n"
+ "m=audio " + isa.getPort()
+ " RTP/AVP " + "13 " + getSupportedMedia() + "\r\n"
+ "a=rtpmap:13 CN/8000" + "\r\n"
+ getRtpmaps();
if (localMediaPreference != null) {
sdp += "a=PreferredPayload:"
+ localMediaPreference.getPayload() + "\r\n";
}
public String generateSdp(CallParticipant cp, String name, InetSocketAddress isa)
{
String toNumber = cp.getPhoneNumber();
String sdp = "v=0\r\n"
+ "o=" + name + " 1 1 IN IP4 "
+ isa.getAddress().getHostAddress() + "\r\n"
+ "s=SIP Call\r\n"
+ "c=IN IP4 "
+ isa.getAddress().getHostAddress() + "\r\n"
+ "t=0 0 \r\n"
+ "m=audio " + isa.getPort();
if (toNumber.indexOf("sip:") == 0) // TODO hack for Lync DTMF
{
sdp += " RTP/AVP " + "13 " + getSupportedMedia() + "\r\n"
+ "a=rtpmap:13 CN/8000" + "\r\n";
} else { // Lync, add DTMF support
sdp += " RTP/AVP " + "13 101 " + getSupportedMedia() + "\r\n"
+ "a=rtpmap:13 CN/8000" + "\r\n"
+ "a=rtpmap:101 telephone-event/8000" + "\r\n"
+ "a=fmtp:101 0-16" + "\r\n";
}
sdp += getRtpmaps();
if (localMediaPreference != null)
{
sdp += "a=PreferredPayload:" + localMediaPreference.getPayload() + "\r\n";
}
if (transmitMediaInfo != null) {
sdp += "a=transmitPayload:"
......@@ -307,7 +321,7 @@ public class SdpManager {
remoteSdpInfo.setMediaInfo(mediaInfo);
String payloads = "13 " + mediaInfo.getPayload();
String payloads = "13 101 " + mediaInfo.getPayload();
byte telephoneEventPayload = remoteSdpInfo.getTelephoneEventPayload();
......@@ -340,6 +354,8 @@ public class SdpManager {
+ "m=audio " + isa.getPort()
+ " RTP/AVP " + payloads + "\r\n"
+ "a=rtpmap:13 CN/8000" + "\r\n"
+ "a=rtpmap:101 telephone-event/8000" + "\r\n"
+ "a=fmtp:101 0-16" + "\r\n"
+ generateRtpmap(mediaInfo) + "\r\n"
+ transmitMap
+ telephoneEvent;
......
......@@ -89,6 +89,10 @@ public abstract class CallHandler extends Thread {
*/
protected CallHandler otherCall;
public CallHandler getOtherCall() {
return this.otherCall;
}
public void suppressStatus(boolean suppressStatus) {
this.suppressStatus = suppressStatus;
}
......
......@@ -739,7 +739,7 @@ public class ConferenceManager {
}
if (displayName != null) {
cp.setDisplayName(displayName);
//cp.setDisplayName(displayName);
cp.setConferenceDisplayName(displayName);
}
......
......@@ -451,7 +451,7 @@ public class ConferenceMember implements TreatmentDoneListener,
this.callHandler = callHandler;
if (cp.getProtocol() != null && "WebRtc".equals(cp.getProtocol()) == false && "Rtmfp".equals(cp.getProtocol()) == false)
if (cp.getProtocol() != null && "WebRtc".equals(cp.getProtocol()) == false && "Rtmfp".equals(cp.getProtocol()) == false && "Speaker".equals(cp.getProtocol()) == false)
{
if (rtcpAddress != null) {
this.rtcpAddress = rtcpAddress;
......
......@@ -73,6 +73,10 @@ import org.ifsoft.rtp.*;
import org.jitsi.impl.neomedia.codec.audio.opus.Opus;
import org.xmpp.jnodes.IChannel;
/**
* Receive RTP data for this ConferenceMember, add it to the mix
* and keep statistics.
......@@ -175,8 +179,17 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
private boolean initializationDone = false;
public MemberReceiver(ConferenceMember member, CallParticipant cp,
DatagramChannel datagramChannel) throws IOException {
private IChannel relayChannel = null;
public void setChannel(IChannel relayChannel)
{
this.relayChannel = relayChannel;
}
public MemberReceiver(ConferenceMember member, CallParticipant cp, DatagramChannel datagramChannel) throws IOException
{
this.member = member;
this.cp = cp;
......@@ -376,7 +389,7 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
if (cp.getProtocol() != null && ("WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol())))
if (cp.getProtocol() != null && ("WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol()) || "Speaker".equals(cp.getProtocol())))
{
conferenceManager.getConferenceReceiver().addMember(this);
......@@ -868,7 +881,7 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
private boolean callIsDead() {
if (cp.getProtocol() != null && ("WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol())))
if (cp.getProtocol() != null && ("WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol()) || "Speaker".equals(cp.getProtocol())))
{
return false;
}
......@@ -988,6 +1001,7 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
member.getMemberSender().setSendAddress(fromAddress);
if (packet == null) return;
/*
* receivedData has a 12 byte RTP header at the beginning
* and length includes the RTP header.
......@@ -1408,7 +1422,17 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
}
}
return;
}
}
if (relayChannel != null)
{
try {
relayChannel.pushReceiverAudio(data);
} catch(Exception e) {}
return;
}
long start = 0;
......
......@@ -50,7 +50,7 @@ import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
import java.text.ParseException;
import org.xmpp.jnodes.RelayChannel;
import org.xmpp.jnodes.IChannel;
import org.ifsoft.*;
import org.ifsoft.rtp.*;
......@@ -103,7 +103,7 @@ public class MemberSender {
private int outChannels;
private DatagramChannel datagramChannel;
private boolean initializationDone = false;
private RelayChannel relayChannel;
private IChannel relayChannel;
private long startTime = 0;
public MemberSender(CallParticipant cp, DatagramChannel datagramChannel) throws IOException
......@@ -149,14 +149,14 @@ public class MemberSender {
}
public void setWebRTCParticipant(RelayChannel relayChannel)
public void setChannel(IChannel relayChannel)
{
this.relayChannel = relayChannel;
}
public RelayChannel getWebRTCParticipant()
public IChannel getChannel()
{
return relayChannel;
return this.relayChannel;
}
public InetSocketAddress getSendAddress() {
......@@ -320,7 +320,7 @@ public class MemberSender {
public synchronized void handleVP8Video(RTPPacket videoPacket)
{
try {
getWebRTCParticipant().pushVideo(videoPacket);
//getWebRTCParticipant().pushVideo(videoPacket);
} catch (Exception e) {
......@@ -347,24 +347,28 @@ public class MemberSender {
long start = System.nanoTime();
if (dataToSend == null) {
if (Logger.logLevel == -77) {
Logger.println("Call " + cp + " no data to send");
if (dataToSend == null)
{
if (Logger.logLevel == -77)
{
Logger.println("Call " + cp + " no data to send");
}
if (comfortNoiseType == CN_USE_PAYLOAD) {
if (senderPacket.getRtpPayload() != RtpPacket.COMFORT_PAYLOAD) {
if (Logger.logLevel == -77) {
Logger.println("Call " + cp + " sending comfort payload");
}
if (senderPacket.getRtpPayload() != RtpPacket.COMFORT_PAYLOAD)
{
if (Logger.logLevel == -77) {
Logger.println("Call " + cp + " sending comfort payload");
}
if (getWebRTCParticipant() == null)
{
if (cp.getRtmfpSendStream() == null) sendComfortNoisePayload();
if (relayChannel == null)
{
if (cp.getRtmfpSendStream() == null && "SIP".equals(cp.getProtocol()))
sendComfortNoisePayload();
} else getWebRTCParticipant().sendComfortNoisePayload();
}
} else relayChannel.sendComfortNoisePayload();
}
}
mustSetMarkBit = true;
......@@ -475,17 +479,20 @@ public class MemberSender {
} else if (myMediaInfo.getEncoding() == RtpPacket.PCM_ENCODING) {
byte[] input = AudioConversion.littleEndianIntsToBytes(dataToSend);
byte[] output = new byte[Opus.MAX_PACKET];
if (relayChannel != null && relayChannel.encode())
{
byte[] input = AudioConversion.littleEndianIntsToBytes(dataToSend);
byte[] output = new byte[Opus.MAX_PACKET];
int outLength = Opus.encode(opusEncoder, input, 0, frameSizeInSamplesPerChannel, output, 0, output.length);
opusBytes = new byte[outLength];
System.arraycopy(output, 0, opusBytes, 0, outLength);
int outLength = Opus.encode(opusEncoder, input, 0, frameSizeInSamplesPerChannel, output, 0, output.length);
opusBytes = new byte[outLength];
System.arraycopy(output, 0, opusBytes, 0, outLength);
System.arraycopy(output, 0, rtpData, RtpPacket.HEADER_SIZE, outLength);
senderPacket.setLength(outLength + RtpPacket.HEADER_SIZE);
System.arraycopy(output, 0, rtpData, RtpPacket.HEADER_SIZE, outLength);
senderPacket.setLength(outLength + RtpPacket.HEADER_SIZE);
//Logger.println("RtpPacket.PCM_ENCODING " + outLength);
//Logger.println("RtpPacket.PCM_ENCODING " + outLength);
}
} else {
AudioConversion.intsToBytes(dataToSend, rtpData, RtpPacket.HEADER_SIZE);
......@@ -516,7 +523,7 @@ public class MemberSender {
* so that if we sent data, it would also be received!
*/
if (getWebRTCParticipant() == null)
if (relayChannel == null)
{
if (cp.getRtmfpSendStream() != null) // RTMFP
{
......@@ -531,7 +538,7 @@ public class MemberSender {
RtmfpCallAgent.publishHandlers.get(cp.getRtmfpSendStream()).B(ts, new AudioPacket(rtmfp, rtmfp.length), 0);
}
} else { // SIP
} else if ("SIP".equals(cp.getProtocol())) { // SIP
if (cp.getInputTreatment() == null) {
try {
......@@ -550,13 +557,20 @@ public class MemberSender {
return false;
}
}
} else { //do nothing;
return true;
}
} else { // WebRTC
try {
getWebRTCParticipant().pushAudio(senderPacket.getData(), opusBytes);
if (relayChannel.encode())
relayChannel.pushAudio(senderPacket.getData(), opusBytes);
else
relayChannel.pushAudio(dataToSend);
} catch (Exception e) {
......
......@@ -142,7 +142,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene
placeCall(); // no gateway involved, direct SIP call
} else if (cp.getProtocol() != null && ("Videobridge".equals(cp.getProtocol()) || "WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol()))) {
} else if (cp.getProtocol() != null && ("Speaker".equals(cp.getProtocol()) || "WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol()))) {
placeCall(); // WebRtc call
......@@ -172,8 +172,8 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene
csa = new NSOutgoingCallAgent(this);
} else if (protocol.equalsIgnoreCase("WebRtc")) {
csa = new WebRtcCallAgent(this);
} else if (protocol.equalsIgnoreCase("Videobridge")) {
csa = new VideobridgeCallAgent(this);
} else if (protocol.equalsIgnoreCase("Speaker")) {
csa = new SpeakerCallAgent(this);
} else if (protocol.equalsIgnoreCase("Rtmfp")) {
csa = new RtmfpCallAgent(this);
} else {
......@@ -482,7 +482,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene
protocol = cp.getProtocol();
}
if (protocol.equalsIgnoreCase("WebRtc") || protocol.equalsIgnoreCase("Rtmfp")) {
if (protocol.equalsIgnoreCase("WebRtc") || protocol.equalsIgnoreCase("Rtmfp") || protocol.equalsIgnoreCase("Speaker")) {
return true;
}
......@@ -506,7 +506,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene
public boolean waitForCallToBeEstablished() {
if (cp.getProtocol().equalsIgnoreCase("WebRtc") || cp.getProtocol().equalsIgnoreCase("Rtmfp")) {
if (cp.getProtocol().equalsIgnoreCase("WebRtc") || cp.getProtocol().equalsIgnoreCase("Rtmfp") || cp.getProtocol().equalsIgnoreCase("Speaker")) {
return true;
}
......
......@@ -183,20 +183,11 @@ public class SipServer implements SipListener {
Logger.println("");
Logger.println("Bridge private address: " + properties.getProperty("javax.sip.IP_ADDRESS"));
String protocol = System.getProperty("com.sun.voip.server.PROTOCOL");
if ("tcp".equals(protocol))
{
tcpListenPort = sipStack.createListeningPoint(sipPort, "tcp");
sipProvider = sipStack.createSipProvider(tcpListenPort);
}
if ("udp".equals(protocol))
{
udpListenPort = sipStack.createListeningPoint(sipPort, "udp");
sipProvider = sipStack.createSipProvider(udpListenPort);
}
tcpListenPort = sipStack.createListeningPoint(localHostAddress, sipPort, "tcp");
udpListenPort = sipStack.createListeningPoint(localHostAddress, sipPort, "udp");
sipProvider = sipStack.createSipProvider(tcpListenPort);
sipProvider.addListeningPoint(udpListenPort);
sipProvider.addSipListener(this);
sipAddress = new InetSocketAddress(sipStack.getIPAddress(), sipPort);
......@@ -216,7 +207,13 @@ public class SipServer implements SipListener {
{
try {
InetAddress inetAddress = InetAddress.getByName(voIPGateways.get(i));
registrations.add(new RegisterProcessing(inetAddress.getHostAddress(), voIPGateways.get(i), voIPGatewayLoginInfo.get(i)));
ProxyCredentials proxyCredentials = voIPGatewayLoginInfo.get(i);
if (proxyCredentials.getAuthUserName() != null)
{
registrations.add(new RegisterProcessing(inetAddress.getHostAddress(), voIPGateways.get(i), proxyCredentials));
}
} catch (Exception e) {
System.out.println(String.format("Bad Address %s ", voIPGateways.get(i)));
......@@ -224,6 +221,10 @@ public class SipServer implements SipListener {
}
}
} catch(TransportAlreadySupportedException e) {
Logger.exception("Stack has transport already supported", e);
return;
} catch(NullPointerException e) {
Logger.exception("Stack has no ListeningPoints", e);
return;
......@@ -361,6 +362,13 @@ public class SipServer implements SipListener {
if (request.getMethod().equals(Request.REGISTER)) {
handleRegister(request, requestEvent);
} else if (request.getMethod().equals(Request.OPTIONS)) {
Response res = messageFactory.createResponse(Response.OK, request);
sipProvider.sendResponse(res);
return;
} else if (!request.getMethod().equals(Request.INVITE)) {
Logger.writeFile("sipListener could not be found for " + sipCallId + " " + request.getMethod() + ". Ignoring");
return;
......@@ -856,5 +864,21 @@ public class SipServer implements SipListener {
return authorization;
}
/*
private class CRLfKeepAliveTask extends TimerTask
{
@Override
public void run()
{
try
{
tcpListenPort.sendHeartbeat( sipAddress.getAddress().getHostAddress(), sipAddress.getPort() );
}
catch (IOException e)
{
Logger.println("Error while sending a heartbeat", e);
}
}
}
*/
}
......@@ -140,8 +140,8 @@ public class SipUtil {
supportedMedia.add(new MediaInfo(
(byte)0, RtpPacket.PCMU_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo(
(byte)101, RtpPacket.PCM_ENCODING, 8000, 1, false));
// supportedMedia.add(new MediaInfo(
// (byte)101, RtpPacket.PCM_ENCODING, 8000, 1, false));
supportedMedia.add(new MediaInfo(
(byte)102, RtpPacket.PCM_ENCODING, 8000, 2, false));
......@@ -236,7 +236,7 @@ if (false) {
}
public String generateSdp(CallParticipant cp, InetSocketAddress isa) {
String sdp = sdpManager.generateSdp("MeetingCentral", isa);
String sdp = sdpManager.generateSdp(cp, "MeetingCentral", isa);
String s = "a=conferenceId:" + cp.getConferenceId();
......@@ -321,6 +321,9 @@ if (false) {
String fromName = cp.getDisplayName();
String fromNumber = cp.getDisplayName(); //cp.getFromPhoneNumber();
String toNumber = cp.getPhoneNumber();
String transport = "udp";
Logger.println("XXX from = " + fromName + " " + cp);
// int toSipPort = SipServer.getSipAddress().getPort();
// XXX this should be the proxy or gateway port!
......@@ -412,6 +415,8 @@ if (false) {
} else { // telephone number
transport = System.getProperty("com.sun.voip.server.PROTOCOL");
if (toNumber.indexOf("tel:") == 0)
{
toNumber = toNumber.substring(4);
......@@ -454,8 +459,11 @@ if (false) {
if (gatewayRequired)
{
Logger.println("XXXX gatewayRequired");
if (proxyCredentialList.size() != 0)
{
Logger.println("XXXX gatewayRequired 1");
int voipIndex = 0;
for (int i=0; i<proxyCredentialList.size(); i++)
......@@ -470,19 +478,26 @@ if (false) {
ProxyCredentials proxyCredentials = proxyCredentialList.get(voipIndex);
fromName = proxyCredentials.getUserDisplay();
//fromName = proxyCredentials.getUserDisplay();
voipGateway = proxyCredentials.getHost();
obProxy = proxyCredentials.getProxy();
fromAddress = addressFactory.createSipURI(proxyCredentials.getUserName(), voipGateway);
//fromAddress = addressFactory.createSipURI(proxyCredentials.getUserName(), voipGateway);
fromAddress = addressFactory.createSipURI(fromName, voipGateway);
cp.setProxyCredentials(proxyCredentials); // we need this to match SIP transaction later
cp.setDisplayName(proxyCredentials.getUserDisplay()); // we need this to get proxy authentication details later
//cp.setProxyCredentials(proxyCredentials); // we need this to match SIP transaction later
//cp.setDisplayName(proxyCredentials.getUserDisplay()); // we need this to get proxy authentication details later
} else {
Logger.println("XXXX gatewayRequired 2");
}
Logger.println("XXXX gatewayRequired 3");
toAddress = addressFactory.createSipURI(toNumber, voipGateway);
} else {
Logger.println("XXXX gatewayRequired 4");
Logger.println("fromNumber " + fromNumber);
if (fromNumber.startsWith("sip:"))
......@@ -494,6 +509,7 @@ if (false) {
toAddress = addressFactory.createSipURI(toNumber, voipGateway);
}
Logger.println("XXXX gatewayRequired 5");
Logger.println("from " + fromAddress);
Logger.println("to " + toAddress);
......@@ -509,6 +525,7 @@ if (false) {
* 5060 == cp.getPort()
*/
Logger.println("XXXX gatewayRequired 6");
if (Bridge.getPrivateHost().startsWith("127.") &&
voipGateway.equals("127.0.0.1") == false) {
......@@ -550,12 +567,14 @@ if (false) {
toNumber = toNumber.substring(0, ix);
}
Logger.println("XXXX gatewayRequired 7");
requestURI = addressFactory.createSipURI(toNumber, voipGateway);
requestURI.setPort(toSipPort);
requestURI.setTransportParam
(sipProvider.getListeningPoint().getTransport());
(sipProvider.getListeningPoint(transport).getTransport());
/* create Via headers
* e.g. Via: SIP/2.0/UDP 152.70.1.43:5060;branch=z9hG4bK5
......@@ -563,7 +582,7 @@ if (false) {
* 152.70.1.43:5060 == (local address and SIP port)
* branch=z9hG4bk5 == (auto generated branch id)
*/
viaHeader = headerFactory.createViaHeader(ourIpAddress, ourSipPort, sipProvider.getListeningPoint().getTransport(), null);
viaHeader = headerFactory.createViaHeader(ourIpAddress, ourSipPort, sipProvider.getListeningPoint(transport).getTransport(), null);
//viaHeader.setBranch(MessageFactoryImpl.generateBranchId());
viaHeaders = new ArrayList();
viaHeaders.add(viaHeader);
......@@ -591,6 +610,8 @@ if (false) {
Request.INVITE, callIdHeader, cSeqHeader,
fromHeader, toHeader, viaHeaders, maxForwards);
Logger.println("XXXX gatewayRequired 10");
if (SdpManager.useTelephoneEvent() == true) {
allowEventsHeader =
headerFactory.createAllowEventsHeader("telephone-event");
......@@ -610,6 +631,8 @@ if (false) {
contactURI = addressFactory.createSipURI(fromNumber, ourPublicIpAddress);
Logger.println("XXXX gatewayRequired 12");
contactURI.setPort(ourPublicSipPort);
Address contactAddress =
......@@ -622,6 +645,8 @@ if (false) {
invite.addHeader(contactHeader);
Logger.println("XXXX gatewayRequired 14");
if (obProxy != null)
{
try {
......@@ -635,6 +660,8 @@ if (false) {
}
}
Logger.println("XXXX gatewayRequired 16");
if (cp.isAutoAnswer())
{
Logger.println("Call " + cp + " alert-info added");
......@@ -652,6 +679,8 @@ if (false) {
}
Logger.println("XXXX gatewayRequired 18");
if (sdp != null) {
contentTypeHeader =
headerFactory.createContentTypeHeader("application", "sdp");
......@@ -672,7 +701,9 @@ if (false) {
return null;
}
Logger.println("XXXX gatewayRequired 19");
clientTransaction.sendRequest();
Logger.println("XXXX gatewayRequired 20");
return clientTransaction;
}
......
/*
* Copyright 2007 Sun Microsystems, Inc.
*
* This file is part of jVoiceBridge.
*
* jVoiceBridge is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation and distributed hereunder
* to you.
*
* jVoiceBridge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Sun designates this particular file as subject to the "Classpath"
* exception as provided by Sun in the License file that accompanied this
* code.
*/
package com.sun.voip.server;
import org.jivesoftware.openfire.XMPPServer;
import com.sun.voip.CallParticipant;
import com.sun.voip.CallState;
import com.sun.voip.MediaInfo;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.*;
import org.dom4j.*;
import org.xmpp.packet.*;
import org.ifsoft.rayo.*;
import org.xmpp.jnodes.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SpeakerCallAgent extends CallSetupAgent
{
private static final Logger Log = LoggerFactory.getLogger(SpeakerCallAgent.class);
private CallParticipant cp;
private MemberReceiver memberReceiver;
private MemberSender memberSender;
private MediaInfo mixerMediaPreference;
public SpeakerCallAgent(CallHandler callHandler)
{
super(callHandler);
cp = callHandler.getCallParticipant();
mixerMediaPreference = callHandler.getConferenceManager().getMediaInfo();
memberSender = callHandler.getMemberSender();
memberReceiver = callHandler.getMemberReceiver();
Log.info("SpeakerCallAgent init " + cp.getDisplayName() + " " + cp.getPhoneNumber() + " " + cp.isMuted());
}
public void initiateCall() throws IOException
{
String domainName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
try {
if ("CALL".equals(cp.getDisplayName()) && "Speaker".equals(cp.getProtocol())) // bridge from call to speaker
{
memberSender.setChannel(new SpeakerChannel(cp.getOtherCall().getMemberReceiver()));
}
setState(CallState.ANSWERED);
setEndpointAddress(null, (byte)0, (byte)0, (byte)0);
setState(CallState.ESTABLISHED);
} catch (Exception e) {
Log.error("Call " + cp + ": SpeakerCallAgent: initiateCall exception ");
e.printStackTrace();
}
}
public String getSdp()
{
return null;
}
public void setRemoteMediaInfo(String sdp)
{
return;
}
}
......@@ -47,7 +47,7 @@ public class WebRtcCallAgent extends CallSetupAgent
mixerMediaPreference = callHandler.getConferenceManager().getMediaInfo();
memberSender = callHandler.getMemberSender();
memberSender.setWebRTCParticipant(cp.getRelayChannel());
memberSender.setChannel(cp.getChannel());
memberReceiver = callHandler.getMemberReceiver();
callHandler.setEndpointAddress(null, (byte) (cp.getMediaPreference() == "PCM/48000/2" ? 111 : 0), (byte)0, (byte)0);
......
......@@ -122,7 +122,7 @@ public class RayoPlugin implements Plugin, SessionEventListener {
}
}
}, timeout, timeout, TimeUnit.MILLISECONDS);
Log.info("Jingle Nodes Loaded.");
Log.info("Rayo Plugin Loaded.");
verifyNetwork();
}
......
......@@ -61,6 +61,7 @@ public class Application implements CallEventListener {
properties.setProperty("javax.sip.STACK_NAME", "JAIN SIP 1.1");
properties.setProperty("javax.sip.RETRANSMISSION_FILTER", "on");
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "99");
properties.setProperty("gov.nist.javax.sip.MIN_KEEPALIVE_TIME_SECONDS", "360");
properties.setProperty("gov.nist.javax.sip.SERVER_LOG", logDir + "sip_server.log");
properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", logDir + "sip_debug.log");
properties.setProperty("javax.sip.IP_ADDRESS",config.getPrivateHost());
......@@ -1853,7 +1854,7 @@ public class Application implements CallEventListener {
if ("protocol".equalsIgnoreCase(parameter))
{
if (value.equalsIgnoreCase("SIP") == false && value.equalsIgnoreCase("NS") == false && value.equalsIgnoreCase("WebRtc") == false && value.equalsIgnoreCase("Rtmfp") == false)
if (value.equalsIgnoreCase("SIP") == false && value.equalsIgnoreCase("NS") == false && value.equalsIgnoreCase("WebRtc") == false && value.equalsIgnoreCase("Rtmfp") == false && value.equalsIgnoreCase("Speaker") == false)
{
reportError("Invalid protocol: " + value);
return;
......
......@@ -130,7 +130,7 @@ public class Config implements MUCEventListener {
String name = defaultProxy;
String username = JiveGlobals.getProperty("voicebridge.default.proxy.username", "admin");
String sipusername = JiveGlobals.getProperty("voicebridge.default.proxy.sipusername", name);
String authusername = JiveGlobals.getProperty("voicebridge.default.proxy.sipauthuser", name);
String authusername = JiveGlobals.getProperty("voicebridge.default.proxy.sipauthuser", null);
String displayname = JiveGlobals.getProperty("voicebridge.default.proxy.sipdisplayname", name);
String password = JiveGlobals.getProperty("voicebridge.default.proxy.sippassword", name);
String server = JiveGlobals.getProperty("voicebridge.default.proxy.sipserver");
......
/**
* $Revision $
* $Date $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xmpp.jnodes;
public interface IChannel {
public void pushAudio(byte[] rtpData, byte[] opus);
public void pushAudio(int[] dataToSend);
public void pushReceiverAudio(int[] dataToSend);
public void sendComfortNoisePayload();
public boolean encode();
public boolean isActive();
public void setActive(boolean active);
}
......@@ -48,7 +48,7 @@ import com.rayo.core.xml.providers.*;
public class RelayChannel {
public class RelayChannel implements IChannel {
private final SelDatagramChannel channelA;
private final SelDatagramChannel channelB;
......@@ -98,6 +98,8 @@ public class RelayChannel {
private int frameSizeInSamplesPerChannel = (sampleRate * frameSizeInMillis) / 1000;
private int frameSizeInBytes = outputFrameSize * channels * frameSizeInSamplesPerChannel;
private boolean active = true;
private static final Logger Log = LoggerFactory.getLogger(RelayChannel.class);
public static RelayChannel createLocalRelayChannel(final String host, final int minPort, final int maxPort) throws IOException {
......@@ -417,11 +419,6 @@ public class RelayChannel {
return BitAssistant.toShortNetwork(bytes, Integer.valueOf(2));
}
public void sendComfortNoisePayload()
{
}
private Long getNextAudioTimestamp(Long clockRate)
{
Integer timestamp = lastAudioTimestamp;
......@@ -429,6 +426,33 @@ public class RelayChannel {
return new Long((new Integer(timestamp.intValue())).longValue());
}
public void sendComfortNoisePayload()
{
}
public boolean encode()
{
return true;
}
public boolean isActive()
{
return active;
}
public void setActive(boolean active)
{
this.active = active;
}
public void pushAudio(int[] dataToSend)
{
}
public synchronized void pushAudio(byte[] rtpData, byte[] opus)
{
try {
......@@ -482,6 +506,11 @@ public class RelayChannel {
}
public void pushReceiverAudio(int[] dataToSend)
{
}
private boolean decryptMedia(byte[] b)
{
Byte data[] = BitAssistant.bytesToArray(b);
......
/**
* $Revision $
* $Date $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xmpp.jnodes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.voip.*;
import com.sun.voip.server.*;
public class SpeakerChannel implements IChannel
{
private static final Logger Log = LoggerFactory.getLogger(SpeakerChannel.class);
private MemberReceiver memberReceiver;
private short sequenceNumber = 1;
private CallParticipant cp;
private int kt = 0;
private boolean active = true;
public SpeakerChannel(MemberReceiver memberReceiver)
{
this.memberReceiver = memberReceiver;
Log.info("SpeakerChannel init " + memberReceiver);
}
public void sendComfortNoisePayload()
{
}
public boolean encode()
{
return false;
}
public boolean isActive()
{
return active;
}
public void setActive(boolean active)
{
this.active = active;
Log.info("SpeakerChannel setActive " + active + " " + memberReceiver);
}
public void pushAudio(int[] dataToSend)
{
if (memberReceiver != null && active)
{
if (sequenceNumber < 10) Log.info("SpeakerChannel pushAudio " + memberReceiver);
memberReceiver.handleWebRtcMedia(dataToSend, sequenceNumber++);
}
}
public synchronized void pushAudio(byte[] rtpData, byte[] opus)
{
}
public void pushReceiverAudio(int[] dataToSend)
{
if (memberReceiver != null && active)
{
kt++;
if (kt < 10) Log.info("SpeakerChannel pushReceiverAudio " + memberReceiver);
memberReceiver.handleWebRtcMedia(dataToSend, sequenceNumber++);
}
}
}
\ No newline at end of file
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