From 360638f0dcd6f9de39a731070bedafec336a889a Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 25 Nov 2009 01:42:35 +0000 Subject: [PATCH] dont send boost restart when working sigmod is present git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@901 a93c3328-9c30-0410-af19-c9cd2b2d52af --- .../ozmod_sangoma_boost/ozmod_sangoma_boost.c | 43 +++++++++++-------- .../sangoma_boost_client.c | 4 +- .../src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c | 9 +++- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c index ea5c3175b1..c29df99f1b 100644 --- a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c +++ b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c @@ -246,13 +246,12 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request) zap_status_t status = ZAP_FAIL; sangoma_boost_request_id_t r; sangomabc_event_t event = {0}; - int sanity = 5000; + int boost_request_timeout = 5000; sangoma_boost_request_status_t st; char ani[128] = ""; char *gr = NULL; uint32_t count = 0; int tg=0; - if (zap_test_flag(span, ZAP_SPAN_SUSPENDED)) { zap_log(ZAP_LOG_CRIT, "SPAN is not online.\n"); *zchan = NULL; @@ -340,12 +339,12 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request) while(zap_running() && OUTBOUND_REQUESTS[r].status == BST_WAITING) { zap_sleep(1); - if (--sanity <= 0) { + if (--boost_request_timeout <= 0) { status = ZAP_FAIL; *zchan = NULL; + zap_log(ZAP_LOG_CRIT, "Timed out waiting for boost channel request response\n"); goto done; } - //printf("WTF %d\n", sanity); } if (OUTBOUND_REQUESTS[r].status == BST_READY && OUTBOUND_REQUESTS[r].zchan) { @@ -1160,6 +1159,9 @@ static zap_status_t zap_boost_connection_open(zap_span_t *span) if (sangoma_boost_data->sigmod->start_span(span) != ZAP_SUCCESS) { return ZAP_FAIL; } + zap_clear_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RESTARTING); + zap_clear_flag_locked(span, ZAP_SPAN_SUSPENDED); + zap_clear_flag((&sangoma_boost_data->mcon), MSU_FLAG_DOWN); } sangoma_boost_data->pcon = sangoma_boost_data->mcon; @@ -1283,27 +1285,30 @@ static void *zap_sangoma_boost_run(zap_thread_t *me, void *obj) } init_outgoing_array(); - - sangomabc_exec_commandp(pcon, - 0, - 0, - -1, - SIGBOOST_EVENT_SYSTEM_RESTART, - 0); - zap_set_flag(mcon, MSU_FLAG_DOWN); + if (!sangoma_boost_data->sigmod) { + sangomabc_exec_commandp(pcon, + 0, + 0, + -1, + SIGBOOST_EVENT_SYSTEM_RESTART, + 0); + zap_set_flag(mcon, MSU_FLAG_DOWN); + } while (zap_test_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING)) { sangomabc_event_t *event = NULL; int activity = 0; if (!zap_running()) { - sangomabc_exec_commandp(pcon, - 0, - 0, - -1, - SIGBOOST_EVENT_SYSTEM_RESTART, - 0); - zap_set_flag(mcon, MSU_FLAG_DOWN); + if (!sangoma_boost_data->sigmod) { + sangomabc_exec_commandp(pcon, + 0, + 0, + -1, + SIGBOOST_EVENT_SYSTEM_RESTART, + 0); + zap_set_flag(mcon, MSU_FLAG_DOWN); + } zap_log(ZAP_LOG_DEBUG, "zap is no longer running\n"); break; } diff --git a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c index f2021d5392..2030500ffc 100644 --- a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c +++ b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c @@ -75,7 +75,7 @@ static void sangomabc_print_event_call(sangomabc_connection_t *mcon, sangomabc_e { if (event->event_id == SIGBOOST_EVENT_HEARTBEAT) return; - zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT: %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n", + zap_log(file, func, line, ZAP_LOG_LEVEL_DEBUG, "%s EVENT: %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n", dir ? "TX":"RX", sangomabc_event_id_name(event->event_id), event->event_id, @@ -93,7 +93,7 @@ static void sangomabc_print_event_short(sangomabc_connection_t *mcon, sangomabc_ { if (event->event_id == SIGBOOST_EVENT_HEARTBEAT) return; - zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT (%s): %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i \n", + zap_log(file, func, line, ZAP_LOG_LEVEL_DEBUG, "%s EVENT (%s): %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i \n", dir ? "TX":"RX", priority ? "P":"N", sangomabc_event_id_name(event->event_id), diff --git a/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c b/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c index f7dbb042ad..f239d59f8c 100644 --- a/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c +++ b/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c @@ -29,6 +29,13 @@ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Contributors: + * + * Moises Silva + * David Yatzin + * Nenad Corbic + * */ #ifdef __sun @@ -62,7 +69,7 @@ #define sangoma_create_socket_intr sangoma_open_api_span_chan #endif -/*! Starting with libsangoma 3 we can use the new libsangoma waitable API, the poor souls of those using a release were LIBSANGOMA version +/*! Starting with libsangoma 3 we can use the new libsangoma waitable API, the poor souls of those using a release where LIBSANGOMA version * is defined but the version is not higher or equal to 3.0.0 will be forced to upgrade * */ #ifdef LIBSANGOMA_VERSION