diff --git a/OpenVBX/controllers/twiml.php b/OpenVBX/controllers/twiml.php
index a5d87de1..83949703 100644
--- a/OpenVBX/controllers/twiml.php
+++ b/OpenVBX/controllers/twiml.php
@@ -320,6 +320,7 @@ public function dial()
$rest_access = $this->input->get_post('rest_access');
$to = $this->input->get_post('to');
+ $conference_name = $this->input->get_post('conference_name');
$callerid = $this->input->get_post('callerid');
if(!$this->session->userdata('loggedin')
@@ -360,8 +361,11 @@ public function dial()
{
$this->dial_user_by_client_id($this->input->get_post('to'), $options);
}
- else
+ elseif(strlen($conference_name) > 0)
{
+ $this->join_conference($conference_name, $this->input->get_post('muted'), $this->input->get_post('beep'));
+ }
+ else {
$to = normalize_phone_to_E164($to);
$this->response->dial($to, $options);
}
@@ -391,12 +395,40 @@ protected function dial_user_by_client_id($client_id, $options)
$user = VBX_User::get(array('id' => $user_id));
if ($user instanceof VBX_User)
{
- $dial = $this->response->dial(NULL, $options);
+ $dial = $this->response->dial(null, $options);
$dial->client($user_id);
}
else
{
- $this->reponse->say('Unknown client id: '.$user_id.'. Goodbye.');
+ $this->response->say('Unknown client id: '.$user_id.'. Goodbye.');
+ $this->response->hangup();
+ }
+ }
+
+ /**
+ * Join A Conference Call
+ *
+ * @param string $conference_name
+ * @param string $muted
+ * @param string $beep
+ * @return void
+ */
+ protected function join_conference($conference_name, $muted, $beep)
+ {
+ if (strlen($conference_name) > 2)
+ {
+ $confOptions = array(
+ 'muted' => $muted,
+ 'beep' => $beep,
+ 'startConferenceOnEnter' => 'false'
+ );
+
+ $dial = $this->response->dial(null, null);
+ $dial->conference($conference_name, $confOptions);
+ }
+ else
+ {
+ $this->response->say('Invalid confernce call name. Goodbye.');
$this->response->hangup();
}
}
@@ -436,7 +468,7 @@ protected function dial_user_by_email($user_email, $options) {
if (count($user->devices))
{
$options['sequential'] = 'true';
- $dial = $this->response->dial(NULL, $options);
+ $dial = $this->response->dial(null, $options);
foreach ($user->devices as $device)
{
diff --git a/plugins/standard/applets/conference/twiml.php b/plugins/standard/applets/conference/twiml.php
index b3c6ae76..fac5a113 100644
--- a/plugins/standard/applets/conference/twiml.php
+++ b/plugins/standard/applets/conference/twiml.php
@@ -8,6 +8,7 @@
$isModerator = false;
$defaultWaitUrl = 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient';
$waitUrl = AppletInstance::getValue('wait-url', $defaultWaitUrl);
+$record = AppletInstance::getValue('record','do-not-record');
$hasModerator = false;
@@ -45,6 +46,7 @@
'startConferenceOnEnter' => (!$hasModerator || $isModerator)? 'true' : 'false',
'endConferenceOnExit' => ($hasModerator && $isModerator)? 'true' : 'false',
'waitUrl' => $waitUrl,
+ 'record' => $record,
);
$response = new TwimlResponse();
diff --git a/plugins/standard/applets/conference/ui.php b/plugins/standard/applets/conference/ui.php
index 820e17f5..1e62745d 100644
--- a/plugins/standard/applets/conference/ui.php
+++ b/plugins/standard/applets/conference/ui.php
@@ -15,6 +15,7 @@
array("url" => "http://twimlets.com/holdmusic?Bucket=com.twilio.music.soft-rock",
"name" => "Soft Rock"),
);
+$record = AppletInstance::getValue('record','do-not-record');
?>
Moderator
@@ -33,6 +34,28 @@
+
+ Call Recording
+
diff --git a/plugins/standard/pages/conferences.js b/plugins/standard/pages/conferences.js
new file mode 100644
index 00000000..6f6fbb39
--- /dev/null
+++ b/plugins/standard/pages/conferences.js
@@ -0,0 +1,65 @@
+function joinConference(params) {
+ params = $.extend(params, { 'Digits': 1 });
+ window.parent.Client.call(params)
+}
+
+$(document).ready(function(){
+ jQuery(function($) {
+ $(function(){
+
+ var
+ calls = {},
+ select = $('#calls'),
+ updateCalls = function() {
+ $.getJSON(window.location + '/?json=1', function(data) {
+ $.each(data, function(conference_name, call) {
+ if(!calls[conference_name]) {
+ calls[conference_name] = call;
+
+ row = '';
+ row += '' + call.date_created + ' | ';
+ row += '' + call.friendly_name + ' | ';
+ row += '' + call.status + ' | ';
+ row += 'Join | ';
+ row += 'Listen |
';
+
+ select.append(row);
+ }
+ });
+
+ $.each(calls, function(conference_name, call) {
+ if(!data[conference_name]) {
+ delete calls[conference_name];
+ $('#' + conference_name).fadeOut(250, function() {
+ $(this).remove();
+ });
+ }
+ });
+ });
+ };
+
+ updateCalls();
+ setInterval(updateCalls, 5000);
+ });
+
+ $('#calls').delegate('.join', 'click', function(e) {
+ e.preventDefault();
+
+ joinConference({
+ 'conference_name': $(this).closest('tr').attr('id'),
+ 'muted': 'false',
+ 'beep': 'true'
+ });
+ });
+
+ $('#calls').delegate('.listen', 'click', function(e) {
+ e.preventDefault();
+
+ joinConference({
+ 'conference_name': $(this).closest('tr').attr('id'),
+ 'muted': 'true',
+ 'beep': 'false'
+ });
+ });
+ });
+});
\ No newline at end of file
diff --git a/plugins/standard/pages/conferences.php b/plugins/standard/pages/conferences.php
new file mode 100644
index 00000000..9e82afcf
--- /dev/null
+++ b/plugins/standard/pages/conferences.php
@@ -0,0 +1,43 @@
+conferences->getIterator(0, 50, array('Status' => 'in-progress'));
+
+ $res = array();
+
+ foreach($conferences as $call) {
+ $res[$call->friendly_name] = array(
+ 'date_created' => date("F j, Y, g:i a",strtotime($call->date_created)),
+ 'friendly_name' => $call->friendly_name,
+ 'status' => $call->status,
+ 'duration' => $call->duration
+ );
+ }
+
+ header('Content-type: application/json');
+ echo json_encode($res);
+ exit;
+
+endif;
+
+OpenVBX::addJS('pages/conferences.js');
+
+?>
+
+
+
+
+
+
+ Start Time | Conference Name | Status | Join | Listen |
+
+
+
+
+
+
+
diff --git a/plugins/standard/plugin.json b/plugins/standard/plugin.json
index 25ceb188..2a907c73 100644
--- a/plugins/standard/plugin.json
+++ b/plugins/standard/plugin.json
@@ -1,6 +1,12 @@
{
- "name" : "Standard",
- "author" : "Twilio ",
- "description" : "Standard set of applets for OpenVBX",
- "url" : "http://openvbx.org"
+ "name" : "Standard",
+ "author" : "Twilio ",
+ "description" : "Standard set of applets for OpenVBX",
+ "url" : "http://openvbx.org",
+ "links" : [{
+ "menu" : "Conferences",
+ "url" : "conferences/manager",
+ "script" : "pages/conferences.php",
+ "label" : "Manager"
+ }]
}
\ No newline at end of file