[Freeswitch-svn] [commit] r6163 - in freeswitch/trunk: conf src src/include/private

Freeswitch SVN anthm at freeswitch.org
Mon Nov 5 13:45:26 EST 2007


Author: anthm
Date: Mon Nov  5 13:45:26 2007
New Revision: 6163

Modified:
   freeswitch/trunk/conf/switch.conf.xml
   freeswitch/trunk/src/include/private/switch_core_pvt.h
   freeswitch/trunk/src/switch_core.c
   freeswitch/trunk/src/switch_utils.c

Log:
make mailer app name a config option

Modified: freeswitch/trunk/conf/switch.conf.xml
==============================================================================
--- freeswitch/trunk/conf/switch.conf.xml	(original)
+++ freeswitch/trunk/conf/switch.conf.xml	Mon Nov  5 13:45:26 2007
@@ -8,6 +8,8 @@
     <param name="loglevel" value="debug"/>
     <!--Try to catch any crashes that can be recoverable (in the context of a call)-->
     <param name="crash-protection" value="false"/>
+    <param name="mailer-app" value="sendmail"/>
+    <param name="mailer-app-args" value="-t"/>
     <!--RTP port range -->
     <!--<param name="rtp-start-port" value="16384"/>-->
     <!--<param name="rtp-end-port" value="32768"/>-->

Modified: freeswitch/trunk/src/include/private/switch_core_pvt.h
==============================================================================
--- freeswitch/trunk/src/include/private/switch_core_pvt.h	(original)
+++ freeswitch/trunk/src/include/private/switch_core_pvt.h	Mon Nov  5 13:45:26 2007
@@ -171,6 +171,8 @@
 	int32_t sps;
 	int32_t sps_last;
 	switch_log_level_t hard_log_level;
+	char *mailer_app;
+	char *mailer_app_args;
 };
 
 extern struct switch_runtime runtime;

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Mon Nov  5 13:45:26 2007
@@ -542,6 +542,8 @@
 
 	switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
 	runtime.hard_log_level = SWITCH_LOG_DEBUG;
+	runtime.mailer_app = "sendmail";
+	runtime.mailer_app_args = "-t";
 
 	/* INIT APR and Create the pool context */
 	if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
@@ -595,6 +597,10 @@
 
                     switch_core_session_ctl(SCSC_LOGLEVEL, &level);
 					
+				} else if (!strcasecmp(var, "mailer-app")) {
+					runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val);
+				} else if (!strcasecmp(var, "mailer-app-args")) {
+					runtime.mailer_app_args = switch_core_strdup(runtime.memory_pool, val);
 				} else if (!strcasecmp(var, "sessions-per-second")) {
 					switch_core_sessions_per_second(atoi(val));
 				} else if (!strcasecmp(var, "max-sessions")) {

Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c	(original)
+++ freeswitch/trunk/src/switch_utils.c	Mon Nov  5 13:45:26 2007
@@ -33,6 +33,7 @@
 #ifndef WIN32
 #include <arpa/inet.h>
 #endif
+#include "private/switch_core_pvt.h"
 
 static const char switch_b64_table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 #define B64BUFFLEN 1024
@@ -179,7 +180,7 @@
     if (ifd) {
         close(ifd);
     }
-    snprintf(buf, B64BUFFLEN, "/bin/cat %s | /usr/sbin/sendmail -tf \"%s\" %s", filename, from, to);
+    snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s", filename, runtime.mailer_app, runtime.mailer_app_args);
     if(system(buf)) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n", buf);
     }



More information about the Freeswitch-svn mailing list