From 288455cfe2a9a2e7723f1e075e66c2a9cc3d7461 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 22 Jun 2011 17:05:09 -0400 Subject: [PATCH] freetdm: add some extra logging in ftmod_zt and ftmod_analog --- libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c | 1 + libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index b747162702..27eecb4f7f 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -932,6 +932,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) ftdm_channel_lock(closed_chan); if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Going onhook"); ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL); } diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index b66eb0bb6f..982412d334 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -725,7 +725,7 @@ static FIO_COMMAND_FUNCTION(zt_command) { int command = ZT_OFFHOOK; if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "OFFHOOK Failed"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "OFFHOOK Failed"); return FTDM_FAIL; } ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); @@ -735,7 +735,7 @@ static FIO_COMMAND_FUNCTION(zt_command) { int command = ZT_ONHOOK; if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ONHOOK Failed"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "ONHOOK Failed"); return FTDM_FAIL; } ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); @@ -745,7 +745,7 @@ static FIO_COMMAND_FUNCTION(zt_command) { int command = ZT_FLASH; if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "FLASH Failed"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "FLASH Failed"); return FTDM_FAIL; } } @@ -754,7 +754,7 @@ static FIO_COMMAND_FUNCTION(zt_command) { int command = ZT_WINK; if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "WINK Failed"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "WINK Failed"); return FTDM_FAIL; } } @@ -763,7 +763,7 @@ static FIO_COMMAND_FUNCTION(zt_command) { int command = ZT_RING; if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Ring Failed"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "RING Failed"); return FTDM_FAIL; } ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_RINGING); @@ -773,7 +773,7 @@ static FIO_COMMAND_FUNCTION(zt_command) { int command = ZT_RINGOFF; if (ioctl(ftdmchan->sockfd, codes.HOOK, &command)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Ring-off failed"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Ring-off Failed"); return FTDM_FAIL; } ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_RINGING);