From b2bfc8a3f6a826c1c0b2bd10213c11439df11aad Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 27 Mar 2013 08:14:22 +0100 Subject: voicemail account configuration directory --- misc/freeswitch/scripts/configuration.lua | 75 ++++++++++++++----------------- 1 file changed, 34 insertions(+), 41 deletions(-) (limited to 'misc/freeswitch/scripts/configuration.lua') 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); -- cgit v1.2.3 From 4fccfd605fc705f8785568fc393be1207b51ecc5 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 11 Apr 2013 09:33:28 +0200 Subject: defaults added --- misc/freeswitch/scripts/configuration.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/configuration.lua') diff --git a/misc/freeswitch/scripts/configuration.lua b/misc/freeswitch/scripts/configuration.lua index c17f8a4..b23f76a 100644 --- a/misc/freeswitch/scripts/configuration.lua +++ b/misc/freeswitch/scripts/configuration.lua @@ -289,8 +289,9 @@ function conf_event_socket(database) require 'configuration.simple_xml' local xml = configuration.simple_xml.SimpleXml:new(); + local settings = { password = 'ClueCon', ['listen-ip'] = '127.0.0.1', ['listen-port'] = '80212' }; require 'common.configuration_table'; - local settings = common.configuration_table.get(database, 'event_socket', 'settings'); + settings = common.configuration_table.get(database, 'event_socket', 'settings', settings) or settings; XML_STRING = xml:element{ 'document', -- cgit v1.2.3 From 8d4ad7908c78357845b82ad9fb298cf1f9612093 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 11 Apr 2013 10:57:29 +0200 Subject: port fixed --- misc/freeswitch/scripts/configuration.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'misc/freeswitch/scripts/configuration.lua') diff --git a/misc/freeswitch/scripts/configuration.lua b/misc/freeswitch/scripts/configuration.lua index b23f76a..16dbed7 100644 --- a/misc/freeswitch/scripts/configuration.lua +++ b/misc/freeswitch/scripts/configuration.lua @@ -289,9 +289,9 @@ function conf_event_socket(database) require 'configuration.simple_xml' local xml = configuration.simple_xml.SimpleXml:new(); - local settings = { password = 'ClueCon', ['listen-ip'] = '127.0.0.1', ['listen-port'] = '80212' }; + local settings = { password = 'ClueCon', ['listen-ip'] = '127.0.0.1', ['listen-port'] = '8021' }; require 'common.configuration_table'; - settings = common.configuration_table.get(database, 'event_socket', 'settings', settings) or settings; + settings = common.configuration_table.get(database, 'event_socket', 'settings', {settings = settings}); XML_STRING = xml:element{ 'document', -- cgit v1.2.3 From 313eef1e54b0858ab50a81e7929761744a262c0c Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 7 Jun 2013 10:17:41 +0200 Subject: pager config generator added --- misc/freeswitch/scripts/configuration.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'misc/freeswitch/scripts/configuration.lua') diff --git a/misc/freeswitch/scripts/configuration.lua b/misc/freeswitch/scripts/configuration.lua index 16dbed7..2486565 100644 --- a/misc/freeswitch/scripts/configuration.lua +++ b/misc/freeswitch/scripts/configuration.lua @@ -194,8 +194,8 @@ function conf_conference(database) local conf_name = params:getHeader('conf_name'); local profile_name = params:getHeader('profile_name'); - if conf_name then - require 'common.conference' + if conf_name:find('^conference%d+') then + require 'common.conference'; conference = common.conference.Conference:new{log=log, database=database}:find_by_id(common.str.to_i(conf_name)); if conference then log:debug('CONFIG_CONFERENCE ', conf_name, ' name: ', conference.record.name, ', profile: ', profile_name); @@ -211,6 +211,27 @@ function conf_conference(database) else log:error('CONFIG_CONFERENCE ', conf_name, ' - conference not found'); end + elseif conf_name:find('^pager%d+') then + local parameters = { + ['moh-sound'] = '', + ['caller-controls'] = "speaker", + ['moderator-controls'] = "moderator", + ['comfort-noise'] = false, + } + + require 'common.pager'; + pager = common.pager.Pager:new{log=log, database=database}:find_by_id(common.str.to_i(conf_name)); + if pager then + log:debug('CONFIG_PAGER ', conf_name, ', profile: ', profile_name); + profiles = xml:element{ + 'profiles', + xml:element{ + 'profile', + name = profile_name, + xml:from_hash('param', parameters, 'name', 'value'), + }, + }; + end else log:notice('CONFIG_CONFERENCE - no conference name'); end -- cgit v1.2.3