]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make mailer app name a config option
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 5 Nov 2007 18:45:26 +0000 (18:45 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 5 Nov 2007 18:45:26 +0000 (18:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6163 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/switch.conf.xml
src/include/private/switch_core_pvt.h
src/switch_core.c
src/switch_utils.c

index 98c49f426f7f63ceaa361d221be76b68f030af86..f30ac7cb835164b9e6ed8e30946fcc8c66f44863 100644 (file)
@@ -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"/>-->
index af75dc9d31ea1a5ad55f8a23c9248902ae9ddea0..184dedb346d0897ec7373de76e9983f55c5467cb 100644 (file)
@@ -171,6 +171,8 @@ struct switch_runtime {
        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;
index 25b96547d552cc15c03a12e7dfaa82095e50ce34..122d9e16db7bb5fe1451718c2f0a0e6090b5d121 100644 (file)
@@ -542,6 +542,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(const char *console, switch_cor
 
        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_DECLARE(switch_status_t) switch_core_init(const char *console, switch_cor
 
                     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")) {
index 0d250828a54b22fe9efdde07a4169cbd13da704c..816cd731dbe269c0881d5681c7c4cd44f41c23f7 100644 (file)
@@ -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 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(char *to, char *from, char *he
     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);
     }