]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweaks
authorBrian West <brian@freeswitch.org>
Tue, 15 Jul 2008 14:41:08 +0000 (14:41 +0000)
committerBrian West <brian@freeswitch.org>
Tue, 15 Jul 2008 14:41:08 +0000 (14:41 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9033 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_cpp.h
src/switch_cpp.cpp

index a0990ae74a28bc3007df0f2dcc48b5b58b7c6425..a87ad4ff2fef7bf4ef1a730d1dfa3b6bbca425ad 100644 (file)
@@ -13,7 +13,31 @@ extern "C" {
 #define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
 #define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
 #define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
-#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&caller_profile, 0, sizeof(caller_profile)); memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown";  caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = "";  caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
+#define init_vars() allocated = 0;                                             \
+       session = NULL;                                                                         \
+       channel = NULL;                                                                         \
+       uuid = NULL;                                                                            \
+       tts_name = NULL;                                                                        \
+       voice_name = NULL;                                                                      \
+       xml_cdr_text = NULL;                                                            \
+       memset(&caller_profile, 0, sizeof(caller_profile)); \
+       memset(&args, 0, sizeof(args));                                         \
+       ap = NULL;                                                                                      \
+       caller_profile.source = "mod_unknown";                          \
+       caller_profile.dialplan = "";                                           \
+       caller_profile.context = "";                                            \
+       caller_profile.caller_id_name = "";                                     \
+       caller_profile.caller_id_number = "";                           \
+       caller_profile.network_addr = "";                                       \
+       caller_profile.ani = "";                                                        \
+       caller_profile.aniii = "";                                                      \
+       caller_profile.rdnis = "";                                                      \
+       caller_profile.username = "";                                           \
+       on_hangup = NULL;                                                                       \
+       memset(&cb_state, 0, sizeof(cb_state));                         \
+       hook_state = CS_NEW;                                                            \
+       fhp = NULL
+
 //// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch@cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution//
 #if 0
 #ifndef SWITCHTOMEMPOOL
index 46d28341526bb6a59a9d197856a7ee69a784bc98..a91306fe277ff26e44048d26ff19ea0931c45b74 100644 (file)
@@ -1124,8 +1124,6 @@ SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *sess
 SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *result)
 {
        
-    switch_file_handle_t *fh = NULL;      
-
        this_check(SWITCH_STATUS_FALSE);
        sanity_check(SWITCH_STATUS_FALSE);
        
@@ -1134,20 +1132,6 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
     }
 
        if (fhp) {
-               fh = fhp;
-       }
-
-       if (fh) {
-               if (!fh) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because fh is null\n");
-                       return SWITCH_STATUS_FALSE;     
-               }
-               
-               if (!fh->file_interface) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because fh->file_interface is null\n");
-                       return SWITCH_STATUS_FALSE;     
-               }
-               
                if (!strncasecmp(result, "speed", 4)) {
                        char *p;
                
@@ -1158,10 +1142,10 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
                                        if (!(step = atoi(p))) {
                                                step = 1;
                                        }
-                                       fh->speed += step;
+                                       fhp->speed += step;
                                } else {
                                        int speed = atoi(p);
-                                       fh->speed = speed;
+                                       fhp->speed = speed;
                                }
                                return SWITCH_STATUS_SUCCESS;
                        }
@@ -1169,18 +1153,18 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
                        return SWITCH_STATUS_FALSE;
 
                } else if (!strcasecmp(result, "pause")) {
-                       if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
-                               switch_clear_flag(fh, SWITCH_FILE_PAUSE);
+                       if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) {
+                               switch_clear_flag(fhp, SWITCH_FILE_PAUSE);
                        } else {
-                               switch_set_flag(fh, SWITCH_FILE_PAUSE);
+                               switch_set_flag(fhp, SWITCH_FILE_PAUSE);
                        }
                        return SWITCH_STATUS_SUCCESS;
                } else if (!strcasecmp(result, "stop")) {
                        return SWITCH_STATUS_FALSE;
                } else if (!strcasecmp(result, "restart")) {
                        unsigned int pos = 0;
-                       fh->speed = 0;
-                       switch_core_file_seek(fh, &pos, 0, SEEK_SET);
+                       fhp->speed = 0;
+                       switch_core_file_seek(fhp, &pos, 0, SEEK_SET);
                        return SWITCH_STATUS_SUCCESS;
                } else if (!strncasecmp(result, "seek", 4)) {
                        switch_codec_t *codec;
@@ -1199,18 +1183,18 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
                                        if (step > 0) {
                                                samps = step * (codec->implementation->samples_per_second / 1000);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-                                               switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
+                                               switch_core_file_seek(fhp, &pos, samps, SEEK_CUR);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
                                        } else {
                                                samps = step * (codec->implementation->samples_per_second / 1000);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-                                               switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
+                                               switch_core_file_seek(fhp, &pos, fhp->pos - samps, SEEK_SET);
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
                                        }
                                } else {
                                        samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-                                       switch_core_file_seek(fh, &pos, samps, SEEK_SET);
+                                       switch_core_file_seek(fhp, &pos, samps, SEEK_SET);
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
                                }
                        }
@@ -1218,6 +1202,7 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
                        return SWITCH_STATUS_SUCCESS;
                }
        }
+
     if (!strcmp(result, "true") || !strcmp(result, "undefined")) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "return success\n");
                return SWITCH_STATUS_SUCCESS;