summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-12 09:41:55 +0100
committerspag <spag@golwen.net>2013-02-12 09:41:55 +0100
commit0ece4561627130eceb83deef4e5c2df00ec1664e (patch)
treef4e62ff18ac251bd813499ba54ecff818bb03a4e /misc/freeswitch/scripts/dialplan
parent8e55bf891a0520ba241585d8295ccc37ed57b09e (diff)
support for registrations to non default profiles
Diffstat (limited to 'misc/freeswitch/scripts/dialplan')
-rw-r--r--misc/freeswitch/scripts/dialplan/sip_call.lua36
1 files changed, 21 insertions, 15 deletions
diff --git a/misc/freeswitch/scripts/dialplan/sip_call.lua b/misc/freeswitch/scripts/dialplan/sip_call.lua
index 61d4f76..b56f1b2 100644
--- a/misc/freeswitch/scripts/dialplan/sip_call.lua
+++ b/misc/freeswitch/scripts/dialplan/sip_call.lua
@@ -116,23 +116,29 @@ function SipCall.fork(self, destinations, arg )
elseif destination.type == 'sipaccount' then
local callee_id_params = '';
local sip_account = sip_account_class:find_by_id(destination.id);
- local call_waiting = self:call_waiting_busy(sip_account);
- if not call_waiting then
- destinations[index].numbers = sip_account:phone_numbers();
+ if not sip_account then
+ self.log:notice('FORK - sip_account not found - sip_account=', destination.id);
+ elseif common.str.blank(sip_account.record.profile_name) or common.str.blank(sip_account.record.sip_host) then
+ call_result = { code = 480, phrase = 'User offline', disposition = 'USER_NOT_REGISTERED' };
+ else
+ local call_waiting = self:call_waiting_busy(sip_account);
+ if not call_waiting then
+ destinations[index].numbers = sip_account:phone_numbers();
- if not arg.callee_id_name then
- table.insert(origination_variables, "effective_callee_id_name='" .. sip_account.record.caller_name .. "'");
- end
- if not arg.callee_id_number then
- table.insert(origination_variables, "effective_callee_id_number='" .. destination.number .. "'");
- end
- if destination.alert_info then
- table.insert(origination_variables, "alert_info='" .. destination.alert_info .. "'");
+ if not arg.callee_id_name then
+ table.insert(origination_variables, "effective_callee_id_name='" .. sip_account.record.caller_name .. "'");
+ end
+ if not arg.callee_id_number then
+ table.insert(origination_variables, "effective_callee_id_number='" .. destination.number .. "'");
+ end
+ if destination.alert_info then
+ table.insert(origination_variables, "alert_info='" .. destination.alert_info .. "'");
+ end
+ table.insert(dial_strings, '[' .. table.concat(origination_variables , ',') .. ']sofia/' .. sip_account.record.profile_name .. '/' .. sip_account.record.auth_name .. '%' .. sip_account.record.sip_host);
+ else
+ some_destinations_busy = true;
+ call_result = { code = 486, phrase = 'User busy', disposition = 'USER_BUSY' };
end
- table.insert(dial_strings, '[' .. table.concat(origination_variables , ',') .. ']user/' .. sip_account.record.auth_name);
- else
- some_destinations_busy = true;
- call_result = { code = 486, phrase = 'User busy', disposition = 'USER_BUSY' };
end
elseif destination.type == 'gateway' then
require 'common.gateway'