summaryrefslogtreecommitdiff
path: root/misc/freeswitch
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-27 08:14:22 +0100
committerPeter Kozak <spag@golwen.net>2013-03-27 08:14:22 +0100
commitb2bfc8a3f6a826c1c0b2bd10213c11439df11aad (patch)
treed93ed6b17bd2c146ada8e74dda7423fa876c0381 /misc/freeswitch
parent41b306402d020aff3615308cdd555b0a05221343 (diff)
voicemail account configuration directory
Diffstat (limited to 'misc/freeswitch')
-rw-r--r--misc/freeswitch/scripts/configuration.lua75
1 files changed, 34 insertions, 41 deletions
diff --git a/misc/freeswitch/scripts/configuration.lua b/misc/freeswitch/scripts/configuration.lua
index 88ef452..c17f8a4 100644
--- a/misc/freeswitch/scripts/configuration.lua
+++ b/misc/freeswitch/scripts/configuration.lua
@@ -412,7 +412,27 @@ function directory_sip_account(database)
local user_xml = nil;
- if not common.str.blank(auth_name) then
+ if tostring(purpose) == 'publish-vm' and not common.str.blank(auth_name) then
+ require 'dialplan.voicemail';
+ local voicemail_account = dialplan.voicemail.Voicemail:new{ log = log, database = database }:find_by_name(auth_name);
+ if voicemail_account then
+ log:debug('DIRECTORY_VOICEMAIL_ACCOUNT - ', voicemail_account.class, '=',voicemail_account.id, '/', voicemail_account.uuid, '|', voicemail_account.name);
+ user_xml = xml:element{
+ 'groups',
+ xml:element{
+ 'group',
+ name = 'default',
+ xml:element{
+ 'users',
+ xml:element{
+ 'user',
+ id = voicemail_account.record.name,
+ },
+ },
+ },
+ };
+ end
+ elseif not common.str.blank(auth_name) then
require 'common.sip_account'
local sip_account = common.sip_account.SipAccount:new{ log = log, database = database}:find_by_auth_name(auth_name);
@@ -435,46 +455,19 @@ function directory_sip_account(database)
gs_account_owner_id = sip_account.record.sip_accountable_id
}
- if tostring(purpose) == 'publish-vm' then
- log:debug('DIRECTORY_SIP_ACCOUNT - purpose: VoiceMail, auth_name: ', sip_account.record.auth_name, ', caller_name: ', sip_account.record.caller_name, ', domain: ', domain);
- user_xml = xml:element{
- 'groups',
- xml:element{
- 'group',
- name = 'default',
- xml:element{
- 'users',
- xml:element{
- 'user',
- id = sip_account.record.auth_name,
- xml:element{
- 'params',
- xml:from_hash('param', user_parameters, 'name', 'value'),
- },
- xml:element{
- 'variables',
- xml:from_hash('variable', user_variables, 'name', 'value'),
- },
- },
- },
- },
- };
- else
- log:debug('DIRECTORY_SIP_ACCOUNT - auth_name: ', sip_account.record.auth_name, ', caller_name: ', sip_account.record.caller_name, ', domain: ', domain);
-
- user_xml = xml:element{
- 'user',
- id = sip_account.record.auth_name,
- xml:element{
- 'params',
- xml:from_hash('param', user_parameters, 'name', 'value'),
- },
- xml:element{
- 'variables',
- xml:from_hash('variable', user_variables, 'name', 'value'),
- },
- };
- end
+ log:debug('DIRECTORY_SIP_ACCOUNT - auth_name: ', sip_account.record.auth_name, ', caller_name: ', sip_account.record.caller_name, ', domain: ', domain);
+ user_xml = xml:element{
+ 'user',
+ id = sip_account.record.auth_name,
+ xml:element{
+ 'params',
+ xml:from_hash('param', user_parameters, 'name', 'value'),
+ },
+ xml:element{
+ 'variables',
+ xml:from_hash('variable', user_variables, 'name', 'value'),
+ },
+ };
else
require 'common.gateway'
local sip_gateway = common.gateway.Gateway:new{ log = log, database = database }:find_by_auth_name(auth_name);