freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
January 2007
- 9 participants
- 183 discussions
23 Jan '07
Author: mikej
Date: Mon Jan 22 20:40:14 2007
New Revision: 4027
Modified:
freeswitch/trunk/Makefile.am
freeswitch/trunk/Makefile.in
freeswitch/trunk/src/switch_xml.c
Log:
tweak var types in xml config, change makefile to install all the new broken out xml files.
Modified: freeswitch/trunk/Makefile.am
==============================================================================
--- freeswitch/trunk/Makefile.am (original)
+++ freeswitch/trunk/Makefile.am Mon Jan 22 20:40:14 2007
@@ -199,7 +199,7 @@
install_mod: modules
@echo Installing $(NAME)
@mkdir -p $(PREFIX) $(PREFIX)/conf $(PREFIX)/mod $(PREFIX)/db $(PREFIX)/log $(PREFIX)/bin $(PREFIX)/scripts $(PREFIX)/htdocs $(PREFIX)/grammar
- @if [ ! -f $(PREFIX)/conf/freeswitch.xml ] ; then /bin/cp -p conf/freeswitch.xml $(PREFIX)/conf/; fi
+ @if [ ! -f $(PREFIX)/conf/freeswitch.xml ] ; then /bin/cp -p conf/*.xml $(PREFIX)/conf/; fi
@if [ -f .libs/$(NAME) ] ; then /bin/cp -p .libs/$(NAME) $(PREFIX)/bin ; else /bin/cp -p ./$(NAME) $(PREFIX)/bin ; fi
@echo Installing Modules
@rm -f build/freeswitch.env
Modified: freeswitch/trunk/Makefile.in
==============================================================================
--- freeswitch/trunk/Makefile.in (original)
+++ freeswitch/trunk/Makefile.in Mon Jan 22 20:40:14 2007
@@ -1137,7 +1137,7 @@
install_mod: modules
@echo Installing $(NAME)
@mkdir -p $(PREFIX) $(PREFIX)/conf $(PREFIX)/mod $(PREFIX)/db $(PREFIX)/log $(PREFIX)/bin $(PREFIX)/scripts $(PREFIX)/htdocs $(PREFIX)/grammar
- @if [ ! -f $(PREFIX)/conf/freeswitch.xml ] ; then /bin/cp -p conf/freeswitch.xml $(PREFIX)/conf/; fi
+ @if [ ! -f $(PREFIX)/conf/freeswitch.xml ] ; then /bin/cp -p conf/*.xml $(PREFIX)/conf/; fi
@if [ -f .libs/$(NAME) ] ; then /bin/cp -p .libs/$(NAME) $(PREFIX)/bin ; else /bin/cp -p ./$(NAME) $(PREFIX)/bin ; fi
@echo Installing Modules
@rm -f build/freeswitch.env
Modified: freeswitch/trunk/src/switch_xml.c
==============================================================================
--- freeswitch/trunk/src/switch_xml.c (original)
+++ freeswitch/trunk/src/switch_xml.c Mon Jan 22 20:40:14 2007
@@ -886,11 +886,11 @@
}
if ((cmd = strstr(bp, "<!--#"))) {
- write(new_fd, bp, cmd - bp);
+ write(new_fd, bp, (unsigned)(cmd - bp));
if ((e = strstr(cmd, "-->"))) {
*e = '\0';
e += 3;
- write(new_fd, e, strlen(e));
+ write(new_fd, e, (unsigned)strlen(e));
} else {
ml++;
}
@@ -947,7 +947,7 @@
continue;
}
- write(new_fd, bp, cur);
+ write(new_fd, bp, (unsigned)cur);
}
close(old_fd);
1
0
23 Jan '07
Author: anthm
Date: Mon Jan 22 20:12:47 2007
New Revision: 4026
Added:
freeswitch/trunk/conf/conference.conf.xml
freeswitch/trunk/conf/console.conf.xml
freeswitch/trunk/conf/default_context.xml
freeswitch/trunk/conf/dialplan_directory.conf.xml
freeswitch/trunk/conf/dingaling.conf.xml
freeswitch/trunk/conf/directory.xml
freeswitch/trunk/conf/enum.conf.xml
freeswitch/trunk/conf/event_multicast.conf.xml
freeswitch/trunk/conf/event_socket.conf.xml
freeswitch/trunk/conf/iax.conf.xml
freeswitch/trunk/conf/ivr.conf.xml
freeswitch/trunk/conf/lang_en.xml
freeswitch/trunk/conf/lang_fr.xml
freeswitch/trunk/conf/modules.conf.xml
freeswitch/trunk/conf/portaudio.conf.xml
freeswitch/trunk/conf/rss.conf.xml
freeswitch/trunk/conf/sofia.conf.xml
freeswitch/trunk/conf/spidermonkey.conf.xml
freeswitch/trunk/conf/switch.conf.xml
freeswitch/trunk/conf/syslog.conf.xml
freeswitch/trunk/conf/wanpipe.conf.xml
freeswitch/trunk/conf/woomera.conf.xml
freeswitch/trunk/conf/xml_curl.conf.xml
freeswitch/trunk/conf/xml_rpc.conf.xml
freeswitch/trunk/conf/xmpp_event.conf.xml
freeswitch/trunk/conf/zeroconf.conf.xml
Modified:
freeswitch/trunk/conf/freeswitch.xml
freeswitch/trunk/src/switch_xml.c
Log:
xml preprocessor (calling all documentors and default config composers!!)
Added: freeswitch/trunk/conf/conference.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/conference.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,84 @@
+<!-- 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>
+ <room name="888(a)sub.mydomain.com" status="FreeSWITCH"/>
+ </advertise>
+
+ <!-- These are the default keys that map when you do not specify a caller control group -->
+ <!-- Note: none and default are reserved names for group names -->
+ <caller-controls>
+ <group name="default">
+ <control action="mute" digits="0"/>
+ <control action="deaf mute" digits="*"/>
+ <control action="energy up" digits="9"/>
+ <control action="energy equ" digits="8"/>
+ <control action="energy dn" digits="7"/>
+ <control action="vol talk up" digits="3"/>
+ <control action="vol talk zero" digits="2"/>
+ <control action="vol talk dn" digits="1"/>
+ <control action="vol listen up" digits="6"/>
+ <control action="vol listen zero" digits="5"/>
+ <control action="vol listen dn" digits="4"/>
+ <control action="hangup" digits="#"/>
+ </group>
+ </caller-controls>
+
+ <!-- Profiles are collections of settings you can reference by name. -->
+ <profiles>
+ <!--If no profile is specified it will default to "default"-->
+ <profile name="default">
+ <!-- Domain (for presence) -->
+ <param name="domain" value="sub.mydomain.com"/>
+ <!-- Sample Rate-->
+ <param name="rate" value="8000"/>
+ <!-- Number of milliseconds per frame -->
+ <param name="interval" value="20"/>
+ <!-- Energy level required for audio to be sent to the other users -->
+ <param name="energy-level" value="300"/>
+ <!-- Name of the caller control group to use for this profile -->
+ <!-- <param name="caller-controls" value="some name"/> -->
+ <!-- TTS Engine to use -->
+ <!--<param name="tts-engine" value="cepstral"/>-->
+ <!-- TTS Voice to use -->
+ <!--<param name="tts-voice" value="david"/>-->
+
+ <!-- If TTS is enabled all audio-file params beginning with -->
+ <!-- 'say:' will be considered text to say with TTS -->
+ <!-- Set a default path here so you can use relative paths in the other sound params-->
+ <!--<param name="sound-prefix" value="/soundfiles"/>-->
+ <!-- File to play to acknowledge succees -->
+ <!--<param name="ack-sound" value="beep.wav"/>-->
+ <!-- File to play to acknowledge failure -->
+ <!--<param name="nack-sound" value="beeperr.wav"/>-->
+ <!-- File to play to acknowledge muted -->
+ <!--<param name="muted-sound" value="muted.wav"/>-->
+ <!-- File to play to acknowledge unmuted -->
+ <!--<param name="unmuted-sound" value="unmuted.wav"/>-->
+ <!-- File to play if you are alone in the conference -->
+ <!--<param name="alone-sound" value="yactopitc.wav"/>-->
+ <!-- File to play when you join the conference -->
+ <!--<param name="enter-sound" value="welcome.wav"/>-->
+ <!-- File to play when you leave the conference -->
+ <!--<param name="exit-sound" value="exit.wav"/>-->
+ <!-- File to play when you ae ejected from the conference -->
+ <!--<param name="kicked-sound" value="kicked.wav"/>-->
+ <!-- File to play when the conference is locked -->
+ <!--<param name="locked-sound" value="locked.wav"/>-->
+ <!-- File to play when the conference is locked during the call-->
+ <!--<param name="is-locked-sound" value="is-locked.wav"/>-->
+ <!-- File to play when the conference is unlocked during the call-->
+ <!--<param name="is-unlocked-sound" value="is-unlocked.wav"/>-->
+ <!-- File to play to prompt for a pin -->
+ <!--<param name="pin-sound" value="pin.wav"/>-->
+ <!-- File to play to when the pin is invalid -->
+ <!--<param name="bad-pin-sound" value="invalid-pin.wav"/>-->
+ <!-- Conference pin -->
+ <!--<param name="pin" value="12345"/>-->
+ <!-- Default Caller ID Name for outbound calls -->
+ <param name="caller-id-name" value="FreeSWITCH"/>
+ <!-- Default Caller ID Number for outbound calls -->
+ <param name="caller-id-number" value="8777423583"/>
+ </profile>
+ </profiles>
+</configuration>
Added: freeswitch/trunk/conf/console.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/console.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,8 @@
+<configuration name="console.conf" description="Console Logger">
+ <!-- pick a file name, a function name or 'all' -->
+ <!-- map as many as you need for specific debugging -->
+ <mappings>
+ <!-- <param name="log_event" value="DEBUG"/> -->
+ <param name="all" value="DEBUG"/>
+ </mappings>
+</configuration>
Added: freeswitch/trunk/conf/default_context.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/default_context.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,105 @@
+<!-- Valid fields in conditions: -->
+<!-- "dialplan, caller_id_name, ani, ani2, caller_id_number, -->
+<!-- rdnis, destination_number, uuid, source, context, chan_name" -->
+
+<!-- *NOTE* The special context name 'any' will match any context -->
+<context name="default">
+ <extension name="556"> <!-- demo phrases -->
+ <condition field="destination_number" expression="^556$">
+ <action application="answer"/>
+ <action application="sleep" data="1000"/>
+ <action application="phrase" data="spell,${caller_id_name}"/>
+ <action application="phrase" data="spell-phonetic,${caller_id_name}"/>
+ <action application="phrase" data="timespec,12:45:15"/>
+ <action application="phrase" data="saydate,0"/>
+ <action application="phrase" data="msgcount,130"/>
+ <action application="phrase" data="ip-addr,66.250.68.194"/>
+ <action application="phrase" data="saydate,$strepoch(2006-03-23 7:23)"/>
+ <!--<action application="phrase" data="timeleft,3:30"/>-->
+ </condition>
+ </extension>
+
+ <extension name="tollfree">
+ <condition field="destination_number" expression="^(18(0{2}|8{2}|7{2}|6{2})\d{7})$">
+ <action application="enum" data="$1"/>
+ <action application="bridge" data="${enum_auto_route}"/>
+ </condition>
+ </extension>
+
+ <!-- Call the FreeSWITCH conference via SIP -->
+ <!--<extension name="FreeSWITCH Conference SIP">-->
+ <!--<condition field="destination_number" expression="^888$">-->
+ <!--<action application="bridge" data="sofia/test/888(a)conference.freeswitch.org"/>-->
+ <!--</condition>-->
+ <!--</extension> -->
+
+ <!-- Call the FreeSWITCH conference via IAX -->
+ <!--<extension name="FreeSWITCH Conference IAX">-->
+ <!--<condition field="destination_number" expression="^8888$">-->
+ <!--<action application="bridge" data="iax/guest(a)conference.freeswitch.org/888"/>-->
+ <!--</condition>-->
+ <!--</extension>-->
+
+ <extension name="testmusic">
+ <condition field="destination_number" expression="^1234$">
+ <!-- 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/test/1234(a)conference.freeswitch.org"/>
+ </condition>
+ </extension>
+
+ <!-- Enter an existing conference -->
+ <extension name="1000">
+ <condition field="destination_number" expression="^1000$">
+ <action application="conference" data="freeswitch"/>
+ </condition>
+ </extension>
+
+ <!-- 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/test/1234@conference.freeswitch.org"/>
+ </condition>
+ </extension>
+
+ <!-- extensions starting with 4, all the numbers after 4 form a numeric filename -->
+ <!-- continue="true" means keep looking for more extensions to match -->
+ <!-- *NOTE* The entire dialplan is parsed ONCE when the call starts -->
+ <!-- so any call info acquired after the various actions cannot -->
+ <!-- be taken into consideration. -->
+
+ <!-- The first match will play a beep and the second one plays -->
+ <!-- the desired file. This is for demo purposes both actions -->
+ <!-- could have been under the same <extension> tag as well. -->
+ <extension name="playsound1" continue="true">
+ <condition field="source" expression="mod_sofia"/>
+ <condition field="destination_number" expression="^4(\d+)">
+ <action application="playback" data="/var/sounds/beep.gsm"/>
+ </condition>
+ </extension>
+
+ <extension name="playsound2">
+ <condition field="source" expression="mod_sofia"/>
+ <condition field="destination_number" expression="^4(\d+)">
+ <action application="playback" data="/root/$1.raw"/>
+ </condition>
+ </extension>
+
+ <!-- send everything with a certian RDNIS to Wanpipe ISDN -->
+ <extension name="To PRI">
+ <condition field="rdnis" expression="8881231234"/>
+ <condition field="destination_number" expression="(.*)">
+ <action application="bridge" data="wanpipe/a/a/$1"/>
+ </condition>
+ </extension>
+
+ <!-- Call *MUST* originate from mod_iax and also be dialing ext 9999-->
+ <extension name="9999">
+ <condition field="source" expression="mod_iax"/>
+ <condition field="destination_number" expression="9999">
+ <action application="playback" data="/var/sounds/beep.gsm"/>
+ </condition>
+ </extension>
+
+</context>
Added: freeswitch/trunk/conf/dialplan_directory.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/dialplan_directory.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,9 @@
+<configuration name="dialplan_directory.conf" description="Dialplan Directory">
+ <settings>
+ <param name="directory-name" value="ldap"/>
+ <param name="host" value="ldap.freeswitch.org"/>
+ <param name="dn" value="cn=Manager,dc=freeswitch,dc=org"/>
+ <param name="pass" value="test"/>
+ <param name="base" value="dc=freeswitch,dc=org"/>
+ </settings>
+</configuration>
Added: freeswitch/trunk/conf/dingaling.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/dingaling.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,53 @@
+<configuration name="dingaling.conf" description="XMPP Jingle Endpoint">
+ <settings>
+ <param name="debug" value="0"/>
+ <param name="codec-prefs" value="PCMU"/>
+ </settings>
+
+ <!-- *NOTE* change <x-profile></x-profile> to <profile></profile> to enable -->
+
+ <!-- Client Profile (Original mode) -->
+ <x-profile type="client">
+ <param name="name" value="$${domain}"/>
+ <param name="login" value="myjid(a)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="auto-login" value="true"/>
+ <param name="auto-reply" value="Press *Call* to call FreeSWITCH and be sure to come to ClueCon! http://www.cluecon.com"/>
+ <!-- SASL "plain" or "md5" -->
+ <param name="sasl" value="plain"/>
+ <!-- if the server where the jabber is hosted is not the same as the one in the jid -->
+ <!--<param name="server" value="alternate.server.com"/>-->
+ <!-- Enable TLS or not -->
+ <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 -->
+ <!-- <param name="vad" value="in"/> -->
+ <!-- <param name="vad" value="out"/> -->
+ <param name="vad" value="both"/>
+ </x-profile>
+
+ <!-- Component (Server to Server Login) -->
+ <x-profile type="component">
+ <!-- All traffic for *(a)sub.mydomain.com will come to you -->
+ <param name="name" value="$${subdomain}"/>
+ <param name="password" value="secret"/>
+ <param name="dialplan" value="XML"/>
+ <param name="rtp-ip" value="auto"/>
+ <param name="server" value="jabber.server.org:5347"/>
+ <!-- disable to trade async for more calls -->
+ <param name="use-rtp-timer" value="true"/>
+ <!-- "_auto_" means the extension will be automaticly set to the called jid -->
+ <param name="exten" value="_auto_"/>
+ <!--<param name="vad" value="both"/>-->
+ </x-profile>
+
+</configuration>
Added: freeswitch/trunk/conf/directory.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/directory.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,59 @@
+<!--the domain or ip (the right hand side of the @ in the addr-->
+<domain name="jabber.org">
+ <!--the user id (the left hand side of the @ in the addr-->
+ <user id="stpeter">
+ <params>
+ <!-- omit password for authless registration -->
+ <param name="password" value="mypass"/>
+ </params>
+
+ <vcard xmlns='vcard-temp'>
+ <FN>Peter Saint-Andre</FN>
+ <N>
+ <FAMILY>Saint-Andre</FAMILY>
+ <GIVEN>Peter</GIVEN>
+ <MIDDLE/>
+ </N>
+ <NICKNAME>stpeter</NICKNAME>
+ <URL>http://www.jabber.org/people/stpeter.php</URL>
+ <BDAY>1966-08-06</BDAY>
+ <ORG>
+ <ORGNAME>Jabber Software Foundation</ORGNAME>
+ <ORGUNIT>Jabber Software Foundation</ORGUNIT>
+ </ORG>
+ <TITLE>Executive Director</TITLE>
+ <ROLE>Patron Saint</ROLE>
+ <TEL><WORK/><VOICE/><NUMBER>303-308-3282</NUMBER></TEL>
+ <TEL><WORK/><FAX/><NUMBER/></TEL>
+ <TEL><WORK/><MSG/><NUMBER/></TEL>
+ <ADR>
+ <WORK/>
+ <EXTADD>Suite 600</EXTADD>
+ <STREET>1899 Wynkoop Street</STREET>
+ <LOCALITY>Denver</LOCALITY>
+ <REGION>CO</REGION>
+ <PCODE>80202</PCODE>
+ <CTRY>USA</CTRY>
+ </ADR>
+ <TEL><HOME/><VOICE/><NUMBER>303-555-1212</NUMBER></TEL>
+ <TEL><HOME/><FAX/><NUMBER/></TEL>
+ <TEL><HOME/><MSG/><NUMBER/></TEL>
+ <ADR>
+ <HOME/>
+ <EXTADD/>
+ <STREET/>
+ <LOCALITY>Denver</LOCALITY>
+ <REGION>CO</REGION>
+ <PCODE>80209</PCODE>
+ <CTRY>USA</CTRY>
+ </ADR>
+ <EMAIL><INTERNET/><PREF/><USERID>stpeter(a)jabber.org</USERID></EMAIL>
+ <JABBERID>stpeter(a)jabber.org</JABBERID>
+ <DESC>
+ More information about me is located on my
+ personal website: http://www.saint-andre.com/
+ </DESC>
+ </vcard>
+
+ </user>
+</domain>
Added: freeswitch/trunk/conf/enum.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/enum.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,11 @@
+<configuration name="enum.conf" description="ENUM Module">
+ <settings>
+ <param name="default-root" value="e164.org"/>
+ </settings>
+
+ <routes>
+ <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/test/$1"/>
+ <route service="E2U+IAX2" regex="iax2:(.*)" replace="iax/$1"/>
+ <route service="E2U+XMPP" regex="XMPP:(.*)" replace="dingaling/jingle/$1"/>
+ </routes>
+</configuration>
Added: freeswitch/trunk/conf/event_multicast.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/event_multicast.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,8 @@
+<configuration name="event_multicast.conf" description="Multicast Event">
+ <settings>
+ <param name="address" value="225.1.1.1"/>
+ <param name="port" value="4242"/>
+ <param name="bindings" value="all"/>
+ </settings>
+</configuration>
+
Added: freeswitch/trunk/conf/event_socket.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/event_socket.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,7 @@
+<configuration name="event_socket.conf" description="Socket Client">
+ <settings>
+ <param name="listen-ip" value="127.0.0.1"/>
+ <param name="listen-port" value="8021"/>
+ <param name="password" value="ClueCon"/>
+ </settings>
+</configuration>
Modified: freeswitch/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/trunk/conf/freeswitch.xml (original)
+++ freeswitch/trunk/conf/freeswitch.xml Mon Jan 22 20:12:47 2007
@@ -1,800 +1,66 @@
<?xml version="1.0"?>
<document type="freeswitch/xml">
-
+ <!--#comment
+ All comments starting with #command will be preprocessed and never sent to the xml parser
+ Valid instructions:
+ #include ==> Include another file to this exact point
+ (partial xml should be encased in <include></include> tags)
+ #set ==> Set a global variable (can be expanded during preprocessing with $$ variables)
+ (note the double $$ which denotes preprocessor variables)
+ #comment ==> A general comment such as this
+
+ The preprocessor will compuile the full xml document to ${prefix}/log/freeswitch.registry
+ 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=PCUM@20i"-->
+ <!--my domain is $${domain}-->
<section name="configuration" description="Various Configuration">
-
- <configuration name="switch.conf" description="Modules">
- <settings>
- <!--Most channels to allow at once -->
- <param name="max-sessions" value="1000"/>
- </settings>
- <!--Any variables defined here will be available in every channel, in the dialplan etc -->
- <variables>
- <variable name="uk-ring" value="%(400,200,400,450);%(400,2200,400,450)"/>
- <variable name="us-ring" value="%(2000, 4000, 440.0, 480.0)"/>
- <variable name="bong-ring" value="v=4000;>=0;+=2;#(60,0);v=2000;%(940,0,350,440)"/>
- </variables>
- </configuration>
-
- <configuration name="modules.conf" description="Modules">
- <modules>
- <!-- Loggers (I'd load these first) -->
- <load module="mod_console"/>
- <!-- <load module="mod_syslog"/> -->
-
- <!-- Multi-Faceted -->
- <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->
- <load module="mod_enum"/>
-
- <!-- XML Interfaces -->
- <!-- <load module="mod_xml_rpc"/> -->
- <!-- <load module="mod_xml_curl"/> -->
-
- <!-- Event Handlers -->
- <!-- <load module="mod_cdr"/> -->
- <!-- <load module="mod_event_multicast"/> -->
- <!-- <load module="mod_event_socket"/> -->
- <!-- <load module="mod_xmpp_event"/> -->
- <!-- <load module="mod_zeroconf"/> -->
-
- <!-- Directory Interfaces -->
- <!-- <load module="mod_ldap"/> -->
-
- <!-- Endpoints -->
- <!-- <load module="mod_dingaling"/> -->
- <!--<load module="mod_iax"/>-->
- <load module="mod_portaudio"/>
- <load module="mod_sofia"/>
- <!-- <load module="mod_wanpipe"/> -->
- <!-- <load module="mod_woomera"/> -->
-
- <!-- Applications -->
- <load module="mod_bridgecall"/>
- <load module="mod_commands"/>
- <load module="mod_conference"/>
- <load module="mod_dptools"/>
- <load module="mod_echo"/>
- <!--<load module="mod_park"/>-->
- <load module="mod_playback"/>
-
- <!-- Dialplan Interfaces -->
- <!-- <load module="mod_dialplan_directory"/> -->
- <load module="mod_dialplan_xml"/>
-
- <!-- Codec Interfaces -->
- <load module="mod_g711"/>
- <load module="mod_gsm"/>
- <!-- <load module="mod_ilbc"/> -->
- <load module="mod_l16"/>
- <!-- <load module="mod_speex"/> -->
-
- <!-- File Format Interfaces -->
- <load module="mod_sndfile"/>
- <load module="mod_native_file"/>
-
- <!-- Timers -->
- <load module="mod_softtimer"/>
-
- <!-- Languages -->
- <!-- <load module="mod_spidermonkey"/> -->
- <!-- <load module="mod_perl"/> -->
-
- <!-- ASR /TTS -->
- <!-- <load module="mod_cepstral"/> -->
- <!-- <load module="mod_rss"/> -->
- </modules>
- </configuration>
-
- <configuration name="spidermonkey.conf" description="Spider Monkey JavaScript Plug-Ins">
- <modules>
- <load module="mod_spidermonkey_teletone"/>
- <load module="mod_spidermonkey_core_db"/>
- <!--<load module="mod_spidermonkey_odbc"/>-->
- </modules>
- </configuration>
-
- <configuration name="event_multicast.conf" description="Multicast Event">
- <settings>
- <param name="address" value="225.1.1.1"/>
- <param name="port" value="4242"/>
- <param name="bindings" value="all"/>
- </settings>
- </configuration>
-
- <configuration name="event_socket.conf" description="Socket Client">
- <settings>
- <param name="listen-ip" value="127.0.0.1"/>
- <param name="listen-port" value="8021"/>
- <param name="password" value="ClueCon"/>
- </settings>
- </configuration>
-
- <configuration name="iax.conf" description="IAX Configuration">
- <settings>
- <param name="debug" value="0"/>
- <!-- <param name="ip" value="1.2.3.4"> -->
- <param name="port" value="4569"/>
- <param name="dialplan" value="XML"/>
- <param name="codec-prefs" value="PCMU@20i,PCMA,speex,L16"/>
- <param name="codec-master" value="us"/>
- <param name="codec-rates" value="8"/>
- </settings>
- </configuration>
-
- <configuration name="console.conf" description="Console Logger">
- <!-- pick a file name, a function name or 'all' -->
- <!-- map as many as you need for specific debugging -->
- <mappings>
- <!-- <param name="log_event" value="DEBUG"/> -->
- <param name="all" value="DEBUG"/>
- </mappings>
- </configuration>
-
- <configuration name="sofia.conf" description="sofia Endpoint">
- <profiles>
- <profile name="mydomain1.com">
- <registrations>
- <!-- <registration name="asterlink">
- <param name="register-scheme" value="Digest"/>
- <param name="register-realm" value=""/>
- <param name="register-username" value="1001"/>
- <param name="register-password" value="nhy65tgb"/>
- <param name="register-from" value="sip:1001@208.64.200.40"/>
- <param name="register-to" value="sip:1001@conference.freeswitch.org"/>
- <param name="register-proxy" value="sip:conference.freeswitch.org:5060"/>
- <param name="register-frequency" value="20"/>
- </registration> -->
- </registrations>
- <settings>
- <param name="debug" value="1"/>
- <param name="rfc2833-pt" value="101"/>
- <param name="sip-port" value="5060"/>
- <param name="dialplan" value="XML"/>
- <param name="dtmf-duration" value="100"/>
- <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"/>
-
- <!--Uncomment to set all inbound calls to no media mode-->
- <!--<param name="inbound-no-media" value="true"/>-->
-
- <!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
- <!--<param name="inbound-late-negotiation" value="true"/>-->
-
- <!-- this lets anything register -->
- <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication -->
- <param name="accept-blind-reg" value="true"/>
-
- <!--<param name="auth-calls" value="true"/>-->
- <!-- 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"/> -->
- <!-- VAD choose one (out is a good choice); -->
- <!-- <param name="vad" value="in"/> -->
- <!-- <param name="vad" value="out"/> -->
- <!-- <param name="vad" value="both"/> -->
- <!--<param name="alias" value="sip:10.0.1.251:5555"/>-->
- </settings>
- </profile>
- </profiles>
- </configuration>
-
- <configuration name="syslog.conf" description="Syslog Logger">
- <!-- SYSLOG -->
- <!-- emerg - system is unusable -->
- <!-- alert - action must be taken immediately -->
- <!-- crit - critical conditions -->
- <!-- err - error conditions -->
- <!-- warning - warning conditions -->
- <!-- notice - normal, but significant, condition -->
- <!-- info - informational message -->
- <!-- debug - debug-level message -->
- <settings>
- <param name="ident" value="freeswitch"/>
- <param name="facility" value="user"/>
- <param name="format" value="${time} - ${message}"/>
- <param name="level" value="debug,info,warning-alert"/>
- </settings>
- </configuration>
-
- <configuration name="woomera.conf" description="Woomera Endpoint">
- <settings>
- <param name="debug" value="0"/>
- </settings>
- <interface>
- <param name="host" value="localhost"/>
- <param name="port" value="42420"/>
- <param name="audio-ip" value="127.0.0.1"/>
- <param name="dialplan" value="XML"/>
- </interface>
- </configuration>
-
- <configuration name="wanpipe.conf" description="Sangoma Wanpipe Endpoint">
- <settings>
- <param name="debug" value="1"/>
- <param name="dialplan" value="XML"/>
- <param name="mtu" value="320"/>
- <param name="dtmf-on" value="800"/>
- <param name="dtmf-off" value="100"/>
- <param name="supress-dtmf-tone" value="yes"/>
- </settings>
- <span>
- <param name="span" value="1"/>
- <param name="node" value="cpe"/>
- <!-- <param name="switch" value="ni2"/> -->
- <param name="switch" value="dms100"/>
- <!-- <param name="switch" value="lucent5e"/> -->
- <!-- <param name="switch" value="att4ess"/> -->
- <!-- <param name="switch" value="euroisdn"/> -->
- <!-- <param name="switch" value="gr303eoc"/> -->
- <!-- <param name="switch" value="gr303tmc"/> -->
- <param name="dp" value="national"/>
- <!-- <param name="dp" value="international"/> -->
- <!-- <param name="dp" value="local"/> -->
- <!-- <param name="dp" value="private"/> -->
- <!-- <param name="dp" value="unknown"/> -->
- <param name="l1" value="ulaw"/>
- <!-- <param name="l1" value="alaw"/> -->
- <param name="bchan" value="1-23"/>
- <param name="dchan" value="24"/>
- <param name="dialplan" value="XML"/>
- </span>
- </configuration>
-
- <configuration name="portaudio.conf" description="Soundcard Endpoint">
- <settings>
- <!-- indev, outdev, ringdev:
- partial case sensitive string match on something in the name
- or the device number prefixed with # eg "#1" (or blank for default) -->
-
- <!-- device to use for input -->
- <param name="indev" value=""/>
- <!-- device to use for output -->
- <param name="outdev" value=""/>
-
- <!--device to use for inbound ring -->
- <!--<param name="ringdev" value=""/>-->
- <!--File to play as the ring sound -->
- <!--<param name="ring-file" value="/sounds/ring.wav"/>-->
- <!--Number of seconds to pause between rings -->
- <!--<param name="ring-interval" value="5"/>-->
-
- <!--file to play when calls are on hold-->
- <!--<param name="hold-file" value="/sounds/holdmusic.wav"/>-->
- <!--Timer to use for hold music (i'd leave this one commented)-->
- <!--<param name="timer-name" value="soft"/>-->
-
- <!--Default dialplan and caller-id info -->
- <param name="dialplan" value="XML"/>
- <param name="cid-name" value="FreeSwitch"/>
- <param name="cid-num" value="5555551212"/>
-
- <!--audio sample rate and interval -->
- <param name="sample-rate" value="8000"/>
- <param name="codec-ms" value="20"/>
- </settings>
- </configuration>
-
- <configuration name="zeroconf.conf" description="Zeroconf Event Handler">
- <settings>
- <param name="publish" value="yes"/>
- <param name="browse" value="_sip._udp"/>
- </settings>
- </configuration>
-
- <configuration name="xmpp_event.conf" description="XMPP Event Handler">
- <settings>
- <param name="#debug" value="1"/>
- <param name="jid" value="freeswitch(a)my.jabber.com/me"/>
- <param name="passwd" value="mypass"/>
- <param name="target-jid" value="freeswitch(a)reader.org/him"/>
- </settings>
- </configuration>
-
- <configuration name="dialplan_directory.conf" description="Dialplan Directory">
- <settings>
- <param name="directory-name" value="ldap"/>
- <param name="host" value="ldap.freeswitch.org"/>
- <param name="dn" value="cn=Manager,dc=freeswitch,dc=org"/>
- <param name="pass" value="test"/>
- <param name="base" value="dc=freeswitch,dc=org"/>
- </settings>
- </configuration>
-
- <configuration name="dingaling.conf" description="XMPP Jingle Endpoint">
- <settings>
- <param name="debug" value="0"/>
- <param name="codec-prefs" value="PCMU"/>
- </settings>
-
- <!-- *NOTE* change <x-profile></x-profile> to <profile></profile> to enable -->
-
- <!-- Client Profile (Original mode) -->
- <x-profile type="client">
- <param name="name" value="mydomain.com"/>
- <param name="login" value="myjid(a)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="auto-login" value="true"/>
- <param name="auto-reply" value="Press *Call* to call FreeSWITCH and be sure to come to ClueCon! http://www.cluecon.com"/>
- <!-- SASL "plain" or "md5" -->
- <param name="sasl" value="plain"/>
- <!-- if the server where the jabber is hosted is not the same as the one in the jid -->
- <!--<param name="server" value="alternate.server.com"/>-->
- <!-- Enable TLS or not -->
- <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 -->
- <!-- <param name="vad" value="in"/> -->
- <!-- <param name="vad" value="out"/> -->
- <param name="vad" value="both"/>
- </x-profile>
-
- <!-- Component (Server to Server Login) -->
- <x-profile type="component">
- <!-- All traffic for *(a)sub.mydomain.com will come to you -->
- <param name="name" value="sub.mydomain.com"/>
- <param name="password" value="secret"/>
- <param name="dialplan" value="XML"/>
- <param name="rtp-ip" value="auto"/>
- <param name="server" value="jabber.server.org:5347"/>
- <!-- disable to trade async for more calls -->
- <param name="use-rtp-timer" value="true"/>
- <!-- "_auto_" means the extension will be automaticly set to the called jid -->
- <param name="exten" value="_auto_"/>
- <!--<param name="vad" value="both"/>-->
- </x-profile>
-
- </configuration>
-
- <configuration name="xml_curl.conf" description="cURL XML Gateway">
- <settings>
- <!-- The url to a gateway cgi that can generate xml similar to
- what's in this file only on-the-fly (leave it commented if you dont
- need it) -->
- <!-- one or more |-delim of configuration|directory|dialplan -->
- <!--<param name="gateway-url" value="http://www.mydomain.com/test.cgi" bindings="dialplan"/>-->
- <!-- set this to provide authentication credentials to the server -->
- <!--<param name="gateway-credentials" value="muser:mypass"/>-->
- </settings>
- </configuration>
-
- <configuration name="xml_rpc.conf" description="XML RPC">
- <settings>
- <!-- The port where you want to run the http service (default 8080) -->
- <param name="http-port" value="8080"/>
- <!-- if all 3 of the following params exist all http traffic will require auth -->
- <param name="auth-realm" value="freeswitch"/>
- <param name="auth-user" value="freeswitch"/>
- <param name="auth-pass" value="works"/>
- </settings>
- </configuration>
-
- <configuration name="rss.conf" description="RSS Parser">
- <feeds>
- <!-- Just download the files to wherever and refer to them here -->
- <!-- <feed name="Slash Dot">/home/rss/rss.rss</feed> -->
- <!-- <feed name="News Forge">/home/rss/newsforge.rss</feed> -->
- </feeds>
- </configuration>
-
- <!-- 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>
- <room name="888(a)sub.mydomain.com" status="FreeSWITCH"/>
- </advertise>
-
-<!-- These are the default keys that map when you do not specify a caller control group -->
-<!-- Note: none and default are reserved names for group names -->
- <caller-controls>
- <group name="default">
- <control action="mute" digits="0"/>
- <control action="deaf mute" digits="*"/>
- <control action="energy up" digits="9"/>
- <control action="energy equ" digits="8"/>
- <control action="energy dn" digits="7"/>
- <control action="vol talk up" digits="3"/>
- <control action="vol talk zero" digits="2"/>
- <control action="vol talk dn" digits="1"/>
- <control action="vol listen up" digits="6"/>
- <control action="vol listen zero" digits="5"/>
- <control action="vol listen dn" digits="4"/>
- <control action="hangup" digits="#"/>
- </group>
- </caller-controls>
-
- <!-- Profiles are collections of settings you can reference by name. -->
- <profiles>
- <!--If no profile is specified it will default to "default"-->
- <profile name="default">
- <!-- Domain (for presence) -->
- <param name="domain" value="sub.mydomain.com"/>
- <!-- Sample Rate-->
- <param name="rate" value="8000"/>
- <!-- Number of milliseconds per frame -->
- <param name="interval" value="20"/>
- <!-- Energy level required for audio to be sent to the other users -->
- <param name="energy-level" value="300"/>
- <!-- Name of the caller control group to use for this profile -->
- <!-- <param name="caller-controls" value="some name"/> -->
- <!-- TTS Engine to use -->
- <!--<param name="tts-engine" value="cepstral"/>-->
- <!-- TTS Voice to use -->
- <!--<param name="tts-voice" value="david"/>-->
-
- <!-- If TTS is enabled all audio-file params beginning with -->
- <!-- 'say:' will be considered text to say with TTS -->
- <!-- Set a default path here so you can use relative paths in the other sound params-->
- <!--<param name="sound-prefix" value="/soundfiles"/>-->
- <!-- File to play to acknowledge succees -->
- <!--<param name="ack-sound" value="beep.wav"/>-->
- <!-- File to play to acknowledge failure -->
- <!--<param name="nack-sound" value="beeperr.wav"/>-->
- <!-- File to play to acknowledge muted -->
- <!--<param name="muted-sound" value="muted.wav"/>-->
- <!-- File to play to acknowledge unmuted -->
- <!--<param name="unmuted-sound" value="unmuted.wav"/>-->
- <!-- File to play if you are alone in the conference -->
- <!--<param name="alone-sound" value="yactopitc.wav"/>-->
- <!-- File to play when you join the conference -->
- <!--<param name="enter-sound" value="welcome.wav"/>-->
- <!-- File to play when you leave the conference -->
- <!--<param name="exit-sound" value="exit.wav"/>-->
- <!-- File to play when you ae ejected from the conference -->
- <!--<param name="kicked-sound" value="kicked.wav"/>-->
- <!-- File to play when the conference is locked -->
- <!--<param name="locked-sound" value="locked.wav"/>-->
- <!-- File to play when the conference is locked during the call-->
- <!--<param name="is-locked-sound" value="is-locked.wav"/>-->
- <!-- File to play when the conference is unlocked during the call-->
- <!--<param name="is-unlocked-sound" value="is-unlocked.wav"/>-->
- <!-- File to play to prompt for a pin -->
- <!--<param name="pin-sound" value="pin.wav"/>-->
- <!-- File to play to when the pin is invalid -->
- <!--<param name="bad-pin-sound" value="invalid-pin.wav"/>-->
- <!-- Conference pin -->
- <!--<param name="pin" value="12345"/>-->
- <!-- Default Caller ID Name for outbound calls -->
- <param name="caller-id-name" value="FreeSWITCH"/>
- <!-- Default Caller ID Number for outbound calls -->
- <param name="caller-id-number" value="8777423583"/>
- </profile>
- </profiles>
- </configuration>
-
- <configuration name="enum.conf" description="ENUM Module">
- <settings>
- <param name="default-root" value="e164.org"/>
- </settings>
-
- <routes>
- <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/test/$1"/>
- <route service="E2U+IAX2" regex="iax2:(.*)" replace="iax/$1"/>
- <route service="E2U+XMPP" regex="XMPP:(.*)" replace="dingaling/jingle/$1"/>
- </routes>
- </configuration>
-
- <configuration name="ivr.conf" description="IVR menus">
- <menus>
- <menu name="main"
- greet-long="/soundfiles/greet-long.wav"
- greet-short="/soundfiles/greet-short.wav"
- invalid-sound="/soundfiles/invalid.wav"
- exit-sound="/soundfiles/exit.wav" timeout ="15" max-failures="3">
- <entry action="menu-exit" digits="*"/>
- <entry action="menu-sub" digits="2" param="menu2"/>
- <entry action="menu-exec-api" digits="3" param="api arg"/>
- <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
- <entry action="menu-back" digits="5"/>
- <entry action="menu-call-transfer" digits="7" param="888"/>
- <entry action="menu-sub" digits="8" param="menu8"/>>
- </menu>
- <menu name="menu8"
- greet-long="/soundfiles/greet-long.wav"
- greet-short="/soundfiles/greet-short.wav"
- invalid-sound="/soundfiles/invalid.wav"
- exit-sound="/soundfiles/exit.wav"
- timeout ="15"
- max-failures="3">
- <entry action="menu-back" digits="#"/>
- <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
- <entry action="menu-top" digits="*"/>
- </menu>
- <menu name="menu2"
- greet-long="/soundfiles/greet-long.wav"
- greet-short="/soundfiles/greet-short.wav"
- invalid-sound="/soundfiles/invalid.wav"
- exit-sound="/soundfiles/exit.wav"
- timeout ="15"
- max-failures="3">
- <entry action="menu-back" digits="#"/>
- <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
- <entry action="menu-top" digits="*"/>
- </menu>
- </menus>
- </configuration>
-
+ <!--#include "switch.conf.xml"-->
+ <!--#include "modules.conf.xml"-->
+ <!--#include "spidermonkey.conf.xml"-->
+ <!--#include "event_multicast.conf.xml"-->
+ <!--#include "event_socket.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 "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 "conference.conf.xml"-->
+ <!--#include "enum.conf.xml"-->
+ <!--#include "ivr.conf.xml"-->
</section>
<section name="dialplan" description="Regex/XML Dialplan">
- <!-- Valid fields in conditions: -->
- <!-- "dialplan, caller_id_name, ani, ani2, caller_id_number, -->
- <!-- rdnis, destination_number, uuid, source, context, chan_name" -->
-
- <!-- *NOTE* The special context name 'any' will match any context -->
- <context name="default">
- <extension name="556"> <!-- demo phrases -->
- <condition field="destination_number" expression="^556$">
- <action application="answer"/>
- <action application="sleep" data="1000"/>
- <action application="phrase" data="spell,${caller_id_name}"/>
- <action application="phrase" data="spell-phonetic,${caller_id_name}"/>
- <action application="phrase" data="timespec,12:45:15"/>
- <action application="phrase" data="saydate,0"/>
- <action application="phrase" data="msgcount,130"/>
- <action application="phrase" data="ip-addr,66.250.68.194"/>
- <action application="phrase" data="saydate,$strepoch(2006-03-23 7:23)"/>
- <!--<action application="phrase" data="timeleft,3:30"/>-->
- </condition>
- </extension>
-
- <extension name="tollfree">
- <condition field="destination_number" expression="^(18(0{2}|8{2}|7{2}|6{2})\d{7})$">
- <action application="enum" data="$1"/>
- <action application="bridge" data="${enum_auto_route}"/>
- </condition>
- </extension>
-
- <!-- Call the FreeSWITCH conference via SIP -->
- <!--<extension name="FreeSWITCH Conference SIP">-->
- <!--<condition field="destination_number" expression="^888$">-->
- <!--<action application="bridge" data="sofia/test/888(a)conference.freeswitch.org"/>-->
- <!--</condition>-->
- <!--</extension> -->
-
- <!-- Call the FreeSWITCH conference via IAX -->
- <!--<extension name="FreeSWITCH Conference IAX">-->
- <!--<condition field="destination_number" expression="^8888$">-->
- <!--<action application="bridge" data="iax/guest(a)conference.freeswitch.org/888"/>-->
- <!--</condition>-->
- <!--</extension>-->
-
- <extension name="testmusic">
- <condition field="destination_number" expression="^1234$">
- <!-- 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/test/1234(a)conference.freeswitch.org"/>
- </condition>
- </extension>
-
- <!-- Enter an existing conference -->
- <extension name="1000">
- <condition field="destination_number" expression="^1000$">
- <action application="conference" data="freeswitch"/>
- </condition>
- </extension>
-
- <!-- 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/test/1234@conference.freeswitch.org"/>
- </condition>
- </extension>
-
- <!-- extensions starting with 4, all the numbers after 4 form a numeric filename -->
- <!-- continue="true" means keep looking for more extensions to match -->
- <!-- *NOTE* The entire dialplan is parsed ONCE when the call starts -->
- <!-- so any call info acquired after the various actions cannot -->
- <!-- be taken into consideration. -->
-
- <!-- The first match will play a beep and the second one plays -->
- <!-- the desired file. This is for demo purposes both actions -->
- <!-- could have been under the same <extension> tag as well. -->
- <extension name="playsound1" continue="true">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="^4(\d+)">
- <action application="playback" data="/var/sounds/beep.gsm"/>
- </condition>
- </extension>
-
- <extension name="playsound2">
- <condition field="source" expression="mod_sofia"/>
- <condition field="destination_number" expression="^4(\d+)">
- <action application="playback" data="/root/$1.raw"/>
- </condition>
- </extension>
-
- <!-- send everything with a certian RDNIS to Wanpipe ISDN -->
- <extension name="To PRI">
- <condition field="rdnis" expression="8881231234"/>
- <condition field="destination_number" expression="(.*)">
- <action application="bridge" data="wanpipe/a/a/$1"/>
- </condition>
- </extension>
-
- <!-- Call *MUST* originate from mod_iax and also be dialing ext 9999-->
- <extension name="9999">
- <condition field="source" expression="mod_iax"/>
- <condition field="destination_number" expression="9999">
- <action application="playback" data="/var/sounds/beep.gsm"/>
- </condition>
- </extension>
-
- </context>
+ <!--#include "default_context.xml"-->
</section>
<section name="directory" description="User Directory">
- <!--the domain or ip (the right hand side of the @ in the addr-->
- <domain name="jabber.org">
- <!--the user id (the left hand side of the @ in the addr-->
- <user id="stpeter">
- <params>
- <!-- omit password for authless registration -->
- <param name="password" value="mypass"/>
- </params>
-
- <vcard xmlns='vcard-temp'>
- <FN>Peter Saint-Andre</FN>
- <N>
- <FAMILY>Saint-Andre</FAMILY>
- <GIVEN>Peter</GIVEN>
- <MIDDLE/>
- </N>
- <NICKNAME>stpeter</NICKNAME>
- <URL>http://www.jabber.org/people/stpeter.php</URL>
- <BDAY>1966-08-06</BDAY>
- <ORG>
- <ORGNAME>Jabber Software Foundation</ORGNAME>
- <ORGUNIT>Jabber Software Foundation</ORGUNIT>
- </ORG>
- <TITLE>Executive Director</TITLE>
- <ROLE>Patron Saint</ROLE>
- <TEL><WORK/><VOICE/><NUMBER>303-308-3282</NUMBER></TEL>
- <TEL><WORK/><FAX/><NUMBER/></TEL>
- <TEL><WORK/><MSG/><NUMBER/></TEL>
- <ADR>
- <WORK/>
- <EXTADD>Suite 600</EXTADD>
- <STREET>1899 Wynkoop Street</STREET>
- <LOCALITY>Denver</LOCALITY>
- <REGION>CO</REGION>
- <PCODE>80202</PCODE>
- <CTRY>USA</CTRY>
- </ADR>
- <TEL><HOME/><VOICE/><NUMBER>303-555-1212</NUMBER></TEL>
- <TEL><HOME/><FAX/><NUMBER/></TEL>
- <TEL><HOME/><MSG/><NUMBER/></TEL>
- <ADR>
- <HOME/>
- <EXTADD/>
- <STREET/>
- <LOCALITY>Denver</LOCALITY>
- <REGION>CO</REGION>
- <PCODE>80209</PCODE>
- <CTRY>USA</CTRY>
- </ADR>
- <EMAIL><INTERNET/><PREF/><USERID>stpeter(a)jabber.org</USERID></EMAIL>
- <JABBERID>stpeter(a)jabber.org</JABBERID>
- <DESC>
- More information about me is located on my
- personal website: http://www.saint-andre.com/
- </DESC>
- </vcard>
-
- </user>
- </domain>
+ <!--#include "directory.xml"-->
</section>
<!-- phrases section (under development still) -->
<section name="phrases" description="Speech Phrase Management">
<macros>
<language name="en" sound_path="/snds" tts_engine="cepstral" tts_voice="david">
- <macro name="msgcount">
- <input pattern="(.*)">
- <match>
- <action function="execute" data="sleep(1000)"/>
- <action function="play-file" data="vm-youhave.wav"/>
- <action function="say" data="$1" method="pronounced" type="items"/>
- <action function="play-file" data="vm-messages.wav"/>
- <!-- or -->
- <!--<action function="speak-text" data="you have $1 messages"/>-->
- </match>
- </input>
- </macro>
- <macro name="saydate">
- <input pattern="(.*)">
- <match>
- <action function="say" data="$1" method="pronounced" type="current_date_time"/>
- </match>
- </input>
- </macro>
- <macro name="timespec">
- <input pattern="(.*)">
- <match>
- <action function="say" data="$1" method="pronounced" type="time_measurement"/>
- </match>
- </input>
- </macro>
- <macro name="ip-addr">
- <input pattern="(.*)">
- <match>
- <action function="say" data="$1" method="iterated" type="ip_address"/>
- <action function="say" data="$1" method="pronounced" type="ip_address"/>
- </match>
- </input>
- </macro>
- <macro name="spell">
- <input pattern="(.*)">
- <match>
- <action function="say" data="$1" method="pronounced" type="name_spelled"/>
- </match>
- </input>
- </macro>
- <macro name="spell-phonetic">
- <input pattern="(.*)">
- <match>
- <action function="say" data="$1" method="pronounced" type="name_phonetic"/>
- </match>
- </input>
- </macro>
- <macro name="tts-timeleft">
- <!-- The parser will visit each <input> tag and execute the actions in <match> or <nomatch> depending on the pattern param -->
- <!-- If the function "break" is encountered all parsing will cease -->
- <input pattern="(\d+):(\d+)">
- <match>
- <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
- <action function="break"/>
- </match>
- <nomatch>
- <action function="speak-text" data="That input was invalid."/>
- </nomatch>
- </input>
- <input pattern="(\d+) min (\d+) sec">
- <match>
- <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
- </match>
- <nomatch>
- <action function="speak-text" data="That input was invalid."/>
- </nomatch>
- </input>
- </macro>
+ <!--#include "lang_en.xml"-->
</language>
<language name="fr" sound_path="/var/sounds/lang/fr/jean" tts_engine="cepstral" tts_voice="jean-pierre">
- <macro name="msgcount">
- <input pattern="(.*)">
- <match>
- <action function="play-file" data="tuas.wav"/>
- <action function="say" data="$1" method="pronounced" type="items"/>
- <action function="play-file" data="messages.wav"/>
- </match>
- </input>
- </macro>
- <macro name="timeleft">
- <input pattern="(\d+):(\d+)">
- <match>
- <action function="speak-text" data="il y a $1 minutes et de $2 secondes de restant"/>
- </match>
- </input>
- </macro>
+ <!--#include "lang_fr.xml"-->
</language>
</macros>
</section>
-</document>
+</document>
Added: freeswitch/trunk/conf/iax.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/iax.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,11 @@
+<configuration name="iax.conf" description="IAX Configuration">
+ <settings>
+ <param name="debug" value="0"/>
+ <!-- <param name="ip" value="1.2.3.4"> -->
+ <param name="port" value="4569"/>
+ <param name="dialplan" value="XML"/>
+ <param name="codec-prefs" value="PCMU@20i,PCMA,speex,L16"/>
+ <param name="codec-master" value="us"/>
+ <param name="codec-rates" value="8"/>
+ </settings>
+</configuration>
Added: freeswitch/trunk/conf/ivr.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/ivr.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,39 @@
+<configuration name="ivr.conf" description="IVR menus">
+ <menus>
+ <menu name="main"
+ greet-long="/soundfiles/greet-long.wav"
+ greet-short="/soundfiles/greet-short.wav"
+ invalid-sound="/soundfiles/invalid.wav"
+ exit-sound="/soundfiles/exit.wav" timeout ="15" max-failures="3">
+ <entry action="menu-exit" digits="*"/>
+ <entry action="menu-sub" digits="2" param="menu2"/>
+ <entry action="menu-exec-api" digits="3" param="api arg"/>
+ <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
+ <entry action="menu-back" digits="5"/>
+ <entry action="menu-call-transfer" digits="7" param="888"/>
+ <entry action="menu-sub" digits="8" param="menu8"/>>
+ </menu>
+ <menu name="menu8"
+ greet-long="/soundfiles/greet-long.wav"
+ greet-short="/soundfiles/greet-short.wav"
+ invalid-sound="/soundfiles/invalid.wav"
+ exit-sound="/soundfiles/exit.wav"
+ timeout ="15"
+ max-failures="3">
+ <entry action="menu-back" digits="#"/>
+ <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
+ <entry action="menu-top" digits="*"/>
+ </menu>
+ <menu name="menu2"
+ greet-long="/soundfiles/greet-long.wav"
+ greet-short="/soundfiles/greet-short.wav"
+ invalid-sound="/soundfiles/invalid.wav"
+ exit-sound="/soundfiles/exit.wav"
+ timeout ="15"
+ max-failures="3">
+ <entry action="menu-back" digits="#"/>
+ <entry action="menu-play-sound" digits="4" param="/soundfiles/4.wav"/>
+ <entry action="menu-top" digits="*"/>
+ </menu>
+ </menus>
+</configuration>
Added: freeswitch/trunk/conf/lang_en.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/lang_en.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,71 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+ <macro name="msgcount">
+ <input pattern="(.*)">
+ <match>
+ <action function="execute" data="sleep(1000)"/>
+ <action function="play-file" data="vm-youhave.wav"/>
+ <action function="say" data="$1" method="pronounced" type="items"/>
+ <action function="play-file" data="vm-messages.wav"/>
+ <!-- or -->
+ <!--<action function="speak-text" data="you have $1 messages"/>-->
+ </match>
+ </input>
+ </macro>
+ <macro name="saydate">
+ <input pattern="(.*)">
+ <match>
+ <action function="say" data="$1" method="pronounced" type="current_date_time"/>
+ </match>
+ </input>
+ </macro>
+ <macro name="timespec">
+ <input pattern="(.*)">
+ <match>
+ <action function="say" data="$1" method="pronounced" type="time_measurement"/>
+ </match>
+ </input>
+ </macro>
+ <macro name="ip-addr">
+ <input pattern="(.*)">
+ <match>
+ <action function="say" data="$1" method="iterated" type="ip_address"/>
+ <action function="say" data="$1" method="pronounced" type="ip_address"/>
+ </match>
+ </input>
+ </macro>
+ <macro name="spell">
+ <input pattern="(.*)">
+ <match>
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ </match>
+ </input>
+ </macro>
+ <macro name="spell-phonetic">
+ <input pattern="(.*)">
+ <match>
+ <action function="say" data="$1" method="pronounced" type="name_phonetic"/>
+ </match>
+ </input>
+ </macro>
+ <macro name="tts-timeleft">
+ <!-- The parser will visit each <input> tag and execute the actions in <match> or <nomatch> depending on the pattern param -->
+ <!-- If the function "break" is encountered all parsing will cease -->
+ <input pattern="(\d+):(\d+)">
+ <match>
+ <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
+ <action function="break"/>
+ </match>
+ <nomatch>
+ <action function="speak-text" data="That input was invalid."/>
+ </nomatch>
+ </input>
+ <input pattern="(\d+) min (\d+) sec">
+ <match>
+ <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
+ </match>
+ <nomatch>
+ <action function="speak-text" data="That input was invalid."/>
+ </nomatch>
+ </input>
+ </macro>
+</include><!--This line will be ignored it's here to validate the xml and is optional -->
Added: freeswitch/trunk/conf/lang_fr.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/lang_fr.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,18 @@
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+<macro name="msgcount">
+ <input pattern="(.*)">
+ <match>
+ <action function="play-file" data="tuas.wav"/>
+ <action function="say" data="$1" method="pronounced" type="items"/>
+ <action function="play-file" data="messages.wav"/>
+ </match>
+ </input>
+</macro>
+<macro name="timeleft">
+ <input pattern="(\d+):(\d+)">
+ <match>
+ <action function="speak-text" data="il y a $1 minutes et de $2 secondes de restant"/>
+ </match>
+ </input>
+</macro>
+</include><!--This line will be ignored it's here to validate the xml and is optional -->
Added: freeswitch/trunk/conf/modules.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/modules.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,68 @@
+<configuration name="modules.conf" description="Modules">
+ <modules>
+ <!-- Loggers (I'd load these first) -->
+ <load module="mod_console"/>
+ <!-- <load module="mod_syslog"/> -->
+
+ <!-- Multi-Faceted -->
+ <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->
+ <load module="mod_enum"/>
+
+ <!-- XML Interfaces -->
+ <!-- <load module="mod_xml_rpc"/> -->
+ <!-- <load module="mod_xml_curl"/> -->
+
+ <!-- Event Handlers -->
+ <!-- <load module="mod_cdr"/> -->
+ <!-- <load module="mod_event_multicast"/> -->
+ <!-- <load module="mod_event_socket"/> -->
+ <!-- <load module="mod_xmpp_event"/> -->
+ <!-- <load module="mod_zeroconf"/> -->
+
+ <!-- Directory Interfaces -->
+ <!-- <load module="mod_ldap"/> -->
+
+ <!-- Endpoints -->
+ <!-- <load module="mod_dingaling"/> -->
+ <!--<load module="mod_iax"/>-->
+ <load module="mod_portaudio"/>
+ <load module="mod_sofia"/>
+ <!-- <load module="mod_wanpipe"/> -->
+ <!-- <load module="mod_woomera"/> -->
+
+ <!-- Applications -->
+ <load module="mod_bridgecall"/>
+ <load module="mod_commands"/>
+ <load module="mod_conference"/>
+ <load module="mod_dptools"/>
+ <load module="mod_echo"/>
+ <!--<load module="mod_park"/>-->
+ <load module="mod_playback"/>
+
+ <!-- Dialplan Interfaces -->
+ <!-- <load module="mod_dialplan_directory"/> -->
+ <load module="mod_dialplan_xml"/>
+
+ <!-- Codec Interfaces -->
+ <load module="mod_g711"/>
+ <load module="mod_gsm"/>
+ <!-- <load module="mod_ilbc"/> -->
+ <load module="mod_l16"/>
+ <!-- <load module="mod_speex"/> -->
+
+ <!-- File Format Interfaces -->
+ <load module="mod_sndfile"/>
+ <load module="mod_native_file"/>
+
+ <!-- Timers -->
+ <load module="mod_softtimer"/>
+
+ <!-- Languages -->
+ <!-- <load module="mod_spidermonkey"/> -->
+ <!-- <load module="mod_perl"/> -->
+
+ <!-- ASR /TTS -->
+ <!-- <load module="mod_cepstral"/> -->
+ <!-- <load module="mod_rss"/> -->
+ </modules>
+</configuration>
Added: freeswitch/trunk/conf/portaudio.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/portaudio.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,33 @@
+<configuration name="portaudio.conf" description="Soundcard Endpoint">
+ <settings>
+ <!-- indev, outdev, ringdev:
+ partial case sensitive string match on something in the name
+ or the device number prefixed with # eg "#1" (or blank for default) -->
+
+ <!-- device to use for input -->
+ <param name="indev" value=""/>
+ <!-- device to use for output -->
+ <param name="outdev" value=""/>
+
+ <!--device to use for inbound ring -->
+ <!--<param name="ringdev" value=""/>-->
+ <!--File to play as the ring sound -->
+ <!--<param name="ring-file" value="/sounds/ring.wav"/>-->
+ <!--Number of seconds to pause between rings -->
+ <!--<param name="ring-interval" value="5"/>-->
+
+ <!--file to play when calls are on hold-->
+ <!--<param name="hold-file" value="/sounds/holdmusic.wav"/>-->
+ <!--Timer to use for hold music (i'd leave this one commented)-->
+ <!--<param name="timer-name" value="soft"/>-->
+
+ <!--Default dialplan and caller-id info -->
+ <param name="dialplan" value="XML"/>
+ <param name="cid-name" value="FreeSwitch"/>
+ <param name="cid-num" value="5555551212"/>
+
+ <!--audio sample rate and interval -->
+ <param name="sample-rate" value="8000"/>
+ <param name="codec-ms" value="20"/>
+ </settings>
+</configuration>
Added: freeswitch/trunk/conf/rss.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/rss.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,7 @@
+<configuration name="rss.conf" description="RSS Parser">
+ <feeds>
+ <!-- Just download the files to wherever and refer to them here -->
+ <!-- <feed name="Slash Dot">/home/rss/rss.rss</feed> -->
+ <!-- <feed name="News Forge">/home/rss/newsforge.rss</feed> -->
+ </feeds>
+</configuration>
Added: freeswitch/trunk/conf/sofia.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/sofia.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,54 @@
+<configuration name="sofia.conf" description="sofia Endpoint">
+ <profiles>
+ <profile name="$${domain}">
+ <registrations>
+ <!-- <registration name="asterlink">
+ <param name="register-scheme" value="Digest"/>
+ <param name="register-realm" value=""/>
+ <param name="register-username" value="1001"/>
+ <param name="register-password" value="nhy65tgb"/>
+ <param name="register-from" value="sip:1001@208.64.200.40"/>
+ <param name="register-to" value="sip:1001@conference.freeswitch.org"/>
+ <param name="register-proxy" value="sip:conference.freeswitch.org:5060"/>
+ <param name="register-frequency" value="20"/>
+ </registration> -->
+ </registrations>
+ <settings>
+ <param name="debug" value="1"/>
+ <param name="rfc2833-pt" value="101"/>
+ <param name="sip-port" value="5060"/>
+ <param name="dialplan" value="XML"/>
+ <param name="dtmf-duration" value="100"/>
+ <param name="codec-prefs" value="$${default_codecs}"/>
+ <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"/>
+
+ <!--Uncomment to set all inbound calls to no media mode-->
+ <!--<param name="inbound-no-media" value="true"/>-->
+
+ <!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
+ <!--<param name="inbound-late-negotiation" value="true"/>-->
+
+ <!-- this lets anything register -->
+ <!-- comment the next line and uncomment one or both of the other 2 lines for call authentication -->
+ <param name="accept-blind-reg" value="true"/>
+
+ <!--<param name="auth-calls" value="true"/>-->
+ <!-- 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"/> -->
+ <!-- VAD choose one (out is a good choice); -->
+ <!-- <param name="vad" value="in"/> -->
+ <!-- <param name="vad" value="out"/> -->
+ <!-- <param name="vad" value="both"/> -->
+ <!--<param name="alias" value="sip:10.0.1.251:5555"/>-->
+ </settings>
+ </profile>
+ </profiles>
+</configuration>
Added: freeswitch/trunk/conf/spidermonkey.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/spidermonkey.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,7 @@
+<configuration name="spidermonkey.conf" description="Spider Monkey JavaScript Plug-Ins">
+ <modules>
+ <load module="mod_spidermonkey_teletone"/>
+ <load module="mod_spidermonkey_core_db"/>
+ <!--<load module="mod_spidermonkey_odbc"/>-->
+ </modules>
+</configuration>
Added: freeswitch/trunk/conf/switch.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/switch.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,13 @@
+<configuration name="switch.conf" description="Modules">
+ <settings>
+ <!--Most channels to allow at once -->
+ <param name="max-sessions" value="1000"/>
+ </settings>
+ <!--Any variables defined here will be available in every channel, in the dialplan etc -->
+ <variables>
+ <variable name="uk-ring" value="%(400,200,400,450);%(400,2200,400,450)"/>
+ <variable name="us-ring" value="%(2000, 4000, 440.0, 480.0)"/>
+ <variable name="bong-ring" value="v=4000;>=0;+=2;#(60,0);v=2000;%(940,0,350,440)"/>
+ </variables>
+</configuration>
+
Added: freeswitch/trunk/conf/syslog.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/syslog.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,17 @@
+<configuration name="syslog.conf" description="Syslog Logger">
+ <!-- SYSLOG -->
+ <!-- emerg - system is unusable -->
+ <!-- alert - action must be taken immediately -->
+ <!-- crit - critical conditions -->
+ <!-- err - error conditions -->
+ <!-- warning - warning conditions -->
+ <!-- notice - normal, but significant, condition -->
+ <!-- info - informational message -->
+ <!-- debug - debug-level message -->
+ <settings>
+ <param name="ident" value="freeswitch"/>
+ <param name="facility" value="user"/>
+ <param name="format" value="${time} - ${message}"/>
+ <param name="level" value="debug,info,warning-alert"/>
+ </settings>
+</configuration>
Added: freeswitch/trunk/conf/wanpipe.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/wanpipe.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,31 @@
+<configuration name="wanpipe.conf" description="Sangoma Wanpipe Endpoint">
+ <settings>
+ <param name="debug" value="1"/>
+ <param name="dialplan" value="XML"/>
+ <param name="mtu" value="320"/>
+ <param name="dtmf-on" value="800"/>
+ <param name="dtmf-off" value="100"/>
+ <param name="supress-dtmf-tone" value="yes"/>
+ </settings>
+ <span>
+ <param name="span" value="1"/>
+ <param name="node" value="cpe"/>
+ <!-- <param name="switch" value="ni2"/> -->
+ <param name="switch" value="dms100"/>
+ <!-- <param name="switch" value="lucent5e"/> -->
+ <!-- <param name="switch" value="att4ess"/> -->
+ <!-- <param name="switch" value="euroisdn"/> -->
+ <!-- <param name="switch" value="gr303eoc"/> -->
+ <!-- <param name="switch" value="gr303tmc"/> -->
+ <param name="dp" value="national"/>
+ <!-- <param name="dp" value="international"/> -->
+ <!-- <param name="dp" value="local"/> -->
+ <!-- <param name="dp" value="private"/> -->
+ <!-- <param name="dp" value="unknown"/> -->
+ <param name="l1" value="ulaw"/>
+ <!-- <param name="l1" value="alaw"/> -->
+ <param name="bchan" value="1-23"/>
+ <param name="dchan" value="24"/>
+ <param name="dialplan" value="XML"/>
+ </span>
+</configuration>
Added: freeswitch/trunk/conf/woomera.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/woomera.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,11 @@
+<configuration name="woomera.conf" description="Woomera Endpoint">
+ <settings>
+ <param name="debug" value="0"/>
+ </settings>
+ <interface>
+ <param name="host" value="localhost"/>
+ <param name="port" value="42420"/>
+ <param name="audio-ip" value="127.0.0.1"/>
+ <param name="dialplan" value="XML"/>
+ </interface>
+</configuration>
Added: freeswitch/trunk/conf/xml_curl.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/xml_curl.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,11 @@
+<configuration name="xml_curl.conf" description="cURL XML Gateway">
+ <settings>
+ <!-- The url to a gateway cgi that can generate xml similar to
+ what's in this file only on-the-fly (leave it commented if you dont
+ need it) -->
+ <!-- one or more |-delim of configuration|directory|dialplan -->
+ <!--<param name="gateway-url" value="http://www.mydomain.com/test.cgi" bindings="dialplan"/>-->
+ <!-- set this to provide authentication credentials to the server -->
+ <!--<param name="gateway-credentials" value="muser:mypass"/>-->
+ </settings>
+</configuration>
Added: freeswitch/trunk/conf/xml_rpc.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/xml_rpc.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,10 @@
+<configuration name="xml_rpc.conf" description="XML RPC">
+ <settings>
+ <!-- The port where you want to run the http service (default 8080) -->
+ <param name="http-port" value="8080"/>
+ <!-- if all 3 of the following params exist all http traffic will require auth -->
+ <param name="auth-realm" value="freeswitch"/>
+ <param name="auth-user" value="freeswitch"/>
+ <param name="auth-pass" value="works"/>
+ </settings>
+</configuration>
Added: freeswitch/trunk/conf/xmpp_event.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/xmpp_event.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,8 @@
+<configuration name="xmpp_event.conf" description="XMPP Event Handler">
+ <settings>
+ <param name="#debug" value="1"/>
+ <param name="jid" value="freeswitch(a)my.jabber.com/me"/>
+ <param name="passwd" value="mypass"/>
+ <param name="target-jid" value="freeswitch(a)reader.org/him"/>
+ </settings>
+</configuration>
Added: freeswitch/trunk/conf/zeroconf.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/zeroconf.conf.xml Mon Jan 22 20:12:47 2007
@@ -0,0 +1,6 @@
+<configuration name="zeroconf.conf" description="Zeroconf Event Handler">
+ <settings>
+ <param name="publish" value="yes"/>
+ <param name="browse" value="_sip._udp"/>
+ </settings>
+</configuration>
Modified: freeswitch/trunk/src/switch_xml.c
==============================================================================
--- freeswitch/trunk/src/switch_xml.c (original)
+++ freeswitch/trunk/src/switch_xml.c Mon Jan 22 20:12:47 2007
@@ -781,13 +781,204 @@
return &root->xml;
}
+static switch_size_t read_line(int fd, char *buf, switch_size_t len) {
+ char c, *p;
+ int cur;
+ switch_size_t total = 0;
+
+ p = buf;
+ while (total + sizeof(c) < len && (cur = read(fd, &c, sizeof(c))) > 0) {
+ total += cur;
+ *p++ = c;
+ if (c == '\n') {
+ break;
+ }
+ }
+
+ *p++ = '\0';
+ return total;
+}
+
+static char *expand_vars(char *buf, char *ebuf, switch_size_t elen, switch_size_t *newlen)
+{
+ char *var, *val;
+ char *rp = buf;
+ char *wp = ebuf;
+ char *ep = ebuf + elen - 1;
+
+ if (!(var = strstr(rp, "$${"))) {
+ *newlen = strlen(buf);
+ return buf;
+ }
+
+ while(*rp && wp < ep) {
+
+ if (*rp == '$' && *(rp+1) == '$' && *(rp+2) == '{') {
+ char *e = strchr(rp, '}');
+
+ if (e) {
+ rp += 3;
+ var = rp;
+ *e++ = '\0';
+ rp = e;
+ if ((val = switch_core_get_variable(var))) {
+ char *p;
+ for(p = val; p && *p && wp <= ep; p++) {
+ *wp++ = *p;
+ }
+ }
+ }
+
+ }
+
+ *wp++ = *rp++;
+ }
+ *wp++ = '\0';
+ *newlen = strlen(ebuf);
+
+ return ebuf;
+
+}
+
+static int preprocess(const char *file, int new_fd, int rlevel)
+{
+ int old_fd, close_fd = -1;
+ char *new_file = NULL;
+ switch_size_t cur = 0, ml = 0;
+ char *q, *cmd, buf[2048], ebuf[8192];
+
+ if ((old_fd = open(file, O_RDONLY, 0)) < 0) {
+ return old_fd;
+ }
+
+ if (rlevel > 100) {
+ return -1;
+ }
+
+ if (new_fd < 0) {
+ if (!(new_file = switch_mprintf("%s/freeswitch.registry", SWITCH_GLOBAL_dirs.log_dir))) {
+ goto done;
+ }
+
+ if ((new_fd = open(new_file, O_WRONLY | O_CREAT | O_TRUNC, 0)) < 0) {
+ goto done;
+ }
+ close_fd = new_fd;
+ }
+
+ while((cur = read_line(old_fd, buf, sizeof(buf))) > 0) {
+ char *arg, *e;
+ char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur);
+
+ /* we ignore <include> or </include> for the sake of validators */
+ if (strstr(buf, "<include>") || strstr(buf, "</include>")) {
+ continue;
+ }
+
+ if (ml) {
+ if ((e = strstr(buf, "-->"))) {
+ ml = 0;
+ bp = e + 3;
+ cur = strlen(bp);
+ } else {
+ continue;
+ }
+ }
+
+ if ((cmd = strstr(bp, "<!--#"))) {
+ write(new_fd, bp, cmd - bp);
+ if ((e = strstr(cmd, "-->"))) {
+ *e = '\0';
+ e += 3;
+ write(new_fd, e, strlen(e));
+ } else {
+ ml++;
+ }
+
+ cmd += 5;
+ if ((e = strchr(cmd, '\r')) || (e = strchr(cmd, '\n'))) {
+ *e = '\0';
+ }
+
+ if ((arg = strchr(cmd, ' '))) {
+ *arg++ = '\0';
+ if ((q = strchr(arg, '"'))) {
+ char *qq = q+1;
+
+ if ((qq = strchr(qq, '"'))) {
+ *qq = '\0';
+ arg = q+1;
+ }
+ }
+
+ if (!strcasecmp(cmd, "set")) {
+ char *name = arg;
+ char *val = strchr(name, '=');
+
+ if (val) {
+ char *ve = val++;
+ while(*val && *val == ' ') {
+ val++;
+ }
+ *ve-- = '\0';
+ while(*ve && *ve == ' ') {
+ *ve-- = '\0';
+ }
+ }
+
+ if (name && val) {
+ switch_core_set_variable(name, val);
+ }
+
+ } else if (!strcasecmp(cmd, "include")) {
+ char *fme = NULL, *ifile = arg;
+
+ if (!switch_is_file_path(ifile)) {
+ fme = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, arg);
+ ifile = fme;
+ }
+ if (preprocess(ifile, new_fd, rlevel + 1) < 0) {
+ fprintf(stderr, "Error including %s (%s)\n", ifile, strerror(errno));
+ }
+ switch_safe_free(fme);
+ } /* else NO OP */
+ }
+
+ continue;
+ }
+
+ write(new_fd, bp, cur);
+ }
+
+ close(old_fd);
+
+ if (close_fd > -1) {
+ close(close_fd);
+ new_fd = open(new_file, O_RDONLY, 0);
+ }
+
+ done:
+
+ switch_safe_free(new_file);
+
+ if (new_fd < 0) {
+ return old_fd;
+ }
+
+ return new_fd;
+}
+
// a wrapper for switch_xml_parse_fd that accepts a file name
SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(const char *file)
{
- int fd = open(file, O_RDONLY, 0);
- switch_xml_t xml = switch_xml_parse_fd(fd);
+ int fd = -1;
+ switch_xml_t xml = NULL;
+
+ if ((fd = preprocess(file, -1, 0)) > -1) {
+ xml = switch_xml_parse_fd(fd);
+ close(fd);
+ }
- if (fd >= 0) close(fd);
return xml;
}
1
0
[Freeswitch-svn] [commit] r4025 - freeswitch/trunk/src/mod/event_handlers/mod_cdr
by Freeswitch SVN 22 Jan '07
by Freeswitch SVN 22 Jan '07
22 Jan '07
Author: mishehu
Date: Mon Jan 22 18:33:35 2007
New Revision: 4025
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile
freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/csvcdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/curlcdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
Log:
Merged changes from my branch r4024.
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile Mon Jan 22 18:33:35 2007
@@ -1,11 +1,11 @@
-CFLAGS += $(shell mysql_config --include)
+#CFLAGS += $(shell mysql_config --include)
#CFLAGS += -DSWITCH_QUEUE_ENHANCED
-LDFLAGS += $(shell mysql_config --libs)
+#LDFLAGS += $(shell mysql_config --libs)
#LDFLAGS += -lcurl
CPPCC = g++
-OBJS=cdrcontainer.o basecdr.o baseregistry.o mysqlcdr.o pddcdr.o csvcdr.o xmlcdr.o
+OBJS=cdrcontainer.o basecdr.o baseregistry.o mysqlcdr.o pddcdr.o csvcdr.o xmlcdr.o sqlitecdr.o
all: depends $(OBJS) $(MODNAME).$(DYNAMIC_LIB_EXTEN)
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp Mon Jan 22 18:33:35 2007
@@ -324,7 +324,7 @@
temppair.second = tempvariable;
chanvars_fixed.push_back(temppair);
- }
+ }
}
// This one is for processing of supplemental chanvars
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/csvcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/csvcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/csvcdr.cpp Mon Jan 22 18:33:35 2007
@@ -74,8 +74,11 @@
switch_strftime(formattedcalltransferdate,&retsizectd,sizeof(formattedcalltransferdate),format,&tempcalltransfer);
switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
- process_channel_variables(chanvars_fixed_list,newchannel->channel);
- process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat_fixed_in_supp);
+ if(chanvars_fixed_list.size() > 0)
+ process_channel_variables(chanvars_fixed_list,newchannel->channel);
+
+ if(chanvars_supp_list.size() > 0)
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat_fixed_in_supp);
}
}
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/curlcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/curlcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/curlcdr.cpp Mon Jan 22 18:33:35 2007
@@ -79,8 +79,11 @@
switch_strftime(formattedcalltransferdate,&retsizectd,sizeof(formattedcalltransferdate),format,&tempcalltransfer);
switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
- process_channel_variables(chanvars_fixed_list,newchannel->channel);
- process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,0);
+ if(chanvars_fixed_list.size() > 0)
+ process_channel_variables(chanvars_fixed_list,newchannel->channel);
+
+ if(chanvars_supp_list.size() > 0)
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,0);
}
}
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.cpp Mon Jan 22 18:33:35 2007
@@ -79,8 +79,9 @@
outputfile_name.append(".");
outputfile_name.append(myuuid); // The goal is to have a resulting filename of "/path/to/myuuid"
outputfile_name.append(".pdd"); // .pdd - "perl data dumper"
- bool repeat = 1;
- process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat);
+ bool repeat_fixed_in_supp = 1;
+ if(chanvars_supp_list.size() > 0)
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat_fixed_in_supp);
}
}
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/xmlcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/xmlcdr.cpp Mon Jan 22 18:33:35 2007
@@ -80,8 +80,10 @@
outputfile_name.append(myuuid); // The goal is to have a resulting filename of "/path/to/myuuid"
outputfile_name.append(".xml"); // .xml - "XML Data Dumper"
- bool repeat = 1;
- process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat);
+ bool repeat_fixed_in_supp = 1;
+
+ if(chanvars_supp_list.size() > 0)
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat_fixed_in_supp);
}
}
1
0
[Freeswitch-svn] [commit] r4024 - freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr
by Freeswitch SVN 22 Jan '07
by Freeswitch SVN 22 Jan '07
22 Jan '07
Author: mishehu
Date: Mon Jan 22 18:31:21 2007
New Revision: 4024
Modified:
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/csvcdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
Log:
Added a few missing if's that needed to be in the ctors of csvcdr.cpp and a few others. Need to make sure that the stl containers for the chanvars fixed/supp actually contain something.
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile Mon Jan 22 18:31:21 2007
@@ -1,11 +1,11 @@
-CFLAGS += $(shell mysql_config --include)
-CFLAGS += -DSWITCH_QUEUE_ENHANCED
-LDFLAGS += $(shell mysql_config --libs)
+#CFLAGS += $(shell mysql_config --include)
+#CFLAGS += -DSWITCH_QUEUE_ENHANCED
+#LDFLAGS += $(shell mysql_config --libs)
#LDFLAGS += -lcurl
CPPCC = g++
-OBJS=cdrcontainer.o basecdr.o baseregistry.o mysqlcdr.o pddcdr.o csvcdr.o xmlcdr.o
+OBJS=cdrcontainer.o basecdr.o baseregistry.o mysqlcdr.o pddcdr.o csvcdr.o xmlcdr.o sqlitecdr.o
all: depends $(OBJS) $(MODNAME).$(DYNAMIC_LIB_EXTEN)
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp Mon Jan 22 18:31:21 2007
@@ -324,7 +324,7 @@
temppair.second = tempvariable;
chanvars_fixed.push_back(temppair);
- }
+ }
}
// This one is for processing of supplemental chanvars
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/csvcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/csvcdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/csvcdr.cpp Mon Jan 22 18:31:21 2007
@@ -74,8 +74,11 @@
switch_strftime(formattedcalltransferdate,&retsizectd,sizeof(formattedcalltransferdate),format,&tempcalltransfer);
switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
- process_channel_variables(chanvars_fixed_list,newchannel->channel);
- process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat_fixed_in_supp);
+ if(chanvars_fixed_list.size() > 0)
+ process_channel_variables(chanvars_fixed_list,newchannel->channel);
+
+ if(chanvars_supp_list.size() > 0)
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat_fixed_in_supp);
}
}
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.cpp Mon Jan 22 18:31:21 2007
@@ -79,8 +79,11 @@
switch_strftime(formattedcalltransferdate,&retsizectd,sizeof(formattedcalltransferdate),format,&tempcalltransfer);
switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
- process_channel_variables(chanvars_fixed_list,newchannel->channel);
- process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,0);
+ if(chanvars_fixed_list.size() > 0)
+ process_channel_variables(chanvars_fixed_list,newchannel->channel);
+
+ if(chanvars_supp_list.size() > 0)
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,0);
}
}
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp Mon Jan 22 18:31:21 2007
@@ -79,8 +79,9 @@
outputfile_name.append(".");
outputfile_name.append(myuuid); // The goal is to have a resulting filename of "/path/to/myuuid"
outputfile_name.append(".pdd"); // .pdd - "perl data dumper"
- bool repeat = 1;
- process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat);
+ bool repeat_fixed_in_supp = 1;
+ if(chanvars_supp_list.size() > 0)
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat_fixed_in_supp);
}
}
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/xmlcdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/xmlcdr.cpp Mon Jan 22 18:31:21 2007
@@ -80,8 +80,10 @@
outputfile_name.append(myuuid); // The goal is to have a resulting filename of "/path/to/myuuid"
outputfile_name.append(".xml"); // .xml - "XML Data Dumper"
- bool repeat = 1;
- process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat);
+ bool repeat_fixed_in_supp = 1;
+
+ if(chanvars_supp_list.size() > 0)
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,repeat_fixed_in_supp);
}
}
1
0
[Freeswitch-svn] [commit] r4023 - freeswitch/trunk/src/mod/event_handlers/mod_cdr
by Freeswitch SVN 22 Jan '07
by Freeswitch SVN 22 Jan '07
22 Jan '07
Author: mishehu
Date: Mon Jan 22 17:08:13 2007
New Revision: 4023
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile
Log:
Commented out the CFLAGS in mod_cdr for using my apr_queue enhancements by default.
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile Mon Jan 22 17:08:13 2007
@@ -1,6 +1,6 @@
CFLAGS += $(shell mysql_config --include)
-CFLAGS += -DSWITCH_QUEUE_ENHANCED
+#CFLAGS += -DSWITCH_QUEUE_ENHANCED
LDFLAGS += $(shell mysql_config --libs)
#LDFLAGS += -lcurl
1
0
[Freeswitch-svn] [commit] r4022 - freeswitch/trunk/src/mod/event_handlers/mod_cdr
by Freeswitch SVN 22 Jan '07
by Freeswitch SVN 22 Jan '07
22 Jan '07
Author: mishehu
Date: Mon Jan 22 17:03:56 2007
New Revision: 4022
Added:
freeswitch/trunk/src/mod/event_handlers/mod_cdr/curlcdr.cpp
- copied unchanged from r4020, /freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/curlcdr.h
- copied unchanged from r4020, /freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.h
freeswitch/trunk/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp
- copied unchanged from r4020, /freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/sqlitecdr.h
- copied unchanged from r4020, /freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/sqlitecdr.h
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile
freeswitch/trunk/src/mod/event_handlers/mod_cdr/README
freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.h
freeswitch/trunk/src/mod/event_handlers/mod_cdr/csvcdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.h
freeswitch/trunk/src/mod/event_handlers/mod_cdr/odbccdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.cpp
freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.h
freeswitch/trunk/src/mod/event_handlers/mod_cdr/schema.sql
freeswitch/trunk/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
Log:
Merged changes in from my branch at r4020.
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/Makefile Mon Jan 22 17:03:56 2007
@@ -1,6 +1,8 @@
CFLAGS += $(shell mysql_config --include)
+CFLAGS += -DSWITCH_QUEUE_ENHANCED
LDFLAGS += $(shell mysql_config --libs)
+#LDFLAGS += -lcurl
CPPCC = g++
OBJS=cdrcontainer.o basecdr.o baseregistry.o mysqlcdr.o pddcdr.o csvcdr.o xmlcdr.o
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/README
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/README (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/README Mon Jan 22 17:03:56 2007
@@ -82,6 +82,14 @@
<param name="chanvars_supp" value=""/> value is a comma separated list of supplemental channel variables to log. Can be a wildcard (*) (optional)
<param name="chanvars_supp_repeat_fixed" value=""/> value is 0 for no, 1 for yes, and determines whether or not to repeat any of the fixed channel variables as key / value pairs in the chanvars table.
<param name="timezone" value=""/> value is utc for utc time, local for localtime. If not specified or incorrectly specified, localtime is assumed.
+
+Class: SqliteCDR, located in sqlitecdr.h and sqlitecdr.cpp
+ This class uses the Sqlite3 library as included with FreeSWITCH's core. Sqlite is not strict in its handling of column types, and in theory you can toss any sort of data at any sort of column. That being said, this logger was designed to at least attempt to match the column types to the type of data being sent to it. It will warn you if the schema does not match what chanvars_fixed types you specify, but it will not fail on them. However, due to the use of prepared statements, it is likely that you will have unexpected results if you mismatch your chanvars_fixed logging to db schema. The is the first SQL logger to automatically create the db schema and even update it on its own.
+Configuration: Section <sqlitecdr>
+ <param name="path" value=""/> value is the path to the database to open or create (required)
+ <param name="chanvars_fixed" value=""/> Is a comma separated list of key=type pairs. Types are x for decimal, s for string (varchar), d for double, i for integer, t for tiny. If no type is provided, it defaults that column to string (varchar). It cannot accept wildcards (*). You must have a matching column of matching type in the main freeswitchcdr table. The logger will attempt to automatically update the schema, but it cannot if a column by that name already exists.(optional)
+ <param name="chanvars_supp" value=""/> value is a comma separated list of supplemental channel variables to log. Can be a wildcard (*) (optional)
+ <param name="chanvars_supp_repeat_fixed" value=""/> value is 0 for no, 1 for yes, and determines whether or not to repeat any of the fixed channel variables as key / value pairs in the chanvars table.
FAQ:
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp Mon Jan 22 17:03:56 2007
@@ -60,6 +60,7 @@
if(newchannel != 0)
{
errorstate = 0;
+ originated=1; // One-legged calls are always considered the originator
memset(clid,0,80);
memset(dialplan,0,80);
memset(myuuid,0,37);
@@ -132,7 +133,6 @@
// Or were we maybe we were the caller?
if(newchannel->callerprofile->originatee_caller_profile)
{
- originated = 1;
if (newchannel->callerprofile) {
if(newchannel->callerprofile->caller_id_number != 0)
strncpy(src,newchannel->callerprofile->caller_id_number,strlen(newchannel->callerprofile->caller_id_number));
@@ -377,6 +377,35 @@
}
}
+void BaseCDR::escape_string(std::string& src)
+{
+ std::string::size_type pos = 0;
+
+ // find all occurences of ' and replace them with \'
+ while ( ( pos = src.find( "'", pos ) ) != std::string::npos )
+ {
+ src.replace( pos, 1, "\\'" );
+ pos += 2;
+ }
+}
+
+std::string BaseCDR::escape_chararray(char* src)
+{
+ std::string src_string = src;
+
+ std::string::size_type pos = 0;
+
+ // find all occurences of ' and replace them with \'
+ while ( ( pos = src_string.find( "'", pos ) ) != std::string::npos )
+ {
+ src_string.replace( pos, 1, "\\'" );
+ pos += 2;
+ }
+
+ return src_string;
+}
+
+
/* For Emacs:
* Local Variables:
* mode:c++
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.h
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.h (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.h Mon Jan 22 17:03:56 2007
@@ -84,6 +84,8 @@
void parse_channel_variables_xconfig(std::string& unparsed,std::list<std::string>& chanvarslist,std::vector<switch_mod_cdr_sql_types_t>& chanvars_fixed_types); // Typically used for SQL types
void process_channel_variables(const std::list<std::string>& stringlist,const std::list<std::string>& fixedlist,switch_channel_t *channel,bool repeat = 1); //This is used for supplemental chanvars
void process_channel_variables(const std::list<std::string>& stringlist,switch_channel_t *channel); // This is used for fixed chanvars
+ void escape_string(std::string& src);
+ std::string escape_chararray(char* src);
switch_time_t callstartdate;
switch_time_t callanswerdate;
switch_time_t callenddate;
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/csvcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/csvcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/csvcdr.cpp Mon Jan 22 17:03:56 2007
@@ -179,7 +179,7 @@
if(outputfile.good())
{
activated = 1;
- switch_console_printf(SWITCH_CHANNEL_LOG,"CsvCDR activated, log rotation will occur at or after %d MB",(filesize_limit/1024/1024));
+ switch_console_printf(SWITCH_CHANNEL_LOG,"CsvCDR activated, log rotation will occur at or after %d MB\n",(filesize_limit/1024/1024));
}
}
else
@@ -228,7 +228,21 @@
switch_console_printf(SWITCH_CHANNEL_LOG,"Could not open the CSV file %s . CsvCDR logger will not be functional until this is resolved and a reload is issued. Failbit is set to %d.\n",filename.c_str(),outputfile.fail());
activated = 0;
}
+ else
+ {
+ outputfile << "callstartdate,formattedcallstartdate,callanswerdate,formattedcallanswerdate,calltransferdate,formattedcalltransferdate,callendate,formattedcallenddate,hangupcause_text,hangupcause,clid,originated,dialplan,myuuid,destuuid,src,dst,srcchannel,dstchannel,ani,aniii,network_address,lastapp,lastdata,billusec,disposition,amaflags";
+ if(chanvars_fixed_list.size())
+ {
+ std::list<std::string>::iterator iItr, iEnd;
+ for(iItr = chanvars_fixed_list.begin(),iEnd = chanvars_fixed_list.end(); iItr != iEnd; iItr++)
+ outputfile << "," << *iItr;
+ }
+ if(logchanvars)
+ outputfile << ",chanvars_supp";
+
+ outputfile << std::endl;
+ }
}
bool CsvCDR::process_record()
@@ -315,7 +329,7 @@
chanvars_fixed_list.clear();
chanvars_supp_list.clear();
connectionstate = 0;
- switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CsvCDR... Done!");
+ switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CsvCDR... Done!\n");
}
AUTO_REGISTER_BASECDR(CsvCDR);
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp Mon Jan 22 17:03:56 2007
@@ -62,6 +62,7 @@
dstchannel_length = (long unsigned int)strlen(dstchannel);
lastapp_length = (long unsigned int)strlen(lastapp);
lastdata_length = (long unsigned int)strlen(lastdata);
+ network_addr_length = (long unsigned int)strlen(network_addr);
if(chanvars_fixed_list.size() > 0)
process_channel_variables(chanvars_fixed_list,newchannel->channel);
@@ -195,7 +196,7 @@
if(activated)
{
- tmp_sql_query = "INSERT INTO freeswitchcdr (callstartdate,callanswerdate,calltransferdate,callenddate,originated,clid,src,dst,ani,aniii,dialplan,myuuid,destuuid,srcchannel,dstchannel,lastapp,lastdata,billusec,disposition,hangupcause,amaflags";
+ tmp_sql_query = "INSERT INTO freeswitchcdr (callstartdate,callanswerdate,calltransferdate,callenddate,originated,clid,src,dst,ani,aniii,dialplan,myuuid,destuuid,srcchannel,dstchannel,network_addr,lastapp,lastdata,billusec,disposition,hangupcause,amaflags";
int items_appended = 0;
@@ -213,7 +214,7 @@
}
}
- tmp_sql_query.append(") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");
+ tmp_sql_query.append(") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");
if(chanvars_fixed_list.size() > 0 )
{
@@ -334,13 +335,13 @@
set_mysql_time(tm1,my_callstartdate);
set_mysql_time(tm2,my_callanswerdate);
set_mysql_time(tm3,my_calltransferdate);
- set_mysql_time(tm4,my_calltransferdate);
+ set_mysql_time(tm4,my_callenddate);
// Why is this out of order? I don't know, it doesn't make sense.
add_parameter(my_callstartdate,MYSQL_TYPE_DATETIME);
add_parameter(my_callanswerdate,MYSQL_TYPE_DATETIME);
- add_parameter(my_callenddate,MYSQL_TYPE_DATETIME);
add_parameter(my_calltransferdate,MYSQL_TYPE_DATETIME);
+ add_parameter(my_callenddate,MYSQL_TYPE_DATETIME);
add_parameter(originated,MYSQL_TYPE_TINY);
add_string_parameter(clid,clid_length,MYSQL_TYPE_VAR_STRING,0);
@@ -353,6 +354,7 @@
add_string_parameter(destuuid,destuuid_length,MYSQL_TYPE_VAR_STRING,0);
add_string_parameter(srcchannel,srcchannel_length,MYSQL_TYPE_VAR_STRING,0);
add_string_parameter(dstchannel,dstchannel_length,MYSQL_TYPE_VAR_STRING,0);
+ add_string_parameter(network_addr,network_addr_length,MYSQL_TYPE_VAR_STRING,0);
add_string_parameter(lastapp,lastapp_length,MYSQL_TYPE_VAR_STRING,0);
add_string_parameter(lastdata,lastdata_length,MYSQL_TYPE_VAR_STRING,0);
add_parameter(billusec,MYSQL_TYPE_LONGLONG,0);
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.h
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.h (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.h Mon Jan 22 17:03:56 2007
@@ -95,6 +95,7 @@
long unsigned int aniii_length;
long unsigned int lastapp_length;
long unsigned int lastdata_length;
+ long unsigned int network_addr_length;
// Now a couple internal methods
template <typename T> void add_parameter(T& param, enum_field_types type, bool *is_null=0);
void add_string_parameter(char* param, long unsigned int& param_length, enum_field_types type, bool* is_null=0);
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/odbccdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/odbccdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/odbccdr.cpp Mon Jan 22 17:03:56 2007
@@ -222,7 +222,7 @@
{
tmp_sql_query = "INSERT INTO ";
tmp_sql_query.append(tablename);
- tmp_sql_query.append(" (callstartdate,callanswerdate,calltransferdate,callenddate,originated,clid,src,dst,ani,aniii,dialplan,myuuid,destuuid,srcchannel,dstchannel,lastapp,lastdata,billusec,disposition,hangupcause,amaflags");
+ tmp_sql_query.append(" (callstartdate,callanswerdate,calltransferdate,callenddate,originated,clid,src,dst,ani,aniii,dialplan,myuuid,destuuid,srcchannel,dstchannel,network_addr,lastapp,lastdata,billusec,disposition,hangupcause,amaflags");
int items_appended = 0;
@@ -240,7 +240,7 @@
}
}
- tmp_sql_query.append(") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");
+ tmp_sql_query.append(") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");
if(chanvars_fixed_list.size() > 0 )
{
@@ -422,6 +422,7 @@
SQLBindParameter(ODBC_stmt, index++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, sizeof(destuuid), 0, destuuid, 0, 0);
SQLBindParameter(ODBC_stmt, index++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(srcchannel), 0, srcchannel, 0, 0);
SQLBindParameter(ODBC_stmt, index++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(dstchannel), 0, dstchannel, 0, 0);
+ SQLBindParameter(ODBC_stmt, index++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(network_addr), 0, network_addr, 0, 0);
SQLBindParameter(ODBC_stmt, index++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(lastapp), 0, lastapp, 0, 0);
SQLBindParameter(ODBC_stmt, index++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(lastdata), 0, lastdata, 0, 0);
SQLBindParameter(ODBC_stmt, index++, SQL_PARAM_INPUT, SQL_C_UBIGINT, SQL_BIGINT, 0, 0, &billusec, 0, 0);
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.cpp Mon Jan 22 17:03:56 2007
@@ -172,41 +172,45 @@
{
// Format the call record and proceed from here...
outputfile << "$VAR1 = {" << std::endl;
- outputfile << "\t\'callstartdate\' = \'" << callstartdate << "\'," << std::endl;
- outputfile << "\t\'formattedcallstartdate\' = \'" << formattedcallstartdate << "\'," << std::endl;
- outputfile << "\t\'callanswerdate\' = \'" << callanswerdate << "\'," << std::endl;
- outputfile << "\t\'formattedcallanswerdate\' = \'" << formattedcallanswerdate << "\'," << std::endl;
- outputfile << "\t\'calltransferdate\' = \'" << calltransferdate << "\'," << std::endl;
- outputfile << "\t\'formattedcalltransferdate\' = \'" << formattedcalltransferdate << "\'," << std::endl;
- outputfile << "\t\'callenddate\' = \'" << callenddate << "\'," << std::endl;
- outputfile << "\t\'formatcallenddate\' = \'" << formattedcallenddate << "\'," << std::endl;
- outputfile << "\t\'hangupcause\' = \'" << hangupcause_text << "\'," << std::endl;
- outputfile << "\t\'hangupcausecode\' = \'" << hangupcause << "\'," << std::endl;
- outputfile << "\t\'clid\' = \'" << clid << "\'," << std::endl;
- outputfile << "\t\'originated\' = \'" << originated << "\'," << std::endl;
- outputfile << "\t\'dialplan\' = \'" << dialplan << "\'," << std::endl;
- outputfile << "\t\'myuuid\' = \'" << myuuid << "\'," << std::endl;
- outputfile << "\t\'destuuid\' = \'" << destuuid << "\'," << std::endl;
- outputfile << "\t\'src\' = \'" << src << "\'," << std::endl;
- outputfile << "\t\'dst\' = \'" << dst << "\'," << std::endl;
- outputfile << "\t\'srcchannel\' = \'" << srcchannel << "\'," << std::endl;
- outputfile << "\t\'dstchannel\' = \'" << dstchannel << "\'," << std::endl;
- outputfile << "\t\'ani\' = \'" << ani << "\'," << std::endl;
- outputfile << "\t\'aniii\' = \'" << aniii << "\'," << std::endl;
- outputfile << "\t\'network_addr\' = \'" << network_addr << "\'," << std::endl;
- outputfile << "\t\'lastapp\' = \'" << lastapp << "\'," << std::endl;
- outputfile << "\t\'lastdata\' = \'" << lastdata << "\'," << std::endl;
- outputfile << "\t\'billusec\' = \'" << billusec << "\'," << std::endl;
- outputfile << "\t\'disposition\' = \'" << disposition << "\'," << std::endl;
- outputfile << "\t\'amaflags\' = \'" << amaflags << "\'," << std::endl;
+ outputfile << "\t\'callstartdate\' => \'" << callstartdate << "\'," << std::endl;
+ outputfile << "\t\'formattedcallstartdate\' => \'" << formattedcallstartdate << "\'," << std::endl;
+ outputfile << "\t\'callanswerdate\' => \'" << callanswerdate << "\'," << std::endl;
+ outputfile << "\t\'formattedcallanswerdate\' => \'" << formattedcallanswerdate << "\'," << std::endl;
+ outputfile << "\t\'calltransferdate\' => \'" << calltransferdate << "\'," << std::endl;
+ outputfile << "\t\'formattedcalltransferdate\' => \'" << formattedcalltransferdate << "\'," << std::endl;
+ outputfile << "\t\'callenddate\' => \'" << callenddate << "\'," << std::endl;
+ outputfile << "\t\'formattedcallenddate\' => \'" << formattedcallenddate << "\'," << std::endl;
+ outputfile << "\t\'hangupcause\' => \'" << hangupcause_text << "\'," << std::endl;
+ outputfile << "\t\'hangupcausecode\' => \'" << hangupcause << "\'," << std::endl;
+ outputfile << "\t\'clid\' => \'" << escape_chararray(clid) << "\'," << std::endl;
+ outputfile << "\t\'originated\' => \'" << originated << "\'," << std::endl;
+ outputfile << "\t\'dialplan\' => \'" << dialplan << "\'," << std::endl;
+ outputfile << "\t\'myuuid\' => \'" << myuuid << "\'," << std::endl;
+ outputfile << "\t\'destuuid\' => \'" << destuuid << "\'," << std::endl;
+ outputfile << "\t\'src\' => \'" << src << "\'," << std::endl;
+ outputfile << "\t\'dst\' => \'" << dst << "\'," << std::endl;
+ outputfile << "\t\'srcchannel\' => \'" << srcchannel << "\'," << std::endl;
+ outputfile << "\t\'dstchannel\' => \'" << dstchannel << "\'," << std::endl;
+ outputfile << "\t\'ani\' => \'" << ani << "\'," << std::endl;
+ outputfile << "\t\'aniii\' => \'" << aniii << "\'," << std::endl;
+ outputfile << "\t\'network_addr\' => \'" << network_addr << "\'," << std::endl;
+ outputfile << "\t\'lastapp\' => \'" << lastapp << "\'," << std::endl;
+ outputfile << "\t\'lastdata\' => \'" << lastdata << "\'," << std::endl;
+ outputfile << "\t\'billusec\' => \'" << billusec << "\'," << std::endl;
+ outputfile << "\t\'disposition\' => \'" << disposition << "\'," << std::endl;
+ outputfile << "\t\'amaflags\' => \'" << amaflags << "\'," << std::endl;
// Now to process chanvars
outputfile << "\t\'chanvars\' => {" << std::endl;
if(chanvars_supp.size() > 0 )
{
- std::map<std::string,std::string>::iterator iItr,iEnd;
+ std::map< std::string,std::string >::iterator iItr,iEnd;
for(iItr = chanvars_supp.begin(), iEnd = chanvars_supp.end() ; iItr != iEnd; iItr++)
- outputfile << "\t\t\'" << iItr->first << "\' = \'" << iItr->second << "\'," << std::endl;
+ {
+ escape_string(iItr->second);
+ outputfile << "\t\t\'" << iItr->first;
+ outputfile << "\' => \'" << iItr->second << "\'," << std::endl;
+ }
}
outputfile << "\t}," << std::endl << "};" << std::endl << std::endl;
retval = 1;
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.h
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.h (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/pddcdr.h Mon Jan 22 17:03:56 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Bret McDanel <trixter AT 0xdecafbad.com>
*
* Description: This C++ header file describes the PddCDR class which handles formatting a CDR out to
* individual text files in a Perl Data Dumper format.
@@ -54,7 +55,6 @@
virtual void tempdump_record();
virtual void reread_tempdumped_records();
virtual std::string get_display_name();
-
private:
static bool activated; // Is this module activated?
static bool connectionstate; // What is the status of the connection?
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/schema.sql
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/schema.sql (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/schema.sql Mon Jan 22 17:03:56 2007
@@ -15,6 +15,7 @@
destuuid char(36) NOT NULL,
srcchannel varchar(80) NOT NULL,
dstchannel varchar(80) NOT NULL, /* Need to decide - this might be redundant as you can link the records via uuid */
+ network_addr varchar(40) default "",
lastapp varchar(80) default "",
lastdata varchar(255) default "",
billusec bigint default 0,
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/xmlcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/xmlcdr.cpp Mon Jan 22 17:03:56 2007
@@ -171,7 +171,7 @@
switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str());
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Preping the CDR to %s.\n",outputfile_name.c_str());
+ //switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Preping the CDR to %s.\n",outputfile_name.c_str());
// Format the call record and proceed from here...
outputfile << "<?xml version=\"1.0\"?>" << std::endl;
outputfile << "<document type=\"freeswitch-cdr/xml\">" << std::endl;
@@ -213,7 +213,7 @@
}
outputfile << "\t</chanvars>" << std::endl << "</document>" << std::endl << std::endl;
- switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Dumping the CDR to %s.\n",outputfile_name.c_str());
+ //switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Dumping the CDR to %s.\n",outputfile_name.c_str());
retval = 1;
}
1
0
22 Jan '07
Author: anthm
Date: Mon Jan 22 16:59:07 2007
New Revision: 4021
Modified:
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/switch_core.c
Log:
tweak core for build err and add core_get_var
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Mon Jan 22 16:59:07 2007
@@ -473,6 +473,13 @@
SWITCH_DECLARE(char *) switch_core_get_variable(char *varname);
/*!
+ \brief Add a global variable to the core
+ \param varname the name of the variable
+ \param value the value of the variable
+*/
+SWITCH_DECLARE(void) switch_core_set_variable(char *varname, char *value);
+
+/*!
\brief Hangup All Sessions
\param cause the hangup cause to apply to the hungup channels
*/
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Mon Jan 22 16:59:07 2007
@@ -610,6 +610,11 @@
return (char *) switch_core_hash_find(runtime.global_vars, varname);
}
+SWITCH_DECLARE(void) switch_core_set_variable(char *varname, char *value)
+{
+ switch_core_hash_insert(runtime.global_vars, switch_core_strdup(runtime.memory_pool, varname), switch_core_strdup(runtime.memory_pool, value));
+}
+
#ifdef SWITCH_DEBUG_RWLOCKS
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(char *uuid_str,
@@ -2881,7 +2886,7 @@
#endif
-static int handle_fatality(int sig)
+static void handle_fatality(int sig)
{
switch_thread_id_t thread_id;
jmp_buf *env;
@@ -2909,10 +2914,10 @@
jmp_buf env;
int sig;
- signal(SIGSEGV, (void *) handle_fatality);
- signal(SIGFPE, (void *) handle_fatality);
+ signal(SIGSEGV, handle_fatality);
+ signal(SIGFPE, handle_fatality);
#ifndef WIN32
- signal(SIGBUS, (void *) handle_fatality);
+ signal(SIGBUS, handle_fatality);
#endif
if ((sig = setjmp(env)) != 0) {
1
0
[Freeswitch-svn] [commit] r4020 - freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr
by Freeswitch SVN 22 Jan '07
by Freeswitch SVN 22 Jan '07
22 Jan '07
Author: mishehu
Date: Mon Jan 22 16:41:06 2007
New Revision: 4020
Added:
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.h
Modified:
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.h
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp
freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.h
Log:
Added in Bret's curlcdr.h/cpp files, made a change in BaseCDR for escaping the strings, added in the ability to adjust the timestamps for SqliteCDR so that you can log according to lt or utc.
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/Makefile Mon Jan 22 16:41:06 2007
@@ -2,6 +2,7 @@
CFLAGS += $(shell mysql_config --include)
CFLAGS += -DSWITCH_QUEUE_ENHANCED
LDFLAGS += $(shell mysql_config --libs)
+#LDFLAGS += -lcurl
CPPCC = g++
OBJS=cdrcontainer.o basecdr.o baseregistry.o mysqlcdr.o pddcdr.o csvcdr.o xmlcdr.o
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.cpp Mon Jan 22 16:41:06 2007
@@ -377,6 +377,35 @@
}
}
+void BaseCDR::escape_string(std::string& src)
+{
+ std::string::size_type pos = 0;
+
+ // find all occurences of ' and replace them with \'
+ while ( ( pos = src.find( "'", pos ) ) != std::string::npos )
+ {
+ src.replace( pos, 1, "\\'" );
+ pos += 2;
+ }
+}
+
+std::string BaseCDR::escape_chararray(char* src)
+{
+ std::string src_string = src;
+
+ std::string::size_type pos = 0;
+
+ // find all occurences of ' and replace them with \'
+ while ( ( pos = src_string.find( "'", pos ) ) != std::string::npos )
+ {
+ src_string.replace( pos, 1, "\\'" );
+ pos += 2;
+ }
+
+ return src_string;
+}
+
+
/* For Emacs:
* Local Variables:
* mode:c++
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.h (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/basecdr.h Mon Jan 22 16:41:06 2007
@@ -84,6 +84,8 @@
void parse_channel_variables_xconfig(std::string& unparsed,std::list<std::string>& chanvarslist,std::vector<switch_mod_cdr_sql_types_t>& chanvars_fixed_types); // Typically used for SQL types
void process_channel_variables(const std::list<std::string>& stringlist,const std::list<std::string>& fixedlist,switch_channel_t *channel,bool repeat = 1); //This is used for supplemental chanvars
void process_channel_variables(const std::list<std::string>& stringlist,switch_channel_t *channel); // This is used for fixed chanvars
+ void escape_string(std::string& src);
+ std::string escape_chararray(char* src);
switch_time_t callstartdate;
switch_time_t callanswerdate;
switch_time_t callenddate;
Added: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.cpp
==============================================================================
--- (empty file)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.cpp Mon Jan 22 16:41:06 2007
@@ -0,0 +1,384 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+ * Copyright 2006, Author: Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+ *
+ * This code is largely derived from csvcdr.cpp with minor code snippets from mod_xml_curl.c and edited by
+ * Bret McDanel <trixter AT 0xdecafbad.com>
+ * The Initial Developer of the Original Code is
+ * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Bret McDanel <trixter AT 0xdecafbad.com>
+ * Anthony Minessale II <anthmct(a)yahoo.com>
+ *
+ * Description: This C++ source file describes the CurlCDR class that handles processing CDRs to HTTP endpoint.
+ * This is the standard Curl module, and has a list of predefined variables to log out which can be
+ * added to, but never have the default ones removed. If you want to use one that allows you to explicity
+ * set all data variables to be logged and in what order, then this is not the class you want to use, and
+ * one will be coming in the future to do just that.
+ *
+ * curlcdr.cpp
+ *
+ */
+
+#include <switch.h>
+#include "curlcdr.h"
+#include <string>
+#include <curl/curl.h>
+
+
+CurlCDR::CurlCDR() : BaseCDR()
+{
+ memset(formattedcallstartdate,0,100);
+ memset(formattedcallanswerdate,0,100);
+ memset(formattedcallenddate,0,100);
+}
+
+CurlCDR::CurlCDR(switch_mod_cdr_newchannel_t *newchannel) : BaseCDR(newchannel)
+{
+ memset(formattedcallstartdate,0,100);
+ memset(formattedcallanswerdate,0,100);
+ memset(formattedcalltransferdate,0,100);
+ memset(formattedcallenddate,0,100);
+
+ if(newchannel != 0)
+ {
+ switch_time_exp_t tempcallstart, tempcallanswer, tempcalltransfer, tempcallend;
+ memset(&tempcallstart,0,sizeof(tempcallstart));
+ memset(&tempcalltransfer,0,sizeof(tempcalltransfer));
+ memset(&tempcallanswer,0,sizeof(tempcallanswer));
+ memset(&tempcallend,0,sizeof(tempcallend));
+ convert_time(&tempcallstart, callstartdate);
+ convert_time(&tempcallanswer, callanswerdate);
+ convert_time(&tempcalltransfer, calltransferdate);
+ convert_time(&tempcallend, callenddate);
+
+ // Format the times
+ apr_size_t retsizecsd, retsizecad, retsizectd, retsizeced; //csd == callstartdate, cad == callanswerdate, ced == callenddate, ceff == callenddate_forfile
+ char format[] = "%Y-%m-%d %H:%M:%S";
+ switch_strftime(formattedcallstartdate,&retsizecsd,sizeof(formattedcallstartdate),format,&tempcallstart);
+ switch_strftime(formattedcallanswerdate,&retsizecad,sizeof(formattedcallanswerdate),format,&tempcallanswer);
+ switch_strftime(formattedcalltransferdate,&retsizectd,sizeof(formattedcalltransferdate),format,&tempcalltransfer);
+ switch_strftime(formattedcallenddate,&retsizeced,sizeof(formattedcallenddate),format,&tempcallend);
+
+ process_channel_variables(chanvars_fixed_list,newchannel->channel);
+ process_channel_variables(chanvars_supp_list,chanvars_fixed_list,newchannel->channel,0);
+ }
+}
+
+CurlCDR::~CurlCDR()
+{
+
+}
+
+bool CurlCDR::activated=0;
+bool CurlCDR::logchanvars=0;
+bool CurlCDR::connectionstate=0;
+modcdr_time_convert_t CurlCDR::convert_time = switch_time_exp_lt;
+const char *CurlCDR::gateway_url;
+const char *CurlCDR::gateway_credentials;
+std::list<std::string> CurlCDR::chanvars_fixed_list;
+std::list<std::string> CurlCDR::chanvars_supp_list;
+std::string CurlCDR::display_name = "CurlCDR - The HTTP CDR logger";
+std::string CurlCDR::postdata;
+
+
+void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
+{
+ switch_console_printf(SWITCH_CHANNEL_LOG, "CurlCDR::connect() - Loading configuration file.\n");
+ activated = 0; // Set it as inactive initially
+ connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
+
+ switch_console_printf(SWITCH_CHANNEL_LOG,"Checking to see if curlcdr is valid\n");
+ if ((settings = switch_xml_child(cfg, "curlcdr")))
+ {
+ switch_console_printf(SWITCH_CHANNEL_LOG,"curlcdr appears to be!!!\n");
+ int count_config_params = 0; // Need to make sure all params are set before we load
+ for (param = switch_xml_child(settings, "param"); param; param = param->next)
+ {
+ char *var = (char *) switch_xml_attr_soft(param, "name");
+ char *val = (char *) switch_xml_attr_soft(param, "value");
+
+ if (!strcmp(var, "gateway_url"))
+ {
+ if(val != 0)
+ gateway_url = val;
+ count_config_params++;
+ }
+ else if (!strcmp(var, "gateway_credentials"))
+ {
+ if(val != 0)
+ gateway_credentials=val;
+ count_config_params++;
+ }
+ else if (!strcmp(var, "chanvars_supp"))
+ {
+ if(val != 0)
+ {
+ std::string unparsed;
+ unparsed = val;
+ if(unparsed.size() > 0)
+ {
+ bool fixed = 0;
+ parse_channel_variables_xconfig(unparsed,chanvars_supp_list,fixed);
+ logchanvars=1;
+ }
+ }
+ }
+ else if (!strcmp(var, "chanvars_fixed"))
+ {
+ if(val != 0)
+ {
+ std::string unparsed;
+ unparsed = val;
+ if(unparsed.size() > 0)
+ {
+ bool fixed = 1;
+ parse_channel_variables_xconfig(unparsed,chanvars_fixed_list,fixed);
+ logchanvars=1;
+ }
+ }
+ }
+ else if(!strcmp(var,"timezone"))
+ {
+ if(!strcmp(val,"utc"))
+ convert_time = switch_time_exp_gmt;
+ else if(!strcmp(val,"local"))
+ convert_time = switch_time_exp_lt;
+ else
+ {
+ switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ convert_time = switch_time_exp_lt;
+ }
+ }
+ }
+
+ if(count_config_params > 0)
+ {
+ if(strlen(gateway_url))
+ {
+ activated = 1;
+ switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR activated");
+ }
+ else
+ switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR::connect(): You must specify a gateway_url to have the records logged to.\n");
+ }
+ else
+ switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a gateway_url to have the records logged to.\n");
+ }
+}
+
+
+
+// from Bjarne Stroustrup's page (the guy who designed and implemented C++)
+// surely his code has to be better than mine - ok he did say this was the
+// *easiest* way and made no comment on it being best :)
+std::string CurlCDR::itos(int i)
+{
+ std::stringstream s;
+ s << i;
+ return s.str();
+}
+
+std::string CurlCDR::lltos(long long ll)
+{
+ std::stringstream s;
+ s << ll;
+ return s.str();
+}
+
+
+bool CurlCDR::process_record()
+{
+ CURL *curl_handle = NULL;
+ static char curl_errorstr[CURL_ERROR_SIZE];
+ bool retval = 0;
+ char *curlescaped;
+
+
+ curl_handle = curl_easy_init();
+ if(!strncasecmp(gateway_url,"https",5)) {
+ curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYPEER,0);
+ curl_easy_setopt(curl_handle,CURLOPT_SSL_VERIFYHOST,0);
+ }
+
+ // build the HTTP POST data block
+ // WARNING - We need to make sure that the data added is properly escaped, else some sneaky person could set
+ // their CLID to "My Name&billusec=0" for example, which would result in a post of
+ // clid=My+Name&billusec=0
+ // Simply calculating the billusec in the web app wont solve this because they could play the same
+ // game with callstarttime and all of that.
+ //
+ // The solution I came up with was to use curl_easy_escape() which does a strlen() for every value,
+ // as well as a malloc of some sort, and thus requires a curl_free(). This is *not* efficient, if
+ // anyone has a better idea, that would be great. We cant rely on this after the string is assembled
+ // however because things like the real & would be escaped and that would break things.
+ //
+ // To compensate I only do this where its likely to be a problem. Preformatted dates are not likely
+ // to ever have such data in them.
+ postdata.append("callstartdate=" + lltos(callstartdate));
+ postdata.append("&formattedcallstartdate=");
+ postdata.append(formattedcallstartdate);
+ postdata.append("&callanswerdate=" + lltos(callanswerdate));
+ postdata.append("&formattedcallanswerdate=");
+ postdata.append(formattedcallanswerdate);
+ postdata.append("&calltransferdate=" + lltos(calltransferdate));
+ postdata.append("&formattedcalltransferdate=");
+ postdata.append(formattedcalltransferdate);
+ postdata.append("&callenddate=" + lltos(callenddate));
+ postdata.append("&formattedcallenddate=");
+ postdata.append(formattedcallenddate);
+ postdata.append("&hangupcause_text=");
+ postdata.append(hangupcause_text);
+ postdata.append("&hangupcause=" + itos(hangupcause));
+ postdata.append("&clid=");
+ curlescaped = curl_easy_escape(curl_handle,clid,0);
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+ postdata.append(originated==FALSE?"&originated=0":"&originated=1");
+ postdata.append("&dialplan=");
+ curlescaped = curl_easy_escape(curl_handle,dialplan,0); // admin may have used 'bad chars' in the dialplan name
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+ postdata.append("&myuuid=");
+ postdata.append(myuuid);
+ postdata.append("&destuuid=");
+ postdata.append(destuuid);
+ postdata.append("&src=");
+ curlescaped = curl_easy_escape(curl_handle,src,0);
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+ postdata.append("&dst=");
+ curlescaped = curl_easy_escape(curl_handle,dst,0);
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+ postdata.append("&srcchannel=");
+ curlescaped = curl_easy_escape(curl_handle,srcchannel,0);
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+ postdata.append("&dstchannel=");
+ curlescaped = curl_easy_escape(curl_handle,dstchannel,0);
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+ postdata.append("&ani=");
+ postdata.append(ani); // this may need to be escaped but is likely to be safe since it should be numeric
+ postdata.append("&aniii=");
+ postdata.append(aniii); // this has to be numeric to be valid
+ postdata.append("&network_addr=");
+ postdata.append(network_addr);
+ postdata.append("&lastapp=");
+ curlescaped = curl_easy_escape(curl_handle,lastapp,0);
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+ postdata.append("&lastdata=");
+ curlescaped = curl_easy_escape(curl_handle,lastdata,0);
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+
+ postdata.append("&billusec=" + lltos(billusec));
+ postdata.append("&disposition=" + itos(disposition));
+ postdata.append("&amaflags=" + itos(amaflags));
+
+ // Now to process chanvars, fixed ones first
+ if(chanvars_fixed.size() > 0 ) {
+ std::list<std::pair<std::string,std::string> >::iterator iItr, iEnd;
+ for(iItr = chanvars_fixed.begin(), iEnd = chanvars_fixed.end(); iItr != iEnd; iItr++) {
+ curlescaped = curl_easy_escape(curl_handle,iItr->second.c_str(),0);
+ if(curlescaped != (char *)NULL) {
+ postdata.append("&" + iItr->first + "=" + curlescaped);
+ curl_free(curlescaped);
+ }
+ }
+ }
+
+ if(chanvars_supp.size() > 0 ) {
+ std::map<std::string,std::string>::iterator iItr,iEnd;
+ for(iItr = chanvars_supp.begin(), iEnd = chanvars_supp.end() ; iItr != iEnd; iItr++) {
+ curlescaped = curl_easy_escape(curl_handle,iItr->second.c_str(),0);
+ if(curlescaped != (char *)NULL) {
+ postdata.append("&" + iItr->first + "=");
+ postdata.append(curlescaped);
+ curl_free(curlescaped);
+ }
+ }
+ }
+
+
+ if(!switch_strlen_zero(gateway_credentials)) {
+ curl_easy_setopt(curl_handle,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
+ curl_easy_setopt(curl_handle,CURLOPT_USERPWD,gateway_credentials);
+ }
+ curl_easy_setopt(curl_handle,CURLOPT_POST,1);
+ curl_easy_setopt(curl_handle,CURLOPT_POSTFIELDS,postdata.c_str());
+ curl_easy_setopt(curl_handle,CURLOPT_URL,gateway_url);
+ curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"freeswitch-xml/1.0");
+ curl_easy_setopt(curl_handle,CURLOPT_ERRORBUFFER,curl_errorstr);
+ if(curl_easy_perform(curl_handle)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR,"CurlCDR::process_record() - Error logging CDR record - %s\n",curl_errorstr);
+ }
+ curl_easy_cleanup(curl_handle);
+
+ retval = 1;
+ return retval;
+}
+
+bool CurlCDR::is_activated()
+{
+ return activated;
+}
+
+void CurlCDR::tempdump_record()
+{
+
+}
+
+void CurlCDR::reread_tempdumped_records()
+{
+
+}
+
+std::string CurlCDR::get_display_name()
+{
+ return display_name;
+}
+
+void CurlCDR::disconnect()
+{
+ activated = 0;
+ logchanvars = 0;
+ chanvars_fixed_list.clear();
+ chanvars_supp_list.clear();
+ connectionstate = 0;
+ switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CurlCDR... Done!");
+}
+
+AUTO_REGISTER_BASECDR(CurlCDR);
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c++
+ * indent-tabs-mode:nil
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */
Added: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.h
==============================================================================
--- (empty file)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/curlcdr.h Mon Jan 22 16:41:06 2007
@@ -0,0 +1,97 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+ * Copyright 2006, Author: Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application Call Detail Recorder module
+ *
+ * This code is largely derived from csvcdr.cpp with minor code snippets from mod_xml_curl.c and edited by
+ * Bret McDanel <trixter AT 0xdecafbad.com>
+ * The Initial Developer of the Original Code is
+ * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Bret McDanel <trixter AT 0xdecafbad.com>
+ * Anthony Minessale II <anthmct(a)yahoo.com>
+ *
+ * Description: This C++ source file describes the CurlCDR class that handles processing CDRs to HTTP endpoint.
+ * This is the standard Curl module, and has a list of predefined variables to log out which can be
+ * added to, but never have the default ones removed. If you want to use one that allows you to explicity
+ * set all data variables to be logged and in what order, then this is not the class you want to use, and
+ * one will be coming in the future to do just that.
+ *
+ * curlcdr.h
+ *
+ */
+
+#include "baseregistry.h"
+#include <switch.h>
+#include <iostream>
+#include <fstream>
+#include <list>
+#include <sstream>
+
+
+#ifndef CURLCDR
+#define CURLCDR
+
+class CurlCDR : public BaseCDR {
+ public:
+ CurlCDR();
+ CurlCDR(switch_mod_cdr_newchannel_t *newchannel);
+ //CurlCDR(const CurlCDR& copyFrom);
+ virtual ~CurlCDR();
+ virtual bool process_record();
+ virtual void connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param); // connect and disconnect need to be static because we're persisting connections until shutdown
+ virtual void disconnect();
+ virtual bool is_activated();
+ virtual void tempdump_record();
+ virtual void reread_tempdumped_records();
+ virtual std::string get_display_name();
+ virtual std::string itos(int i);
+ virtual std::string lltos(long long ll);
+
+ private:
+ static bool activated; // Is this module activated?
+ static bool connectionstate; // What is the status of the connection?
+ static bool logchanvars;
+ static modcdr_time_convert_t convert_time;
+ static const char *gateway_url; // The URL to send data to
+ static const char *gateway_credentials; // The credentials for http auth
+ static std::list<std::string> chanvars_fixed_list; // Normally this would be used, but not in this class
+ static std::list<std::string> chanvars_supp_list; // This will hold the list for all chanvars here
+ static std::string display_name;
+ static std::string postdata;
+ char formattedcallstartdate[100];
+ char formattedcallanswerdate[100];
+ char formattedcalltransferdate[100];
+ char formattedcallenddate[100];
+};
+
+#endif
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c++
+ * indent-tabs-mode:nil
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.cpp Mon Jan 22 16:41:06 2007
@@ -172,41 +172,45 @@
{
// Format the call record and proceed from here...
outputfile << "$VAR1 = {" << std::endl;
- outputfile << "\t\'callstartdate\' = \'" << callstartdate << "\'," << std::endl;
- outputfile << "\t\'formattedcallstartdate\' = \'" << formattedcallstartdate << "\'," << std::endl;
- outputfile << "\t\'callanswerdate\' = \'" << callanswerdate << "\'," << std::endl;
- outputfile << "\t\'formattedcallanswerdate\' = \'" << formattedcallanswerdate << "\'," << std::endl;
- outputfile << "\t\'calltransferdate\' = \'" << calltransferdate << "\'," << std::endl;
- outputfile << "\t\'formattedcalltransferdate\' = \'" << formattedcalltransferdate << "\'," << std::endl;
- outputfile << "\t\'callenddate\' = \'" << callenddate << "\'," << std::endl;
- outputfile << "\t\'formatcallenddate\' = \'" << formattedcallenddate << "\'," << std::endl;
- outputfile << "\t\'hangupcause\' = \'" << hangupcause_text << "\'," << std::endl;
- outputfile << "\t\'hangupcausecode\' = \'" << hangupcause << "\'," << std::endl;
- outputfile << "\t\'clid\' = \'" << clid << "\'," << std::endl;
- outputfile << "\t\'originated\' = \'" << originated << "\'," << std::endl;
- outputfile << "\t\'dialplan\' = \'" << dialplan << "\'," << std::endl;
- outputfile << "\t\'myuuid\' = \'" << myuuid << "\'," << std::endl;
- outputfile << "\t\'destuuid\' = \'" << destuuid << "\'," << std::endl;
- outputfile << "\t\'src\' = \'" << src << "\'," << std::endl;
- outputfile << "\t\'dst\' = \'" << dst << "\'," << std::endl;
- outputfile << "\t\'srcchannel\' = \'" << srcchannel << "\'," << std::endl;
- outputfile << "\t\'dstchannel\' = \'" << dstchannel << "\'," << std::endl;
- outputfile << "\t\'ani\' = \'" << ani << "\'," << std::endl;
- outputfile << "\t\'aniii\' = \'" << aniii << "\'," << std::endl;
- outputfile << "\t\'network_addr\' = \'" << network_addr << "\'," << std::endl;
- outputfile << "\t\'lastapp\' = \'" << lastapp << "\'," << std::endl;
- outputfile << "\t\'lastdata\' = \'" << lastdata << "\'," << std::endl;
- outputfile << "\t\'billusec\' = \'" << billusec << "\'," << std::endl;
- outputfile << "\t\'disposition\' = \'" << disposition << "\'," << std::endl;
- outputfile << "\t\'amaflags\' = \'" << amaflags << "\'," << std::endl;
+ outputfile << "\t\'callstartdate\' => \'" << callstartdate << "\'," << std::endl;
+ outputfile << "\t\'formattedcallstartdate\' => \'" << formattedcallstartdate << "\'," << std::endl;
+ outputfile << "\t\'callanswerdate\' => \'" << callanswerdate << "\'," << std::endl;
+ outputfile << "\t\'formattedcallanswerdate\' => \'" << formattedcallanswerdate << "\'," << std::endl;
+ outputfile << "\t\'calltransferdate\' => \'" << calltransferdate << "\'," << std::endl;
+ outputfile << "\t\'formattedcalltransferdate\' => \'" << formattedcalltransferdate << "\'," << std::endl;
+ outputfile << "\t\'callenddate\' => \'" << callenddate << "\'," << std::endl;
+ outputfile << "\t\'formattedcallenddate\' => \'" << formattedcallenddate << "\'," << std::endl;
+ outputfile << "\t\'hangupcause\' => \'" << hangupcause_text << "\'," << std::endl;
+ outputfile << "\t\'hangupcausecode\' => \'" << hangupcause << "\'," << std::endl;
+ outputfile << "\t\'clid\' => \'" << escape_chararray(clid) << "\'," << std::endl;
+ outputfile << "\t\'originated\' => \'" << originated << "\'," << std::endl;
+ outputfile << "\t\'dialplan\' => \'" << dialplan << "\'," << std::endl;
+ outputfile << "\t\'myuuid\' => \'" << myuuid << "\'," << std::endl;
+ outputfile << "\t\'destuuid\' => \'" << destuuid << "\'," << std::endl;
+ outputfile << "\t\'src\' => \'" << src << "\'," << std::endl;
+ outputfile << "\t\'dst\' => \'" << dst << "\'," << std::endl;
+ outputfile << "\t\'srcchannel\' => \'" << srcchannel << "\'," << std::endl;
+ outputfile << "\t\'dstchannel\' => \'" << dstchannel << "\'," << std::endl;
+ outputfile << "\t\'ani\' => \'" << ani << "\'," << std::endl;
+ outputfile << "\t\'aniii\' => \'" << aniii << "\'," << std::endl;
+ outputfile << "\t\'network_addr\' => \'" << network_addr << "\'," << std::endl;
+ outputfile << "\t\'lastapp\' => \'" << lastapp << "\'," << std::endl;
+ outputfile << "\t\'lastdata\' => \'" << lastdata << "\'," << std::endl;
+ outputfile << "\t\'billusec\' => \'" << billusec << "\'," << std::endl;
+ outputfile << "\t\'disposition\' => \'" << disposition << "\'," << std::endl;
+ outputfile << "\t\'amaflags\' => \'" << amaflags << "\'," << std::endl;
// Now to process chanvars
outputfile << "\t\'chanvars\' => {" << std::endl;
if(chanvars_supp.size() > 0 )
{
- std::map<std::string,std::string>::iterator iItr,iEnd;
+ std::map< std::string,std::string >::iterator iItr,iEnd;
for(iItr = chanvars_supp.begin(), iEnd = chanvars_supp.end() ; iItr != iEnd; iItr++)
- outputfile << "\t\t\'" << iItr->first << "\' = \'" << iItr->second << "\'," << std::endl;
+ {
+ escape_string(iItr->second);
+ outputfile << "\t\t\'" << iItr->first;
+ outputfile << "\' => \'" << iItr->second << "\'," << std::endl;
+ }
}
outputfile << "\t}," << std::endl << "};" << std::endl << std::endl;
retval = 1;
Modified: freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.h
==============================================================================
--- freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.h (original)
+++ freeswitch/branches/mishehu/src/mod/event_handlers/mod_cdr/pddcdr.h Mon Jan 22 16:41:06 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Bret McDanel <trixter AT 0xdecafbad.com>
*
* Description: This C++ header file describes the PddCDR class which handles formatting a CDR out to
* individual text files in a Perl Data Dumper format.
@@ -54,7 +55,6 @@
virtual void tempdump_record();
virtual void reread_tempdumped_records();
virtual std::string get_display_name();
-
private:
static bool activated; // Is this module activated?
static bool connectionstate; // What is the status of the connection?
1
0
[Freeswitch-svn] [commit] r4019 - freeswitch/trunk/src/mod/xml_int/mod_xml_rpc
by Freeswitch SVN 22 Jan '07
by Freeswitch SVN 22 Jan '07
22 Jan '07
Author: mikej
Date: Mon Jan 22 13:18:48 2007
New Revision: 4019
Modified:
freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
Log:
add "freeswitch_api" in addition to "freeswitch.api" as xmlrpc method so it can work with java.
Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Mon Jan 22 13:18:48 2007
@@ -235,6 +235,7 @@
registryP = xmlrpc_registry_new(&env);
xmlrpc_registry_add_method(&env, registryP, NULL, "freeswitch.api", &freeswitch_api, NULL);
+ xmlrpc_registry_add_method(&env, registryP, NULL,"freeswitch_api", &freeswitch_api, NULL);
MIMETypeInit();
MIMETypeAdd("text/html", "html");
1
0
22 Jan '07
Author: mikej
Date: Mon Jan 22 12:59:27 2007
New Revision: 4018
Modified:
freeswitch/trunk/libs/js/src/jsfile.c
Log:
add file object from spidermonkey.
Modified: freeswitch/trunk/libs/js/src/jsfile.c
==============================================================================
--- freeswitch/trunk/libs/js/src/jsfile.c (original)
+++ freeswitch/trunk/libs/js/src/jsfile.c Mon Jan 22 12:59:27 2007
@@ -41,9 +41,7 @@
/*
* JS File object
*/
-#if defined(JS_HAS_FILE_OBJECT) && (JS_HAS_FILE_OBJECT - 0) /* OSSP BUGFIX */
-
-#ifdef OSSP
+#ifdef OSSP_HACK
#include "../config.h"
#endif
@@ -52,7 +50,7 @@
/* ----------------- Platform-specific includes and defines ----------------- */
#if defined(XP_WIN) || defined(XP_OS2)
# include <direct.h>
-#ifdef OSSP
+#ifdef OSSP_HACK
# include <dirent.h>
# include <fcntl.h>
# include <time.h>
@@ -65,7 +63,7 @@
# define CURRENT_DIR "c:\\"
# define POPEN _popen
# define PCLOSE _pclose
-#ifdef OSSP
+#ifdef OSSP_HACK
# undef mkdir
# define mkdir(file, mode) _mkdir(file)
#endif
@@ -74,7 +72,7 @@
# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
-#ifdef OSSP
+#ifdef OSSP_HACK
# include <sys/types.h>
# include <sys/stat.h>
# include <dirent.h>
@@ -104,13 +102,13 @@
#include "jsscript.h"
#include "jsstr.h"
#include "jsutil.h" /* Added by JSIFY */
-#ifdef OSSP /* CLEANUP */
+#ifdef OSSP_HACK /* CLEANUP */
#include "jsfile.h"
#endif
#include <string.h>
/* NSPR dependencies */
-#ifdef OSSP
+#ifdef OSSP_HACK
#define PR_RDONLY 0x01
#define PR_WRONLY 0x02
#define PR_RDWR 0x04
@@ -174,7 +172,7 @@
#undef MSG_DEF
};
-#ifdef OSSP
+#ifdef OSSP_HACK
static
#endif
const JSErrorFormatString *
@@ -270,7 +268,7 @@
JSBool hasAutoflush; /* should we force a flush for each line break? */
JSBool isNative; /* if the file is using OS-specific file FILE type */
/* We can actually put the following two in a union since they should never be used at the same time */
-#ifdef OSSP
+#ifdef OSSP_HACK
FILE *handle; /* the handle for the file, if open. */
#else
PRFileDesc *handle; /* the handle for the file, if open. */
@@ -823,7 +821,7 @@
/* Buffered version of PR_Read. Used by js_FileRead */
static int32
-#ifdef OSSP
+#ifdef OSSP_HACK
js_BufferedRead(JSFile * f, unsigned char *buf, int32 len)
#else
js_BufferedRead(JSFile * f, char *buf, int32 len)
@@ -842,7 +840,7 @@
}
if (len>0) {
-#ifdef OSSP
+#ifdef OSSP_HACK
count += (!f->isNative)
? fread(buf, 1, len, f->handle)
: fread(buf, 1, len, f->nativehandle);
@@ -921,7 +919,7 @@
break;
case UCS2:
-#ifdef OSSP
+#ifdef OSSP_HACK
count = js_BufferedRead(file, (unsigned char*)buf, len*2) >> 1;
#else
count = js_BufferedRead(file, (char*)buf, len*2) >> 1;
@@ -954,7 +952,7 @@
switch (mode) {
case ASCII:
-#ifdef OSSP
+#ifdef OSSP_HACK
count = fseek(file->handle, len, SEEK_CUR);
#else
count = PR_Seek(file->handle, len, PR_SEEK_CUR);
@@ -994,7 +992,7 @@
break;
case UCS2:
-#ifdef OSSP
+#ifdef OSSP_HACK
count = fseek(file->handle, len*2, SEEK_CUR)/2;
#else
count = PR_Seek(file->handle, len*2, PR_SEEK_CUR)/2;
@@ -1030,7 +1028,7 @@
for (i = 0; i<len; i++)
aux[i] = buf[i] % 256;
-#ifdef OSSP
+#ifdef OSSP_HACK
count = (!file->isNative)
? fwrite(aux, 1, len, file->handle)
: fwrite(aux, 1, len, file->nativehandle);
@@ -1060,7 +1058,7 @@
}
i+=j;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
j = (!file->isNative)
? fwrite(utfbuf, 1, i, file->handle)
: fwrite(utfbuf, 1, i, file->nativehandle);
@@ -1078,7 +1076,7 @@
break;
case UCS2:
-#ifdef OSSP
+#ifdef OSSP_HACK
count = (!file->isNative)
? fwrite(buf, 1, len*2, file->handle) >> 1
: fwrite(buf, 1, len*2, file->nativehandle) >> 1;
@@ -1114,7 +1112,7 @@
return JS_FALSE;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
return access(file->path, F_OK) == 0;
#else
return PR_Access(file->path, PR_ACCESS_EXISTS) == PR_SUCCESS;
@@ -1127,7 +1125,7 @@
if (!file->isNative) {
if (file->isOpen && !(file->mode & PR_RDONLY))
return JS_FALSE;
-#ifdef OSSP
+#ifdef OSSP_HACK
return access(file->path, R_OK) == 0;
#else
return PR_Access(file->path, PR_ACCESS_READ_OK) == PR_SUCCESS;
@@ -1148,7 +1146,7 @@
if (!file->isNative) {
if (file->isOpen && !(file->mode & PR_WRONLY))
return JS_FALSE;
-#ifdef OSSP
+#ifdef OSSP_HACK
return access(file->path, W_OK) == 0;
#else
return PR_Access(file->path, PR_ACCESS_WRITE_OK) == PR_SUCCESS;
@@ -1168,7 +1166,7 @@
js_isFile(JSContext *cx, JSFile *file)
{
if (!file->isNative) {
-#ifdef OSSP
+#ifdef OSSP_HACK
struct stat info;
if (file->isOpen
@@ -1203,7 +1201,7 @@
js_isDirectory(JSContext *cx, JSFile *file)
{
if(!file->isNative){
-#ifdef OSSP
+#ifdef OSSP_HACK
struct stat info;
#else
PRFileInfo info;
@@ -1213,7 +1211,7 @@
if (!js_exists(cx, file))
return JS_FALSE;
-#ifdef OSSP
+#ifdef OSSP_HACK
if (file->isOpen
? fstat(fileno(file->handle), &info) != 0
: stat(file->path, &info) != 0) {
@@ -1243,7 +1241,7 @@
static jsval
js_size(JSContext *cx, JSFile *file)
{
-#ifdef OSSP
+#ifdef OSSP_HACK
struct stat info;
#else
PRFileInfo info;
@@ -1251,7 +1249,7 @@
JSFILE_CHECK_NATIVE("size");
-#ifdef OSSP
+#ifdef OSSP_HACK
if (file->isOpen
? fstat(fileno(file->handle), &info) != 0
: stat(file->path, &info) != 0) {
@@ -1495,7 +1493,7 @@
}
} else {
/* TODO: what about the permissions?? Java ignores the problem... */
-#ifdef OSSP
+#ifdef OSSP_HACK
{
int my_fd;
int my_fd_mode = 0;
@@ -1562,7 +1560,7 @@
JS_ReportWarning(cx, "Unable to close a native file, proceeding", file->path);
goto out;
}else{
-#ifdef OSSP
+#ifdef OSSP_HACK
if (file->handle && fclose(file->handle) != 0) {
#else
if(file->handle && PR_Close(file->handle)){
@@ -1599,7 +1597,7 @@
JSFILE_CHECK_NATIVE("remove");
JSFILE_CHECK_CLOSED("remove");
-#ifdef OSSP
+#ifdef OSSP_HACK
if (remove(file->path) == 0) {
#else
if ((js_isDirectory(cx, file) ?
@@ -1624,7 +1622,7 @@
{
JSFile *file = JS_GetInstancePrivate(cx, obj, &file_class, NULL);
char *dest = NULL;
-#ifdef OSSP
+#ifdef OSSP_HACK
FILE *handle = NULL;
#else
PRFileDesc *handle = NULL;
@@ -1655,7 +1653,7 @@
goto out;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
{
int my_fd;
if ((my_fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC, 0644)) != -1)
@@ -1677,7 +1675,7 @@
buffer = JS_malloc(cx, size);
-#ifdef OSSP
+#ifdef OSSP_HACK
count = INT_TO_JSVAL((int)fread(buffer, 1, (size_t)size, file->handle));
#else
count = INT_TO_JSVAL(PR_Read(file->handle, buffer, size));
@@ -1691,7 +1689,7 @@
goto out;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
count = INT_TO_JSVAL((int)fwrite(buffer, 1, (size_t)JSVAL_TO_INT(size), handle));
#else
count = INT_TO_JSVAL(PR_Write(handle, buffer, JSVAL_TO_INT(size)));
@@ -1711,7 +1709,7 @@
if(!file_close(cx, obj, 0, NULL, rval)) goto out;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
if (fclose(handle) != 0) {
#else
if(PR_Close(handle)!=PR_SUCCESS){
@@ -1725,7 +1723,7 @@
return JS_TRUE;
out:
if(file->isOpen && !fileInitiallyOpen){
-#ifdef OSSP
+#ifdef OSSP_HACK
if (fclose(file->handle) != 0) {
#else
if(PR_Close(file->handle)!=PR_SUCCESS){
@@ -1734,7 +1732,7 @@
}
}
-#ifdef OSSP
+#ifdef OSSP_HACK
if (handle && fclose(handle) != 0) {
#else
if(handle && PR_Close(handle)!=PR_SUCCESS){
@@ -1759,7 +1757,7 @@
dest = RESOLVE_PATH(cx, JS_GetStringBytes(JS_ValueToString(cx, argv[0])));
-#ifdef OSSP
+#ifdef OSSP_HACK
if (rename(file->path, dest) == 0){
#else
if (PR_Rename(file->path, dest)==PR_SUCCESS){
@@ -1788,7 +1786,7 @@
JSFILE_CHECK_NATIVE("flush");
JSFILE_CHECK_OPEN("flush");
-#ifdef OSSP
+#ifdef OSSP_HACK
if (fflush(file->handle) == 0){
#else
if (PR_Sync(file->handle)==PR_SUCCESS){
@@ -2096,7 +2094,7 @@
static JSBool
file_list(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
-#ifdef OSSP
+#ifdef OSSP_HACK
DIR *dir;
struct dirent *entry;
#else
@@ -2136,7 +2134,7 @@
goto out;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
dir = opendir(file->path);
#else
dir = PR_OpenDir(file->path);
@@ -2151,12 +2149,12 @@
array = JS_NewArrayObject(cx, 0, NULL);
len = 0;
-#ifdef OSSP
+#ifdef OSSP_HACK
while ((entry = readdir(dir))!=NULL) {
#else
while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH))!=NULL) {
#endif
-#ifdef OSSP
+#ifdef OSSP_HACK
if ( strcmp(entry->d_name, ".") == 0
|| strcmp(entry->d_name, "..") == 0)
continue;
@@ -2165,7 +2163,7 @@
if (re!=NULL) {
size_t index = 0;
-#ifdef OSSP
+#ifdef OSSP_HACK
str = JS_NewStringCopyZ(cx, entry->d_name);
#else
str = JS_NewStringCopyZ(cx, entry->name);
@@ -2180,7 +2178,7 @@
}
}else
if (func!=NULL) {
-#ifdef OSSP
+#ifdef OSSP_HACK
str = JS_NewStringCopyZ(cx, entry->d_name);
#else
str = JS_NewStringCopyZ(cx, entry->name);
@@ -2195,7 +2193,7 @@
}
}
-#ifdef OSSP
+#ifdef OSSP_HACK
filePath = js_combinePath(cx, file->path, (char*)entry->d_name);
#else
filePath = js_combinePath(cx, file->path, (char*)entry->name);
@@ -2209,7 +2207,7 @@
}
v = OBJECT_TO_JSVAL(eachFile);
JS_SetElement(cx, array, len, &v);
-#ifdef OSSP
+#ifdef OSSP_HACK
JS_SetProperty(cx, array, entry->d_name, &v);
#else
JS_SetProperty(cx, array, entry->name, &v);
@@ -2217,7 +2215,7 @@
len++;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
if (closedir(dir) != 0) {
#else
if(PR_CloseDir(dir)!=PR_SUCCESS){
@@ -2259,7 +2257,7 @@
char *fullName;
fullName = js_combinePath(cx, file->path, dirName);
-#ifdef OSSP
+#ifdef OSSP_HACK
if (mkdir(fullName, 0755) == 0) {
#else
if (PR_MkDir(fullName, 0755)==PR_SUCCESS){
@@ -2283,7 +2281,7 @@
file_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval*rval)
{
JSFile *file = JS_GetInstancePrivate(cx, obj, &file_class, NULL);
-#ifdef OSSP
+#ifdef OSSP_HACK
JSString *str;
if ((str = JS_NewStringCopyZ(cx, file->path)) == NULL)
@@ -2301,8 +2299,8 @@
JSFile *file = JS_GetInstancePrivate(cx, obj, &file_class, NULL);
char url[MAX_PATH_LENGTH];
jschar *urlChars;
-#ifdef OSSP
size_t len;
+#ifdef OSSP_HACK
JSString *str;
#endif
@@ -2311,7 +2309,7 @@
sprintf(url, "file://%s", file->path);
/* TODO: js_escape in jsstr.h may go away at some point */
-#ifdef OSSP /* BUGFIX */
+#ifdef OSSP_HACK /* BUGFIX */
len = strlen(url);
if ((urlChars = js_InflateString(cx, url, &len)) == NULL)
return JS_FALSE;
@@ -2321,7 +2319,8 @@
}
*rval = STRING_TO_JSVAL(str);
#else
- urlChars = js_InflateString(cx, url, strlen(url));
+ len = strlen(url);
+ urlChars = js_InflateString(cx, url, &len);
if (urlChars == NULL) return JS_FALSE;
*rval = STRING_TO_JSVAL(js_NewString(cx, urlChars, strlen(url), 0));
#endif
@@ -2399,7 +2398,7 @@
}
/* Internal function, used for cases which NSPR file support doesn't cover */
-#ifdef OSSP /* CLEANUP */
+#ifdef OSSP_HACK /* CLEANUP */
static
#endif
JSObject*
@@ -2514,7 +2513,7 @@
FILE_APPEND = -19,
FILE_REPLACE = -20,
FILE_AUTOFLUSH = -21,
-#ifdef OSSP /* BUGFIX */
+#ifdef OSSP_HACK /* BUGFIX */
FILE_ISNATIVE = -22
#else
FILE_ISNATIVE = -22,
@@ -2554,13 +2553,13 @@
char *bytes;
JSString *str;
jsint tiny;
-#ifdef OSSP
+#ifdef OSSP_HACK
struct stat info;
#else
PRFileInfo info;
#endif
JSBool flag;
-#ifdef OSSP
+#ifdef OSSP_HACK
struct tm *tm;
time_t t;
#else
@@ -2703,7 +2702,7 @@
case FILE_CREATED:
SECURITY_CHECK(cx, NULL, "creationTime", file);
JSFILE_CHECK_NATIVE("creationTime");
-#ifdef OSSP
+#ifdef OSSP_HACK
if (file->isOpen
? fstat(fileno(file->handle), &info) != 0
: stat(file->path, &info) != 0) {
@@ -2749,7 +2748,7 @@
case FILE_MODIFIED:
SECURITY_CHECK(cx, NULL, "lastModified", file);
JSFILE_CHECK_NATIVE("lastModified");
-#ifdef OSSP
+#ifdef OSSP_HACK
if (file->isOpen
? fstat(fileno(file->handle), &info) != 0
: stat(file->path, &info) != 0) {
@@ -2793,7 +2792,7 @@
JSFILE_CHECK_NATIVE("length");
if (js_isDirectory(cx, file)) { /* XXX debug me */
-#ifdef OSSP
+#ifdef OSSP_HACK
DIR *dir;
struct dirent *entry;
#else
@@ -2802,7 +2801,7 @@
#endif
jsint count = 0;
-#ifdef OSSP
+#ifdef OSSP_HACK
if(!(dir = opendir(file->path))){
#else
if(!(dir = PR_OpenDir(file->path))){
@@ -2812,7 +2811,7 @@
goto out;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
while ((entry = readdir(dir))) {
if ( strcmp(entry->d_name, ".") == 0
|| strcmp(entry->d_name, "..") == 0)
@@ -2824,7 +2823,7 @@
count++;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
if(closedir(dir) != 0){
#else
if(!PR_CloseDir(dir)){
@@ -2859,7 +2858,7 @@
}
if (file->isOpen && js_isFile(cx, file)) {
-#ifdef OSSP
+#ifdef OSSP_HACK
int pos = fseek(file->handle, 0, SEEK_CUR);
#else
int pos = PR_Seek(file->handle, 0, PR_SEEK_CUR);
@@ -2882,7 +2881,7 @@
/* this is some other property -- try to use the dir["file"] syntax */
if (js_isDirectory(cx, file)) {
-#ifdef OSSP
+#ifdef OSSP_HACK
DIR *dir = NULL;
struct dirent *entry = NULL;
#else
@@ -2898,7 +2897,7 @@
prop_name = JS_GetStringBytes(str);
/* no native files past this point */
-#ifdef OSSP
+#ifdef OSSP_HACK
dir = opendir(file->path);
#else
dir = PR_OpenDir(file->path);
@@ -2909,7 +2908,7 @@
return JS_FALSE;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
while ((entry = readdir(dir)) != NULL) {
if ( strcmp(entry->d_name, ".") == 0
|| strcmp(entry->d_name, "..") == 0)
@@ -2922,7 +2921,7 @@
bytes = js_combinePath(cx, file->path, prop_name);
*vp = OBJECT_TO_JSVAL(js_NewFileObject(cx, bytes));
JS_free(cx, bytes);
-#ifdef OSSP /* BUGFIX */
+#ifdef OSSP_HACK /* BUGFIX */
closedir(dir);
#else
PR_CloseDir(dir);
@@ -2930,7 +2929,7 @@
return JS_TRUE;
}
}
-#ifdef OSSP /* BUGFIX */
+#ifdef OSSP_HACK /* BUGFIX */
closedir(dir);
#else
PR_CloseDir(dir);
@@ -2977,7 +2976,7 @@
goto out;
}
-#ifdef OSSP
+#ifdef OSSP_HACK
pos = fseek(file->handle, offset, SEEK_SET);
#else
pos = PR_Seek(file->handle, offset, PR_SEEK_SET);
@@ -3108,4 +3107,3 @@
JSPROP_ENUMERATE | JSPROP_READONLY );
return file;
}
-#endif /* JS_HAS_FILE_OBJECT */
1
0