Add hold music option and update the call_block dialplan.

This commit is contained in:
markjcrane
2015-10-19 18:30:55 -06:00
parent a66e1a61c3
commit 710a3fa696
4 changed files with 39 additions and 3 deletions

View File

@@ -350,6 +350,31 @@ $text['label-busy']['de-at'] = "Besetzt";
$text['label-busy']['ar-eg'] = "مشغول";
$text['label-busy']['he'] = "תפוס";
$text['label-hold']['en-us'] = "Hold";
$text['label-hold']['es-cl'] = "";
$text['label-hold']['pt-pt'] = "";
$text['label-hold']['fr-fr'] = "";
$text['label-hold']['nl-nl'] = "";
$text['label-hold']['pt-br'] = "";
$text['label-hold']['pl'] = "";
$text['label-hold']['sv-se'] = "";
$text['label-hold']['uk'] = "";
$text['label-hold']['ro'] = "";
$text['label-hold']['de-at'] = "";
$text['label-hold']['ar-eg'] = "";
$text['label-hold']['he'] = "";
$text['label-voicemail']['en-us'] = "Voicemail";
$text['label-voicemail']['es-cl'] = "Correo de Voz";
$text['label-voicemail']['pt-pt'] = "Correio de Voz";
$text['label-voicemail']['fr-fr'] = "Messagerie Vocale";
$text['label-voicemail']['pt-br'] = "Correio de voz";
$text['label-voicemail']['pl'] = "Poczta głosowa";
$text['label-voicemail']['sv-se'] = "Röstbrevlåda";
$text['label-voicemail']['uk'] = "Голосова пошта";
$text['label-voicemail']['de-at'] = "Mailbox";
$text['label-voicemail']['he'] = "תא קולי";
$text['label-add-note']['en-us'] = "Block calls from a number. Either select a number from the list above or enter the number, name and enable below.";
$text['label-add-note']['es-cl'] = "Bloquea llamadas desde un número. Puede elegir un número de la lista de arriba o ingresar el n&uacute, nombre y activarlo abajo.";
$text['label-add-note']['pt-pt'] = "Bloquear chamadas a partir de um número. Seleccione um número a partir da lista indicada ou introduza um número, nome e active.";

View File

@@ -298,6 +298,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
else {
echo " <option value='Busy'>".$text['label-busy']."</option>\n";
}
if ($action == "Hold") {
echo " <option value='Hold' selected='selected'>".$text['label-hold']."</option>\n";
}
else {
echo " <option value='Hold'>".$text['label-hold']."</option>\n";
}
call_block_get_extensions($extension);
echo " </select>\n";
echo "<br />\n";

View File

@@ -1,7 +1,7 @@
<context name="{v_context}">
<extension name="call_block" number="" continue="true" app_uuid="b1b31930-d0ee-4395-a891-04df94599f1f" enabled="false">
<condition>
<action application="lua" data="app.lua call_block"/>
<condition field="${call_blocked}" expression="^true$" >
<anti-action application="lua" data="app.lua call_block"/>
</condition>
</extension>
</context>

View File

@@ -112,6 +112,7 @@ This method causes the script to get its manadatory arguments directly from the
--set the cache
if (found_cid_num) then -- caller id exists
if (found_enabled == "true") then
--set the cache
cache = "found_cid_num=" .. found_cid_num .. "&found_uuid=" .. found_uuid .. "&found_enabled=" .. found_enabled .. "&found_action=" .. found_action .. "&found_count=" .. found_count;
result = trim(api:execute("memcache", "set app:call_block:" .. params["domain_name"] .. ":" .. params["cid_num"] .. " '"..cache.."' "..expire["call_block"]));
@@ -172,7 +173,7 @@ This method causes the script to get its manadatory arguments directly from the
if (source == "database") then
dbh:query("UPDATE v_call_block SET call_block_count = " .. found_count + 1 .. " WHERE call_block_uuid = '" .. found_uuid .. "'")
end
session:setVariable("call_block", "block")
session:execute("set", "call_blocked=true");
logger("W", "NOTICE", "number " .. params["cid_num"] .. " blocked with " .. found_count .. " previous hits, domain_name: " .. params["domain_name"])
if (found_action == "Reject") then
session:hangup("CALL_REJECTED")
@@ -180,6 +181,10 @@ This method causes the script to get its manadatory arguments directly from the
if (found_action == "Busy") then
session:hangup("USER_BUSY")
end
if (details[0] =="Hold") then
session:setAutoHangup(false)
session:execute("transfer", "*9664 XML " .. details[1])
end
if (details[0] =="Voicemail") then
session:setAutoHangup(false)
session:execute("transfer", "*99" .. details[2] .. " XML " .. details[1])