From: Daniel Dickinson Date: Tue, 13 Jul 2010 01:48:08 +0000 (+0000) Subject: [packages]: net/freeswitch: Added UCI config of extensions and incoming DIDs (to... X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=commitdiff_plain;hb=ecddc9f2ec8ae664b9f3cb1f4e5601a00b84a5e6 [packages]: net/freeswitch: Added UCI config of extensions and incoming DIDs (to extensions only) SVN-Revision: 22157 --- diff --git a/net/freeswitch/Makefile b/net/freeswitch/Makefile index b49cd3d887..f71bcfe51c 100644 --- a/net/freeswitch/Makefile +++ b/net/freeswitch/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=freeswitch PKG_VERSION:=1.0.6 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/net/freeswitch/files/etc.uci/dialplan/default.xml b/net/freeswitch/files/etc.uci/dialplan/default.xml deleted file mode 100644 index c366370fc6..0000000000 --- a/net/freeswitch/files/etc.uci/dialplan/default.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/net/freeswitch/files/etc.uci/dialplan/default.xml.template b/net/freeswitch/files/etc.uci/dialplan/default.xml.template new file mode 100644 index 0000000000..d8db98af4b --- /dev/null +++ b/net/freeswitch/files/etc.uci/dialplan/default.xml.template @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/net/freeswitch/files/etc.uci/dialplan/public.xml b/net/freeswitch/files/etc.uci/dialplan/public.xml deleted file mode 100644 index 77cc51f752..0000000000 --- a/net/freeswitch/files/etc.uci/dialplan/public.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/net/freeswitch/files/etc.uci/dialplan/public.xml.template b/net/freeswitch/files/etc.uci/dialplan/public.xml.template new file mode 100644 index 0000000000..9eb968a5c2 --- /dev/null +++ b/net/freeswitch/files/etc.uci/dialplan/public.xml.template @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/net/freeswitch/files/etc.uci/dialplan/public/PLACEHOLDER b/net/freeswitch/files/etc.uci/dialplan/public/PLACEHOLDER deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/net/freeswitch/files/etc.uci/dialplan/public/did.xml.template b/net/freeswitch/files/etc.uci/dialplan/public/did.xml.template new file mode 100644 index 0000000000..0805d51976 --- /dev/null +++ b/net/freeswitch/files/etc.uci/dialplan/public/did.xml.template @@ -0,0 +1,6 @@ + + + + + + diff --git a/net/freeswitch/files/etc.uci/directory/default/1000.xml b/net/freeswitch/files/etc.uci/directory/default/1000.xml deleted file mode 100644 index 9bee406ddf..0000000000 --- a/net/freeswitch/files/etc.uci/directory/default/1000.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/net/freeswitch/files/etc.uci/directory/default/1001.xml b/net/freeswitch/files/etc.uci/directory/default/1001.xml deleted file mode 100644 index 97c1931c51..0000000000 --- a/net/freeswitch/files/etc.uci/directory/default/1001.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/net/freeswitch/files/etc.uci/directory/default/1002.xml b/net/freeswitch/files/etc.uci/directory/default/1002.xml deleted file mode 100644 index d33691d100..0000000000 --- a/net/freeswitch/files/etc.uci/directory/default/1002.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/net/freeswitch/files/etc.uci/directory/default/1003.xml b/net/freeswitch/files/etc.uci/directory/default/1003.xml deleted file mode 100644 index f8b5926c9d..0000000000 --- a/net/freeswitch/files/etc.uci/directory/default/1003.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/net/freeswitch/files/etc.uci/directory/default/1004.xml b/net/freeswitch/files/etc.uci/directory/default/1004.xml deleted file mode 100644 index c3e7da5722..0000000000 --- a/net/freeswitch/files/etc.uci/directory/default/1004.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/net/freeswitch/files/etc.uci/directory/default/extension.xml.template b/net/freeswitch/files/etc.uci/directory/default/extension.xml.template new file mode 100644 index 0000000000..3f0a4dc20a --- /dev/null +++ b/net/freeswitch/files/etc.uci/directory/default/extension.xml.template @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/net/freeswitch/files/uci/extensions.sh b/net/freeswitch/files/uci/extensions.sh new file mode 100644 index 0000000000..553824b395 --- /dev/null +++ b/net/freeswitch/files/uci/extensions.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# Copyright (C) 2010 Vertical Communications +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. + +fs_escape_slash() { + local inval="$1" + [ -z "$inval" ] && return 0 + echo "$inval" | sed -e 's/([/\\$\^\[\]])/\\\1/g' +} + +fs_ext_entry() { + local cfg="$1" + local number + local userid + local password + local vm_password + local toll_allow + local account_code + local effective_callerid_name + local effective_callerid_number + local outbound_callerid_name + local outbound_callerid_number + local did + local callgroup + + config_get number "$cfg" number + [ "$number" = "default" ] && return 1 + config_get userid "$cfg" userid "$number" + config_get password "$cfg" password '$${default_password}' + config_get vm_password "$cfg" vm_password "$number" + config_get toll_allow "$cfg" toll_allow 'domestic,international,local' + config_get account_code "$cfg" account_code "$number" + config_get effective_callerid_name "$cfg" effective_callerid_name "Extension $number" + config_get effective_callerid_number "$cfg" effective_callerid_number "$number" + config_get outbound_callerid_name "$cfg" outbound_callerid_name '$${outbound_caller_name}' + config_get outbound_callerid_number "$cfg" outbound_callerid_number '$${outbound_caller_id}' + config_get did "$cfg" did + config_get callgroup "$cfg" callgroup "everyone" + + sed -e "s/\[{FS_EXTENSION_ID}\]/$(fs_escape_slash $userid)/ + s/\[{FS_EXTENSION_PASSWORD}\]/$(fs_escape_slash $password)/ + s/\[{FS_EXTENSION_VM_PASSWORD}\]/$(fs_escape_slash $vm_password)/ + s/\[{FS_EXTENSION_TOLL_ALLOW}\]/$(fs_escape_slash $toll_allow)/ + s/\[{FS_EXTENSION_ACCOUNT_CODE}\]/$(fs_escape_slash $account_code)/ + s/\[{FS_EXTENSION_EFFECTIVE_CALLERID_NAME}\]/$(fs_escape_slash $effective_callerid_name)/ + s/\[{FS_EXTENSION_EFFECTIVE_CALLERID_NUMBER}\]/$(fs_escape_slash $effective_callerid_number)/ + s/\[{FS_EXTENSION_OUTBOUND_CALLERID_NAME}\]/$(fs_escape_slash $outbound_callerid_name)/ + s/\[{FS_EXTENSION_OUTBOUND_CALLERID_NUMBER}\]/$(fs_escape_slash $outbound_callerid_number)/ + s/\[{FS_EXTENSION_CALLGROUP}\]/$(fs_escape_slash $callgroup)/ + " /etc/freeswitch/directory/default/extension.xml.template >/etc/freeswitch/directory/default/ext-"$number".xml + + [ -n "$did" ] && { + sed -e "s/\[{FS_INCOMING_DID}\]/$did/ + s/\[{FS_EXTENSION_NUMBER}\]/$number/ + " /etc/freeswitch/dialplan/public/did.xml.template >/etc/freeswitch/dialplan/public/20-did-"$did".xml + } + + append ext_number_list "$number" '|' +} + +fs_extensions_all() { + local ext_number_list="" + rm -f /etc/freeswitch/directory/default/ext-*.xml + rm -f /etc/freeswitch/dialplan/public/20-did-*.xml + config_foreach fs_ext_entry "extension" + sed -e "s/\[{FS_DIALPLAN_PHONES}\]/$ext_number_list/" /etc/freeswitch/dialplan/public.xml.template >/etc/freeswitch/dialplan/public.xml + sed -e "s/\[{FS_DIALPLAN_PHONES}\]/$ext_number_list/" /etc/freeswitch/dialplan/default.xml.template >/etc/freeswitch/dialplan/default.xml +} diff --git a/net/freeswitch/files/uci/update_xml.sh b/net/freeswitch/files/uci/update_xml.sh index 67fd1c4fb2..8a202189fd 100644 --- a/net/freeswitch/files/uci/update_xml.sh +++ b/net/freeswitch/files/uci/update_xml.sh @@ -12,4 +12,5 @@ fs_init_xml() { fs_profile_external_top "external_top" "/etc/freeswitch/sip_profiles/external.xml" fs_profile_gateway "external_example" "/etc/freeswitch/sip_profiles/external/example.xml" fs_profile_gateway "internal_example" "/etc/freeswitch/sip_profiles/internal/example.xml" + fs_extensions_all }