From 01d839eb64410908dcb7d4e2a913664b4b849608 Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Thu, 2 Sep 2010 18:19:38 -0400 Subject: [PATCH] freetdm: ss7 - implmented queuing of sigevents to ftdmcore --- .../ftmod_sangoma_ss7_handle.c | 3 +++ .../ftmod_sangoma_ss7_main.c | 25 ++++++++++--------- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 6 ++--- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 99b9fe9bc3..7f70cb7566 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -205,6 +205,9 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ SS7_DEBUG_CHAN(ftdmchan,"No TMR/Bearer Cap information in IAM!%s\n", " "); } + /* add any special variables for the dialplan */ + /*ftdm_channel_add_var(ftdmchan, "ss7_stuff", "s");*/ + /* set the state of the channel to collecting...the rest is done by the chan monitor */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 6d31ac55ad..66efe1ab12 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -322,6 +322,9 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) ftdm_safe_free(sngss7_event); }/* while ((sngss7_event = ftdm_queue_dequeue(ftdmspan->signal_data->event_queue))) */ + /* signal the core that sig events are queued for processing */ + ftdm_span_trigger_signals(ftdmspan); + break; /**********************************************************************/ case FTDM_TIMEOUT: @@ -512,10 +515,9 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev /******************************************************************************/ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { - ftdm_sigmsg_t sigev; - ftdm_signaling_status_t status; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - int i = 0; + ftdm_sigmsg_t sigev; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + int i = 0; memset (&sigev, 0, sizeof (sigev)); @@ -848,9 +850,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", ""); /* all flags are down so we can bring up the sig status */ - status = FTDM_SIG_STATE_UP; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; + sigev.sigstatus = FTDM_SIG_STATE_UP; ftdm_span_send_signal (ftdmchan->span, &sigev); } } else { @@ -952,9 +953,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* if the sig_status is up...bring it down */ if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { - status = FTDM_SIG_STATE_DOWN; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal (ftdmchan->span, &sigev); } @@ -1016,9 +1016,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE flag %s\n", ""); /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal (ftdmchan->span, &sigev); /* check the last state and return to it to allow the call to finish */ @@ -1113,9 +1112,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_BLOCK flag %s\n", ""); /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal (ftdmchan->span, &sigev); /* remove any reset flags */ @@ -1420,7 +1418,10 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) span->state_map = &sangoma_ss7_state_map; span->mod_data = ss7_span_info; + /* set the flag to indicate that this span uses channel state change queues */ ftdm_set_flag (span, FTDM_SPAN_USE_CHAN_QUEUE); + /* set the flag to indicate that this span uses sig event queues */ + ftdm_set_flag (span, FTDM_SPAN_USE_SIGNALS_QUEUE); /* parse the configuration and apply to the global config structure */ if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 28ff6bd4cd..4fac251c17 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -60,9 +60,10 @@ void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan); void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan); void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan); +/******************************************************************************/ + /* FUNCTIONS ******************************************************************/ -void -ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) +void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); @@ -133,7 +134,6 @@ ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /******************************************************************************/ - void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__);