Repository: openmeetings
Updated Branches:
  refs/heads/master 1ab1ad72b -> 8f5974fad


[OPENMEETINGS-1664] initial commit to master


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/8f5974fa
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/8f5974fa
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/8f5974fa

Branch: refs/heads/master
Commit: 8f5974fad8ae0f727d79272a5c098292e2ff9401
Parents: 1ab1ad7
Author: Maxim Solodovnik <[email protected]>
Authored: Tue Jul 11 08:22:56 2017 +0700
Committer: Maxim Solodovnik <[email protected]>
Committed: Tue Jul 11 08:22:56 2017 +0700

----------------------------------------------------------------------
 .../core/remote/ScopeApplicationAdapter.java    |  68 ++--
 .../apache/openmeetings/db/dao/room/SipDao.java |  19 +-
 .../openmeetings/db/entity/basic/Client.java    |   4 +-
 .../tests/PortAvailabilityTest.lzx              |   2 +-
 .../src/site/xdoc/red5sip-integration_3.3.xml   | 316 +++++++++++++++++++
 .../src/site/xdoc/red5sip-integration_4.0.xml   | 304 ------------------
 .../src/site/xdoc/voip-sip-integration.xml      |  42 ++-
 .../openmeetings/web/app/Application.java       |  22 +-
 .../web/room/activities/ActivitiesPanel.java    |  11 +-
 .../WEB-INF/classes/applicationContext.xml      |  15 +-
 10 files changed, 427 insertions(+), 376 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/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 80975c1..8997db8 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
@@ -36,10 +36,12 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 import java.util.UUID;
 
 import org.apache.openmeetings.IApplication;
@@ -89,6 +91,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
        private static final String MOBILE_PARAM = "mobileClient";
        private static final String WIDTH_PARAM = "width";
        private static final String HEIGHT_PARAM = "height";
+       private static final String SIP_PARAM = "sipClient";
        public static final String HIBERNATE_SCOPE = "hibernate";
        public static final String FLASH_SECURE = "secure";
        public static final String FLASH_NATIVE_SSL = "native";
@@ -193,7 +196,10 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                String tcUrl = map.containsKey("tcUrl") ? 
(String)map.get("tcUrl") : "";
                Map<String, Object> connParams = getConnParams(params);
                String uid = (String)connParams.get("uid");
-               if ("noclient".equals(uid)) {
+               StreamClient rcm = new StreamClient();
+               rcm.setScope(conn.getScope().getName());
+               boolean hibernate = HIBERNATE_SCOPE.equals(rcm.getScope());
+               if (hibernate && "noclient".equals(uid)) {
                        return true;
                }
                String ownerSid = (String)connParams.get(OWNER_SID_PARAM);
@@ -204,9 +210,6 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                        _log.warn("No Owner SID is provided, client is 
rejected");
                        return rejectClient();
                }
-               StreamClient rcm = new StreamClient();
-               rcm.setScope(conn.getScope().getName());
-               boolean hibernate = HIBERNATE_SCOPE.equals(rcm.getScope());
                if (hibernate) {
                        return true; //mobile initial connect
                }
@@ -217,6 +220,9 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                if (Boolean.TRUE.equals(connParams.get(MOBILE_PARAM))) {
                        rcm.setMobile(true);
                }
+               if (Boolean.TRUE.equals(connParams.get(SIP_PARAM))) {
+                       rcm.setSipTransport(true);
+               }
                rcm.setUid(Strings.isEmpty(uid) ? UUID.randomUUID().toString() 
: uid);
                rcm.setOwnerSid(ownerSid);
                rcm.setUserport(conn.getRemotePort());
@@ -448,7 +454,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                        // and room except the current disconnected cause it 
could throw an exception
                        _log.debug("currentScope " + scope);
 
-                       if (client.isMobile()) {
+                       if (client.isMobile() || client.isSipTransport()) {
                                IApplication app = 
(IApplication)Application.get(wicketApplicationName);
                                app.exit(client.getUid());
                        }
@@ -1081,14 +1087,6 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                return result.isEmpty() ? result : roomDao.getSipRooms(result);
        }
 
-       public List<Long> getActiveRoomIds() {
-               List<Long> result = getVerifiedActiveRoomIds(null);
-               for (Server s : serverDao.getActiveServers()) {
-                       result.addAll(getVerifiedActiveRoomIds(s));
-               }
-               return result.isEmpty() ? result : roomDao.getSipRooms(result);
-       }
-
        /**
         * Returns number of SIP conference participants
         * @param roomId id of room
@@ -1107,6 +1105,24 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                return (c != null && c > 0) ? "(" + (c - 1) + ")" : "";
        }
 
+       public String getSipNumber(Double roomId) {
+               Room r = roomDao.get(roomId.longValue());
+               if (r != null && r.getConfno() != null) {
+                       log.debug("getSipNumber: roomId: {}, sipNumber: {}", 
new Object[]{roomId, r.getConfno()});
+                       return r.getConfno();
+               }
+               return null;
+       }
+
+       public List<Long> getActiveRoomIds() {
+               Set<Long> ids = new HashSet<>();
+               ids.addAll(getVerifiedActiveRoomIds(null));
+               for (Server s : serverDao.getActiveServers()) {
+                       ids.addAll(getVerifiedActiveRoomIds(s));
+               }
+               return new ArrayList<>(ids);
+       }
+
        public synchronized int updateSipTransport() {
                _log.debug("-----------  updateSipTransport");
                IConnection current = Red5.getConnectionLocal();
@@ -1125,27 +1141,17 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                return count != null && count > 0 ? count - 1 : 0;
        }
 
-       public void setSipTransport(Long roomId, String publicSID, String 
broadCastId) {
+       public void setSipTransport(String broadCastId) {
                _log.debug("-----------  setSipTransport");
                IConnection current = Red5.getConnectionLocal();
-               IClient c = current.getClient();
+               IClient client = current.getClient();
                // Notify all clients of the same scope (room)
-               StreamClient currentClient = 
sessionManager.get(IClientUtil.getId(c));
-               currentClient.setSipTransport(true);
-               currentClient.setScope("" + roomId);
-               currentClient.setRoomEnter(new Date());
-               currentClient.setFirstname("SIP Transport");
-               currentClient.setLastname(getSipTransportLastname(roomId));
-               currentClient.setBroadCastId(broadCastId);
-               currentClient.setBroadcasting(true);
-               currentClient.setUid(publicSID);
-               currentClient.setWidth(120);
-               currentClient.setHeight(90);
-               currentClient.setPicture_uri("phone.png");
-               sessionManager.update(currentClient);
-               IClientUtil.init(c, currentClient.getId(), false);
-
-               sendMessageToCurrentScope("addNewUser", currentClient, false);
+               StreamClient c = sessionManager.get(IClientUtil.getId(client));
+               c.setLastname(getSipTransportLastname(c.getRoomId()));
+               c.setBroadCastId(broadCastId);
+               sessionManager.update(c);
+
+               sendMessageToCurrentScope("addNewUser", c, false);
        }
 
        public JSONObject getFlashSettings() {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java
index 140c719..040a48c 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/room/SipDao.java
@@ -40,10 +40,13 @@ public class SipDao {
        private static final Logger log = 
Red5LoggerFactory.getLogger(SipDao.class);
        public static final String ASTERISK_OM_FAMILY = "openmeetings";
        public static final String ASTERISK_OM_KEY = "rooms";
+       public static final Long SIP_USER_ID = -1L;
+       public static final String SIP_USER_NAME = "SIP Transport";
        private String sipHostname;
        private int sipPort;
        private String sipUsername;
        private String sipPassword;
+       private String uid;
        private long timeout;
        private ManagerConnectionFactory factory;
 
@@ -69,7 +72,7 @@ public class SipDao {
                con.setSocketTimeout((int)timeout);
                return con;
        }
-       
+
        private ManagerResponse exec(ManagerAction action) {
                if (factory == null) {
                        log.warn("There is no Asterisk configured");
@@ -158,15 +161,15 @@ public class SipDao {
                ResponseEvents r = execEvent(da);
                if (r != null) {
                        log.debug("SipDao::countUsers size == " + 
r.getEvents().size());
-                       // "- 1" here means: ListComplete event 
+                       // "- 1" here means: ListComplete event
                        return r.getEvents().size() - 1; // TODO check if was 
successfull
                }
                return 0;
        }
-       
+
        /**
         * Perform call to specified phone number and join to conference
-        * 
+        *
         * @param number
         *            number to call
         * @param r
@@ -188,4 +191,12 @@ public class SipDao {
 
                exec(oa); //TODO handle response
        }
+
+       public String getUid() {
+               return uid;
+       }
+
+       public void setUid(String uid) {
+               this.uid = uid;
+       }
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
index 8eac370..d103bea 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
@@ -150,10 +150,10 @@ public class Client implements IClient {
                sid = UUID.randomUUID().toString();
        }
 
-       public Client(StreamClient rcl, UserDao dao) {
+       public Client(StreamClient rcl, User user) {
                this.sessionId = UUID.randomUUID().toString();
                this.pageId = 0;
-               this.user = dao.get(rcl.getUserId());
+               this.user = user;
                this.connectedSince = new Date();
                uid = rcl.getUid();
                sid = rcl.getOwnerSid();

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/openmeetings-flash/src/main/swf10/networkTesting/tests/PortAvailabilityTest.lzx
----------------------------------------------------------------------
diff --git 
a/openmeetings-flash/src/main/swf10/networkTesting/tests/PortAvailabilityTest.lzx
 
b/openmeetings-flash/src/main/swf10/networkTesting/tests/PortAvailabilityTest.lzx
index ea60c7e..61605b9 100644
--- 
a/openmeetings-flash/src/main/swf10/networkTesting/tests/PortAvailabilityTest.lzx
+++ 
b/openmeetings-flash/src/main/swf10/networkTesting/tests/PortAvailabilityTest.lzx
@@ -43,7 +43,7 @@
                rtmp.setAttribute("src", hostUrl);
                this.log(": " + lbl('report.start') + " " + hostUrl);
 
-               canvas.publicSID = "networktest";
+               canvas.publicSID = "noclient";
                rtmp.connect();
        </method>
 

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/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
new file mode 100644
index 0000000..28aa4a8
--- /dev/null
+++ b/openmeetings-server/src/site/xdoc/red5sip-integration_3.3.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="[email protected]">Apache 
OpenMeetings Team</author>
+       </properties>
+       <body>
+               <section name="SIP-Transport Integration">
+                       <p>You need Apache OpenMeetings <strong>version 
3.1+</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.9.0.tar.gz
+sudo tar -xvzf asterisk-13.9.0.tar.gz
+cd ./asterisk-13.9.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>&lt;bean id="sipDao" 
class="org.apache.openmeetings.db.dao.room.SipDao"&gt;</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/8f5974fa/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
deleted file mode 100644
index fb9b7f0..0000000
--- a/openmeetings-server/src/site/xdoc/red5sip-integration_4.0.xml
+++ /dev/null
@@ -1,304 +0,0 @@
-<?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="[email protected]">Apache 
OpenMeetings Team</author>
-       </properties>
-       <body>
-               <section name="SIP-Transport Integration">
-                       <p>You need Apache OpenMeetings <strong>version 
3.1+</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 12.10.</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 &amp;&amp; cd /usr/src/asterisk
-sudo wget 
http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-13.9.0.tar.gz
-sudo tar -xvzf asterisk-13.9.0.tar.gz
-cd ./asterisk-13.9.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>&lt;bean id="sipDao" 
class="org.apache.openmeetings.db.dao.room.SipDao"&gt;</strong>
-                               uncomment its parameters and set it to your 
custom values.
-                               <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
-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>Start red5sip
-                                       <source>
-<![CDATA[
-service red5sip start
-]]>
-                                       </source>
-                               </li>
-                       </ul>
-               </section>
-       </body>
-</document>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/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 2539bb4..f77f7ee 100644
--- a/openmeetings-server/src/site/xdoc/voip-sip-integration.xml
+++ b/openmeetings-server/src/site/xdoc/voip-sip-integration.xml
@@ -13,17 +13,14 @@
    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";>
+               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>VoIP and SIP Integration</title>
                <author email="[email protected]">Apache 
OpenMeetings Team</author>
        </properties>
-
        <body>
-
                <section name="VoIP and SIP Integration">
-
                        <p>
                                There are multiple ways to integrate with VoIP 
and or SIP.
                                OpenMeetings does not provide out of the box a 
ready to run VoIP
@@ -46,27 +43,24 @@
                                To get help on the integration you can contact 
the
                                <a href="mail-lists.html">mailing lists</a>
                                or for example somebody from the list of
-                               <a href="commercial-support.html">commercial 
support</a>
-                               .
-                <br/><br/>
-                <a href="red5sip-integration_2.0.html">
-                Instruction how-to set up OpenMeetings SIP-Transport 
integration for Openmeetings 2.0
-                </a>.<br/>
-                <a href="red5sip-integration_2.1.html">
-                Instruction how-to set up OpenMeetings SIP-Transport 
integration for Openmeetings 2.1
-                </a>.<br/>
-                <a href="red5sip-integration_3.0.html">
-                Instruction how-to set up OpenMeetings SIP-Transport 
integration for Openmeetings 3.0
-                </a>.<br/>
-                <a href="red5sip-integration_3.1.html">
-                Instruction how-to set up OpenMeetings SIP-Transport 
integration for Openmeetings 3.1+
-                </a>.<br/>
-                               <a href="red5sip-integration_4.0.html">
-                               Instruction how-to set up OpenMeetings 
SIP-Transport integration for Openmeetings 4.0+
+                               <a href="commercial-support.html">commercial 
support</a>.
+                               <br/><br/>
+                               <a href="red5sip-integration_2.0.html">
+                                       Instruction how-to set up OpenMeetings 
SIP-Transport integration for Openmeetings 2.0
+                               </a>.<br/>
+                               <a href="red5sip-integration_2.1.html">
+                                       Instruction how-to set up OpenMeetings 
SIP-Transport integration for Openmeetings 2.1
+                               </a>.<br/>
+                               <a href="red5sip-integration_3.0.html">
+                                       Instruction how-to set up OpenMeetings 
SIP-Transport integration for Openmeetings 3.0
+                               </a>.<br/>
+                               <a href="red5sip-integration_3.1.html">
+                                       Instruction how-to set up OpenMeetings 
SIP-Transport integration for Openmeetings 3.1+
+                               </a>.<br/>
+                               <a href="red5sip-integration_3.3.html">
+                                       Instruction how-to set up OpenMeetings 
SIP-Transport integration for Openmeetings 3.3+
                                </a>.<br/>
                        </p>
                </section>
-
        </body>
-
 </document>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
index b68706a..325a233 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
@@ -19,6 +19,8 @@
 package org.apache.openmeetings.web.app;
 
 import static org.apache.openmeetings.core.util.WebSocketHelper.sendRoom;
+import static org.apache.openmeetings.db.dao.room.SipDao.SIP_USER_ID;
+import static org.apache.openmeetings.db.dao.room.SipDao.SIP_USER_NAME;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.HEADER_XFRAME_SAMEORIGIN;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
@@ -50,6 +52,7 @@ import org.apache.openmeetings.core.util.WebSocketHelper;
 import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
 import org.apache.openmeetings.db.dao.label.LabelDao;
 import org.apache.openmeetings.db.dao.log.ConferenceLogDao;
+import org.apache.openmeetings.db.dao.room.SipDao;
 import org.apache.openmeetings.db.dao.server.SessiondataDao;
 import org.apache.openmeetings.db.dao.user.UserDao;
 import org.apache.openmeetings.db.entity.basic.Client;
@@ -316,7 +319,7 @@ public class Application extends 
AuthenticatedWebApplication implements IApplica
                                User u = udao.get(sd.getUserId());
                                rcl = getBean(MobileService.class).create(rcl, 
u);
                                //Mobile client enters the room
-                               client = new Client(rcl, udao);
+                               client = new Client(rcl, 
udao.get(rcl.getUserId()));
                                addOnlineUser(client);
                                if (rcl.getRoomId() != null) {
                                        client.setCam(0);
@@ -326,6 +329,23 @@ public class Application extends 
AuthenticatedWebApplication implements IApplica
                                        WebSocketHelper.sendRoom(new 
RoomMessage(client.getRoomId(), client.getUserId(), 
RoomMessage.Type.roomEnter));
                                }
                                //FIXME TODO rights
+                       } else if (client == null && rcl.isSipTransport()) {
+                               if 
(!getBean(SipDao.class).getUid().equals(rcl.getUid())) {
+                                       return null;
+                               }
+                               rcl.setPicture_uri("phone.png");
+                               //SipTransport enters the room
+                               User u = new User();
+                               u.setId(SIP_USER_ID);
+                               u.setFirstname(SIP_USER_NAME);
+                               client = new Client(rcl, u);
+                               addOnlineUser(client);
+                               client.setCam(0);
+                               client.setMic(0);
+                               client.set(Activity.broadcastA);
+                               addUserToRoom(client);
+                               //FIXME TODO unify this
+                               WebSocketHelper.sendRoom(new 
RoomMessage(client.getRoomId(), client.getUserId(), 
RoomMessage.Type.roomEnter));
                        } else {
                                return null;
                        }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
index a821e85..c4be939 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
@@ -19,6 +19,8 @@
 package org.apache.openmeetings.web.room.activities;
 
 import static org.apache.openmeetings.core.util.WebSocketHelper.sendRoom;
+import static org.apache.openmeetings.db.dao.room.SipDao.SIP_USER_ID;
+import static org.apache.openmeetings.db.dao.room.SipDao.SIP_USER_NAME;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
 import static org.apache.openmeetings.web.app.Application.getBean;
 import static org.apache.openmeetings.web.app.Application.getOnlineClient;
@@ -184,8 +186,13 @@ public class ActivitiesPanel extends BasePanel {
                                        decline.setVisible(false);
                                        break;
                        }
-                       User u = getBean(UserDao.class).get(a.getSender());
-                       String name = self ? getString("1362") : 
String.format("%s %s", u.getFirstname(), u.getLastname());
+                       String name;
+                       if (SIP_USER_ID.equals(a.getSender())) {
+                               name = SIP_USER_NAME;
+                       } else {
+                               User u = 
getBean(UserDao.class).get(a.getSender());
+                               name = self ? getString("1362") : 
String.format("%s %s", u.getFirstname(), u.getLastname());
+                       }
                        switch (a.getType()) {
                                case roomEnter:
                                        text = ""; // TODO should this be fixed?

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8f5974fa/openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml 
b/openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml
index a3015a2..ce0c968 100644
--- a/openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml
+++ b/openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml
@@ -160,13 +160,14 @@
        <bean id="roommanagement" 
class="org.apache.openmeetings.core.data.conference.RoomManager" />
        <bean id="roomDao" class="org.apache.openmeetings.db.dao.room.RoomDao"/>
        <bean id="sipDao" class="org.apache.openmeetings.db.dao.room.SipDao">
-       <!--  Should be uncommented and updated with real values for Asterisk
-               <constructor-arg><value>127.0.0.1</value></constructor-arg>
-               <constructor-arg><value>5038</value></constructor-arg>
-               <constructor-arg><value>openmeetings</value></constructor-arg>
-               <constructor-arg><value>12345</value></constructor-arg>
-               <constructor-arg><value>10000</value></constructor-arg>
-        -->
+       <!-- Should be uncommented and updated with real values for Asterisk
+               <constructor-arg index="0" value="127.0.0.1"/>
+               <constructor-arg index="1" value="5038" type = "int"/>
+               <constructor-arg index="2" value="openmeetings"/>
+               <constructor-arg index="3" value="12345"/>
+               <constructor-arg index="4" value="10000" type = "long"/>
+               <property name="uid" 
value="87dddad4-9ca5-475b-860f-2e0825d02b76"/>
+       -->
        </bean>
        <bean id="invitationDao" 
class="org.apache.openmeetings.db.dao.room.InvitationDao" />
        <bean id="groupDao" 
class="org.apache.openmeetings.db.dao.user.GroupDao" />

Reply via email to