Repository: openmeetings Updated Branches: refs/heads/3.3.x c67943e84 -> 18c013459
[OPENMEETINGS-1664] initial commit on SIP fixing Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/18c01345 Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/18c01345 Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/18c01345 Branch: refs/heads/3.3.x Commit: 18c0134591b04c4fcebda8921450033c4a2ee639 Parents: c67943e Author: Maxim Solodovnik <[email protected]> Authored: Thu Jul 6 13:45:59 2017 +0700 Committer: Maxim Solodovnik <[email protected]> Committed: Thu Jul 6 13:45:59 2017 +0700 ---------------------------------------------------------------------- .../remote/red5/ScopeApplicationAdapter.java | 56 ++-- .../apache/openmeetings/db/dao/room/SipDao.java | 17 +- .../openmeetings/db/entity/basic/Client.java | 4 +- .../openmeetings/db/entity/room/Client.java | 6 + .../tests/PortAvailabilityTest.lzx | 2 +- .../src/site/xdoc/red5sip-integration_3.3.xml | 316 +++++++++++++++++++ .../src/site/xdoc/voip-sip-integration.xml | 43 ++- .../openmeetings/web/app/Application.java | 18 +- .../WEB-INF/classes/applicationContext.xml | 41 +-- 9 files changed, 429 insertions(+), 74 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/openmeetings/blob/18c01345/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java index ac642a4..4e18027 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java @@ -82,7 +82,6 @@ import org.apache.openmeetings.util.Version; import org.apache.openmeetings.util.message.RoomMessage; import org.apache.openmeetings.util.message.TextRoomMessage; import org.apache.wicket.Application; -import org.apache.wicket.util.string.StringValue; import org.apache.wicket.util.string.Strings; import org.red5.logging.Red5LoggerFactory; import org.red5.server.adapter.MultiThreadedApplicationAdapter; @@ -106,6 +105,8 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp private static final String WIDTH_PARAM = "width"; private static final String HEIGHT_PARAM = "height"; private static final String NATIVE_SSL_PARAM = "nativeSsl"; + public static final String HIBERNATE_SCOPE = "hibernate"; + private static final String SIP_PARAM = "sipClient"; @Autowired private ISessionManager sessionManager; @@ -207,18 +208,18 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp if (parentSid == null) { parentSid = (String)connParams.get("parentSid"); } - StringValue scn = StringValue.valueOf(conn.getScope().getName()); - long roomId = scn.toLong(Long.MIN_VALUE); Client rcm = new Client(); + rcm.setScope(conn.getScope().getName()); + boolean hibernate = HIBERNATE_SCOPE.equals(rcm.getScope()); IApplication iapp = (IApplication)Application.get(wicketApplicationName); if (!Strings.isEmpty(securityCode)) { //this is for external applications like ffmpeg [OPENMEETINGS-1574] - if (roomId < 0) { - log.warn("Trying to enter invalid scope using security code, client is rejected:: " + roomId); + if (rcm.getRoomId() == null) { + log.warn("Trying to enter invalid scope using security code, client is rejected:: " + rcm.getRoomId()); return rejectClient(); } String _uid = null; - for (org.apache.openmeetings.db.entity.basic.Client wcl : iapp.getOmRoomClients(roomId)) { + for (org.apache.openmeetings.db.entity.basic.Client wcl : iapp.getOmRoomClients(rcm.getRoomId())) { if (wcl.getSid().equals(securityCode)) { _uid = wcl.getUid(); break; @@ -229,7 +230,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp return rejectClient(); } Client parent = sessionManager.getClientByPublicSID(_uid, null); - if (parent == null || !parent.getScope().equals(scn.toString())) { + if (parent == null || !parent.getScope().equals(rcm.getScope())) { log.warn("Security code is invalid, client is rejected"); return rejectClient(); } @@ -250,7 +251,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp log.warn("No UIDs are provided, client is rejected"); return rejectClient(); } - if ("networktest".equals(uid)) { + if (hibernate && "noclient".equals(uid)) { return true; } @@ -267,17 +268,16 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp rcm.setStreamPublishName(parentSid); } rcm.setStreamid(conn.getClient().getId()); - rcm.setScope(scn.toString()); - boolean notHibernate = !"hibernate".equals(scn.toString()); - if (Long.MIN_VALUE != roomId) { - rcm.setRoomId(roomId); - } else if (notHibernate) { + if (rcm.getRoomId() == null && !hibernate) { log.warn("Bad room specified, client is rejected"); return rejectClient(); } + if (Boolean.TRUE.equals(connParams.get(SIP_PARAM))) { + rcm.setSipTransport(true); + } if (connParams.containsKey("mobileClient")) { Sessiondata sd = sessiondataDao.check(parentSid); - if (sd.getUserId() == null && notHibernate) { + if (sd.getUserId() == null && !hibernate) { log.warn("Attempt of unauthorized room enter, client is rejected"); return rejectClient(); } @@ -666,7 +666,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp } }.start(); - if (client.isMobile()) { + if (client.isMobile() || client.isSipTransport()) { IApplication app = (IApplication)Application.get(wicketApplicationName); app.exit(client.getPublicSID()); } @@ -1904,14 +1904,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); - } - private String getSipTransportLastname(Long roomId) { return getSipTransportLastname(roomManager.getSipConferenceMembersNumber(roomId)); } @@ -1920,6 +1912,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(); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/18c01345/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..c9865f4 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 @@ -44,6 +44,7 @@ public class SipDao { private int sipPort; private String sipUsername; private String sipPassword; + private String uid; private long timeout; private ManagerConnectionFactory factory; @@ -69,7 +70,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 +159,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 +189,12 @@ public class SipDao { exec(oa); //TODO handle response } + + public void setUid(String uid) { + this.uid = uid; + } + + public String getUid() { + return uid; + } } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/18c01345/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 8ec7b27..efd7c15 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 @@ -75,10 +75,10 @@ public class Client implements IClient { sid = UUID.randomUUID().toString(); } - public Client(org.apache.openmeetings.db.entity.room.Client rcl, UserDao dao) { + public Client(org.apache.openmeetings.db.entity.room.Client 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.getPublicSID(); sid = UUID.randomUUID().toString(); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/18c01345/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Client.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Client.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Client.java index 1fc7406..e85c8e3 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Client.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Client.java @@ -38,6 +38,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.apache.openmeetings.db.entity.basic.IClient; import org.apache.openmeetings.db.entity.server.Server; import org.apache.openmeetings.util.CalendarPatterns; +import org.apache.wicket.util.string.StringValue; /** * Can be configured to be stored in memory or in database @@ -475,6 +476,11 @@ public class Client implements IClient { public void setScope(String scope) { this.scope = scope; + StringValue scn = StringValue.valueOf(scope); + long roomId = scn.toLong(Long.MIN_VALUE); + if (roomId > 0) { + this.roomId = roomId; + } } public String getFormatedDate() { http://git-wip-us.apache.org/repos/asf/openmeetings/blob/18c01345/openmeetings-flash/src/main/swf/networkTesting/tests/PortAvailabilityTest.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/networkTesting/tests/PortAvailabilityTest.lzx b/openmeetings-flash/src/main/swf/networkTesting/tests/PortAvailabilityTest.lzx index ea60c7e..61605b9 100644 --- a/openmeetings-flash/src/main/swf/networkTesting/tests/PortAvailabilityTest.lzx +++ b/openmeetings-flash/src/main/swf/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/18c01345/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><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/18c01345/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 56361cb..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,24 +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="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> \ No newline at end of file +</document> http://git-wip-us.apache.org/repos/asf/openmeetings/blob/18c01345/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 44f91fe..add10f2 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 @@ -49,6 +49,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.user.UserDao; import org.apache.openmeetings.db.entity.basic.Client; import org.apache.openmeetings.db.entity.basic.Client.Activity; @@ -310,7 +311,7 @@ public class Application extends AuthenticatedWebApplication implements IApplica } if (client == null && rcl.isMobile()) { //Mobile client enters the room - client = new Client(rcl, getBean(UserDao.class)); + client = new Client(rcl, getBean(UserDao.class).get(rcl.getUserId())); addOnlineUser(client); if (rcl.getRoomId() != null) { client.setCam(0); @@ -320,6 +321,21 @@ 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.getPublicSID())) { + return null; + } + //SipTransport enters the room + User u = new User(); //fake + u.setFirstname("SIP Transport"); //TODO check this + 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 if (client == null) { return null; } else if (!client.hasRight(Right.audio) && !client.hasRight(Right.video)) { http://git-wip-us.apache.org/repos/asf/openmeetings/blob/18c01345/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 ee98717..c99613a 100644 --- a/openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml +++ b/openmeetings-web/src/main/webapp/WEB-INF/classes/applicationContext.xml @@ -19,19 +19,19 @@ --> <beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:tx="http://www.springframework.org/schema/tx" - xmlns:context="http://www.springframework.org/schema/context" - xmlns:jaxrs="http://cxf.apache.org/jaxrs" - xmlns:jaxws="http://cxf.apache.org/jaxws" - xmlns:p="http://www.springframework.org/schema/p" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd - http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd - http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd - http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd" - > + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:jaxrs="http://cxf.apache.org/jaxrs" + xmlns:jaxws="http://cxf.apache.org/jaxws" + xmlns:p="http://www.springframework.org/schema/p" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd + http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd + http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd" + > <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> <property name="persistenceUnitName" value="openmeetings" /> </bean> @@ -170,13 +170,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" />
