]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add core-db-inner-pre-trans-execute and core-db-inner-post-trans-execute to switch...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 26 Apr 2012 16:28:47 +0000 (11:28 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 26 Apr 2012 16:28:47 +0000 (11:28 -0500)
src/include/private/switch_core_pvt.h
src/switch_core.c
src/switch_core_sqldb.c

index f1d58688e46ae58fee4c0bd162d340882bf0c80f..781f0e4d068c2e297ef6340c97edb622f5a5fa47 100644 (file)
@@ -263,6 +263,8 @@ struct switch_runtime {
        uint32_t time_sync;
        char *core_db_pre_trans_execute;
        char *core_db_post_trans_execute;
+       char *core_db_inner_pre_trans_execute;
+       char *core_db_inner_post_trans_execute;
 };
 
 extern struct switch_runtime runtime;
index 5f47c68f0e0c7c2ae1fc94ea8cfb1ae728b3c243..adb9338f68e0e4f6fa31f9cd24aeddacc0c06e09 100644 (file)
@@ -1727,6 +1727,10 @@ static void switch_load_core_config(const char *file)
                                        runtime.core_db_pre_trans_execute = switch_core_strdup(runtime.memory_pool, val);
                                } else if (!strcasecmp(var, "core-db-post-trans-execute") && !zstr(val)) {
                                        runtime.core_db_post_trans_execute = switch_core_strdup(runtime.memory_pool, val);
+                               } else if (!strcasecmp(var, "core-db-inner-pre-trans-execute") && !zstr(val)) {
+                                       runtime.core_db_inner_pre_trans_execute = switch_core_strdup(runtime.memory_pool, val);
+                               } else if (!strcasecmp(var, "core-db-inner-post-trans-execute") && !zstr(val)) {
+                                       runtime.core_db_inner_post_trans_execute = switch_core_strdup(runtime.memory_pool, val);
                                } else if (!strcasecmp(var, "mailer-app") && !zstr(val)) {
                                        runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val);
                                } else if (!strcasecmp(var, "mailer-app-args") && val) {
index eed753b840fe792107f6e42746d37d75c0ee6e2f..d6c64758aa0ca6ec9e13ec34105938b0e9ed457c 100644 (file)
@@ -734,7 +734,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
        if (!zstr(runtime.core_db_pre_trans_execute)) {
                switch_cache_db_execute_sql_real(dbh, runtime.core_db_pre_trans_execute, &errmsg);
                if (errmsg) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC [%s]\n", errmsg);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC %s [%s]\n", runtime.core_db_pre_trans_execute, errmsg);
                        free(errmsg);
                }
        }
@@ -789,6 +789,15 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
                break;
        }
 
+
+       if (!zstr(runtime.core_db_inner_pre_trans_execute)) {
+               switch_cache_db_execute_sql_real(dbh, runtime.core_db_inner_pre_trans_execute, &errmsg);
+               if (errmsg) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC %s [%s]\n", runtime.core_db_inner_pre_trans_execute, errmsg);
+                       free(errmsg);
+               }
+       }
+
        while (retries > 0) {
 
                switch_cache_db_execute_sql(dbh, sql, &errmsg);
@@ -809,6 +818,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
                }
        }
 
+       if (!zstr(runtime.core_db_inner_post_trans_execute)) {
+               switch_cache_db_execute_sql_real(dbh, runtime.core_db_inner_post_trans_execute, &errmsg);
+               if (errmsg) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC %s [%s]\n", runtime.core_db_inner_post_trans_execute, errmsg);
+                       free(errmsg);
+               }
+       }
+
  done:
 
        if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
@@ -821,7 +838,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
        if (!zstr(runtime.core_db_post_trans_execute)) {
                switch_cache_db_execute_sql_real(dbh, runtime.core_db_post_trans_execute, &errmsg);
                if (errmsg) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC [%s]\n", errmsg);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL POST TRANS EXEC %s [%s]\n", runtime.core_db_post_trans_execute, errmsg);
                        free(errmsg);
                }
        }