/* FUNCTIONS ******************************************************************/ ftdm_status_t handle_relay_connect(RyMngmt *sta) { sng_relay_t *sng_relay = &g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id]; if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) { /* SS7_INFO("Relay Channel %d initial connection UP\n", sng_relay->id); */ sngss7_set_flag(sng_relay, SNGSS7_RELAY_INIT); } 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! */ } } return FTDM_SUCCESS; } else if (sng_relay->type == LRY_CT_TCP_SERVER) { ftmod_ss7_enable_grp_mtp3Link(sta->t.usta.s.ryUpUsta.id); /* unbloock the ckts on the client system */ return FTDM_SUCCESS; } return FTDM_FAIL; }
ftdm_status_t block_all_ckts_for_relay(uint32_t procId) { int x; SS7_INFO("BLOcking all ckts on ProcID = %d\n", procId); /* we just lost connection to this procId, send out a block for all these circuits */ x = (procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { /**************************************************************************/ if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { /* send out a BLO */ sng_cc_sta_request (1, 0, 0, g_ftdm_sngss7_data.cfg.isupCkt[x].id, 0, SIT_STA_CIRBLOREQ, NULL); } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */ /* move along */ x++; /**************************************************************************/ } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ return FTDM_SUCCESS; }
static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId) { int x; int ret; /* we just got connection to this procId, send out a unblock for all these circuits * since we blocked them when we lost the connection */ x = (procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { /**************************************************************************/ if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { /* send a block request via stack manager */ ret = ftmod_ss7_unblock_isup_ckt(g_ftdm_sngss7_data.cfg.isupCkt[x].id); if (ret) { SS7_INFO("Successfully unblocked CIC:%d(ckt:%d) due to Relay connection\n", g_ftdm_sngss7_data.cfg.isupCkt[x].cic, g_ftdm_sngss7_data.cfg.isupCkt[x].id); } else { SS7_ERROR("Failed to unblock CIC:%d(ckt:%d) due to Relay connection\n", g_ftdm_sngss7_data.cfg.isupCkt[x].cic, g_ftdm_sngss7_data.cfg.isupCkt[x].id); } } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */ /* move along */ x++; /**************************************************************************/ } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ return FTDM_SUCCESS; }
ftdm_status_t reconfig_all_ckts_for_relay(void) { #if 1 int x; int ret; x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { ret = ftmod_ss7_isup_ckt_config(x); if (ret) { SS7_CRITICAL("ISUP CKT %d configuration FAILED (%d)!\n", x, ret); return 1; } else { SS7_INFO("ISUP CKT %d configuration DONE!\n", x); } } /* if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */ /* set the SNGSS7_CONFIGURED flag */ g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= SNGSS7_CONFIGURED; x++; } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ #endif return FTDM_SUCCESS; }
ftdm_status_t disable_all_sigs_for_relay(uint32_t procId) { SS7_INFO("Disalbing all sig links on ProcID = %d\n", procId); ftmod_ss7_disable_grp_mtp3Link(procId); return FTDM_SUCCESS; }
ftdm_status_t disble_all_mtp2_sigs_for_relay(void) { /* check if there is a local mtp2 link*/ if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2_STARTED)) { SS7_INFO("Disalbing all mtp2 sig links on local system\n"); ftmod_ss7_disable_grp_mtp2Link(1); } return FTDM_SUCCESS; }
static int ftmod_ss7_general_configuration(void) { if(sng_cfg_mtp1_gen(&g_ftdm_sngss7_data.cfg)) { SS7_ERROR("General configuration for MTP1 failed!\n"); return FTDM_FAIL; } else { SS7_INFO("General configuration for MTP1 was successful\n"); } if(sng_cfg_mtp2_gen(&g_ftdm_sngss7_data.cfg)) { SS7_ERROR("General configuration for MTP2 failed!\n"); return FTDM_FAIL; } else { SS7_INFO("General configuration for MTP2 was successful\n"); } if(sng_cfg_mtp3_gen(&g_ftdm_sngss7_data.cfg)) { SS7_ERROR("General configuration for MTP3 failed!\n"); return FTDM_FAIL; } else { SS7_INFO("General configuration for MTP3 was successful\n"); } if(sng_cfg_isup_gen(&g_ftdm_sngss7_data.cfg)) { SS7_ERROR("General configuration for ISUP failed!\n"); return FTDM_FAIL; } else { SS7_INFO("General configuration for ISUP was successful\n"); } if(sng_cfg_cc_gen(&g_ftdm_sngss7_data.cfg)) { SS7_ERROR("General configuration for Call-Control failed!\n"); return FTDM_FAIL; } else { SS7_INFO("General configuration for Call-Control was successful\n"); } return FTDM_SUCCESS; }
ftdm_status_t enable_all_ckts_for_relay(void) { sngss7_chan_data_t *sngss7_info = NULL; sng_isup_inf_t *sngIntf = NULL; ftdm_channel_t *ftdmchan = NULL; int x; SS7_INFO("Enabling all ckts becuase of Relay connection\n"); x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { /**********************************************************************/ /* make sure this is voice channel */ if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCkt[x].id, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", g_ftdm_sngss7_data.cfg.isupCkt[x].id); x++; continue; } /* bring the relay_down flag down */ sngss7_clear_ckt_flag(sngss7_info, FLAG_RELAY_DOWN); sngIntf = &g_ftdm_sngss7_data.cfg.isupIntf[g_ftdm_sngss7_data.cfg.isupCkt[x].infId]; /* check if the interface is paused or resumed */ if (sngss7_test_flag(sngIntf, SNGSS7_PAUSED)) { /* don't bring the channel resume flag up...the interface is down */ SS7_DEBUG_CHAN(ftdmchan, "ISUP interface (%d) set to paused, not resuming channel\n", sngIntf->id); } else { SS7_DEBUG_CHAN(ftdmchan, "ISUP interface (%d) set to resume, resuming channel\n", sngIntf->id); /* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */ sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME); sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); } } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */ /* move along */ x++; /**********************************************************************/ } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ return FTDM_SUCCESS; }
ftdm_status_t disable_all_ckts_for_relay(void) { sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; int x; SS7_INFO("Disabling all ckts becuase of Relay loss\n"); x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { /**********************************************************************/ /* make sure this is voice channel */ if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) { /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCkt[x].id, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", g_ftdm_sngss7_data.cfg.isupCkt[x].id); x++; continue; } /* throw the relay_down flag */ sngss7_set_ckt_flag(sngss7_info, FLAG_RELAY_DOWN); /* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */ sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */ /* move along */ x++; /**********************************************************************/ } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ return FTDM_SUCCESS; }
/* FUNCTIONS ******************************************************************/ int ft_to_sngss7_activate_all(void) { int x; x = 1; while (x < (MAX_ISAPS)) { /* check if this link has already been actived */ if ((g_ftdm_sngss7_data.cfg.isap[x].id != 0) && (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_ACTIVE))) { if (ftmod_ss7_enable_isap(x)) { SS7_CRITICAL("ISAP %d Enable: NOT OK\n", x); return 1; } else { SS7_INFO("ISAP %d Enable: OK\n", x); } /* set the SNGSS7_ACTIVE flag */ g_ftdm_sngss7_data.cfg.isap[x].flags |= SNGSS7_ACTIVE; } /* if !SNGSS7_ACTIVE */ x++; } /* while (x < (MAX_ISAPS)) */ if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){ x = 1; while (x < (MAX_NSAPS)) { /* check if this link has already been actived */ if ((g_ftdm_sngss7_data.cfg.nsap[x].id != 0) && (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_ACTIVE))) { if (ftmod_ss7_enable_nsap(x)) { SS7_CRITICAL("NSAP %d Enable: NOT OK\n", x); return 1; } else { SS7_INFO("NSAP %d Enable: OK\n", x); } /* set the SNGSS7_ACTIVE flag */ g_ftdm_sngss7_data.cfg.nsap[x].flags |= SNGSS7_ACTIVE; } /* if !SNGSS7_ACTIVE */ x++; } /* while (x < (MAX_NSAPS)) */ if (g_ftdm_sngss7_data.cfg.mtpRoute[1].id != 0) { x = 1; while (x < (MAX_MTP_LINKSETS+1)) { /* check if this link has already been actived */ if ((g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) && (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_ACTIVE))) { if (ftmod_ss7_enable_mtpLinkSet(x)) { SS7_CRITICAL("LinkSet \"%s\" Enable: NOT OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); return 1; } else { SS7_INFO("LinkSet \"%s\" Enable: OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); } /* set the SNGSS7_ACTIVE flag */ g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= SNGSS7_ACTIVE; } /* if !SNGSS7_ACTIVE */ x++; } /* while (x < (MAX_MTP_LINKSETS+1)) */ } } if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){ return ftmod_ss7_m2ua_start(); } return 0; }
/* FUNCTIONS ******************************************************************/ int ft_to_sngss7_activate_all(void) { int x; x = 1; while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) { /* check if this link has already been actived */ if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_ACTIVE)) { if (ftmod_ss7_enable_isap(x)) { SS7_CRITICAL("ISAP %d Enable: NOT OK\n", x); return 1; } else { SS7_INFO("ISAP %d Enable: OK\n", x); } /* set the SNGSS7_ACTIVE flag */ g_ftdm_sngss7_data.cfg.isap[x].flags |= SNGSS7_ACTIVE; } /* if !SNGSS7_ACTIVE */ x++; } /* while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) */ x = 1; while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) { /* check if this link has already been actived */ if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_ACTIVE)) { if (ftmod_ss7_enable_nsap(x)) { SS7_CRITICAL("NSAP %d Enable: NOT OK\n", x); return 1; } else { SS7_INFO("NSAP %d Enable: OK\n", x); } /* set the SNGSS7_ACTIVE flag */ g_ftdm_sngss7_data.cfg.nsap[x].flags |= SNGSS7_ACTIVE; } /* if !SNGSS7_ACTIVE */ x++; } /* while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) */ if (g_ftdm_sngss7_data.cfg.mtpRoute[1].id != 0) { x = 1; while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { /* check if this link has already been actived */ if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_ACTIVE)) { if (ftmod_ss7_enable_mtpLinkSet(x)) { SS7_CRITICAL("LinkSet \"%s\" Enable: NOT OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); return 1; } else { SS7_INFO("LinkSet \"%s\" Enable: OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); } /* set the SNGSS7_ACTIVE flag */ g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= SNGSS7_ACTIVE; } /* if !SNGSS7_ACTIVE */ x++; } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */ } return 0; }
/* CONFIGURATION **************************************************************/ int ft_to_sngss7_cfg(void) { sng_mtp1Link_t *mtp1_link = NULL; sng_mtp2Link_t *mtp2_link = NULL; sng_mtp3Link_t *mtp3_link = NULL; sng_mtp3LinkSet_t *mtp3_linkset = NULL; sng_mtp3Route_t *mtp3_route = NULL; sng_mtp3_isup_t *mtp3_isup = NULL; sng_mtp3_isup_t *isup_mtp3 = NULL; sng_isupInterface_t *isup_interface = NULL; sng_isupCircuit_t *isup_circuit = NULL; sng_isup_cc_t *isup_cc = NULL; sng_isup_cc_t *cc_isup = NULL; int x; SS7_DEBUG("Starting LibSngSS7 configuration...\n"); if (g_ftdm_sngss7_data.gen_config_done == 0) { /* perform general configuration */ if(ftmod_ss7_general_configuration()) { SS7_ERROR("Failed to run general configuration!\n"); return FTDM_FAIL; } else { SS7_INFO("General Configuration was successful\n"); g_ftdm_sngss7_data.gen_config_done = 1; } } else { SS7_DEBUG("General configuration already done.\n"); } /* MTP1 *******************************************************************/ x=1; mtp1_link = &g_ftdm_sngss7_data.cfg.mtp1Link[x]; while (mtp1_link->id != 0) { if (sngss7_test_flag(mtp1_link, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("MTP1 Link already configured = %s\n",mtp1_link->name); } else { if (ftmod_ss7_configure_mtp1_link(x)) { SS7_ERROR("Failed to configure MTP1 link = %s\n!", mtp1_link->name); return FTDM_FAIL; } else { SS7_INFO("Successfully configured MTP1 link = %s\n", mtp1_link->name); sngss7_set_flag(mtp1_link, SNGSS7_FLAG_CONFIGURED); } } /* next link */ x++; mtp1_link = &g_ftdm_sngss7_data.cfg.mtp1Link[x]; } /* while (g_ftdm_sngss7_data.cfg.mtp1Link[x]->id != 0) */ /* MTP2 *******************************************************************/ x=1; mtp2_link = &g_ftdm_sngss7_data.cfg.mtp2Link[x]; while (mtp2_link->id != 0) { if (sngss7_test_flag(mtp2_link, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("MTP2 Link already configured = %s\n",mtp2_link->name); } else { if (ftmod_ss7_configure_mtp2_link(x)) { SS7_ERROR("Failed to configure MTP2 link = %s\n!", mtp2_link->name); return FTDM_FAIL; } else { SS7_INFO("Successfully configured MTP2 link = %s\n", mtp2_link->name); sngss7_set_flag(mtp2_link, SNGSS7_FLAG_CONFIGURED); } } /* next link */ x++; mtp2_link = &g_ftdm_sngss7_data.cfg.mtp2Link[x]; } /* while (g_ftdm_sngss7_data.cfg.mtp2Link[x]->id != 0) */ /* MTP3 *******************************************************************/ x=1; mtp3_link = &g_ftdm_sngss7_data.cfg.mtp3Link[x]; while (mtp3_link->id != 0) { if (sngss7_test_flag(mtp3_link, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("MTP3 Link already configured = %s\n", mtp3_link->name); } else { if (ftmod_ss7_configure_mtp3_link(x)) { SS7_ERROR("Failed to configure MTP3 link = %s\n!", mtp3_link->name); return FTDM_FAIL; } else { SS7_INFO("Successfully configured MTP3 link = %s\n", mtp3_link->name); sngss7_set_flag(mtp3_link, SNGSS7_FLAG_CONFIGURED); } } /* next link */ x++; mtp3_link = &g_ftdm_sngss7_data.cfg.mtp3Link[x]; } /* while (g_ftdm_sngss7_data.cfg.mtp3Link[x]->id != 0) */ x=1; mtp3_linkset = &g_ftdm_sngss7_data.cfg.mtp3LinkSet[x]; while (mtp3_linkset->id != 0) { if (sngss7_test_flag(mtp3_linkset, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("MTP3 LinkSet already configured = %s\n", mtp3_linkset->name); } else { if (ftmod_ss7_configure_mtp3_linkset(x)) { SS7_ERROR("Failed to configure MTP3 link = %s\n!", mtp3_linkset->name); return FTDM_FAIL; } else { SS7_INFO("Successfully configured MTP3 link = %s\n", mtp3_linkset->name); sngss7_set_flag(mtp3_linkset, SNGSS7_FLAG_CONFIGURED); } } /* next link */ x++; mtp3_linkset = &g_ftdm_sngss7_data.cfg.mtp3LinkSet[x]; } /* while (g_ftdm_sngss7_data.cfg.mtp1Link[x]->id != 0) */ x=1; mtp3_route = &g_ftdm_sngss7_data.cfg.mtp3Route[x]; while (mtp3_route->id != 0) { if (sngss7_test_flag(mtp3_route, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("MTP3 Route already configured = %s\n", mtp3_route->name); } else { if (ftmod_ss7_configure_mtp3_route(x)) { SS7_ERROR("Failed to configure MTP3 route = %s\n!", mtp3_route->name); return FTDM_FAIL; } else { SS7_INFO("Successfully configured MTP3 route = %s\n", mtp3_route->name); sngss7_set_flag(mtp3_route, SNGSS7_FLAG_CONFIGURED); } } /* next link */ x++; mtp3_route = &g_ftdm_sngss7_data.cfg.mtp3Route[x]; } /* while (g_ftdm_sngss7_data.cfg.mtp3Route[x]->id != 0) */ mtp3_route = &g_ftdm_sngss7_data.cfg.mtp3Route[0]; if (sngss7_test_flag(mtp3_route, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("MTP3 Self Route already configured\n"); } else { if (ftmod_ss7_configure_mtp3_route(0)) { SS7_ERROR("Failed to configure MTP3 Route = SelfRoute\n!"); return FTDM_FAIL; } else { SS7_INFO("Successfully configured MTP3 Route = SelfRoute\n"); sngss7_set_flag(mtp3_route, SNGSS7_FLAG_CONFIGURED); } } x=1; mtp3_isup = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; while (mtp3_isup->id != 0) { if (sngss7_test_flag(mtp3_isup, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("MTP3-ISUP interface already configured = %d\n", mtp3_isup->id); } else { if (ftmod_ss7_configure_mtp3_isup(x)) { SS7_ERROR("Failed to configure MTP3-ISUP interface = %d\n!", mtp3_isup->id); return FTDM_FAIL; } else { SS7_INFO("Successfully configured MTP3-ISUP interface = %d\n", mtp3_isup->id); } } /* next link */ x++; mtp3_isup = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; } /* while (g_ftdm_sngss7_data.cfg.mtp3_isup[x]->id != 0) */ /* ISUP *******************************************************************/ x=1; isup_mtp3 = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; while (isup_mtp3->id != 0) { if (sngss7_test_flag(isup_mtp3, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("ISUP-MTP3 interface already configured = %d\n", isup_mtp3->id); } else { if (ftmod_ss7_configure_isup_mtp3(x)) { SS7_ERROR("Failed to configure ISUP-MTP3 interface = %d\n!", isup_mtp3->id); return FTDM_FAIL; } else { SS7_INFO("Successfully configured ISUP-MTP3 interface = %d\n", isup_mtp3->id); sngss7_set_flag(isup_mtp3, SNGSS7_FLAG_CONFIGURED); } } /* next link */ x++; isup_mtp3 = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; } /* while (g_ftdm_sngss7_data.cfg.isup_mtp3[x]->id != 0) */ x=1; isup_cc = &g_ftdm_sngss7_data.cfg.isup_cc[x]; while (isup_cc->id != 0) { if (sngss7_test_flag(isup_cc, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("ISUP-CC interface already configured = %d\n", isup_cc->id); } else { if (ftmod_ss7_configure_isup_cc(x)) { SS7_ERROR("Failed to configure ISUP-CC interface = %d\n!", isup_cc->id); return FTDM_FAIL; } else { SS7_INFO("Successfully configured ISUP-CC interface = %d\n", isup_cc->id); } } /* next link */ x++; isup_cc = &g_ftdm_sngss7_data.cfg.isup_cc[x]; } /* while (g_ftdm_sngss7_data.cfg.isup_cc[x]->id != 0) */ x=1; isup_interface = &g_ftdm_sngss7_data.cfg.isupInterface[x]; while (isup_interface->id != 0) { if (sngss7_test_flag(isup_interface, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("ISUP interface already configured = %s\n", isup_interface->name); } else { if (ftmod_ss7_configure_isup_interface(x)) { SS7_ERROR("Failed to configure ISUP interface = %s\n", isup_interface->name); return FTDM_FAIL; } else { SS7_INFO("Successfully configured ISUP interface = %s\n", isup_interface->name); sngss7_set_flag(isup_interface, SNGSS7_FLAG_CONFIGURED); } } /* next link */ x++; isup_interface = &g_ftdm_sngss7_data.cfg.isupInterface[x]; } /* while (g_ftdm_sngss7_data.cfg.isup_interface[x]->id != 0) */ x=1; isup_circuit = &g_ftdm_sngss7_data.cfg.isupCircuit[x]; while (isup_circuit->id != 0) { if (isup_circuit->cic != 0) { if (sngss7_test_flag(isup_circuit, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("ISUP Circuit already configured = %d\n", isup_circuit->id); } else { if (ftmod_ss7_configure_isup_circuit(x)) { SS7_ERROR("Failed to configure ISUP circuit = %d\n!", isup_circuit->id); return FTDM_FAIL; } else { SS7_INFO("Successfully configured ISUP circuit = %d\n", isup_circuit->id); sngss7_set_flag(isup_circuit, SNGSS7_FLAG_CONFIGURED); } } } /* next link */ x++; isup_circuit = &g_ftdm_sngss7_data.cfg.isupCircuit[x]; } /* while (g_ftdm_sngss7_data.cfg.isup_circuit[x]->id != 0) */ /* CC *********************************************************************/ x=1; cc_isup = &g_ftdm_sngss7_data.cfg.isup_cc[x]; while (cc_isup->id != 0) { if (sngss7_test_flag(cc_isup, SNGSS7_FLAG_CONFIGURED)) { SS7_DEBUG("CC-ISUP interface already configured = %d\n", cc_isup->id); } else { if (ftmod_ss7_configure_cc_isup(x)) { SS7_ERROR("Failed to configure CC-ISUP interface = %d\n!", cc_isup->id); return FTDM_FAIL; } else { SS7_INFO("Successfully configured CC-ISUP interface = %d\n", cc_isup->id); sngss7_set_flag(cc_isup, SNGSS7_FLAG_CONFIGURED); } } /* next link */ x++; cc_isup = &g_ftdm_sngss7_data.cfg.isup_cc[x]; } /* while (g_ftdm_sngss7_data.cfg.cc_isup[x]->id != 0) */ SS7_DEBUG("Finished LibSngSS7 configuration...\n"); return FTDM_SUCCESS; }
/* ACTIVATION *****************************************************************/ int ft_to_sngss7_activate_all(void) { sng_isup_cc_t *cc_isup = NULL; sng_mtp3_isup_t *isup_mtp3 = NULL; sng_mtp3LinkSet_t *mtp3_linkset = NULL; int x; /* CC to ISUP *************************************************************/ x = 1; cc_isup = &g_ftdm_sngss7_data.cfg.isup_cc[x]; while (cc_isup->id != 0) { if (sngss7_test_flag(cc_isup, SNGSS7_FLAG_ACTIVE)) { SS7_DEBUG("CC-ISUP interface already active = %d\n", cc_isup->id); } else { if (sng_activate_cc_isup_inf(cc_isup->ccId)) { SS7_ERROR("Failed to activate CC-ISUP = %d\n",cc_isup->id); return FTDM_FAIL; } else { SS7_INFO("Started CC-ISUP interface = %d\n", cc_isup->id); sngss7_set_flag(cc_isup, SNGSS7_FLAG_ACTIVE); } } /* if (sngss7_test_flag(cc_isup, SNGSS7_FLAG_ACTIVE) */ x++; cc_isup = &g_ftdm_sngss7_data.cfg.isup_cc[x]; } /* while (cc_isup->id != 0) */ /* ISUP - MTP3 ************************************************************/ x = 1; isup_mtp3 = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; while (isup_mtp3->id != 0) { if (sngss7_test_flag(isup_mtp3, SNGSS7_FLAG_ACTIVE)) { SS7_DEBUG("ISUP-MTP3 interface already active = %d\n", isup_mtp3->id); } else { if (sng_activate_isup_mtp3_inf(isup_mtp3->id)) { SS7_ERROR("Failed to activate ISUP-MTP3 = %d\n",isup_mtp3->id); return FTDM_FAIL; } else { SS7_INFO("Started ISUP-MTP3interface = %d\n", isup_mtp3->id); sngss7_set_flag(isup_mtp3, SNGSS7_FLAG_ACTIVE); } } /* if (sngss7_test_flag(isup_mtp3, SNGSS7_FLAG_ACTIVE) */ x++; isup_mtp3 = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; } /* while (isup_mtp3->id != 0) */ /* MTP3 Linkset (MTP3 - MTP2 - MTP1) **************************************/ x = 1; mtp3_linkset = &g_ftdm_sngss7_data.cfg.mtp3LinkSet[x]; while (mtp3_linkset->id != 0) { if (sngss7_test_flag(mtp3_linkset, SNGSS7_FLAG_ACTIVE)) { SS7_DEBUG("MTP3 Linkset already active = %s\n", mtp3_linkset->name); } else { if (sng_activate_mtp3_linkset(mtp3_linkset->id)) { SS7_ERROR("Failed to activate MTP3 Linkset = %s\n",mtp3_linkset->name); return FTDM_FAIL; } else { SS7_INFO("Started MTP3 Linkset = %s\n", mtp3_linkset->name); sngss7_set_flag(mtp3_linkset, SNGSS7_FLAG_ACTIVE); } } /* if (sngss7_test_flag(mtp3_linkset, SNGSS7_FLAG_ACTIVE) */ x++; mtp3_linkset = &g_ftdm_sngss7_data.cfg.mtp3LinkSet[x]; } /* while (mtp3_linkset->id != 0) */ return FTDM_SUCCESS; }