diff --git a/app/conferences/app_config.php b/app/conferences/app_config.php index 0adabb693b..7ada0fd7df 100644 --- a/app/conferences/app_config.php +++ b/app/conferences/app_config.php @@ -76,6 +76,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the conference extension number.'; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_session_enabled'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enable or disable conference sessions.'; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_pin_number'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Optional pin number to secure access to the conference.'; @@ -98,7 +102,7 @@ $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_enabled'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Select whether to enable or disable the conference.'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enable or disable the conference.'; $y = 1; //table array index $z = 0; //field array index diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index c16996b554..b4c61ea6c5 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_edit.php @@ -50,6 +50,7 @@ else { $conference_extension = check_str($_POST["conference_extension"]); $conference_pin_number = check_str($_POST["conference_pin_number"]); $conference_profile = check_str($_POST["conference_profile"]); + $conference_session_enabled = check_str($_POST["conference_session_enabled"]); $conference_flags = check_str($_POST["conference_flags"]); $conference_order = check_str($_POST["conference_order"]); $conference_description = check_str($_POST["conference_description"]); @@ -121,6 +122,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($conference_extension) == 0) { $msg .= "Please provide: Extension
\n"; } //if (strlen($conference_pin_number) == 0) { $msg .= "Please provide: Pin Number
\n"; } if (strlen($conference_profile) == 0) { $msg .= "Please provide: Profile
\n"; } + if (strlen($conference_session_enabled) == 0) { $msg .= "Please provide: Sessions
\n"; } //if (strlen($conference_flags) == 0) { $msg .= "Please provide: Flags
\n"; } //if (strlen($conference_order) == 0) { $msg .= "Please provide: Order
\n"; } //if (strlen($conference_description) == 0) { $msg .= "Please provide: Description
\n"; } @@ -154,6 +156,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "conference_extension, "; $sql .= "conference_pin_number, "; $sql .= "conference_profile, "; + $sql .= "conference_session_enabled, "; $sql .= "conference_flags, "; $sql .= "conference_order, "; $sql .= "conference_description, "; @@ -168,6 +171,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'$conference_extension', "; $sql .= "'$conference_pin_number', "; $sql .= "'$conference_profile', "; + $sql .= "'$conference_session_enabled', "; $sql .= "'$conference_flags', "; $sql .= "'$conference_order', "; $sql .= "'$conference_description', "; @@ -193,23 +197,27 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $dialplan_detail_group = '2'; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - // - $dialplan_detail_tag = 'action'; //condition, action, antiaction - $dialplan_detail_type = 'answer'; - $dialplan_detail_data = ''; - $dialplan_detail_order = '010'; - $dialplan_detail_group = '2'; - dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); + if ($conference_session_enabled == "true") { + // + $dialplan_detail_tag = 'action'; //condition, action, antiaction + $dialplan_detail_type = 'lua'; + $dialplan_detail_data = 'conference.lua'; + $dialplan_detail_order = '020'; + $dialplan_detail_group = '2'; + dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); + } + else { + // + $dialplan_detail_tag = 'action'; //condition, action, antiaction + $dialplan_detail_type = 'conference'; + $pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; } + $flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; } + $dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags; + $dialplan_detail_order = '020'; + $dialplan_detail_group = '2'; + dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - // - $dialplan_detail_tag = 'action'; //condition, action, antiaction - $dialplan_detail_type = 'conference'; - $pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; } - $flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; } - $dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags; - $dialplan_detail_order = '020'; - $dialplan_detail_group = '2'; - dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); + } //save the xml save_dialplan_xml(); @@ -234,6 +242,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "conference_extension = '$conference_extension', "; $sql .= "conference_pin_number = '$conference_pin_number', "; $sql .= "conference_profile = '$conference_profile', "; + $sql .= "conference_session_enabled = '$conference_session_enabled', "; $sql .= "conference_flags = '$conference_flags', "; $sql .= "conference_order = '$conference_order', "; $sql .= "conference_description = '$conference_description', "; @@ -258,7 +267,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); //update dialplan detail condition - $sql = ""; $sql = "update v_dialplan_details set "; $sql .= "dialplan_detail_data = '^".$conference_extension."$' "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; @@ -269,14 +277,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); //update dialplan detail action - $pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; } - $flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; } - $dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags; + if ($conference_session_enabled == "true") { + $dialplan_detail_type = 'lua'; + $dialplan_detail_data = 'conference.lua'; + } + else { + $dialplan_detail_type = 'conference'; + $pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; } + $flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; } + $dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags; + } $sql = "update v_dialplan_details set "; + $sql .= "dialplan_detail_type = '".$dialplan_detail_type."', "; $sql .= "dialplan_detail_data = '".$dialplan_detail_data."' "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and dialplan_detail_tag = 'action' "; - $sql .= "and dialplan_detail_type = 'conference' "; + $sql .= "and (dialplan_detail_type = 'conference' or dialplan_detail_type = 'lua') "; $sql .= "and dialplan_uuid = '$dialplan_uuid' "; $db->query($sql); @@ -313,6 +329,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $conference_extension = $row["conference_extension"]; $conference_pin_number = $row["conference_pin_number"]; $conference_profile = $row["conference_profile"]; + $conference_session_enabled = $row["conference_session_enabled"]; $conference_flags = $row["conference_flags"]; $conference_order = $row["conference_order"]; $conference_description = $row["conference_description"]; @@ -322,6 +339,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset ($prep_statement); } +//set defaults + if (strlen($conference_enabled) == 0) { $conference_enabled = "true"; } + if (strlen($conference_session_enabled) == 0) { $conference_session_enabled = "false"; } + //show the header require_once "includes/header.php"; @@ -336,18 +357,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; echo "\n"; echo "\n"; - if ($action == "add") { - echo "\n"; - } - if ($action == "update") { - echo "\n"; - } + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -452,6 +468,31 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "
Conference AddConference EditConference
\n"; echo "Conferences is used to setup conference rooms with a name, description, and optional pin number. \n"; - echo "Click on Active Conference \n"; + echo "Click on Active Conference \n"; echo "to monitor and interact with the conference room.

\n"; echo "
\n"; + echo " Sessions:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "Select whether to enable or disable the conference sessions.\n"; + echo "
\n"; echo " Flags:\n"; diff --git a/app/conferences_active/v_conference_interactive.php b/app/conferences_active/v_conference_interactive.php index 273e548d79..14346fc345 100644 --- a/app/conferences_active/v_conference_interactive.php +++ b/app/conferences_active/v_conference_interactive.php @@ -110,7 +110,7 @@ echo "
"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
Interactive Conference
\n"; -echo " Use this to monitor and interact with the members of the $conference_display_name conference.\n"; +echo " Use this to monitor and interact with the members of the conference.\n"; echo "
\n"; diff --git a/app/meetings/app_config.php b/app/meetings/app_config.php new file mode 100644 index 0000000000..b4dec2f422 --- /dev/null +++ b/app/meetings/app_config.php @@ -0,0 +1,134 @@ + \ No newline at end of file diff --git a/includes/install/scripts/conference.lua b/includes/install/scripts/conference.lua new file mode 100644 index 0000000000..bbdbdf3582 --- /dev/null +++ b/includes/install/scripts/conference.lua @@ -0,0 +1,169 @@ +-- conference.lua +-- Part of FusionPBX +-- Copyright (C) 2012 Mark J Crane +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- 1. Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- 2. Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. + +--set variables + flags = ""; + max_tries = 3; + digit_timeout = 5000; + +--include the lua script + scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1)); + include = assert(loadfile(scripts_dir .. "/resources/config.lua")); + include(); + +--connect to the database + --ODBC - data source name + if (dsn_name) then + dbh = freeswitch.Dbh(dsn_name,dsn_username,dsn_password); + end + --FreeSWITCH core db handler + if (db_type == "sqlite") then + dbh = freeswitch.Dbh("core:"..db_path.."/"..db_name); + end + +--make sure the session is ready +if ( session:ready() ) then + session:answer( ); + sounds_dir = session:getVariable("sounds_dir"); + domain_name = session:getVariable("domain_name"); + pin_number = session:getVariable("pin_number"); + + --get the domain_uuid + if (domain_name ~= nil) then + sql = "SELECT domain_uuid FROM v_domains "; + sql = sql .. "WHERE domain_name = '" .. domain_name .."' "; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[conference] SQL: " .. sql .. "\n"); + end + status = dbh:query(sql, function(rows) + domain_uuid = rows["domain_uuid"]; + end); + end + + --set the sounds path for the language, dialect and voice + default_language = session:getVariable("default_language"); + default_dialect = session:getVariable("default_dialect"); + default_voice = session:getVariable("default_voice"); + if (not default_language) then default_language = 'en'; end + if (not default_dialect) then default_dialect = 'us'; end + if (not default_voice) then default_voice = 'callie'; end + + --get the variables + domain_name = session:getVariable("domain_name"); + --meeting_uuid = session:getVariable("meeting_uuid"); + caller_id_name = session:getVariable("caller_id_name"); + caller_id_number = session:getVariable("caller_id_number"); + + --if the pin number is provided then require it + if (not pin_number) then + min_digits = 3; + max_digits = 12; + pin_number = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); + end + --get the conference sessions + sql = [[SELECT * FROM v_conference_sessions as s, v_meeting_pins as p + WHERE s.domain_uuid = ']] .. domain_uuid ..[[' + AND s.meeting_uuid = p.meeting_uuid + AND p.member_pin = ']] .. pin_number ..[[' + AND enabled = 'true' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[conference] SQL: " .. sql .. "\n"); + end + status = dbh:query(sql, function(row) + conference_session_uuid = row["conference_session_uuid"]; + conference_uuid = row["conference_uuid"]; + meeting_uuid = row["meeting_uuid"]; + max_members = row["max_members"]; + wait_mod = row["wait_mod"]; + member_type = row["member_type"]; + announce = row["announce"]; + enter_sound = row["enter_sound"]; + mute = row["mute"]; + created = row["created"]; + created_by = row["created_by"]; + enabled = row["enabled"]; + description = row["description"]; + end); + + if (conference_uuid ~= nil) then + --set a conference parameter + --conference set + + if (max_members ~= nil) then + --max members must be 2 or more + session:execute("set","conference_max_members="..max_members); + end + if (mute == "true") then + flags = flags .. "mute"; + end + if (enter_sound ~= nil) then + session:execute("set","conference_enter_sound="..enter_sound); + end + if (exit_sound ~= nil) then + session:execute("set","conference_exit_sound="..exit_sound); + end + + --working + --get number of peoople in the conference + --conference Conference-Center-voip.fusionpbx.com get count + --get number of seconds since the conference started + --conference Conference-Center-voip.fusionpbx.com get run_time + --get max members in a conference + --conference Conference-Center-voip.fusionpbx.com get max_members + --conference Conference-Center-voip.fusionpbx.com set max_members 3 + --sound + --session:execute("set","conference_enter_sound="..enter_sound); + --session:execute("set","conference_exit_sound="..exit_sound); + --used when the first member joins the conference + --session:execute("set","conference_max_members="..max_members); + --if (wait_mod == "true") then + --flags = flags .. "|wait_mod"; --not working + --session:execute("conference","Conference-Center-voip.fusionpbx.com(set conference-flags=wait-mod)"); --not working + --end + if (member_type == "moderator") then + --set as the moderator + flags = flags .. "|moderator"; + --when the moderator leaves end the conference + flags = flags .. "|endconf"; + --set the moderator controls + session:execute("set","conference_controls=moderator"); + end + + --send the call to the conference + --session:execute("conference","confname@profilename+[conference pin number]+flags{moderator}"); + cmd = meeting_uuid.."-"..domain_name.."@default+flags{".. flags .."}"; + freeswitch.consoleLog("notice", "[conference] ".. cmd .."\n"); + session:execute("conference",cmd); + --alternative + --uuid_transfer conference:3000@default inline + + --freeswitch.consoleLog("notice", "[conference] line: 147\n"); + else + session:streamFile("phrase:voicemail_fail_auth:#"); + session:hangup("NORMAL_CLEARING"); + end + +end \ No newline at end of file diff --git a/includes/templates/conf/autoload_configs/conference.conf.xml b/includes/templates/conf/autoload_configs/conference.conf.xml index a33be22d05..165827a482 100644 --- a/includes/templates/conf/autoload_configs/conference.conf.xml +++ b/includes/templates/conf/autoload_configs/conference.conf.xml @@ -10,7 +10,21 @@ - + + + + + + + + + + + + + + + @@ -32,10 +46,10 @@ - - + + @@ -43,7 +57,8 @@ - + + - + - + @@ -126,7 +141,8 @@ - + + @@ -151,7 +167,8 @@ - + + @@ -176,7 +193,8 @@ - + +