/* 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;
}
Esempio n. 2
0
/* 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];


	/* test if this is the first time the channel comes up */
	if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) {
		SS7_DEBUG("Relay Channel %d initial connection UP\n", sng_relay->id);

		/* mark the channel as being up */
		sngss7_set_flag(sng_relay, SNGSS7_RELAY_INIT);
	} else {
		SS7_DEBUG("Relay Channel %d connection UP\n", sng_relay->id);

		/* react based on type of channel */
		switch (sng_relay->type) {
		/******************************************************************/
		case (LRY_CT_TCP_CLIENT):
			/* reconfigure all ISUP ckts, since the main system would have lost all configs */
			if (reconfig_all_ckts_for_relay()) {
				SS7_ERROR("Failed to reconfigure ISUP Ckts!\n");

				/* we're done....this is very bad! */
			} else {				
				enable_all_ckts_for_relay();
			}

			break;
		/******************************************************************/
		case (LRY_CT_TCP_SERVER):
			/*unblock_all_ckts_for_relay(sta->t.usta.s.ryErrUsta.errPid);*/
			ftmod_ss7_enable_grp_mtp3Link(sta->t.usta.s.ryUpUsta.id);

			break;
		/******************************************************************/
		default:
			break;
		/******************************************************************/
		} /* switch (g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryUpUsta.id].type) */
	} /* intial up? */

	return FTDM_SUCCESS;
}