]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fixed 5 relay conditions
authorJames Zhang <jzhang@sangoma.com>
Sat, 26 Nov 2011 02:05:39 +0000 (21:05 -0500)
committerJames Zhang <jzhang@sangoma.com>
Sat, 26 Nov 2011 02:05:39 +0000 (21:05 -0500)
M UP  -> S UP
M Down -> S UP -> M UP
M UP -> S UP -> relay down -> relay up
M UP -> S UP -> Kill M -> M UP
M Up -> S UP -> relay down -> M link down -> relay up -> M link up

libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c
libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c

index 93d76fc8e7d41434c5d7220237914491ddb0ac94..468c8b0a83a77a3f6aed77b1eb307c6e59af8866 100644 (file)
@@ -1171,16 +1171,19 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
                                        sngss7_info->circuit->flags );
                
                if (!(sngss7_info->circuit->flags & SNGSS7_CONFIGURED)) {
-                       if (  !sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED) 
-                           ||(sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME))) {
+                       /* Configure the circuit if RESUME and PAUSED are not set.
+                          And also in a case when RESUME is set */
+                       if (!sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED) ||
+                            sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME)) {
                                if (ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id)) {
                                        SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", sngss7_info->circuit->id);
-                                       *(int*)0=0;
-                                       return 1;
+                                       sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
+                                       sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
                                } else {
                                        SS7_INFO("ISUP CKT %d configuration DONE!\n", sngss7_info->circuit->id);
+                                       sngss7_info->circuit->flags |= SNGSS7_CONFIGURED;
+                                       sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
                                }
-                               sngss7_info->circuit->flags |= SNGSS7_CONFIGURED;
                        }
                }
                 
@@ -1391,7 +1394,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
                        /* check the last state and return to it to allow the call to finish */
                        goto suspend_goto_last;
                }
-
+               
                if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)) {
 
                        SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_TX flag %s\n", "");
index a96dae5cdda7b51cad48fc72041115d22327d6ef..0fb496843ff2b9f0b2963c033b73fcf4102a4a27 100644 (file)
@@ -64,11 +64,9 @@ ftdm_status_t handle_relay_connect(RyMngmt *sta)
        
        SS7_INFO("Relay Channel %d connection UP\n", sng_relay->id);
        if (sng_relay->type == LRY_CT_TCP_CLIENT) {
-               if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) {
-                       if (reconfig_all_ckts_for_relay()) {
-                               SS7_ERROR("Failed to reconfigure ISUP Ckts!\n");
-                               /* we're done....this is very bad! */
-                       }
+               if (reconfig_all_ckts_for_relay()) {
+                       SS7_ERROR("Failed to reconfigure ISUP Ckts!\n");
+                       /* we're done....this is very bad! */
                }
                return FTDM_SUCCESS;
        } else if (sng_relay->type == LRY_CT_TCP_SERVER) {
index 4f184590188ad30bf369d8e99310f552cbeaa1d5..6d5880073d28fd3ed0bbe61f1e8f95281576769a 100644 (file)
@@ -2110,6 +2110,7 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
        uint8_t                         bits_ef = 0;
        int                             x;
        int                                     ret;
+       ret=0;
 
        for (x = 1; x < (ftdmspan->chan_count + 1); x++) {
        /**************************************************************************/
@@ -2147,6 +2148,10 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
 
                        /* query for the status of the ckt */
                        if (ftmod_ss7_isup_ckt_sta(sngss7_info->circuit->id, &state)) {
+                               /* NC: Circuit statistic failed: does not exist. Must re-configure circuit
+                                      Reset the circuit CONFIGURED flag so that RESUME will reconfigure
+                                      this circuit. */
+                               sngss7_info->circuit->flags &= ~SNGSS7_CONFIGURED;
                                SS7_ERROR("Failed to read isup ckt = %d status\n", sngss7_info->circuit->id);
                                continue;
                        }
@@ -2159,6 +2164,14 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
                        if (bits_cd == 0x0) {
                                /* check if circuit is UCIC or transient */
                                if (bits_ab == 0x3) {
+                                       SS7_INFO("ISUP CKT %d re-configuration pending!\n", x);
+                                       sngss7_info->circuit->flags &= ~SNGSS7_CONFIGURED;
+                                       SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
+
+                                       /* NC: The code below should be deleted. Its here for hitorical
+                                              reason. The RESUME code will reconfigure the channel since
+                                              the CONFIGURED flag has been reset */
+#if 0
                                        /* bit a and bit b are set, unequipped */
                                        ret = ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id);
                                        if (ret) {
@@ -2181,6 +2194,7 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
                        
                                        /* unlock the channel */
                                        ftdm_mutex_unlock(ftdmchan->mutex);
+#endif
 
                                } /* if (bits_ab == 0x3) */
                        } else {
@@ -2192,8 +2206,8 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
                                        break;
                                /**************************************************************************/
                                case (1):
-                                       /* locally blocked */
-                                       sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
+                                       /* locally blocked: Therefore we need to state machine to send an unblock */
+                                       sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX);
 
                                        /* set the channel to suspended state */
                                        SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
@@ -2209,7 +2223,7 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan)
                                /**************************************************************************/
                                case (3):
                                        /* both locally and remotely blocked */
-                                       sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
+                                       sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX);
                                        sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
 
                                        /* set the channel to suspended state */