[Freeswitch-svn] [commit] r5034 - in freeswitch/trunk: conf scripts
Author: mikej Date: Sat Apr 28 15:27:17 2007 New Revision: 5034 Added: freeswitch/trunk/scripts/combineconf.pl Modified: freeswitch/trunk/conf/conference.conf.xml freeswitch/trunk/conf/default_context.xml freeswitch/trunk/conf/dingaling.conf.xml freeswitch/trunk/conf/enum.conf.xml freeswitch/trunk/conf/freeswitch.xml freeswitch/trunk/conf/sofia.conf.xml Log: updates, cleanups, and clarifications to the sample conf files. Uses more of the preprocessor variables for simplicity. FSBUILD-2 from Mark D. Anderson. Thanks Mark. Modified: freeswitch/trunk/conf/conference.conf.xml ============================================================================== --- freeswitch/trunk/conf/conference.conf.xml (original) +++ freeswitch/trunk/conf/conference.conf.xml Sat Apr 28 15:27:17 2007 @@ -1,8 +1,8 @@ <!-- None of these paths are real if you want any of these options you need to really set them up --> <configuration name="conference.conf" description="Audio Conference"> - <!-- Advertise certian presence on startup . --> + <!-- Advertise certain presence on startup . --> <advertise> - <room name="888@sub.mydomain.com" status="FreeSWITCH"/> + <room name="888@$${server_name}" status="FreeSWITCH"/> </advertise> <!-- These are the default keys that map when you do not specify a caller control group --> @@ -29,7 +29,7 @@ <!--If no profile is specified it will default to "default"--> <profile name="default"> <!-- Domain (for presence) --> - <param name="domain" value="sub.mydomain.com"/> + <param name="domain" value="$${server_name}"/> <!-- Sample Rate--> <param name="rate" value="8000"/> <!-- Number of milliseconds per frame --> @@ -81,9 +81,9 @@ <!-- Conference pin --> <!--<param name="pin" value="12345"/>--> <!-- Default Caller ID Name for outbound calls --> - <param name="caller-id-name" value="FreeSWITCH"/> + <param name="caller-id-name" value="$${outbound_caller_name}"/> <!-- Default Caller ID Number for outbound calls --> - <param name="caller-id-number" value="8777423583"/> + <param name="caller-id-number" value="$${outbound_caller_id}"/> </profile> </profiles> </configuration> Modified: freeswitch/trunk/conf/default_context.xml ============================================================================== --- freeswitch/trunk/conf/default_context.xml (original) +++ freeswitch/trunk/conf/default_context.xml Sat Apr 28 15:27:17 2007 @@ -29,7 +29,7 @@ <!-- Call the FreeSWITCH conference via SIP --> <!--<extension name="FreeSWITCH Conference SIP">--> <!--<condition field="destination_number" expression="^888$">--> - <!--<action application="bridge" data="sofia/$${domain}/888@conference.freeswitch.org"/>--> + <!--<action application="bridge" data="sofia/$${sip_profile}/888@conference.freeswitch.org"/>--> <!--</condition>--> <!--</extension> --> @@ -53,7 +53,7 @@ <!-- Request a certain tone/file to be played while you wait for the call to be answered--> <action application="set" data="ringback=${us-ring}"/> <!--<action application="set" data="ringback=/home/ring.wav"/>--> - <action application="bridge" data="sofia/$${domain}/1234@conference.freeswitch.org"/> + <action application="bridge" data="sofia/$${sip_profile}/1234@conference.freeswitch.org"/> </condition> </extension> @@ -67,7 +67,7 @@ <!-- Start a dynamic conference and call someone at the same time --> <extension name="2000"> <condition field="destination_number" expression="^2000$"> - <action application="conference" data="bridge:mydynaconf:sofia/$${domain}/1234@conference.freeswitch.org"/> + <action application="conference" data="bridge:mydynaconf:sofia/$${sip_profile}/1234@conference.freeswitch.org"/> </condition> </extension> Modified: freeswitch/trunk/conf/dingaling.conf.xml ============================================================================== --- freeswitch/trunk/conf/dingaling.conf.xml (original) +++ freeswitch/trunk/conf/dingaling.conf.xml Sat Apr 28 15:27:17 2007 @@ -8,12 +8,13 @@ <!-- Client Profile (Original mode) --> <x-profile type="client"> - <param name="name" value="$${domain}"/> + <param name="name" value="$${xmpp_client_profile}"/> <param name="login" value="myjid@myserver.com/talk"/> <param name="password" value="mypass"/> <param name="dialplan" value="XML"/> <param name="message" value="Jingle all the way"/> - <param name="rtp-ip" value="auto"/> + <param name="rtp-ip" value="$${bind_server_ip}"/> + <!-- <param name="ext-rtp-ip" value="$${external_rtp_ip"/> --> <param name="auto-login" value="true"/> <!-- SASL "plain" or "md5" --> <param name="sasl" value="plain"/> @@ -23,9 +24,6 @@ <param name="tls" value="true"/> <!-- disable to trade async for more calls --> <param name="use-rtp-timer" value="true"/> - <!-- or --> - <!-- <param name="rtp-ip" value="auto"/> --> - <!-- <param name="ext-rtp-ip" value="stun:stun.server.com"/> --> <!-- default extension (if one cannot be determined) --> <param name="exten" value="888"/> <!-- VAD choose one --> @@ -37,11 +35,10 @@ <!-- Component (Server to Server Login) --> <x-profile type="component"> - <!-- All traffic for *@sub.mydomain.com will come to you --> - <param name="name" value="$${subdomain}"/> + <param name="name" value="$${xmpp_server_profile}"/> <param name="password" value="secret"/> <param name="dialplan" value="XML"/> - <param name="rtp-ip" value="auto"/> + <param name="rtp-ip" value="$${bind_server_ip}"/> <param name="server" value="jabber.server.org:5347"/> <!-- disable to trade async for more calls --> <param name="use-rtp-timer" value="true"/> Modified: freeswitch/trunk/conf/enum.conf.xml ============================================================================== --- freeswitch/trunk/conf/enum.conf.xml (original) +++ freeswitch/trunk/conf/enum.conf.xml Sat Apr 28 15:27:17 2007 @@ -4,8 +4,8 @@ </settings> <routes> - <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/$${domain}/$1"/> + <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/$${sip_profile}/$1"/> <route service="E2U+IAX2" regex="iax2:(.*)" replace="iax/$1"/> - <route service="E2U+XMPP" regex="XMPP:(.*)" replace="dingaling/$${domain}/$1"/> + <route service="E2U+XMPP" regex="XMPP:(.*)" replace="dingaling/$${xmpp_server_profile}/$1"/> </routes> </configuration> Modified: freeswitch/trunk/conf/freeswitch.xml ============================================================================== --- freeswitch/trunk/conf/freeswitch.xml (original) +++ freeswitch/trunk/conf/freeswitch.xml Sat Apr 28 15:27:17 2007 @@ -13,34 +13,115 @@ Don't modify it while freeswitch is running cos it is mem mapped in most cases =D --> - <!--#set "domain=mydomain.com"--> - <!--#set "subdomain=sub.mydomain.com"--> - <!--#set "default_codecs=PCMU@20i"--> - <!--my domain is $${domain}--> + <!-- Preprocessor Variables + These are introduced when configuration strings must be consistent across modules. + --> + <!-- sip_profile + Must be a domain name if you are being a registry server; otherwise + can be any string. + used by: sofia.conf.xml enum.conf.xml default_context.xml directory.xml + --> + <!--#set "sip_profile=mydomain.com"--> + <!-- xmpp_client_profile and xmpp_server_profile + xmpp_client_profile can be any string. + xmpp_server_profile is appended to "dingaling_" to form the database name + containing the "subscriptions" table. + used by: dingaling.conf.xml enum.conf.xml + --> + <!--#set "xmpp_client_profile=xmppc"--> + <!--#set "xmpp_server_profile=xmpps"--> + <!-- bind_server_ip + Can be an ip address, a dns name, or "auto". + This determines an ip address available on this host to bind. + If you are separating RTP and SIP traffic, you will want to have + use different addresses where this variable appears. + Used by: sofia.conf.xml dingaling.conf.xml + --> + <!--#set "bind_server_ip=auto"--> + <!-- external_rtp_ip + Used as the public IP address for SDP. + Can be an ip address or a string like "stun:stun.server.com" + If unspecified, the bind_server_ip value is used. + Used by: sofia.conf.xml dingaling.conf.xml + --> + <!--#set "external_rtp_ip=stun:stun.server.com"--> + <!-- server_name + A public ip address or DNS name that is used when advertising conference + presence or registering sip. + Used by: conference.conf.xml + --> + <!-- outbound_caller_id and outbound_caller_name + The caller ID telephone number we should use when calling out. + Used by: conference.conf.xml + --> + <!--#set "outbound_caller_name=FreeSWITCH"--> + <!--#set "outbound_caller_id=8777423583"--> + <section name="configuration" description="Various Configuration"> <!--#include "switch.conf.xml"--> <!--#include "modules.conf.xml"--> - <!--#include "spidermonkey.conf.xml"--> + + <!-- Order doesn't matter, but for clarity these are in same order as modules.conf.xml. + If they aren't loaded by modules.conf.xml, then they are ignored. + --> + <!-- Loggers --> + <!--#include "console.conf.xml"--> + <!--#include "syslog.conf.xml"--> + + <!-- Multi-Faceted --> + <!--#include "enum.conf.xml"--> + + <!-- XML Interfaces --> + <!--#include "xml_rpc.conf.xml"--> + <!--#include "xml_curl.conf.xml"--> + <!-- none for mod_xml_cdr --> + + <!-- Event Handlers --> + <!--#include "cdr.conf.xml"--> <!--#include "event_multicast.conf.xml"--> <!--#include "event_socket.conf.xml"--> + <!--#include "xmpp_event.conf.xml"--> + <!--#include "zeroconf.conf.xml"--> + + <!-- Directory Interfaces --> + <!-- none for mod_ldap; dialplan_directory.conf.xml has ldap connection info --> + + <!-- Endpoints --> + <!--#include "dingaling.conf.xml"--> <!--#include "iax.conf.xml"--> - <!--#include "console.conf.xml"--> - <!--#include "sofia.conf.xml"--> - <!--#include "syslog.conf.xml"--> - <!--#include "woomera.conf.xml"--> - <!--#include "wanpipe.conf.xml"--> <!--#include "portaudio.conf.xml"--> <!--#include "alsa.conf.xml"--> - <!--#include "zeroconf.conf.xml"--> - <!--#include "xmpp_event.conf.xml"--> - <!--#include "dialplan_directory.conf.xml"--> - <!--#include "dingaling.conf.xml"--> - <!--#include "xml_curl.conf.xml"--> - <!--#include "xml_rpc.conf.xml"--> - <!--#include "rss.conf.xml"--> + <!--#include "sofia.conf.xml"--> + <!--#include "wanpipe.conf.xml"--> + <!--#include "woomera.conf.xml"--> + + <!-- Applications --> + <!-- none for mod_bridgecall, mod_commands, mod_echo, mod_park, mod_playback --> <!--#include "conference.conf.xml"--> - <!--#include "enum.conf.xml"--> + <!-- ivr.conf is used by mod_dptools --> <!--#include "ivr.conf.xml"--> + + <!-- Dialplan Interfaces --> + <!--#include "dialplan_directory.conf.xml"--> + <!-- mod_dialplan_xml is configured in the separate "dialplan" section. --> + + <!-- Codec Interfaces --> + <!-- no configuration needed --> + <!-- File Format Interfaces --> + <!-- no configuration needed --> + <!-- Timers --> + <!-- no configuration needed --> + + <!-- Languages --> + <!--#include "spidermonkey.conf.xml"--> + <!-- none for mod_perl --> + + <!-- ASR /TTS --> + <!-- none for mod_cepstral --> + <!--#include "rss.conf.xml"--> + + <!-- Say --> + <!-- none for mod_say_en --> <!--#include "mod_cdr.conf.xml"--> </section> @@ -48,6 +129,8 @@ <!--#include "default_context.xml"--> </section> + <!-- mod_dingaling is reliant on the vcard data in the "directory" section. --> + <!-- mod_sofia is reliant on the user data for authorization --> <section name="directory" description="User Directory"> <!--#include "directory.xml"--> </section> @@ -66,3 +149,4 @@ </document> + Modified: freeswitch/trunk/conf/sofia.conf.xml ============================================================================== --- freeswitch/trunk/conf/sofia.conf.xml (original) +++ freeswitch/trunk/conf/sofia.conf.xml Sat Apr 28 15:27:17 2007 @@ -1,6 +1,6 @@ <configuration name="sofia.conf" description="sofia Endpoint"> <profiles> - <profile name="$${domain}"> + <profile name="$${sip_profile}"> <!-- Outbound Registrations --> <gateways> <!--<gateway name="asterlink.com">--> @@ -28,12 +28,12 @@ <param name="sip-port" value="5060"/> <param name="dialplan" value="enum,XML"/> <param name="dtmf-duration" value="100"/> - <param name="codec-prefs" value="$${default_codecs}"/> + <param name="codec-prefs" value="PCMU@20i"/> <param name="codec-ms" value="20"/> <param name="use-rtp-timer" value="true"/> <param name="rtp-timer-name" value="soft"/> - <param name="rtp-ip" value="auto"/> - <param name="sip-ip" value="auto"/> + <param name="rtp-ip" value="$${bind_server_ip}"/> + <param name="sip-ip" value="$${bind_server_ip}"/> <!--If you don't want to pass through timestampes from 1 RTP call to another (on a per call basis with rtp_rewrite_timestamps chanvar)--> <!--<param name="rtp-rewrite-timestampes" value="true"/>--> @@ -60,9 +60,8 @@ <!-- on authed calls, authenticate *all* the packets not just invite --> <!--<param name="auth-all-packets" value="true"/>--> - <!-- optional ; --> - <!-- <param name="ext-rtp-ip" value="stun:stun.server.com"/>--> - <!-- <param name="ext-rtp-ip" value="100.101.102.103"/> --> + <!-- <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>--> + <!-- <param name="ext-sip-ip" value="100.101.102.103"/> --> <!-- VAD choose one (out is a good choice); --> <!-- <param name="vad" value="in"/> --> Added: freeswitch/trunk/scripts/combineconf.pl ============================================================================== --- (empty file) +++ freeswitch/trunk/scripts/combineconf.pl Sat Apr 28 15:27:17 2007 @@ -0,0 +1,49 @@ +#!/usr/bin/perl -w +use strict; + +=head1 NAME + +combineconf.pl - expand #include PIs in a freeswitch conf file + +=head1 SYNOPSIS + + # cd conf + # ../scripts/combineconf.pl freeswitch.xml > freeswitch_combined.xml + +=head1 DESCRIPTION + +This is recursive, and will take multiple input files on the command line. + +You need to run it from the working directory that the relative include paths +except to be resolved from. + +=head1 AUTHOR + +Mark D. Anderson (mda@discerning.com) +Released under same terms as Perl, or alternatively the MPL. + +=cut + +use IO::File; + +sub filter_file { + my ($f) = @_; + my $fh = $f eq '-' ? \*STDIN : IO::File->new($f, 'r'); + die "ERROR: Can't open $f: $!\n" unless $fh; + while(<$fh>) { + if (m/<!--#include\s+"(.*?)"/) { + filter_file($1); + } + else {print;} + } + undef $fh; +} + +sub main { + die "Usage: $0 file1 ...\nCombined output goes to stdout. Use '-' as the filename to use stdin." unless @ARGV; + for(@ARGV) { + filter_file($_); + } +} + +main();
participants (1)
-
Freeswitch SVN