You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/07/13 09:15:36 UTC
openmeetings git commit: [OPENMEETINGS-1664] Attempt to fix red5sip
to work with 4.0.0
Repository: openmeetings
Updated Branches:
refs/heads/master 9446c1665 -> 9b05be587
[OPENMEETINGS-1664] Attempt to fix red5sip to work with 4.0.0
Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/9b05be58
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/9b05be58
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/9b05be58
Branch: refs/heads/master
Commit: 9b05be58775741ff12100ada586be30601bbb55b
Parents: 9446c16
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Thu Jul 13 16:15:28 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Thu Jul 13 16:15:28 2017 +0700
----------------------------------------------------------------------
.../core/remote/ScopeApplicationAdapter.java | 42 +--
.../src/site/xdoc/red5sip-integration_3.1.xml | 1 +
.../src/site/xdoc/red5sip-integration_3.3.xml | 1 +
.../src/site/xdoc/red5sip-integration_4.0.xml | 316 +++++++++++++++++++
.../src/site/xdoc/voip-sip-integration.xml | 3 +
5 files changed, 344 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9b05be58/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
----------------------------------------------------------------------
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
index 750ae6e..d91419d 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
@@ -33,6 +33,7 @@ import static org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicati
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -51,6 +52,7 @@ import org.apache.openmeetings.db.dao.room.RoomDao;
import org.apache.openmeetings.db.dao.room.SipDao;
import org.apache.openmeetings.db.dao.server.ISessionManager;
import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.basic.Client;
import org.apache.openmeetings.db.entity.log.ConferenceLog;
import org.apache.openmeetings.db.entity.room.Room;
import org.apache.openmeetings.db.entity.room.StreamClient;
@@ -486,6 +488,14 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
c.setHeight(240);
}
}
+ if (c.isSipTransport()) {
+ IApplication iapp = (IApplication)Application.get(wicketApplicationName);
+ org.apache.openmeetings.db.entity.basic.Client cl = iapp.getOmOnlineClient(c.getUid());
+ String newNumber = getSipTransportLastname(c.getRoomId());
+ cl.getUser().setLastname(newNumber);
+ c.setLastname(newNumber);
+ c.setLastname(getSipTransportLastname(c.getRoomId()));
+ }
sessionManager.update(c);
_log.debug("newStream SEND: {}", c);
@@ -1064,6 +1074,19 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
/*
* SIP transport methods
*/
+ public List<String> listRoomBroadcast() {
+ List<String> ids = new ArrayList<>();
+ IConnection current = Red5.getConnectionLocal();
+ StreamClient client = sessionManager.get(IClientUtil.getId(current.getClient()));
+ IApplication iapp = (IApplication)Application.get(wicketApplicationName);
+ for (Client c: iapp.getOmRoomClients(client.getRoomId()) ) {
+ for (Client.Stream s : c.getStreams()) {
+ ids.add(s.getBroadcastId());
+ }
+ }
+ return ids;
+ }
+
/**
* Returns number of SIP conference participants
* @param roomId id of room
@@ -1117,25 +1140,6 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
return count != null && count > 0 ? count - 1 : 0;
}
- public void setSipTransport(String broadCastId) {
- _log.debug("----------- setSipTransport");
- IConnection current = Red5.getConnectionLocal();
- IClient client = current.getClient();
- // Notify all clients of the same scope (room)
- StreamClient c = sessionManager.get(IClientUtil.getId(client));
- IApplication iapp = (IApplication)Application.get(wicketApplicationName);
- org.apache.openmeetings.db.entity.basic.Client cl = iapp.getOmOnlineClient(c.getUid());
- String newNumber = getSipTransportLastname(c.getRoomId());
- cl.getUser().setLastname(newNumber);
- c.setLastname(newNumber);
- c.setLastname(getSipTransportLastname(c.getRoomId()));
- c.setBroadCastId(broadCastId);
- sessionManager.update(c);
-
- WebSocketHelper.sendRoom(new TextRoomMessage(c.getRoomId(), c.getUserId(), RoomMessage.Type.rightUpdated, c.getUid()));
- sendMessageToCurrentScope("addNewUser", c, false);
- }
-
public JSONObject getFlashSettings() {
return flashSettings;
}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9b05be58/openmeetings-server/src/site/xdoc/red5sip-integration_3.1.xml
----------------------------------------------------------------------
diff --git a/openmeetings-server/src/site/xdoc/red5sip-integration_3.1.xml b/openmeetings-server/src/site/xdoc/red5sip-integration_3.1.xml
index bdc1b4d..ed92b3b 100644
--- a/openmeetings-server/src/site/xdoc/red5sip-integration_3.1.xml
+++ b/openmeetings-server/src/site/xdoc/red5sip-integration_3.1.xml
@@ -245,6 +245,7 @@ service asterisk restart
<source>
<![CDATA[
git clone https://github.com/openmeetings/red5sip.git
+git checkout red5sip_3.1
]]>
</source>
</li>
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9b05be58/openmeetings-server/src/site/xdoc/red5sip-integration_3.3.xml
----------------------------------------------------------------------
diff --git a/openmeetings-server/src/site/xdoc/red5sip-integration_3.3.xml b/openmeetings-server/src/site/xdoc/red5sip-integration_3.3.xml
index 28aa4a8..51b0d3d 100644
--- a/openmeetings-server/src/site/xdoc/red5sip-integration_3.3.xml
+++ b/openmeetings-server/src/site/xdoc/red5sip-integration_3.3.xml
@@ -247,6 +247,7 @@ service asterisk restart
<source>
<![CDATA[
git clone https://github.com/openmeetings/red5sip.git
+git checkout red5sip_3.3
]]>
</source>
</li>
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9b05be58/openmeetings-server/src/site/xdoc/red5sip-integration_4.0.xml
----------------------------------------------------------------------
diff --git a/openmeetings-server/src/site/xdoc/red5sip-integration_4.0.xml b/openmeetings-server/src/site/xdoc/red5sip-integration_4.0.xml
new file mode 100644
index 0000000..1d8a732
--- /dev/null
+++ b/openmeetings-server/src/site/xdoc/red5sip-integration_4.0.xml
@@ -0,0 +1,316 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<document xmlns="http://maven.apache.org/XDOC/2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
+ <properties>
+ <title>SIP-Transport Integration</title>
+ <author email="dev@openmeetings.apache.org">Apache OpenMeetings Team</author>
+ </properties>
+ <body>
+ <section name="SIP-Transport Integration">
+ <p>You need Apache OpenMeetings <strong>version 4.0+</strong> to apply this guide!</p>
+ <p>You need Asterisk <strong>version 13+</strong> to apply this guide!</p>
+ <p>Here is instruction how-to set up red5sip transport integration with OpenMeetings on Ubuntu 16.04.</p>
+ </section>
+ <section name="Prerequisites">
+ <div>
+ Run the commands
+ <source>
+<![CDATA[
+sudo apt-get update && sudo apt-get upgrade
+]]>
+ </source>
+ </div>
+ </section>
+ <section name="Building and setting up Asterisk">
+ <div>
+ Run the commands
+ <source>
+<![CDATA[
+sudo mkdir /usr/src/asterisk && cd /usr/src/asterisk
+sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-13.17.0.tar.gz
+sudo tar -xvzf asterisk-13.17.0.tar.gz
+cd ./asterisk-13.17.0
+sudo make clean
+sudo contrib/scripts/install_prereq install
+sudo ./configure
+sudo make menuconfig
+]]>
+ </source>
+ Make sure you have selected <tt>Add-ons -> res_config_mysql</tt>, Press F12 to save
+ <source>
+<![CDATA[
+sudo make
+sudo make install
+sudo make samples
+sudo make config
+sudo service asterisk start
+]]>
+ </source>
+ </div>
+ </section>
+ <section name="Configure Asterisk">
+ <div>
+ Enable asterisk MySQL module:<br /><br />
+ Modify "[modules]" section of <tt>/etc/asterisk/modules.conf</tt> as follows:<br />
+ <strong>Add/uncomment the following lines</strong>
+ <source>
+<![CDATA[
+preload => res_config_mysql.so
+]]>
+ </source>
+ </div><br />
+ <div>
+ Configure MySQL module:<br /><br />
+ Set valid data for MySQL in <tt>/etc/asterisk/res_config_mysql.conf</tt> :<br />
+ <strong>Example</strong>
+ <source>
+<![CDATA[
+[general]
+dbhost = 127.0.0.1
+dbname = openmeetings
+dbuser = root
+dbpass =
+dbport = 3306
+dbsock = /var/lib/mysql/mysql.sock
+dbcharset = utf8
+requirements=warn
+]]>
+ </source>
+ </div><br />
+ <div>
+ Modify <tt>/etc/asterisk/sip.conf</tt><br />
+ <strong>Add/uncomment the following line</strong>:<br />
+ <source>
+<![CDATA[
+videosupport=yes
+rtcachefriends=yes
+]]>
+ </source>
+ <strong>Increase maxexpiry value to 43200</strong>:<br />
+ <source>
+<![CDATA[
+maxexpiry=43200
+]]>
+ </source>
+ <strong>Add user for the "SIP Transport"</strong>:<br />
+ <source>
+<![CDATA[
+[red5sip_user]
+type=friend
+secret=12345
+disallow=all
+allow=ulaw
+allow=h263
+host=dynamic
+nat=force_rport,comedia
+context=rooms-red5sip
+]]>
+ </source>
+ </div><br />
+ <div>
+ Add next lines into the <tt>/etc/asterisk/extconfig.conf</tt>:
+ <source>
+<![CDATA[
+[settings]
+sippeers => mysql,general,sipusers
+]]>
+ </source>
+ </div><br />
+ <div>
+ Modify <tt>/etc/asterisk/extensions.conf</tt><br />
+ <strong>Add the following section</strong>:<br />
+ <source>
+<![CDATA[
+; *****************************************************
+; The below dial plan is used to dial into a Openmeetings Conference room
+; The first line DB_EXISTS(openmeetings/room/ does not belong to the openmeetings application but is the name of astDB containing the astDB family/key pair and values
+; To Check if your astDB has been created do the following in a terminal window type the following:
+; asterisk –rx “database show”
+; If you do not receive an output with that resembles openmeetings/rooms/400## where “##” will equal the extension assigned when you created your room
+; If you do not receive the above output check your parameters in /opt/red5/webapps/openmeetings/WEB-INF/classes/applicationContext.xml
+; Go back into the Administrator Panel and remove the PIN number in each room save the record with no PIN number and then re-enter the pin again resave the record.
+; *****************************************************
+
+[rooms]
+exten => _400X!,1,GotoIf($[${DB_EXISTS(openmeetings/rooms/${EXTEN})}]?ok:notavail)
+exten => _400X!,n(ok),SET(PIN=${DB(openmeetings/rooms/${EXTEN})})
+exten => _400X!,n,Set(CONFBRIDGE(user,template)=sip_user)
+exten => _400X!,n,Set(CONFBRIDGE(user,pin)=${PIN})
+exten => _400X!,n(ok),Confbridge(${EXTEN},default_bridge,)
+exten => _400X!,n,Hangup
+exten => _400X!,n(notavail),Answer()
+exten => _400X!,n,Playback(invalid)
+exten => _400X!,n,Hangup
+
+[rooms-originate]
+exten => _400X!,1,Confbridge(${EXTEN},default_bridge,sip_user)
+exten => _400X!,n,Hangup
+
+[rooms-out]
+; *****************************************************
+; Extensions for outgoing calls from Openmeetings room.
+; *****************************************************
+
+[rooms-red5sip]
+exten => _400X!,1,GotoIf($[${DB_EXISTS(openmeetings/rooms/${EXTEN})}]?ok:notavail)
+exten => _400X!,n(ok),Confbridge(${EXTEN},default_bridge,red5sip_user)
+exten => _400X!,n(notavail),Hangup
+]]>
+ </source>
+ </div><br />
+ <div>
+ Modify <tt>/etc/asterisk/confbridge.conf</tt><br />
+ <strong>Add/Modify the following secions</strong>:<br />
+ <source>
+<![CDATA[
+[general]
+
+[red5sip_user]
+type=user
+marked=yes
+dsp_drop_silence=yes
+denoise=true
+
+[sip_user]
+type=user
+end_marked=yes
+wait_marked=yes
+music_on_hold_when_empty=yes
+dsp_drop_silence=yes
+denoise=true
+
+[default_bridge]
+type=bridge
+video_mode=follow_talker
+]]>
+ </source>
+ </div><br />
+ <div>
+ To enable Asterisk Manager API modify <tt>/etc/asterisk/manager.conf</tt><br />
+ <strong>Add/Modify the following sections</strong>:<br />
+ <source>
+<![CDATA[
+[general]
+enabled = yes
+webenabled = no
+port = 5038
+bindaddr = 127.0.0.1
+
+[openmeetings]
+secret = 12345
+deny=0.0.0.0/0.0.0.0
+permit=127.0.0.1/255.255.255.0
+read = all
+write = all
+]]>
+ </source>
+ </div><br />
+ <div>
+ Update OpenMeetings with credentials for Asterisk manager.
+ Modify <tt>/opt/red5/webapps/openmeetings/WEB-INF/classes/applicationContext.xml</tt><br />
+ find <strong><bean id="sipDao" class="org.apache.openmeetings.db.dao.room.SipDao"></strong>
+ uncomment its parameters and set it to your custom values.<br/>
+ set value for <tt>uid</tt> property to unique secret value (can be generated here <a href="https://www.uuidgenerator.net">https://www.uuidgenerator.net</a>)
+ and sync it with <tt>settings.properties</tt> of red5sip (see below)
+ <p style="font-size: larger; color: blue;">
+ IMPORTANT: this step should be done <strong>BEFORE</strong> system install/restore
+ otherwise all SIP related room information will be lost
+ </p>
+ </div><br />
+ <div>
+ Restart asterisk:
+ <source>
+<![CDATA[
+service asterisk restart
+]]>
+ </source>
+ </div><br />
+ </section>
+
+ <section name="Setup red5sip transport">
+ <ul>
+ <li>Download red5sip from <tt>https://github.com/openmeetings/red5sip</tt>
+ <source>
+<![CDATA[
+git clone https://github.com/openmeetings/red5sip.git
+]]>
+ </source>
+ </li>
+ <li>Build with Apache Maven
+ <source>
+<![CDATA[
+cd red5sip
+mvn clean package
+]]>
+ </source>
+ </li>
+ <li>All necessary files will be available in <tt>target</tt> folder, copy/move it to /opt/red5sip/</li>
+ <li>Insert proper values to the <tt>/opt/red5sip/settings.properties</tt>
+ <source>
+<![CDATA[
+red5.host=127.0.0.1 # red5 server address
+om.context=openmeetings # Openmeetings context
+red5.codec=asao
+red5.codec.rate=22 # should correlate with mic settings in public/config.xml
+sip.obproxy=127.0.0.1 # asterisk adderss
+sip.phone=red5sip_user # sip phone number
+sip.authid=red5sip_user # sip auth id
+sip.secret=12345 # sip password
+sip.realm=asterisk # sip realm
+sip.proxy=127.0.0.1 # address of sip proxy
+rooms.forceStart=no # TBD
+uid=87dddad4-9ca5-475b-860f-2e0825d02b76 #can be generated here: https://www.uuidgenerator.net/
+rooms=1 # TBD (not in use)
+]]>
+ </source>
+ </li>
+ <li>Add red5sip to autostart:
+ <source>
+<![CDATA[
+sudo cp /opt/red5sip/red5sip /etc/init.d/
+sudo chmod a+x /etc/init.d/red5sip
+sudo update-rc.d red5sip defaults
+]]>
+ </source>
+ </li>
+ <li>Start openmeetings
+ <source>
+<![CDATA[
+service red5 start
+]]>
+ </source>
+ </li>
+ <li>
+ Enable <tt>SIP</tt> in openmeetings: <br/>
+ <tt>Administration->Configuration->red5sip.enable == yes</tt>
+ </li>
+ <li>
+ Enable SIP for particular room(s): <br/>
+ <tt>Administration->Conference rooms->Room->Enable SIP transport in the room == checked</tt><br/>
+ (SIP number will be assigned to room if everything is OK)
+ </li>
+ <li>Start red5sip
+ <source>
+<![CDATA[
+service red5sip start
+]]>
+ </source>
+ </li>
+ </ul>
+ </section>
+ </body>
+</document>
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9b05be58/openmeetings-server/src/site/xdoc/voip-sip-integration.xml
----------------------------------------------------------------------
diff --git a/openmeetings-server/src/site/xdoc/voip-sip-integration.xml b/openmeetings-server/src/site/xdoc/voip-sip-integration.xml
index f77f7ee..cb2f6c3 100644
--- a/openmeetings-server/src/site/xdoc/voip-sip-integration.xml
+++ b/openmeetings-server/src/site/xdoc/voip-sip-integration.xml
@@ -60,6 +60,9 @@
<a href="red5sip-integration_3.3.html">
Instruction how-to set up OpenMeetings SIP-Transport integration for Openmeetings 3.3+
</a>.<br/>
+ <a href="red5sip-integration_4.0.html">
+ Instruction how-to set up OpenMeetings SIP-Transport integration for Openmeetings 4.0+
+ </a>.<br/>
</p>
</section>
</body>