[packages]: net/freeswitch: Added UCI config of extensions and incoming DIDs (to...
authorDaniel Dickinson <crazycshore@gmail.com>
Tue, 13 Jul 2010 01:48:08 +0000 (01:48 +0000)
committerDaniel Dickinson <crazycshore@gmail.com>
Tue, 13 Jul 2010 01:48:08 +0000 (01:48 +0000)
SVN-Revision: 22157

15 files changed:
net/freeswitch/Makefile
net/freeswitch/files/etc.uci/dialplan/default.xml [deleted file]
net/freeswitch/files/etc.uci/dialplan/default.xml.template [new file with mode: 0644]
net/freeswitch/files/etc.uci/dialplan/public.xml [deleted file]
net/freeswitch/files/etc.uci/dialplan/public.xml.template [new file with mode: 0644]
net/freeswitch/files/etc.uci/dialplan/public/PLACEHOLDER [deleted file]
net/freeswitch/files/etc.uci/dialplan/public/did.xml.template [new file with mode: 0644]
net/freeswitch/files/etc.uci/directory/default/1000.xml [deleted file]
net/freeswitch/files/etc.uci/directory/default/1001.xml [deleted file]
net/freeswitch/files/etc.uci/directory/default/1002.xml [deleted file]
net/freeswitch/files/etc.uci/directory/default/1003.xml [deleted file]
net/freeswitch/files/etc.uci/directory/default/1004.xml [deleted file]
net/freeswitch/files/etc.uci/directory/default/extension.xml.template [new file with mode: 0644]
net/freeswitch/files/uci/extensions.sh [new file with mode: 0644]
net/freeswitch/files/uci/update_xml.sh

index b49cd3d887e436ffffbf588d33a3d212e74fdd70..f71bcfe51c7189f00c171956c6b57e4aefaf2b56 100644 (file)
@@ -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 (file)
index c366370..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-    NOTICE:
-    
-    This context is usually accessed via authenticated callers on the sip profile on port 5060 
-    or transfered callers from the public context which arrived via the sip profile on port 5080.
-    
-    Authenticated users will use the user_context variable on the user to determine what context
-    they can access.  You can also add a user in the directory with the cidr= attribute acl.conf.xml
-    will build the domains ACL using this value.
--->
-<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
-<include>
-  <context name="default">
-
-    <extension name="unloop">
-      <condition field="${unroll_loops}" expression="^true$"/>
-      <condition field="${sip_looped_call}" expression="^true$">
-       <action application="deflect" data="${destination_number}"/>
-      </condition>
-    </extension>
-
-    <extension name="redial">
-      <condition field="destination_number" expression="^870$">
-       <action application="transfer" data="${hash(select/${domain_name}-last_dial/${caller_id_number})}"/>
-      </condition>
-    </extension>
-
-    <extension name="global" continue="true">
-      <condition field="${call_debug}" expression="^true$" break="never">
-       <action application="info"/>
-      </condition>
-      <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never">
-       <action application="set" data="sip_secure_media=true"/>
-       <!-- Offer SRTP on outbound legs if we have it on inbound. -->
-       <!-- <action application="export" data="sip_secure_media=true"/> -->
-      </condition>
-    </extension>
-
-    <!-- If sip_req_host is not a local domain then this has to be an external sip uri -->
-    <!--
-    <extension name="external_sip_uri" continue="true">
-      <condition field="source" expression="mod_sofia"/>
-      <condition field="${outside_call}" expression="^$"/>
-      <condition field="${domain_exists(${sip_req_host})}" expression="true">
-       <anti-action application="bridge" data="sofia/${use_profile}/${sip_to_uri}"/>
-      </condition>
-    </extension>
-    -->
-
-    <extension name="call_return">
-      <condition field="destination_number" expression="^\*69$|^869$|^lcr$">
-       <action application="transfer" data="${hash(select/${domain_name}-call_return/${caller_id_number})}"/>
-      </condition>
-    </extension>
-
-    <extension name="extension-intercom">
-      <condition field="destination_number" expression="^8(100[0-4])$">
-       <action application="set" data="dialed_extension=$1"/>
-       <action application="export" data="sip_auto_answer=true"/>
-       <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
-      </condition>
-    </extension>
-
-    <!-- 
-        dial the extension (1000-1004) for 2 minutes before giving up 
-        otherwise hang up after a successful bridge (hangup_after-bridge=true).
-        Record call if *2 is pressed during call.
-    -->
-    <extension name="Local_Extension">
-      <condition field="destination_number" expression="^(100[0-4])$">
-       <action application="set" data="dialed_extension=$1"/>
-       <action application="export" data="dialed_extension=$1"/>
-       <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
-       <!-- <action application="bind_meta_app" data="1 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/> -->
-       <action application="set" data="ringback=${us-ring}"/>
-       <!-- <action application="set" data="transfer_ringback=$${hold_music}"/> -->
-       <action application="set" data="call_timeout=240"/>
-       <!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
-       <action application="set" data="hangup_after_bridge=true"/>
-       <!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
-       <action application="set" data="continue_on_fail=false"/>
-       <!--<action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>-->
-       <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
-       <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
-      </condition>
-    </extension>
-
-    <extension name="show_info">
-      <condition field="destination_number" expression="^9992$">
-       <action application="answer"/>
-       <action application="info"/>
-       <action application="sleep" data="250"/>
-       <action application="hangup"/>
-      </condition>
-    </extension>
-
-    <extension name="delay_echo">
-      <condition field="destination_number" expression="^9995$">
-       <action application="answer"/>
-       <action application="delay_echo" data="5000"/>
-      </condition>
-    </extension>
-
-    <extension name="echo">
-      <condition field="destination_number" expression="^9996$">
-       <action application="answer"/>
-       <action application="echo"/>
-      </condition>
-    </extension>
-
-    <extension name="milliwatt">
-      <condition field="destination_number" expression="^9997$">
-       <action application="answer"/>
-       <action application="playback" data="tone_stream://%(251,0,1004);loops=-1"/>
-      </condition>
-    </extension>
-
-    <extension name="tone_stream">
-      <condition field="destination_number" expression="^9998$">
-       <action application="answer"/>
-       <action application="playback" data="tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10"/>
-      </condition>
-    </extension>
-
-    <extension name="fur_elise">
-      <condition field="destination_number" expression="^9991$">
-       <action application="answer"/>
-       <action application="playback" data="tone_stream://path=${base_dir}/conf/fur_elise.ttml;loops=10"/>
-      </condition>
-    </extension>
-    
-    <extension name="dial_through_gateway">
-      <!-- Dial any 10 digit or 1+10 number -->
-      <condition field="destination_number" expression="^(1{0,1}\d{10})$">
-        <action application="bridge" data="sofia/gateway/example.com/$1" />
-      </condition>
-    </extension>
-
-    <!--
-       You can place files in the default directory to get included.
-    -->
-    <X-PRE-PROCESS cmd="include" data="default/*.xml"/>
-    
-    <!--
-       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-       
-       Anything you put below this line will may get ignored due to the files in 
-       default/*.xml
-
-       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-    -->
-
-  </context>
-</include>
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 (file)
index 0000000..d8db98a
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    NOTICE:
+    
+    This context is usually accessed via authenticated callers on the sip profile on port 5060 
+    or transfered callers from the public context which arrived via the sip profile on port 5080.
+    
+    Authenticated users will use the user_context variable on the user to determine what context
+    they can access.  You can also add a user in the directory with the cidr= attribute acl.conf.xml
+    will build the domains ACL using this value.
+-->
+<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
+<include>
+  <context name="default">
+
+    <extension name="unloop">
+      <condition field="${unroll_loops}" expression="^true$"/>
+      <condition field="${sip_looped_call}" expression="^true$">
+       <action application="deflect" data="${destination_number}"/>
+      </condition>
+    </extension>
+
+    <extension name="global" continue="true">
+      <condition field="${call_debug}" expression="^true$" break="never">
+       <action application="info"/>
+      </condition>
+      <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never">
+       <action application="set" data="sip_secure_media=true"/>
+       <!-- Offer SRTP on outbound legs if we have it on inbound. -->
+       <!-- <action application="export" data="sip_secure_media=true"/> -->
+      </condition>
+    </extension>
+
+    <!-- If sip_req_host is not a local domain then this has to be an external sip uri -->
+    <!--
+    <extension name="external_sip_uri" continue="true">
+      <condition field="source" expression="mod_sofia"/>
+      <condition field="${outside_call}" expression="^$"/>
+      <condition field="${domain_exists(${sip_req_host})}" expression="true">
+       <anti-action application="bridge" data="sofia/${use_profile}/${sip_to_uri}"/>
+      </condition>
+    </extension>
+    -->
+
+    <extension name="extension-intercom">
+      <condition field="destination_number" expression="^8([{FS_DIALPLAN_PHONES}])$">
+       <action application="set" data="dialed_extension=$1"/>
+       <action application="export" data="sip_auto_answer=true"/>
+       <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
+      </condition>
+    </extension>
+
+    <!-- 
+        dial the extension (filled in from UCI config) 2 minutes before giving
+        up, otherwise hang up after a successful bridge (hangup_after-bridge=true).
+        Record call if *2 is pressed during call (by called extension).
+    -->
+    <extension name="Local_Extension">
+      <condition field="destination_number" expression="^([{FS_DIALPLAN_PHONES}])$">
+       <action application="set" data="dialed_extension=$1"/>
+       <action application="export" data="dialed_extension=$1"/>
+       <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
+       <!-- <action application="bind_meta_app" data="1 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/> -->
+       <action application="set" data="ringback=${us-ring}"/>
+       <!-- <action application="set" data="transfer_ringback=$${hold_music}"/> -->
+       <action application="set" data="call_timeout=240"/>
+       <!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
+       <action application="set" data="hangup_after_bridge=true"/>
+       <!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
+       <action application="set" data="continue_on_fail=false"/>
+       <!--<action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>-->
+       <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
+       <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
+      </condition>
+    </extension>
+
+    <extension name="show_info">
+      <condition field="destination_number" expression="^9992$">
+       <action application="answer"/>
+       <action application="info"/>
+       <action application="sleep" data="250"/>
+       <action application="hangup"/>
+      </condition>
+    </extension>
+
+    <extension name="delay_echo">
+      <condition field="destination_number" expression="^9995$">
+       <action application="answer"/>
+       <action application="delay_echo" data="5000"/>
+      </condition>
+    </extension>
+
+    <extension name="echo">
+      <condition field="destination_number" expression="^9996$">
+       <action application="answer"/>
+       <action application="echo"/>
+      </condition>
+    </extension>
+
+    <extension name="milliwatt">
+      <condition field="destination_number" expression="^9997$">
+       <action application="answer"/>
+       <action application="playback" data="tone_stream://%(251,0,1004);loops=-1"/>
+      </condition>
+    </extension>
+
+    <extension name="tone_stream">
+      <condition field="destination_number" expression="^9998$">
+       <action application="answer"/>
+       <action application="playback" data="tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10"/>
+      </condition>
+    </extension>
+
+    <extension name="fur_elise">
+      <condition field="destination_number" expression="^9991$">
+       <action application="answer"/>
+       <action application="playback" data="tone_stream://path=${base_dir}/conf/fur_elise.ttml;loops=10"/>
+      </condition>
+    </extension>
+    
+    <extension name="dial_through_gateway">
+      <!-- Dial any 10 digit or 1+10 number -->
+      <condition field="destination_number" expression="^(1{0,1}\d{10})$">
+        <action application="bridge" data="sofia/gateway/example.com/$1" />
+      </condition>
+    </extension>
+
+    <!--
+       You can place files in the default directory to get included.
+    -->
+    <X-PRE-PROCESS cmd="include" data="default/*.xml"/>
+    
+    <!--
+       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+       
+       Anything you put below this line will may get ignored due to the files in 
+       default/*.xml
+
+       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+    -->
+
+  </context>
+</include>
diff --git a/net/freeswitch/files/etc.uci/dialplan/public.xml b/net/freeswitch/files/etc.uci/dialplan/public.xml
deleted file mode 100644 (file)
index 77cc51f..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<!--
-    NOTICE:
-
-    This context is usually accessed via the external sip profile listening on port 5080.
-    
-    It is recommended to have separate inbound and outbound contexts.  Not only for security
-    but clearing up why you would need to do such a thing.  You don't want outside un-authenticated
-    callers hitting your default context which allows dialing calls thru your providers and results 
-    in Toll Fraud.
--->
-
-<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
-<include>
-  <context name="public">
-
-    <extension name="unloop">
-      <condition field="${unroll_loops}" expression="^true$"/>
-      <condition field="${sip_looped_call}" expression="^true$">
-       <action application="deflect" data="${destination_number}"/>
-      </condition>
-    </extension>
-    <!--
-       Tag anything pass thru here as an outside_call so you can make sure not
-       to create any routing loops based on the conditions that it came from 
-       the outside of the switch.  
-    -->
-    <extension name="outside_call" continue="true">
-      <condition>
-       <action application="set" data="outside_call=true"/>
-      </condition>
-    </extension>
-
-    <extension name="call_debug" continue="true">
-      <condition field="${call_debug}" expression="^true$" break="never">
-       <action application="info"/>
-      </condition>
-    </extension>
-
-    <extension name="public_extensions">
-      <condition field="destination_number" expression="^(100[0-4])$">
-       <action application="transfer" data="$1 XML default"/>
-      </condition>
-    </extension>
-    
-    <!--
-       You can place files in the public directory to get included.
-    -->
-    <X-PRE-PROCESS cmd="include" data="public/*.xml"/>
-  </context>
-</include>
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 (file)
index 0000000..9eb968a
--- /dev/null
@@ -0,0 +1,50 @@
+<!--
+    NOTICE:
+
+    This context is usually accessed via the external sip profile listening on port 5080.
+    
+    It is recommended to have separate inbound and outbound contexts.  Not only for security
+    but clearing up why you would need to do such a thing.  You don't want outside un-authenticated
+    callers hitting your default context which allows dialing calls thru your providers and results 
+    in Toll Fraud.
+-->
+
+<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
+<include>
+  <context name="public">
+
+    <extension name="unloop">
+      <condition field="${unroll_loops}" expression="^true$"/>
+      <condition field="${sip_looped_call}" expression="^true$">
+       <action application="deflect" data="${destination_number}"/>
+      </condition>
+    </extension>
+    <!--
+       Tag anything pass thru here as an outside_call so you can make sure not
+       to create any routing loops based on the conditions that it came from 
+       the outside of the switch.  
+    -->
+    <extension name="outside_call" continue="true">
+      <condition>
+       <action application="set" data="outside_call=true"/>
+      </condition>
+    </extension>
+
+    <extension name="call_debug" continue="true">
+      <condition field="${call_debug}" expression="^true$" break="never">
+       <action application="info"/>
+      </condition>
+    </extension>
+
+    <extension name="public_extensions">
+      <condition field="destination_number" expression="^([{FS_DIALPLAN_PHONES}])$">
+       <action application="transfer" data="$1 XML default"/>
+      </condition>
+    </extension>
+    
+    <!--
+       You can place files in the public directory to get included.
+    -->
+    <X-PRE-PROCESS cmd="include" data="public/*.xml"/>
+  </context>
+</include>
diff --git a/net/freeswitch/files/etc.uci/dialplan/public/PLACEHOLDER b/net/freeswitch/files/etc.uci/dialplan/public/PLACEHOLDER
deleted file mode 100644 (file)
index e69de29..0000000
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 (file)
index 0000000..0805d51
--- /dev/null
@@ -0,0 +1,6 @@
+<extension name="did-[{FS_INCOMING_DID}]">
+   <condition field="destination_number" expression="[{FS_INCOMING_DID}]">
+     <action application="transfer" data="[{FS_EXTENSION_NUMBER}] XML default"/>
+   </condition>
+</extension>
+
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 (file)
index 9bee406..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<include>
-  <user id="1000">
-    <params>
-      <param name="password" value="$${default_password}"/>
-      <param name="vm-password" value="1000"/>
-    </params>
-    <variables>
-      <variable name="toll_allow" value="domestic,international,local"/>
-      <variable name="accountcode" value="1000"/>
-      <variable name="user_context" value="default"/>
-      <variable name="effective_caller_id_name" value="Extension 1000"/>
-      <variable name="effective_caller_id_number" value="1000"/>
-      <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
-      <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
-      <variable name="callgroup" value="techsupport"/>
-    </variables>
-  </user>
-</include>
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 (file)
index 97c1931..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<include>
-  <user id="1001">
-    <params>
-      <param name="password" value="$${default_password}"/>
-      <param name="vm-password" value="1001"/>
-    </params>
-    <variables>
-      <variable name="toll_allow" value="domestic,international,local"/>
-      <variable name="accountcode" value="1001"/>
-      <variable name="user_context" value="default"/>
-      <variable name="effective_caller_id_name" value="Extension 1001"/>
-      <variable name="effective_caller_id_number" value="1001"/>
-      <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
-      <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
-      <variable name="callgroup" value="techsupport"/>
-    </variables>
-  </user>
-</include>
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 (file)
index d33691d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<include>
-  <user id="1002">
-    <params>
-      <param name="password" value="$${default_password}"/>
-      <param name="vm-password" value="1002"/>
-    </params>
-    <variables>
-      <variable name="toll_allow" value="domestic,international,local"/>
-      <variable name="accountcode" value="1002"/>
-      <variable name="user_context" value="default"/>
-      <variable name="effective_caller_id_name" value="Extension 1002"/>
-      <variable name="effective_caller_id_number" value="1002"/>
-      <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
-      <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
-      <variable name="callgroup" value="techsupport"/>
-    </variables>
-  </user>
-</include>
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 (file)
index f8b5926..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<include>
-  <user id="1003">
-    <params>
-      <param name="password" value="$${default_password}"/>
-      <param name="vm-password" value="1003"/>
-    </params>
-    <variables>
-      <variable name="toll_allow" value="domestic,international,local"/>
-      <variable name="accountcode" value="1003"/>
-      <variable name="user_context" value="default"/>
-      <variable name="effective_caller_id_name" value="Extension 1003"/>
-      <variable name="effective_caller_id_number" value="1003"/>
-      <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
-      <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
-      <variable name="callgroup" value="techsupport"/>
-    </variables>
-  </user>
-</include>
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 (file)
index c3e7da5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<include>
-  <user id="1004">
-    <params>
-      <param name="password" value="$${default_password}"/>
-      <param name="vm-password" value="1004"/>
-    </params>
-    <variables>
-      <variable name="toll_allow" value="domestic,international,local"/>
-      <variable name="accountcode" value="1004"/>
-      <variable name="user_context" value="default"/>
-      <variable name="effective_caller_id_name" value="Extension 1004"/>
-      <variable name="effective_caller_id_number" value="1004"/>
-      <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
-      <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
-      <variable name="callgroup" value="techsupport"/>
-    </variables>
-  </user>
-</include>
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 (file)
index 0000000..3f0a4dc
--- /dev/null
@@ -0,0 +1,18 @@
+<include>
+  <user id="[{FS_EXTENSION_ID}]">
+    <params>
+      <param name="password" value="[{FS_EXTENSION_PASSWORD}]"/>
+      <param name="vm-password" value="[{FS_EXTENSION_VM_PASSWORD}]"/>
+    </params>
+    <variables>
+      <variable name="toll_allow" value="[{FS_EXTENSION_TOLL_ALLOW}]"/>
+      <variable name="accountcode" value="[{FS_EXTENSION_ACCOUNT_CODE}]"/>
+      <variable name="user_context" value="default"/>
+      <variable name="effective_caller_id_name" value="[{FS_EXTENSION_EFFECTIVE_CALLERID_NAME}]"/>
+      <variable name="effective_caller_id_number" value="[{FS_EXTENSION_EFFECTIVE_CALLERID_NUMBER}]"/>
+      <variable name="outbound_caller_id_name" value="[{FS_EXTENSION_OUTBOUND_CALLERID_NAME}]"/>
+      <variable name="outbound_caller_id_number" value="[{FS_EXTENSION_OUTBOUND_CALLERID_NUMBER}]"/>
+      <variable name="callgroup" value="[{FS_EXTENSION_CALLGROUP}]"/>
+    </variables>
+  </user>
+</include>
diff --git a/net/freeswitch/files/uci/extensions.sh b/net/freeswitch/files/uci/extensions.sh
new file mode 100644 (file)
index 0000000..553824b
--- /dev/null
@@ -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
+}
index 67fd1c4fb2dda94b84ea289d4dfebed3a819719d..8a202189fd3faf373f23e483a009bc5d399554a6 100644 (file)
@@ -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
 }