[asterisk-commits] moy: branch moy/mfcr2 r126273 - /team/moy/mfcr2/channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jun 28 21:41:22 CDT 2008


Author: moy
Date: Sat Jun 28 21:41:20 2008
New Revision: 126273

URL: http://svn.digium.com/view/asterisk?view=rev&rev=126273
Log:
updated usage of logging directory openr2 API

Modified:
    team/moy/mfcr2/channels/chan_zap.c

Modified: team/moy/mfcr2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2/channels/chan_zap.c?view=diff&rev=126273&r1=126272&r2=126273
==============================================================================
--- team/moy/mfcr2/channels/chan_zap.c (original)
+++ team/moy/mfcr2/channels/chan_zap.c Sat Jun 28 21:41:20 2008
@@ -8808,6 +8808,7 @@
 				if (!zap_r2) {
 					ast_log(LOG_WARNING, "Cannot get another R2 zap context!\n");
 				} else if (!zap_r2->protocol_context){
+					char tmplogdir[] = "/tmp";
 					zap_r2->protocol_context = openr2_context_new(&zt_r2_mf_iface, &zt_r2_event_iface, 
 							&zt_r2_transcode_iface, mfcr2_cur_variant, mfcr2_cur_max_ani, mfcr2_cur_max_dnis);
 					if (!zap_r2->protocol_context) {
@@ -8821,16 +8822,22 @@
 					openr2_context_set_mf_back_timeout(zap_r2->protocol_context, mfcr2_cur_mfback_timeout);
 					openr2_context_set_metering_pulse_timeout(zap_r2->protocol_context, mfcr2_cur_metering_pulse_timeout);
 					if (ast_strlen_zero(mfcr2_cur_logdir)) {
-						openr2_context_set_log_directory(zap_r2->protocol_context, "/tmp");
+						if (openr2_context_set_log_directory(zap_r2->protocol_context, tmplogdir)) {
+							ast_log(LOG_ERROR, "Failed setting default MFC/R2 log directory %s\n", tmplogdir);
+						}
 					} else {
 						snres = snprintf(logdir, sizeof(logdir), "%s/%s/%s", ast_config_AST_LOG_DIR, "mfcr2", mfcr2_cur_logdir);
 						if (snres >= sizeof(logdir)) {
-							ast_log(LOG_ERROR, "MFC/R2 logging directory truncated, using /tmp\n");
-							openr2_context_set_log_directory(zap_r2->protocol_context, logdir);
+							ast_log(LOG_ERROR, "MFC/R2 logging directory truncated, using %s\n", tmplogdir);
+							if (openr2_context_set_log_directory(zap_r2->protocol_context, tmplogdir)) {
+								ast_log(LOG_ERROR, "Failed setting default MFC/R2 log directory %s\n", tmplogdir);
+							}
 						} else {
-							openr2_context_set_log_directory(zap_r2->protocol_context, logdir);
-						}	
-					}	
+							if (openr2_context_set_log_directory(zap_r2->protocol_context, logdir)) {
+								ast_log(LOG_ERROR, "Failed setting default MFC/R2 log directory %s\n", logdir);
+							}
+						}
+					}
 					ast_cond_init(&zap_r2->do_monitor, NULL);
 					ast_mutex_init(&zap_r2->monitored_count_lock);
 					zap_r2->monitored_count = 0;




More information about the asterisk-commits mailing list