Skip to content

Commit 3fb36ba

Browse files
committed
2 parents af4100a + 0bb7f1c commit 3fb36ba

7 files changed

Lines changed: 74 additions & 2 deletions

File tree

restcomm/restcomm.application/src/main/webapp/WEB-INF/data/hsql/restcomm.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ CREATE MEMORY TABLE "restcomm_media_resource_broker_entity" ("conference_sid" VA
2424
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)
2525
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))
2626
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)
27+
CREATE PROCEDURE PUBLIC."completeConferenceDetailRecord"(IN "in_sid" VARCHAR(100),IN "in_status" VARCHAR(100),IN "in_slave_ms_id" VARCHAR(100),IN "in_date_updated" TIMESTAMP,IN "amIMaster" BOOLEAN,OUT "completed" BOOLEAN) SPECIFIC "completeConferenceDetailRecord_10482" LANGUAGE SQL NOT DETERMINISTIC MODIFIES SQL DATA NEW SAVEPOINT LEVEL BEGIN ATOMIC SET "completed"=FALSE;IF("amIMaster")THEN UPDATE PUBLIC."restcomm_conference_detail_records" SET PUBLIC."restcomm_conference_detail_records"."master_present"=FALSE,PUBLIC."restcomm_conference_detail_records"."date_updated"="in_date_updated" WHERE PUBLIC."restcomm_conference_detail_records"."sid"="in_sid";IF NOT EXISTS(SELECT PUBLIC."restcomm_media_resource_broker_entity"."conference_sid",PUBLIC."restcomm_media_resource_broker_entity"."slave_ms_id",PUBLIC."restcomm_media_resource_broker_entity"."slave_ms_bridge_ep_id",PUBLIC."restcomm_media_resource_broker_entity"."slave_ms_cnf_ep_id",PUBLIC."restcomm_media_resource_broker_entity"."is_bridged_together" FROM PUBLIC."restcomm_media_resource_broker_entity" WHERE "conference_sid"="in_sid")THEN UPDATE PUBLIC."restcomm_conference_detail_records" SET "status"="in_status","date_updated"="in_date_updated" WHERE "sid"="in_sid";SET "completed"=TRUE;END IF;ELSE DELETE FROM PUBLIC."restcomm_media_resource_broker_entity" WHERE "conference_sid"="in_sid" AND "slave_ms_id"="in_slave_ms_id";IF NOT(SELECT "master_present" FROM PUBLIC."restcomm_conference_detail_records" WHERE "sid"="in_sid")THEN IF NOT EXISTS(SELECT PUBLIC."restcomm_media_resource_broker_entity"."conference_sid",PUBLIC."restcomm_media_resource_broker_entity"."slave_ms_id",PUBLIC."restcomm_media_resource_broker_entity"."slave_ms_bridge_ep_id",PUBLIC."restcomm_media_resource_broker_entity"."slave_ms_cnf_ep_id",PUBLIC."restcomm_media_resource_broker_entity"."is_bridged_together" FROM PUBLIC."restcomm_media_resource_broker_entity" WHERE "conference_sid"="in_sid")THEN UPDATE PUBLIC."restcomm_conference_detail_records" SET "status"="in_status","date_updated"="in_date_updated" WHERE "sid"="in_sid";SET "completed"=TRUE;END IF;END IF;END IF;END
2728
CREATE USER SA PASSWORD ""
2829
GRANT DBA TO SA
2930
SET WRITE_DELAY 10

restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/init.sql

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,3 +477,37 @@ BEGIN
477477

478478
END //
479479
DELIMITER ;
480+
481+
DELIMITER //
482+
DROP PROCEDURE IF EXISTS completeConferenceDetailRecord;
483+
CREATE PROCEDURE completeConferenceDetailRecord
484+
(IN in_sid VARCHAR(100)
485+
,IN in_status VARCHAR(100)
486+
,IN in_slave_ms_id VARCHAR(100)
487+
,IN in_date_updated TIMESTAMP
488+
,IN amIMaster BOOLEAN
489+
,OUT completed BOOLEAN)
490+
491+
BEGIN
492+
493+
START TRANSACTION;
494+
SET completed=FALSE;
495+
IF(amIMaster) THEN
496+
UPDATE restcomm_conference_detail_records SET restcomm_conference_detail_records.master_present=FALSE,restcomm_conference_detail_records.date_updated=in_date_updated WHERE restcomm_conference_detail_records.sid=in_sid;
497+
IF NOT EXISTS (SELECT restcomm_media_resource_broker_entity.conference_sid,restcomm_media_resource_broker_entity.slave_ms_id,restcomm_media_resource_broker_entity.slave_ms_bridge_ep_id,restcomm_media_resource_broker_entity.slave_ms_cnf_ep_id,restcomm_media_resource_broker_entity.is_bridged_together FROM restcomm_media_resource_broker_entity WHERE conference_sid=in_sid ) THEN
498+
UPDATE restcomm_conference_detail_records SET status=in_status,date_updated=in_date_updated WHERE sid=in_sid;
499+
SET completed=TRUE;
500+
END IF;
501+
ELSE
502+
DELETE FROM restcomm_media_resource_broker_entity WHERE conference_sid=in_sid AND slave_ms_id=in_slave_ms_id;
503+
IF NOT(SELECT master_present FROM restcomm_conference_detail_records WHERE sid=in_sid) THEN
504+
IF NOT EXISTS(SELECT restcomm_media_resource_broker_entity.conference_sid,restcomm_media_resource_broker_entity.slave_ms_id,restcomm_media_resource_broker_entity.slave_ms_bridge_ep_id,restcomm_media_resource_broker_entity.slave_ms_cnf_ep_id,restcomm_media_resource_broker_entity.is_bridged_together FROM restcomm_media_resource_broker_entity WHERE conference_sid=in_sid ) THEN
505+
UPDATE restcomm_conference_detail_records SET status=in_status,date_updated=in_date_updated WHERE sid=in_sid;
506+
SET completed=TRUE;
507+
END IF;
508+
END IF;
509+
END IF;
510+
COMMIT;
511+
512+
END //
513+
DELIMITER ;

restcomm/restcomm.application/src/main/webapp/WEB-INF/scripts/mariadb/sql/conference-detail-records.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<insert id="addConferenceDetailRecord" parameterType="map">
88
call addConferenceDetailRecord( #{sid}, #{date_created}, #{date_updated}, #{account_sid}, #{status}, #{friendly_name}, #{api_version}, #{uri}, #{master_ms_id}, #{master_present} );
99
</insert>
10+
<select id="completeConferenceDetailRecord" parameterType="map" statementType="CALLABLE">
11+
call completeConferenceDetailRecord( #{sid, mode=IN, jdbcType=VARCHAR}, #{status, mode=IN, jdbcType=VARCHAR}, #{slaveMsId, mode=IN, jdbcType=VARCHAR}, #{dateUpdated, mode=IN, jdbcType=TIMESTAMP}, #{amIMaster, mode=IN, jdbcType=BOOLEAN}, #{completed, mode=OUT, jdbcType=BOOLEAN} );
12+
</select>
1013
<select id="getConferenceDetailRecord" parameterType="string" resultType="hashmap">
1114
SELECT * FROM restcomm_conference_detail_records WHERE sid=#{sid};
1215
</select>

restcomm/restcomm.application/src/main/webapp/WEB-INF/sql/conference-detail-records.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<insert id="addConferenceDetailRecord" parameterType="map">
88
INSERT INTO "restcomm_conference_detail_records" ("sid", "date_created", "date_updated", "account_sid", "status", "friendly_name", "api_version", "uri", "master_ms_id", "master_present") VALUES (#{sid}, #{date_created}, #{date_updated}, #{account_sid}, #{status}, #{friendly_name}, #{api_version}, #{uri}, #{master_ms_id}, #{master_present});
99
</insert>
10+
<select id="completeConferenceDetailRecord" parameterType="map" statementType="CALLABLE">
11+
call "completeConferenceDetailRecord"( #{sid, mode=IN, jdbcType=VARCHAR}, #{status, mode=IN, jdbcType=VARCHAR}, #{slaveMsId, mode=IN, jdbcType=VARCHAR}, #{dateUpdated, mode=IN, jdbcType=TIMESTAMP}, #{amIMaster, mode=IN, jdbcType=BOOLEAN}, #{completed, mode=OUT, jdbcType=BOOLEAN} );
12+
</select>
1013
<select id="getConferenceDetailRecord" parameterType="string" resultType="hashmap">
1114
SELECT * FROM "restcomm_conference_detail_records" WHERE "sid"=#{sid};
1215
</select>

restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/ConferenceDetailRecordsDao.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
package org.restcomm.connect.dao;
2121

2222
import java.util.List;
23+
import java.util.Map;
2324

2425
import org.joda.time.DateTime;
26+
import org.restcomm.connect.commons.dao.Sid;
2527
import org.restcomm.connect.dao.entities.ConferenceDetailRecord;
2628
import org.restcomm.connect.dao.entities.ConferenceDetailRecordFilter;
27-
import org.restcomm.connect.commons.dao.Sid;
2829
import org.restcomm.connect.dao.entities.ConferenceRecordCountFilter;
2930

3031
/**
@@ -62,4 +63,16 @@ public interface ConferenceDetailRecordsDao {
6263
void updateConferenceDetailRecordMasterBridgeEndpointID(ConferenceDetailRecord cdr);
6364

6465
void updateModeratorPresent(ConferenceDetailRecord cdr);
66+
67+
/**
68+
* @param params
69+
* {sid, mode=IN, jdbcType=VARCHAR}
70+
* {status, mode=IN, jdbcType=VARCHAR}
71+
* {slaveMsId, mode=IN, jdbcType=VARCHAR}
72+
* {dateUpdated, mode=IN, jdbcType=TIMESTAMP}
73+
* {amIMaster, mode=IN, jdbcType=BOOLEAN}
74+
* {completed, mode=OUT, jdbcType=BOOLEAN}
75+
* @return true/false depending on if calling agent was able to complete the conference or not.
76+
*/
77+
boolean completeConferenceDetailRecord(Map params);
6578
}

restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/mybatis/MybatisConferenceDetailRecordsDao.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,17 @@ public void updateModeratorPresent(ConferenceDetailRecord cdr) {
198198
}
199199
}
200200

201+
@Override
202+
public boolean completeConferenceDetailRecord(Map params) {
203+
final SqlSession session = sessions.openSession();
204+
try {
205+
session.selectOne(namespace + "completeConferenceDetailRecord", params);
206+
return (boolean)params.get("completed");
207+
} finally {
208+
session.close();
209+
}
210+
}
211+
201212
@Override
202213
public void removeConferenceDetailRecord(Sid sid) {
203214
// TODO Add support for conference modification after basic API's as twillio's

restcomm/restcomm.docs/sources-asciidoc/src/main/asciidoc/api/account-api.adoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ The above commands will print an output similar to the one below:
146146
|Status |The status of this account. Default is active, possible values are active, suspended, and closed.
147147
|Password(Required) |A password that will be used to generate the AuthToken for the new Account resource.
148148
|Role(Required) |The security role that this Account resource will use. If no role is provided then the role of the account resource creating this will be inherited to the new Account resource and may compromise the system.
149+
|OrganizationSid |Sid of organization, in case you want to create this account under a different account than its parent account. By default each new account will inherit its parent's organization. Please note only Super Admins have right to create an account under a different organization.
149150
|==============================================================================================================================================================================================================================
150151

151152

@@ -165,12 +166,18 @@ curl -X GET https://[primarySid]:[primaryAuthToken]@127.0.0.1:8080/restcomm/2012
165166
curl -X GET https://[primarySid]:[primaryAuthToken]@127.0.0.1:8080/restcomm/2012-04-24/Accounts/
166167
----
167168

168-
Here is an example of how to createa a **sub-account**. The sub-account will inherit the same permissions has the Administrator's account.
169+
Here is an example of how to create a **sub-account**. The sub-account will inherit the same permissions has the Administrator's account.
169170

170171
....
171172
curl -X POST https://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ -d "FriendlyName=MySubAccount" -d "EmailAddress=test@telestax.com" -d "Password=restcomm"
172173
....
173174

175+
Here is an example of creating an account under a specific organization.
176+
177+
....
178+
curl -X POST https://<Sid>:<authToken>@<restcommAdress>/restcomm/2012-04-24/Accounts/ -d "FriendlyName=MySubAccount" -d "EmailAddress=test@telestax.com" -d "Password=restcomm" -d "OrganizationSid=<OrganizationSid>"
179+
....
180+
174181

175182
=== Supported Operations
176183

0 commit comments

Comments
 (0)