disable registration for number-alias

This commit is contained in:
Mark Crane 2014-10-21 10:01:30 +00:00
parent 1c63e46608
commit 5535c57a96
1 changed files with 17 additions and 6 deletions

View File

@ -34,16 +34,17 @@
--get the action --get the action
action = params:getHeader("action"); action = params:getHeader("action");
purpose = params:getHeader("purpose"); purpose = params:getHeader("purpose");
--sip_auth - registration --sip_auth - registration
--group_call - call group has been called --group_call - call group has been called
--user_call - user has been called --user_call - user has been called
--additional information --additional information
--event_calling_function = params:getHeader("Event-Calling-Function"); --event_calling_function = params:getHeader("Event-Calling-Function");
--set the variables as a string to prevent nil errors --set the variables as a string
number_alias = ""; number_alias = "";
number_alias_string = ""; number_alias_string = "";
vm_mailto = "";
--determine the correction action to perform --determine the correction action to perform
if (purpose == "gateways") then if (purpose == "gateways") then
@ -380,6 +381,9 @@
table.insert(xml, [[ <variable name="domain_uuid" value="]] .. domain_uuid .. [["/>]]); table.insert(xml, [[ <variable name="domain_uuid" value="]] .. domain_uuid .. [["/>]]);
table.insert(xml, [[ <variable name="domain_name" value="]] .. domain_name .. [["/>]]); table.insert(xml, [[ <variable name="domain_name" value="]] .. domain_name .. [["/>]]);
table.insert(xml, [[ <variable name="extension_uuid" value="]] .. extension_uuid .. [["/>]]); table.insert(xml, [[ <variable name="extension_uuid" value="]] .. extension_uuid .. [["/>]]);
if (string.len(number_alias) > 0) then
table.insert(xml, [[ <variable name="number-alias" value="]] .. number_alias .. [["/>]]);
end
--table.insert(xml, [[ <variable name="call_timeout" value="]] .. call_timeout .. [["/>]]); --table.insert(xml, [[ <variable name="call_timeout" value="]] .. call_timeout .. [["/>]]);
table.insert(xml, [[ <variable name="caller_id_name" value="]] .. sip_from_user .. [["/>]]); table.insert(xml, [[ <variable name="caller_id_name" value="]] .. sip_from_user .. [["/>]]);
table.insert(xml, [[ <variable name="caller_id_number" value="]] .. sip_from_user .. [["/>]]); table.insert(xml, [[ <variable name="caller_id_number" value="]] .. sip_from_user .. [["/>]]);
@ -487,6 +491,13 @@
end end
end end
--disable registration for number-alias
if (params:getHeader("type") ~= "attr") then
if (api:execute("user_data", user .. "@" .. domain_name .." attr id") ~= user) then
XML_STRING = nil;
end
end
--get the XML string from the cache --get the XML string from the cache
if (source == "cache") then if (source == "cache") then
--replace the &#39 back to a single quote --replace the &#39 back to a single quote
@ -517,4 +528,4 @@
--send the xml to the console --send the xml to the console
if (debug["xml_string"]) then if (debug["xml_string"]) then
freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: \n" .. XML_STRING .. "\n"); freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: \n" .. XML_STRING .. "\n");
end end