提交 4340c4d7 authored 作者: David Yat Sin's avatar David Yat Sin

Merged latest FreeTDM code from Sangoma's repo

Merge remote branch 'smgfs/master'

Conflicts:
	build/modules.conf.in
	configure.in
	libs/esl/fs_cli.c
	libs/freetdm/mod_freetdm/mod_freetdm.c
	libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h
	libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c
	libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c
	libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c
	src/include/switch_types.h
	src/mod/applications/mod_commands/mod_commands.c
	src/mod/applications/mod_spandsp/mod_spandsp.c
	src/mod/endpoints/mod_opal/mod_opal.cpp
	src/mod/endpoints/mod_opal/mod_opal.h
	src/mod/endpoints/mod_sofia/mod_sofia.h
	src/mod/endpoints/mod_sofia/rtp.c
	src/switch.c
	src/switch_core.c
	src/switch_rtp.c
...@@ -214,6 +214,8 @@ ftmod_sangoma_ss7_la_SOURCES = \ ...@@ -214,6 +214,8 @@ ftmod_sangoma_ss7_la_SOURCES = \
$(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \
$(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \
$(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c \ $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c \
$(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua_xml.c \
$(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_m2ua.c \
$(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c
ftmod_sangoma_ss7_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -D_GNU_SOURCE ftmod_sangoma_ss7_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) -D_GNU_SOURCE
......
...@@ -13,7 +13,7 @@ cpu_monitoring_interval => 1000 ...@@ -13,7 +13,7 @@ cpu_monitoring_interval => 1000
cpu_set_alarm_threshold => 80 cpu_set_alarm_threshold => 80
; At what CPU percentage stop the CPU alarm ; At what CPU percentage stop the CPU alarm
cpu_reset_alarm_threshold => 70 cpu_clear_alarm_threshold => 70
; Which action to take when the CPU alarm is raised ; Which action to take when the CPU alarm is raised
; it can be warn and/or reject calls ; it can be warn and/or reject calls
......
SS7 Native Bridge
Native bridge is enabled on 2 conditions:
* The SIP header FreeTDM-TransUUID is set in the originating leg and matches a freetdm channel
* The variable freetdm_native_sigbridge is true and the originating leg is also a freetdm channel
Some coding rules apply to this feature:
- Each channel is responsible for clearning its own peer_data and event queue
at the end of the call (when moving to DOWN state)
- Each channel dequeues messages only from its own queue and enqueues messages
in the peer's queue, with the only exception being messages received before
the bridge is stablished (IAM for sure and possible SAM messages) because
if the bridge is not yet stablished the messages must be queued by the channel
in its own queue temporarily until the bridge is ready
- When the bridge is ready it is the responsibility of the incoming channel to
move the messages that stored temporarily in its own queue to the bridged peer queue
- During hangup, each channel is responsible for moving itself to DOWN. The procedure
however differs slightly depending on the hangup conditions
If the user requests hangup (ie, FreeSWITCH) the request will be noted by setting the
FTDM_CHANNEL_USER_HANGUP flag but will not be processed yet because call control is
driven only by the link messages (so no hangup from ESL or command line allowed)
When REL message comes, the channel receiving it must move to TERMINATING state and:
- If the user has not hangup yet (FTDM_CHANNEL_USER_HANGUP flag not set) then
notify the user via SIGEVENT_STOP and wait for the user to move to HANGUP
state by calling ftdm_channel_call_hangup() before sending RLC
- If the user did hangup already (FTDM_CHANNEL_USER_HANGUP flag is set) then
skip user notification and move to HANGUP state directly where the RLC message
will be sent
- On HANGUP state the RLC is sent and the channel is moved to DOWN, final state
The peer channel will forward the REL message and wait for RLC from the network, when
RLC is received the channel can move straight to DOWN itself because the peer channel
is completing its own shutdown procedure when it received the REL message
...@@ -4,6 +4,7 @@ BASE=../../.. ...@@ -4,6 +4,7 @@ BASE=../../..
FT_DIR=.. FT_DIR=..
VERBOSE=1 VERBOSE=1
FTLA=$(FT_DIR)/libfreetdm.la FTLA=$(FT_DIR)/libfreetdm.la
LOCAL_OBJS=tdm.o
LOCAL_CFLAGS=-I$(FT_DIR)/src/include -I$(FT_DIR)/src/isdn/include $(FT_CFLAGS) LOCAL_CFLAGS=-I$(FT_DIR)/src/include -I$(FT_DIR)/src/isdn/include $(FT_CFLAGS)
LOCAL_LDFLAGS=-L$(FT_DIR) -lfreetdm LOCAL_LDFLAGS=-L$(FT_DIR) -lfreetdm
include $(BASE)/build/modmake.rules include $(BASE)/build/modmake.rules
......
差异被折叠。
差异被折叠。
...@@ -48,9 +48,26 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c ...@@ -48,9 +48,26 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c
ftdm_time_t diff = 0; ftdm_time_t diff = 0;
ftdm_channel_state_t state = fchan->state; ftdm_channel_state_t state = fchan->state;
#if 0
/* I could not perform this sanity check without more disruptive changes. Ideally we should check here if the signaling module completing the state
executed a state processor (called ftdm_channel_advance_states() which call fchan->span->state_processor(fchan)) for the state. That is just a
sanity check, as in the past we had at least one bug where the signaling module set the state and then accidentally changed the state to a new one
without calling ftdm_channel_advance_states(), meaning the state processor for the first state was not executed and that lead to unexpected behavior.
If we want to be able to perform this kind of sanity check it would be nice to add a new state status (FTDM_STATE_STATUS_PROCESSING), the function
ftdm_channel_advance_states() would set the state_status to PROCESSING and then the check below for STATUS_NEW would be valid. Currently is not
valid because the signaling module may be completing the state at the end of the state_processor callback and therefore the state will still be
in STATUS_NEW, and is perfectly valid ... */
if (fchan->state_status == FTDM_STATE_STATUS_NEW) {
ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_CRIT,
"Asking to complete state change from %s to %s in %llums, but the state is still unprocessed (this might be a bug!)\n",
ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(state), diff);
}
#endif
if (fchan->state_status == FTDM_STATE_STATUS_COMPLETED) { if (fchan->state_status == FTDM_STATE_STATUS_COMPLETED) {
ftdm_assert_return(!ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE), FTDM_FAIL, ftdm_assert_return(!ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE), FTDM_FAIL, "State change flag set but state is already completed\n");
"State change flag set but state is not completed\n");
return FTDM_SUCCESS; return FTDM_SUCCESS;
} }
...@@ -87,6 +104,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c ...@@ -87,6 +104,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c
ftdm_assert(!fchan->history[hindex].end_time, "End time should be zero!\n"); ftdm_assert(!fchan->history[hindex].end_time, "End time should be zero!\n");
fchan->history[hindex].end_time = ftdm_current_time_in_ms(); fchan->history[hindex].end_time = ftdm_current_time_in_ms();
fchan->last_state_change_time = ftdm_current_time_in_ms();
fchan->state_status = FTDM_STATE_STATUS_COMPLETED; fchan->state_status = FTDM_STATE_STATUS_COMPLETED;
...@@ -262,6 +280,9 @@ static ftdm_status_t ftdm_core_set_state(const char *file, const char *func, int ...@@ -262,6 +280,9 @@ static ftdm_status_t ftdm_core_set_state(const char *file, const char *func, int
} }
} }
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NATIVE_SIGBRIDGE)) {
goto perform_state_change;
}
if (ftdmchan->span->state_map) { if (ftdmchan->span->state_map) {
ok = ftdm_parse_state_map(ftdmchan, state, ftdmchan->span->state_map); ok = ftdm_parse_state_map(ftdmchan, state, ftdmchan->span->state_map);
...@@ -353,6 +374,8 @@ end: ...@@ -353,6 +374,8 @@ end:
goto done; goto done;
} }
perform_state_change:
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
ftdmchan->last_state = ftdmchan->state; ftdmchan->last_state = ftdmchan->state;
ftdmchan->state = state; ftdmchan->state = state;
......
...@@ -288,6 +288,7 @@ typedef struct sngisdn_span_data { ...@@ -288,6 +288,7 @@ typedef struct sngisdn_span_data {
uint8_t force_sending_complete; uint8_t force_sending_complete;
uint8_t cid_name_method; uint8_t cid_name_method;
uint8_t send_cid_name; uint8_t send_cid_name;
uint8_t send_connect_ack;
int32_t timer_t301; int32_t timer_t301;
int32_t timer_t302; int32_t timer_t302;
...@@ -305,7 +306,6 @@ typedef struct sngisdn_span_data { ...@@ -305,7 +306,6 @@ typedef struct sngisdn_span_data {
int32_t timer_t318; int32_t timer_t318;
int32_t timer_t319; int32_t timer_t319;
int32_t timer_t322; int32_t timer_t322;
char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS];
ftdm_timer_id_t timers[SNGISDN_NUM_SPAN_TIMERS]; ftdm_timer_id_t timers[SNGISDN_NUM_SPAN_TIMERS];
ftdm_sched_t *sched; ftdm_sched_t *sched;
......
...@@ -433,6 +433,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ...@@ -433,6 +433,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
signal_data->cid_name_method = SNGISDN_CID_NAME_AUTO; signal_data->cid_name_method = SNGISDN_CID_NAME_AUTO;
signal_data->send_cid_name = SNGISDN_OPT_DEFAULT; signal_data->send_cid_name = SNGISDN_OPT_DEFAULT;
signal_data->send_connect_ack = SNGISDN_OPT_DEFAULT;
span->default_caller_data.dnis.plan = FTDM_NPI_INVALID; span->default_caller_data.dnis.plan = FTDM_NPI_INVALID;
span->default_caller_data.dnis.type = FTDM_TON_INVALID; span->default_caller_data.dnis.type = FTDM_TON_INVALID;
...@@ -615,6 +616,8 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ...@@ -615,6 +616,8 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
parse_timer(val, &signal_data->timer_t322); parse_timer(val, &signal_data->timer_t322);
} else if (!strcasecmp(var, "trunkgroup")) { } else if (!strcasecmp(var, "trunkgroup")) {
/* Do nothing, we already parsed this parameter */ /* Do nothing, we already parsed this parameter */
} else if (!strcasecmp(var, "send-connect-ack")) {
parse_yesno(var, val, &signal_data->send_connect_ack);
} else { } else {
ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var);
} }
......
...@@ -738,6 +738,14 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) ...@@ -738,6 +738,14 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span)
} }
} }
if (signal_data->send_connect_ack != SNGISDN_OPT_DEFAULT) {
if (signal_data->send_connect_ack == SNGISDN_OPT_TRUE) {
cfg.t.cfg.s.inDLSAP.ackOpt = TRUE;
} else {
cfg.t.cfg.s.inDLSAP.ackOpt = FALSE;
}
}
/* Override the restart options if user selected that option */ /* Override the restart options if user selected that option */
if (signal_data->restart_opt != SNGISDN_OPT_DEFAULT) { if (signal_data->restart_opt != SNGISDN_OPT_DEFAULT) {
if (signal_data->restart_opt == SNGISDN_OPT_TRUE) { if (signal_data->restart_opt == SNGISDN_OPT_TRUE) {
......
...@@ -77,7 +77,9 @@ int ft_to_sngss7_cfg_all(void) ...@@ -77,7 +77,9 @@ int ft_to_sngss7_cfg_all(void)
int ret = 0; int ret = 0;
/* check if we have done gen_config already */ /* check if we have done gen_config already */
if (!(g_ftdm_sngss7_data.gen_config)) { if (g_ftdm_sngss7_data.gen_config == SNG_GEN_CFG_STATUS_INIT) {
/* update the global gen_config so we don't do it again */
g_ftdm_sngss7_data.gen_config = SNG_GEN_CFG_STATUS_PENDING;
/* start of by checking if the license and sig file are valid */ /* start of by checking if the license and sig file are valid */
if (sng_validate_license(g_ftdm_sngss7_data.cfg.license, if (sng_validate_license(g_ftdm_sngss7_data.cfg.license,
...@@ -207,31 +209,23 @@ int ft_to_sngss7_cfg_all(void) ...@@ -207,31 +209,23 @@ int ft_to_sngss7_cfg_all(void)
} }
} /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) */ } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_MTP2)) */
/* update the global gen_config so we don't do it again */ if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){
g_ftdm_sngss7_data.gen_config = 1; if(FTDM_SUCCESS != ftmod_ss7_m2ua_init()){
ftdm_log (FTDM_LOG_ERROR, "ftmod_ss7_m2ua_init FAILED \n");
return FTDM_FAIL;
}
}
g_ftdm_sngss7_data.gen_config = SNG_GEN_CFG_STATUS_DONE;
} /* if (!(g_ftdm_sngss7_data.gen_config)) */ } /* if (!(g_ftdm_sngss7_data.gen_config)) */
/* go through all the relays channels and configure it */
x = 1;
while (x < (MAX_RELAY_CHANNELS)) {
/* check if this relay channel has been configured already */
if ((g_ftdm_sngss7_data.cfg.relay[x].id != 0) &&
(!(g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED))) {
/* send the specific configuration */ if (g_ftdm_sngss7_data.gen_config != SNG_GEN_CFG_STATUS_DONE) {
if (ftmod_ss7_relay_chan_config(x)) { SS7_CRITICAL("General configuration FAILED!\n");
SS7_CRITICAL("Relay Channel %d configuration FAILED!\n", x);
return 1; return 1;
} else {
SS7_INFO("Relay Channel %d configuration DONE!\n", x);
} }
/* set the SNGSS7_CONFIGURED flag */
g_ftdm_sngss7_data.cfg.relay[x].flags |= SNGSS7_CONFIGURED;
} /* if !SNGSS7_CONFIGURED */
x++;
} /* while (x < (MAX_RELAY_CHANNELS)) */
x = 1; x = 1;
while (x < (MAX_MTP_LINKS)) { while (x < (MAX_MTP_LINKS)) {
/* check if this link has been configured already */ /* check if this link has been configured already */
...@@ -272,6 +266,8 @@ int ft_to_sngss7_cfg_all(void) ...@@ -272,6 +266,8 @@ int ft_to_sngss7_cfg_all(void)
x++; x++;
} /* while (x < (MAX_MTP_LINKS+1)) */ } /* while (x < (MAX_MTP_LINKS+1)) */
/* no configs above mtp2 for relay */
if (g_ftdm_sngss7_data.cfg.procId == 1) {
x = 1; x = 1;
while (x < (MAX_MTP_LINKS)) { while (x < (MAX_MTP_LINKS)) {
/* check if this link has been configured already */ /* check if this link has been configured already */
...@@ -293,6 +289,8 @@ int ft_to_sngss7_cfg_all(void) ...@@ -293,6 +289,8 @@ int ft_to_sngss7_cfg_all(void)
x++; x++;
} /* while (x < (MAX_MTP_LINKS+1)) */ } /* while (x < (MAX_MTP_LINKS+1)) */
/* in M2UA_SG mode there will not be any MTP3 layer */
if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){
x = 1; x = 1;
while (x < (MAX_NSAPS)) { while (x < (MAX_NSAPS)) {
/* check if this link has been configured already */ /* check if this link has been configured already */
...@@ -321,7 +319,10 @@ int ft_to_sngss7_cfg_all(void) ...@@ -321,7 +319,10 @@ int ft_to_sngss7_cfg_all(void)
x++; x++;
} /* while (x < (MAX_NSAPS)) */ } /* while (x < (MAX_NSAPS)) */
}
/* in M2UA_SG mode there will not be any MTP3 layer */
if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){
x = 1; x = 1;
while (x < (MAX_MTP_LINKSETS+1)) { while (x < (MAX_MTP_LINKSETS+1)) {
/* check if this link has been configured already */ /* check if this link has been configured already */
...@@ -341,7 +342,10 @@ int ft_to_sngss7_cfg_all(void) ...@@ -341,7 +342,10 @@ int ft_to_sngss7_cfg_all(void)
x++; x++;
} /* while (x < (MAX_MTP_LINKSETS+1)) */ } /* while (x < (MAX_MTP_LINKSETS+1)) */
}
/* in M2UA_SG mode there will not be any MTP3 layer */
if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){
x = 1; x = 1;
while (x < (MAX_MTP_ROUTES+1)) { while (x < (MAX_MTP_ROUTES+1)) {
/* check if this link has been configured already */ /* check if this link has been configured already */
...@@ -361,6 +365,7 @@ int ft_to_sngss7_cfg_all(void) ...@@ -361,6 +365,7 @@ int ft_to_sngss7_cfg_all(void)
x++; x++;
} /* while (x < (MAX_MTP_ROUTES+1)) */ } /* while (x < (MAX_MTP_ROUTES+1)) */
}
x = 1; x = 1;
while (x < (MAX_ISAPS)) { while (x < (MAX_ISAPS)) {
...@@ -408,6 +413,11 @@ int ft_to_sngss7_cfg_all(void) ...@@ -408,6 +413,11 @@ int ft_to_sngss7_cfg_all(void)
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.procId > 1) {
break;
}
/* check if this link has been configured already */ /* check if this link has been configured already */
if ((g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) && if ((g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) &&
(!(g_ftdm_sngss7_data.cfg.isupCkt[x].flags & SNGSS7_CONFIGURED))) { (!(g_ftdm_sngss7_data.cfg.isupCkt[x].flags & SNGSS7_CONFIGURED))) {
...@@ -425,6 +435,33 @@ int ft_to_sngss7_cfg_all(void) ...@@ -425,6 +435,33 @@ int ft_to_sngss7_cfg_all(void)
x++; x++;
} /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */
}
/* go through all the relays channels and configure it */
x = 1;
while (x < (MAX_RELAY_CHANNELS)) {
/* check if this relay channel has been configured already */
if ((g_ftdm_sngss7_data.cfg.relay[x].id != 0) &&
(!(g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED))) {
/* send the specific configuration */
if (ftmod_ss7_relay_chan_config(x)) {
SS7_CRITICAL("Relay Channel %d configuration FAILED!\n", x);
return 1;
} else {
SS7_INFO("Relay Channel %d configuration DONE!\n", x);
}
/* set the SNGSS7_CONFIGURED flag */
g_ftdm_sngss7_data.cfg.relay[x].flags |= SNGSS7_CONFIGURED;
} /* if !SNGSS7_CONFIGURED */
x++;
} /* while (x < (MAX_RELAY_CHANNELS)) */
if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){
return ftmod_ss7_m2ua_cfg();
}
return 0; return 0;
} }
......
...@@ -48,35 +48,7 @@ static int ftmod_ss7_enable_isap(int suId); ...@@ -48,35 +48,7 @@ static int ftmod_ss7_enable_isap(int suId);
static int ftmod_ss7_enable_nsap(int suId); static int ftmod_ss7_enable_nsap(int suId);
static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId); static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId);
int ftmod_ss7_inhibit_mtp3link(uint32_t id);
int ftmod_ss7_uninhibit_mtp3link(uint32_t id);
int ftmod_ss7_bind_mtp3link(uint32_t id);
int ftmod_ss7_unbind_mtp3link(uint32_t id);
int ftmod_ss7_activate_mtp3link(uint32_t id);
int ftmod_ss7_deactivate_mtp3link(uint32_t id);
int ftmod_ss7_deactivate2_mtp3link(uint32_t id);
int ftmod_ss7_activate_mtplinkSet(uint32_t id);
int ftmod_ss7_deactivate_mtplinkSet(uint32_t id);
int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id);
int ftmod_ss7_lpo_mtp3link(uint32_t id);
int ftmod_ss7_lpr_mtp3link(uint32_t id);
int ftmod_ss7_shutdown_isup(void);
int ftmod_ss7_shutdown_mtp3(void);
int ftmod_ss7_shutdown_mtp2(void);
int ftmod_ss7_shutdown_relay(void);
int ftmod_ss7_disable_relay_channel(uint32_t chanId);
int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId);
int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId);
int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId);
int ftmod_ss7_block_isup_ckt(uint32_t cktId);
int ftmod_ss7_unblock_isup_ckt(uint32_t cktId);
/******************************************************************************/ /******************************************************************************/
/* FUNCTIONS ******************************************************************/ /* FUNCTIONS ******************************************************************/
...@@ -104,6 +76,7 @@ int ft_to_sngss7_activate_all(void) ...@@ -104,6 +76,7 @@ int ft_to_sngss7_activate_all(void)
x++; x++;
} /* while (x < (MAX_ISAPS)) */ } /* while (x < (MAX_ISAPS)) */
if(SNG_SS7_OPR_MODE_M2UA_SG != g_ftdm_operating_mode){
x = 1; x = 1;
while (x < (MAX_NSAPS)) { while (x < (MAX_NSAPS)) {
/* check if this link has already been actived */ /* check if this link has already been actived */
...@@ -145,6 +118,11 @@ int ft_to_sngss7_activate_all(void) ...@@ -145,6 +118,11 @@ int ft_to_sngss7_activate_all(void)
x++; x++;
} /* while (x < (MAX_MTP_LINKSETS+1)) */ } /* while (x < (MAX_MTP_LINKSETS+1)) */
} }
}
if(SNG_SS7_OPR_MODE_M2UA_SG == g_ftdm_operating_mode){
return ftmod_ss7_m2ua_start();
}
return 0; return 0;
} }
...@@ -779,7 +757,14 @@ int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId) ...@@ -779,7 +757,14 @@ int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId)
cntrl.t.cntrl.action = AUBND_DIS; /* disable and unbind */ cntrl.t.cntrl.action = AUBND_DIS; /* disable and unbind */
cntrl.t.cntrl.subAction = SAGR_DSTPROCID; /* specificed element */ cntrl.t.cntrl.subAction = SAGR_DSTPROCID; /* specificed element */
if (g_ftdm_sngss7_data.cfg.procId == procId) {
SS7_DEBUG("Executing MTP3 cntrl command local pid =%i\n",procId);
return (sng_cntrl_mtp3(&pst, &cntrl)); return (sng_cntrl_mtp3(&pst, &cntrl));
} else {
SS7_WARN("Executing MTP3 cntrl command different local=%i target=%i\n",
g_ftdm_sngss7_data.cfg.procId,procId);
return (sng_cntrl_mtp3_nowait(&pst, &cntrl));
}
} }
...@@ -811,7 +796,14 @@ int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId) ...@@ -811,7 +796,14 @@ int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId)
cntrl.t.cntrl.action = ABND_ENA; /* bind and enable */ cntrl.t.cntrl.action = ABND_ENA; /* bind and enable */
cntrl.t.cntrl.subAction = SAGR_DSTPROCID; /* specificed element */ cntrl.t.cntrl.subAction = SAGR_DSTPROCID; /* specificed element */
if (g_ftdm_sngss7_data.cfg.procId == procId) {
SS7_DEBUG("Executing MTP3 cntrl command local pid =%i\n",procId);
return (sng_cntrl_mtp3(&pst, &cntrl)); return (sng_cntrl_mtp3(&pst, &cntrl));
} else {
SS7_WARN("Executing MTP3 cntrl command different local=%i target=%i\n",
g_ftdm_sngss7_data.cfg.procId,procId);
return (sng_cntrl_mtp3_nowait(&pst, &cntrl));
}
} }
...@@ -848,7 +840,7 @@ int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId) ...@@ -848,7 +840,7 @@ int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId)
} }
/******************************************************************************/ /******************************************************************************/
int ftmod_ss7_block_isup_ckt(uint32_t cktId) int __ftmod_ss7_block_isup_ckt(uint32_t cktId, ftdm_bool_t wait)
{ {
SiMngmt cntrl; SiMngmt cntrl;
Pst pst; Pst pst;
...@@ -876,7 +868,11 @@ int ftmod_ss7_block_isup_ckt(uint32_t cktId) ...@@ -876,7 +868,11 @@ int ftmod_ss7_block_isup_ckt(uint32_t cktId)
cntrl.t.cntrl.action = ADISIMM; /* block via BLO */ cntrl.t.cntrl.action = ADISIMM; /* block via BLO */
cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */
if (wait == FTDM_TRUE) {
return (sng_cntrl_isup(&pst, &cntrl)); return (sng_cntrl_isup(&pst, &cntrl));
} else {
return (sng_cntrl_isup_nowait(&pst, &cntrl));
}
} }
/******************************************************************************/ /******************************************************************************/
......
...@@ -81,6 +81,7 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo ...@@ -81,6 +81,7 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo
/* initalize the sngss7_event */ /* initalize the sngss7_event */
sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); sngss7_event = ftdm_malloc(sizeof(*sngss7_event));
if (sngss7_event == NULL) { if (sngss7_event == NULL) {
SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_ERROR("Failed to allocate memory for sngss7_event!\n");
SS7_FUNC_TRACE_EXIT(__FUNCTION__); SS7_FUNC_TRACE_EXIT(__FUNCTION__);
......
...@@ -764,6 +764,28 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) ...@@ -764,6 +764,28 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled DTMF events\n"); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled DTMF events\n");
#else #else
return FTDM_NOTIMPL; return FTDM_NOTIMPL;
#endif
}
break;
case FTDM_COMMAND_ENABLE_DTMF_REMOVAL:
{
#ifdef WP_API_FEATURE_LIBSNG_HWEC
int return_code = 0;
err = sangoma_hwec_set_hwdtmf_removal(ftdmchan->sockfd, ftdmchan->physical_chan_id, &return_code, 1, 0);
if (return_code) {
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Wanpipe failed to Disable HW-DTMF removal\n");
}
#endif
}
break;
case FTDM_COMMAND_DISABLE_DTMF_REMOVAL:
{
#ifdef WP_API_FEATURE_LIBSNG_HWEC
int return_code = 0;
err = sangoma_hwec_set_hwdtmf_removal(ftdmchan->sockfd, ftdmchan->physical_chan_id, &return_code, 0, 0);
if (return_code) {
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Wanpipe failed to Disable HW-DTMF removal\n");
}
#endif #endif
} }
break; break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论