Skip to content

Commit

Permalink
Merge branch 'master' into Issue1767_RecordVideoRCML
Browse files Browse the repository at this point in the history
  • Loading branch information
ghjansen committed May 11, 2017
2 parents 1227efa + 0c52b0b commit 4f39701
Show file tree
Hide file tree
Showing 36 changed files with 1,068 additions and 119 deletions.
6 changes: 3 additions & 3 deletions release/build.xml
Expand Up @@ -16,8 +16,8 @@
<property name="sipservlets-build" value="773"/>
<property name="restcomm-sipservlets-as7.version" value="3.1.${sipservlets-build}"/>
<!--<property name="jain-sip-ri.version" value="7.0.3.190" />-->
<property name="restcomm-media.version" value="5.1.0"/>
<property name="restcomm-media.build" value="43"/>
<property name="restcomm-media.version" value="6.0"/>
<property name="restcomm-media.build" value="23"/>
<!--property name="mobicents-diameter.version" value="6.1.2.GA" /-->

<!-- mobicents SIP Servlets 7.x on JBoss AS7-->
Expand All @@ -30,7 +30,7 @@
<!--<property name="mobicents-media.download.url" value="https://github.com/Mobicents/mediaserver/releases/download/3.0.2.FINAL/mms-server-3.0.2.Final.zip" />-->
<!--property name="mobicents-media.download.url" value="https://mobicents.ci.cloudbees.com/view/MediaServer/job/Mobicents-MediaServer-2.x/lastSuccessfulBuild/artifact/bootstrap/target/mms-server.zip" /-->
<!--property name="mobicents-media.download.url" value="https://mobicents.ci.cloudbees.com/view/MediaServer/job/Mobicents-MediaServer-4.x/lastSuccessfulBuild/artifact/bootstrap/target/mms-server.zip"/-->
<property name="restcomm-media.download.url" value="https://mobicents.ci.cloudbees.com/view/MediaServer/job/Restcomm-MediaServer-5.x/${restcomm-media.build}/artifact/bootstrap/target/restcomm-media-server.zip"/>
<property name="restcomm-media.download.url" value="https://mobicents.ci.cloudbees.com/view/MediaServer/job/Restcomm-MediaServer-6.x/${restcomm-media.build}/artifact/bootstrap/target/restcomm-media-server.zip"/>
<property name="restcomm-media.distro.zip.path" value="${checkout.dir}/${restcomm-media.download.distro.file}"/>

<!-- <property name="restcomm-olympus.download.url" value="https://mobicents.ci.cloudbees.com/job/Olympus/${olympus.build}/artifact/target/olympus.war"/> -->
Expand Down
17 changes: 16 additions & 1 deletion restcomm/pom.xml
Expand Up @@ -90,7 +90,7 @@
<commons-codec.version>1.10</commons-codec.version>
<commons-lang.version>2.6</commons-lang.version>
<jain.mgcp.version>1.0</jain.mgcp.version>
<mobicents.mgcp.impl.version>6.0.22</mobicents.mgcp.impl.version>
<mobicents.mgcp.impl.version>6.0.23</mobicents.mgcp.impl.version>
<javamail.version>1.4</javamail.version>
<servletapi.version>2.5</servletapi.version>
<sipservletapi.version>3.1.761</sipservletapi.version>
Expand Down Expand Up @@ -129,6 +129,9 @@
<ch-commons-charset.version>3.0.2</ch-commons-charset.version>
<netty.version>3.9.6.Final</netty.version>
<logback.version>1.1.3</logback.version>
<maven-artifact.version>3.1.0</maven-artifact.version>
<smpp-extensions.version>1.0.13</smpp-extensions.version>

</properties>
<modules>
<!-- <module>restcomm.docs</module> -->
Expand Down Expand Up @@ -510,6 +513,18 @@
<artifactId>aws-java-sdk-s3</artifactId>
<version>${aws.sdk.version}</version>
</dependency>

<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${maven-artifact.version}</version>
</dependency>

<dependency>
<groupId>org.restcomm.smpp</groupId>
<artifactId>smpp-extensions</artifactId>
<version>${smpp-extensions.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
Expand Up @@ -10,6 +10,7 @@
the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
MA 02110-1301 USA, or see the FSF site: http://www.fsf.org. -->

<restcomm>
<extensions>
<!--
<extension>
Expand All @@ -18,4 +19,5 @@
<enabled>true</enabled>
</extension>
-->
</extensions>
</extensions>
</restcomm>
Expand Up @@ -21,6 +21,7 @@ CREATE MEMORY TABLE "restcomm_gateways"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"
CREATE MEMORY TABLE "restcomm_media_servers" ( "ms_id" INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, "local_ip" VARCHAR(34) NOT NULL, "local_port" INT NOT NULL, "remote_ip" VARCHAR(34) NOT NULL UNIQUE, "remote_port" INT NOT NULL, "compatibility" VARCHAR(34) DEFAULT 'rms', "response_timeout" VARCHAR(34), "external_address" VARCHAR(34))
CREATE MEMORY TABLE "restcomm_media_resource_broker_entity" ("conference_sid" VARCHAR(34) NOT NULL, "slave_ms_id" VARCHAR(34) NOT NULL, "slave_ms_bridge_ep_id" VARCHAR(34),"slave_ms_cnf_ep_id" VARCHAR(34),"is_bridged_together" BOOLEAN DEFAULT FALSE,PRIMARY KEY ("conference_sid" , "slave_ms_id"))
CREATE MEMORY TABLE PUBLIC."restcomm_extensions_configuration"("sid" VARCHAR(34) NOT NULL PRIMARY KEY,"extension" VARCHAR(255) NOT NULL,"configuration_data" VARCHAR(16777216),"configuration_type" VARCHAR(255) NOT NULL,"date_created" TIMESTAMP NOT NULL,"date_updated" TIMESTAMP, "enabled" BOOLEAN DEFAULT TRUE NOT NULL)
CREATE MEMORY TABLE PUBLIC."restcomm_accounts_extensions" ("account_sid" VARCHAR(34) NOT NULL, "extension_sid" VARCHAR(34) NOT NULL, PRIMARY KEY("account_sid", "extension_sid"), "configuration_data" VARCHAR(16777216))
CREATE MEMORY TABLE "restcomm_geolocation"("sid" VARCHAR(34) NOT NULL PRIMARY KEY, "date_created" DATETIME NOT NULL, "date_updated" DATETIME NOT NULL, "date_executed" DATETIME NOT NULL, "account_sid" VARCHAR(34) NOT NULL, "source" VARCHAR(30), "device_identifier" VARCHAR(30) NOT NULL, "geolocation_type" VARCHAR(15) NOT NULL, "response_status" VARCHAR(30), "cell_id" VARCHAR(10), "location_area_code" VARCHAR(10), "mobile_country_code" INTEGER, "mobile_network_code" VARCHAR(3), "network_entity_address" BIGINT, "age_of_location_info" INTEGER, "device_latitude" VARCHAR(15), "device_longitude" VARCHAR(15), "accuracy" BIGINT, "physical_address" VARCHAR(50), "internet_address" VARCHAR(50), "formatted_address" VARCHAR(200), "location_timestamp" DATETIME, "event_geofence_latitude" VARCHAR(15), "event_geofence_longitude" VARCHAR(15), "radius" BIGINT, "geolocation_positioning_type" VARCHAR(15), "last_geolocation_response" VARCHAR(10), "cause" VARCHAR(150), "api_version" VARCHAR(10) NOT NULL, "uri" LONGVARCHAR NOT NULL)
CREATE USER SA PASSWORD ""
GRANT DBA TO SA
Expand Down
Expand Up @@ -381,6 +381,13 @@ date_updated DATETIME,
enabled BOOLEAN NOT NULL DEFAULT TRUE
);

CREATE TABLE restcomm_accounts_extensions (
account_sid VARCHAR(34) NOT NULL,
extension_sid VARCHAR(34) NOT NULL,
configuration_data LONGTEXT NOT NULL,
PRIMARY KEY (account_sid, extension_sid)
);

INSERT INTO restcomm_accounts VALUES (
"ACae6e420f425248d6a26948c17a9e2acf",
Date("2012-04-24"),
Expand Down
Expand Up @@ -61,4 +61,24 @@
<select id="getDateUpdatedBySid" parameterType="String" resultType="date">
SELECT date_updated FROM restcomm_extensions_configuration WHERE sid=#{sid};
</select>

<select id="getAccountExtensionConfiguration" parameterType="map" resultType="hashmap">
SELECT configuration_data, account_sid AS "sid", extension_sid AS "extension" FROM restcomm_accounts_extensions
WHERE account_sid=#{account_sid} AND extension_sid=#{extension_sid};
</select>

<insert id="addAccountExtensionConfiguration" parameterType="map">
INSERT INTO restcomm_accounts_extensions (account_sid, extension_sid, configuration_data)
VALUES (#{account_sid}, #{extension_sid}, #{configuration_data});
</insert>

<update id="updateAccountExtensionConfiguration" parameterType="map">
UPDATE restcomm_accounts_extensions SET configuration_data=#{configuration_data}
WHERE account_sid=#{account_sid} AND extension_sid=#{extension_sid};
</update>

<delete id="deleteAccountExtensionConfiguration" parameterType="map">
DELETE FROM restcomm_accounts_extensions
WHERE account_sid=#{account_sid} AND extension_sid=#{extension_sid};
</delete>
</mapper>
Expand Up @@ -67,4 +67,24 @@
<select id="getDateUpdatedBySid" parameterType="String" resultType="date">
SELECT "date_updated" FROM "restcomm_extensions_configuration" WHERE "sid"=#{sid};
</select>
</mapper>

<select id="getAccountExtensionConfiguration" parameterType="map" resultType="hashmap">
SELECT "configuration_data", "account_sid" AS "sid", "extension_sid" AS "extension" FROM "restcomm_accounts_extensions"
WHERE "account_sid"=#{account_sid} AND "extension_sid"=#{extension_sid};
</select>

<insert id="addAccountExtensionConfiguration" parameterType="map">
INSERT INTO "restcomm_accounts_extensions" ("account_sid", "extension_sid", "configuration_data")
VALUES (#{account_sid}, #{extension_sid}, #{configuration_data});
</insert>

<update id="updateAccountExtensionConfiguration" parameterType="map">
UPDATE "restcomm_accounts_extensions" SET "configuration_data"=#{configuration_data}
WHERE "account_sid"=#{account_sid} AND "extension_sid"=#{extension_sid};
</update>

<delete id="deleteAccountExtensionConfiguration" parameterType="map">
DELETE FROM "restcomm_accounts_extensions"
WHERE "account_sid"=#{account_sid} AND "extension_sid"=#{extension_sid};
</delete>
</mapper>
Expand Up @@ -97,4 +97,33 @@ public interface ExtensionsConfigurationDao {
* @return
*/
boolean validate(ExtensionConfiguration extensionConfiguration);

/**
* Get account specific ExtensionConfiguration
* @param accountSid
* @param extensionSid
* @return ExtensionConfiguration
*/
ExtensionConfiguration getAccountExtensionConfiguration(String accountSid, String extensionSid);

/**
* Add a new account specific ExtensionConfiguration
* @param extensionConfiguration
* @param accountSid
*/
void addAccountExtensionConfiguration(ExtensionConfiguration extensionConfiguration, Sid accountSid) throws ConfigurationException;

/**
* Update an existing account specific ExtensionConfiguration
* @param extensionConfiguration
* @param accountSid
*/
void updateAccountExtensionConfiguration(ExtensionConfiguration extensionConfiguration, Sid accountSid) throws ConfigurationException;

/**
* Delete account specific ExtensionConfiguration
* @param accountSid
* @param extensionSid
*/
void deleteAccountExtensionConfiguration(String accountSid, String extensionSid);
}
Expand Up @@ -259,6 +259,13 @@ private ExtensionConfiguration toExtensionConfiguration(final Map<String, Object
return new ExtensionConfiguration(sid, extension, enabled, confData, confType, dateCreated, dateUpdated);
}

private ExtensionConfiguration toAccountsExtensionConfiguration(final Map<String, Object> map) {
final Sid sid = new Sid((String)map.get("extension"));
final String extension = (String) map.get("extension");
final Object confData = map.get("configuration_data");
return new ExtensionConfiguration(sid, extension, true, confData, null, null, null);
}

private Map<String, Object> toMap(final ExtensionConfiguration extensionConfiguration) {
final Map<String, Object> map = new HashMap<String, Object>();
map.put("sid", DaoUtils.writeSid(extensionConfiguration.getSid()));
Expand All @@ -276,4 +283,86 @@ private Map<String, Object> toMap(final ExtensionConfiguration extensionConfigur
map.put("enabled", extensionConfiguration.isEnabled());
return map;
}

@Override
public ExtensionConfiguration getAccountExtensionConfiguration(String accountSid, String extensionSid) {
final SqlSession session = sessions.openSession();
ExtensionConfiguration extensionConfiguration = null;
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("account_sid", accountSid.toString());
params.put("extension_sid", extensionSid.toString());
final Map<String, Object> result = session.selectOne(namespace + "getAccountExtensionConfiguration", params);
if (result != null) {
extensionConfiguration = toAccountsExtensionConfiguration(result);
}
return extensionConfiguration;
} finally {
session.close();
}
}

@Override
public void addAccountExtensionConfiguration(ExtensionConfiguration extensionConfiguration, Sid accountSid) throws ConfigurationException {
final SqlSession session = sessions.openSession();
try {
if (extensionConfiguration != null && extensionConfiguration.getConfigurationData() != null) {
if (validate(extensionConfiguration)) {
final Map<String, Object> map = new HashMap<String, Object>();
map.put("account_sid", DaoUtils.writeSid(accountSid));
map.put("extension_sid", DaoUtils.writeSid(extensionConfiguration.getSid()));

if (extensionConfiguration.getConfigurationData() != null)
map.put("configuration_data", extensionConfiguration.getConfigurationData());

session.insert(namespace + "addAccountExtensionConfiguration", map);
session.commit();
} else {
throw new ConfigurationException("Exception trying to add new configuration, validation failed. configuration type: "
+ extensionConfiguration.getConfigurationType());
}
}
} finally {
session.close();
}
}

@Override
public void updateAccountExtensionConfiguration(ExtensionConfiguration extensionConfiguration, Sid accountSid)
throws ConfigurationException {
final SqlSession session = sessions.openSession();
try {
if (extensionConfiguration != null && extensionConfiguration.getConfigurationData() != null) {
if (validate(extensionConfiguration)) {
final Map<String, Object> map = new HashMap<String, Object>();
map.put("account_sid", DaoUtils.writeSid(accountSid));
map.put("extension_sid", DaoUtils.writeSid(extensionConfiguration.getSid()));

if (extensionConfiguration.getConfigurationData() != null)
map.put("configuration_data", extensionConfiguration.getConfigurationData());
session.update(namespace + "updateAccountExtensionConfiguration", map);
} else {
throw new ConfigurationException("Exception trying to update configuration, validation failed. configuration type: "
+ extensionConfiguration.getConfigurationType());
}
}
session.commit();
} finally {
session.close();
}
}

@Override
public void deleteAccountExtensionConfiguration(String accountSid, String extensionSid) {
final SqlSession session = sessions.openSession();
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("account_sid", accountSid.toString());
params.put("extension_sid", extensionSid.toString());
session.delete(namespace + "deleteAccountExtensionConfiguration", params);
session.commit();
} finally {
session.close();
}
}
}
@@ -0,0 +1,46 @@
/*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2013, Telestax Inc and individual contributors
* by the @authors tag.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.restcomm.connect.extension.api;
import org.apache.commons.configuration.Configuration;

public class ExtensionRequest {
private Object payload;
private Configuration configuration;

public ExtensionRequest() {}

public Object getObject() {
return payload;
}

public void setObject(Object object) {
this.payload = object;
}

public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}

public Configuration getConfiguration() {
return this.configuration;
}

}
Expand Up @@ -26,7 +26,7 @@
*/
public class ExtensionResponse {
private Object object;
private boolean allowed;
private boolean allowed = true;

public ExtensionResponse() {}

Expand Down
@@ -0,0 +1,27 @@
/*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2013, Telestax Inc and individual contributors
* by the @authors tag.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
/**
* When an Extension returns a MessageReponse, RC will reconfigure the message it will send
*/
package org.restcomm.connect.extension.api;
public class MessageExtensionResponse extends ExtensionResponse {
//TODO: needs discussion, definition
}
@@ -0,0 +1,27 @@
/*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2013, Telestax Inc and individual contributors
* by the @authors tag.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
/**
* When an Extension returns a NodeReponse, RC will reconfigure the specific RC node it is in
*/
package org.restcomm.connect.extension.api;
public class NodeExtensionResponse extends ExtensionResponse {
//TODO: needs discussion, definition
}

0 comments on commit 4f39701

Please sign in to comment.