diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 02c51a197a..ce9024e9e0 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -69,6 +69,18 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $destination_uuid = check_str($_POST["destination_uuid"]); } + //check for duplicates + $sql = "select count(*) as num_rows from v_destinations "; + $sql .= "where destination_number = '".$destination_number."' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] > 0) { + $msg .= "Duplicate detected.
\n"; + } + } + //check for all required data //if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID
\n"; } //if (strlen($destination_type) == 0) { $msg .= "Please provide: Name
\n"; } diff --git a/resources/install/scripts/app/dialplan/resources/after/010_user_record.lua b/resources/install/scripts/app/dialplan/resources/after/010_user_record.lua index d78ebf1af7..844f2af268 100644 --- a/resources/install/scripts/app/dialplan/resources/after/010_user_record.lua +++ b/resources/install/scripts/app/dialplan/resources/after/010_user_record.lua @@ -1,5 +1,13 @@ --set the user_exists to true or false if (context ~= "public") then + --set the default + record_ext = "wav"; + + --get record_ext + if (session:getVariable("record_ext")) then + record_ext = session:getVariable("record_ext"); + end + --set the recording path path = recordings_dir if (domain_count > 1) then @@ -69,8 +77,8 @@ --record the session if (record_session) then - cmd = "uuid_record "..uuid.." start "..path.."/"..uuid..".wav"; + cmd = "uuid_record "..uuid.." start "..path.."/"..uuid.."."..record_ext; session:execute("set", "api_on_answer="..cmd); --freeswitch.consoleLog("notice", "[app:dialplan] "..cmd.."\n"); end - end \ No newline at end of file + end