Make presence for conferences work out of the box (#2514)
Use '@' instead of '-' for separating conference name and domain, which is what FreeSWITCH mod_conference uses.
This commit is contained in:
@@ -113,7 +113,7 @@ else {
|
|||||||
$default_language = 'en';
|
$default_language = 'en';
|
||||||
$default_dialect = 'us';
|
$default_dialect = 'us';
|
||||||
$default_voice = 'callie';
|
$default_voice = 'callie';
|
||||||
$switch_cmd = "conference ".$meeting_uuid."-".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
$switch_cmd = "conference ".$meeting_uuid."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||||
//connect to event socket
|
//connect to event socket
|
||||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ else {
|
|||||||
$default_language = 'en';
|
$default_language = 'en';
|
||||||
$default_dialect = 'us';
|
$default_dialect = 'us';
|
||||||
$default_voice = 'callie';
|
$default_voice = 'callie';
|
||||||
$switch_cmd = "conference ".$meeting_uuid."-".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
$switch_cmd = "conference ".$meeting_uuid."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||||
//connect to event socket
|
//connect to event socket
|
||||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
@@ -135,7 +135,7 @@ else {
|
|||||||
//show the conferences that have a matching domain
|
//show the conferences that have a matching domain
|
||||||
$tmp_domain = substr($conference_name, -strlen($_SESSION['domain_name']));
|
$tmp_domain = substr($conference_name, -strlen($_SESSION['domain_name']));
|
||||||
if ($tmp_domain == $_SESSION['domain_name']) {
|
if ($tmp_domain == $_SESSION['domain_name']) {
|
||||||
$meeting_uuid = substr($conference_name, 0, strlen($conference_name) - strlen('-'.$_SESSION['domain_name']));
|
$meeting_uuid = substr($conference_name, 0, strlen($conference_name) - strlen('@'.$_SESSION['domain_name']));
|
||||||
$conference[$meeting_uuid]["conference_name"] = $conference_name;
|
$conference[$meeting_uuid]["conference_name"] = $conference_name;
|
||||||
$conference[$meeting_uuid]["session_uuid"] = $session_uuid;
|
$conference[$meeting_uuid]["session_uuid"] = $session_uuid;
|
||||||
$conference[$meeting_uuid]["member_count"] = $member_count;
|
$conference[$meeting_uuid]["member_count"] = $member_count;
|
||||||
|
|||||||
@@ -211,7 +211,7 @@
|
|||||||
$dialplan_detail_type = 'conference';
|
$dialplan_detail_type = 'conference';
|
||||||
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
|
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
|
||||||
$flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; }
|
$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_data = $conference_name.'@'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags;
|
||||||
$dialplan_detail_order = '020';
|
$dialplan_detail_order = '020';
|
||||||
$dialplan_detail_group = '2';
|
$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_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
|
||||||
@@ -263,7 +263,7 @@
|
|||||||
//update dialplan detail action
|
//update dialplan detail action
|
||||||
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
|
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
|
||||||
$flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; }
|
$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_data = $conference_name.'@'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags;
|
||||||
$sql = "update v_dialplan_details set ";
|
$sql = "update v_dialplan_details set ";
|
||||||
$sql .= "dialplan_detail_data = '".$dialplan_detail_data."' ";
|
$sql .= "dialplan_detail_data = '".$dialplan_detail_data."' ";
|
||||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ else {
|
|||||||
$conference_uuid = check_str($_REQUEST["c"]);
|
$conference_uuid = check_str($_REQUEST["c"]);
|
||||||
|
|
||||||
//replace the space with underscore
|
//replace the space with underscore
|
||||||
$conference_name = $conference_uuid.'-'.$_SESSION['domain_name'];
|
$conference_name = $conference_uuid.'@'.$_SESSION['domain_name'];
|
||||||
|
|
||||||
//create the conference list command
|
//create the conference list command
|
||||||
$switch_cmd = "conference '".$conference_name."' xml_list";
|
$switch_cmd = "conference '".$conference_name."' xml_list";
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ else {
|
|||||||
//show the conferences that have a matching domain
|
//show the conferences that have a matching domain
|
||||||
$tmp_domain = substr($name, -strlen($_SESSION['domain_name']));
|
$tmp_domain = substr($name, -strlen($_SESSION['domain_name']));
|
||||||
if ($tmp_domain == $_SESSION['domain_name']) {
|
if ($tmp_domain == $_SESSION['domain_name']) {
|
||||||
$conference_name = substr($name, 0, strlen($name) - strlen('-'.$_SESSION['domain_name']));
|
$conference_name = substr($name, 0, strlen($name) - strlen('@'.$_SESSION['domain_name']));
|
||||||
if (is_uuid($conference_name)) {
|
if (is_uuid($conference_name)) {
|
||||||
$meeting_uuid = $conference_name;
|
$meeting_uuid = $conference_name;
|
||||||
$sql = "select ";
|
$sql = "select ";
|
||||||
|
|||||||
@@ -287,7 +287,7 @@
|
|||||||
|
|
||||||
--if the conference is empty
|
--if the conference is empty
|
||||||
if (conference_session_uuid) then
|
if (conference_session_uuid) then
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." xml_list";
|
||||||
result = trim(api:executeString(cmd));
|
result = trim(api:executeString(cmd));
|
||||||
if (string.sub(result, -9) == "not found") then
|
if (string.sub(result, -9) == "not found") then
|
||||||
--get the conference start_epoch
|
--get the conference start_epoch
|
||||||
@@ -597,7 +597,7 @@
|
|||||||
else
|
else
|
||||||
if (meeting_uuid) then
|
if (meeting_uuid) then
|
||||||
--check if the conference exists
|
--check if the conference exists
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." xml_list";
|
||||||
result = trim(api:executeString(cmd));
|
result = trim(api:executeString(cmd));
|
||||||
if (string.sub(result, -9) == "not found") then
|
if (string.sub(result, -9) == "not found") then
|
||||||
conference_exists = false;
|
conference_exists = false;
|
||||||
@@ -618,7 +618,7 @@
|
|||||||
--max members must be 2 or more
|
--max members must be 2 or more
|
||||||
session:execute("set","conference_max_members="..max_members);
|
session:execute("set","conference_max_members="..max_members);
|
||||||
if (conference_exists) then
|
if (conference_exists) then
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." get count";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." get count";
|
||||||
count = trim(api:executeString(cmd));
|
count = trim(api:executeString(cmd));
|
||||||
if (count ~= nil) then
|
if (count ~= nil) then
|
||||||
if (tonumber(count) >= tonumber(max_members)) then
|
if (tonumber(count) >= tonumber(max_members)) then
|
||||||
@@ -687,7 +687,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--get the conference xml_list
|
--get the conference xml_list
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." xml_list";
|
||||||
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
|
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
|
||||||
result = trim(api:executeString(cmd));
|
result = trim(api:executeString(cmd));
|
||||||
|
|
||||||
@@ -723,7 +723,7 @@
|
|||||||
--play a message that the conference is being a recorded
|
--play a message that the conference is being a recorded
|
||||||
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav");
|
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav");
|
||||||
--play a message that the conference is being a recorded
|
--play a message that the conference is being a recorded
|
||||||
--cmd = "conference "..meeting_uuid.."-"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav";
|
--cmd = "conference "..meeting_uuid.."@"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav";
|
||||||
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
|
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
|
||||||
--response = api:executeString(cmd);
|
--response = api:executeString(cmd);
|
||||||
end
|
end
|
||||||
@@ -731,24 +731,24 @@
|
|||||||
--announce the caller
|
--announce the caller
|
||||||
if (announce == "true") then
|
if (announce == "true") then
|
||||||
--announce the caller - play the recording
|
--announce the caller - play the recording
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." play " .. temp_dir:gsub("\\", "/") .. "/conference-"..uuid..".wav";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." play " .. temp_dir:gsub("\\", "/") .. "/conference-"..uuid..".wav";
|
||||||
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
|
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
|
||||||
response = api:executeString(cmd);
|
response = api:executeString(cmd);
|
||||||
--play has entered the conference
|
--play has entered the conference
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-has_joined.wav";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-has_joined.wav";
|
||||||
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
|
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
|
||||||
response = api:executeString(cmd);
|
response = api:executeString(cmd);
|
||||||
else
|
else
|
||||||
if (not conference_locked) then
|
if (not conference_locked) then
|
||||||
if (sounds == "true") then
|
if (sounds == "true") then
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." play "..enter_sound;
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." play "..enter_sound;
|
||||||
response = api:executeString(cmd);
|
response = api:executeString(cmd);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--get the conference member count
|
--get the conference member count
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." list count";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." list count";
|
||||||
--freeswitch.consoleLog("notice", "[conference center] cmd: ".. cmd .."\n");
|
--freeswitch.consoleLog("notice", "[conference center] cmd: ".. cmd .."\n");
|
||||||
member_count = api:executeString(cmd);
|
member_count = api:executeString(cmd);
|
||||||
if (string.sub(trim(member_count), -9) == "not found") then
|
if (string.sub(trim(member_count), -9) == "not found") then
|
||||||
@@ -773,7 +773,7 @@
|
|||||||
api:executeString(cmd);
|
api:executeString(cmd);
|
||||||
end
|
end
|
||||||
--send the call to the conference
|
--send the call to the conference
|
||||||
cmd = meeting_uuid.."-"..domain_name.."@"..profile.."+flags{".. flags .."}";
|
cmd = meeting_uuid.."@"..domain_name.."@"..profile.."+flags{".. flags .."}";
|
||||||
freeswitch.consoleLog("INFO","[conference center] conference " .. cmd .. "\n");
|
freeswitch.consoleLog("INFO","[conference center] conference " .. cmd .. "\n");
|
||||||
session:execute("conference", cmd);
|
session:execute("conference", cmd);
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-2
@@ -17,7 +17,7 @@
|
|||||||
api = freeswitch.API();
|
api = freeswitch.API();
|
||||||
|
|
||||||
--check if the conference exists
|
--check if the conference exists
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." xml_list";
|
||||||
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
|
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
|
||||||
result = trim(api:executeString(cmd));
|
result = trim(api:executeString(cmd));
|
||||||
if (string.sub(result, -9) == "not found") then
|
if (string.sub(result, -9) == "not found") then
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
--send a command to record the conference
|
--send a command to record the conference
|
||||||
if (not file_exists(recording..".wav")) then
|
if (not file_exists(recording..".wav")) then
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." record "..recording..".wav";
|
cmd = "conference "..meeting_uuid.."@"..domain_name.." record "..recording..".wav";
|
||||||
freeswitch.consoleLog("notice", "[start-recording] cmd: " .. cmd .. "\n");
|
freeswitch.consoleLog("notice", "[start-recording] cmd: " .. cmd .. "\n");
|
||||||
response = api:executeString(cmd);
|
response = api:executeString(cmd);
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user