]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
dont send boost restart when working sigmod is present
authorMoises Silva <moy@sangoma.com>
Wed, 25 Nov 2009 01:42:35 +0000 (01:42 +0000)
committerMoises Silva <moy@sangoma.com>
Wed, 25 Nov 2009 01:42:35 +0000 (01:42 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@901 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c
libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_client.c
libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c

index ea5c3175b1362f113f17cf168c4bf317792517b1..c29df99f1b48bb47cdbd24aa23abac63c1069112 100644 (file)
@@ -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;
                }
index f2021d539284032d480505911a488ad9b3a10619..2030500ffca64fb515fc2253a379af3c8fe4746b 100644 (file)
@@ -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), 
index f7dbb042adcdefd363932b8af402ae437419eabc..f239d59f8c3d200bcc143920f751d25f73ac92b4 100644 (file)
  * 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 <moy@sangoma.com>
+ * David Yatzin <davidy@sangoma.com>
+ * Nenad Corbic <ncorbic@sangoma.com>
+ *
  */
 
 #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