freetdm: fix boost glare invalid state transition
show physical status in ftdm list command update list of events
This commit is contained in:
parent
06ebf2cb5b
commit
f39fcfc8a9
|
@ -3295,6 +3295,8 @@ SWITCH_STANDARD_API(ft_function)
|
|||
int j;
|
||||
for (j = 0 ; j < FTDM_MAX_SPANS_INTERFACE; j++) {
|
||||
if (SPAN_CONFIG[j].span) {
|
||||
ftdm_channel_t *fchan;
|
||||
ftdm_alarm_flag_t alarmbits = FTDM_ALARM_NONE;
|
||||
const char *flags = "none";
|
||||
ftdm_signaling_status_t sigstatus;
|
||||
|
||||
|
@ -3303,12 +3305,17 @@ SWITCH_STANDARD_API(ft_function)
|
|||
} else if (SPAN_CONFIG[j].analog_options & ANALOG_OPTION_CALL_SWAP) {
|
||||
flags = "call swap";
|
||||
}
|
||||
fchan = ftdm_span_get_channel(SPAN_CONFIG[j].span, 1);
|
||||
if (fchan) {
|
||||
ftdm_channel_get_alarms(fchan, &alarmbits);
|
||||
}
|
||||
|
||||
if ((FTDM_SUCCESS == ftdm_span_get_sig_status(SPAN_CONFIG[j].span, &sigstatus))) {
|
||||
stream->write_function(stream,
|
||||
"+OK\n"
|
||||
"span: %u (%s)\n"
|
||||
"type: %s\n"
|
||||
"physical_status: %s\n"
|
||||
"signaling_status: %s\n"
|
||||
"chan_count: %u\n"
|
||||
"dialplan: %s\n"
|
||||
|
@ -3320,6 +3327,7 @@ SWITCH_STANDARD_API(ft_function)
|
|||
j,
|
||||
ftdm_span_get_name(SPAN_CONFIG[j].span),
|
||||
SPAN_CONFIG[j].type,
|
||||
alarmbits ? "alarmed" : "ok",
|
||||
ftdm_signaling_status2str(sigstatus),
|
||||
ftdm_span_get_chan_count(SPAN_CONFIG[j].span),
|
||||
SPAN_CONFIG[j].dialplan,
|
||||
|
@ -3334,6 +3342,7 @@ SWITCH_STANDARD_API(ft_function)
|
|||
"+OK\n"
|
||||
"span: %u (%s)\n"
|
||||
"type: %s\n"
|
||||
"physical_status: %s\n"
|
||||
"chan_count: %u\n"
|
||||
"dialplan: %s\n"
|
||||
"context: %s\n"
|
||||
|
@ -3344,6 +3353,7 @@ SWITCH_STANDARD_API(ft_function)
|
|||
j,
|
||||
ftdm_span_get_name(SPAN_CONFIG[j].span),
|
||||
SPAN_CONFIG[j].type,
|
||||
alarmbits ? "alarmed" : "ok",
|
||||
ftdm_span_get_chan_count(SPAN_CONFIG[j].span),
|
||||
SPAN_CONFIG[j].dialplan,
|
||||
SPAN_CONFIG[j].context,
|
||||
|
|
|
@ -266,12 +266,12 @@ static ftdm_channel_t *find_ftdmchan(ftdm_span_t *span, sangomabc_short_event_t
|
|||
break;
|
||||
} else {
|
||||
ftdmchan = NULL;
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d ~ %d:%d is already in use.\n",
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d ~ %d:%d is already in use in state %s\n",
|
||||
span->channels[i]->span_id,
|
||||
span->channels[i]->chan_id,
|
||||
span->channels[i]->physical_span_id,
|
||||
span->channels[i]->physical_chan_id
|
||||
);
|
||||
span->channels[i]->physical_chan_id,
|
||||
ftdm_channel_state2str(span->channels[i]->state));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1001,26 +1001,41 @@ static void handle_call_start(ftdm_span_t *span, sangomabc_connection_t *mcon, s
|
|||
if (ftdmchan->state == FTDM_CHANNEL_STATE_UP ||
|
||||
ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA ||
|
||||
ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "s%dc%d:FTDMCHAN STATE UP -> Changed to TERMINATING\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
ftdm_log(FTDM_LOG_CRIT, "s%dc%d: FTDMCHAN STATE UP -> Changed to TERMINATING\n",
|
||||
BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
ftdm_set_state_r(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING, 0, r);
|
||||
} else if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP || ftdm_test_sflag(ftdmchan, SFLAG_HANGUP)) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "s%dc%d:FTDMCHAN STATE HANGUP -> Changed to HANGUP COMPLETE\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
ftdm_log(FTDM_LOG_CRIT, "s%dc%d: FTDMCHAN STATE HANGUP -> Changed to HANGUP COMPLETE\n",
|
||||
BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
ftdm_set_state_r(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, 0, r);
|
||||
} else if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "s%dc%d:Collision, hanging up incoming call\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
ftdm_set_state_r(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING, 0, r);
|
||||
ftdm_log(FTDM_LOG_WARNING, "s%dc%d: Collision, hanging up incoming call\n",
|
||||
BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
/* dont hangup the outgoing call, the other side will send a call start nack too
|
||||
* and there we will move to terminating. If we move to terminating here. We used to move
|
||||
* to terminating here, but that introduces a problem in handle_call_start_nack where
|
||||
* when receiving call start nack we move the channel from DOWN to TERMINATING ( cuz we already
|
||||
* hangup here ) and the channel gets stuck in terminating forever. So at this point we're trusting
|
||||
* the other side to send the call start nack ( or proceed with the call )
|
||||
* ftdm_set_state_r(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING, 0, r);
|
||||
*/
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_CRIT, "s%dc%d:FTDMCHAN STATE INVALID %s on IN CALL\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event), ftdm_channel_state2str(ftdmchan->state));
|
||||
ftdm_log(FTDM_LOG_ERROR, "s%dc%d: rejecting incoming call in channel state %s\n",
|
||||
BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event),
|
||||
ftdm_channel_state2str(ftdmchan->state));
|
||||
}
|
||||
ftdm_set_sflag(ftdmchan, SFLAG_SENT_FINAL_MSG);
|
||||
ftdmchan = NULL;
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_CRIT, "s%dc%d: incoming call in invalid channel (channel not found)!\n",
|
||||
BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
}
|
||||
ftdm_log(FTDM_LOG_CRIT, "s%dc%d:START CANT FIND CHAN\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "s%dc%d:START CANT OPEN CHAN\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
ftdm_log(FTDM_LOG_ERROR, "s%dc%d: failed to open channel on incoming call, rejecting!\n",
|
||||
BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event));
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -1271,7 +1286,7 @@ static int parse_sangoma_event(ftdm_span_t *span, sangomabc_connection_t *mcon,
|
|||
|
||||
/* process all pending state changes for that channel before
|
||||
* processing the new boost event */
|
||||
ftdmchan = event_process_states(span, event);
|
||||
ftdmchan = event_process_states(span, event);
|
||||
|
||||
switch(event->event_id) {
|
||||
case SIGBOOST_EVENT_CALL_START:
|
||||
|
|
|
@ -292,9 +292,9 @@ typedef enum {
|
|||
FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */
|
||||
FTDM_SIGEVENT_INVALID
|
||||
} ftdm_signal_event_t;
|
||||
#define SIGNAL_STRINGS "START", "STOP", "TRANSFER", "ANSWER", "UP", "FLASH", "PROGRESS", \
|
||||
"PROGRESS_MEDIA", "NOTIFY", "TONE_DETECTED", "ALARM_TRAP", "ALARM_CLEAR", "MISC", \
|
||||
"COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGLINK_CHANGED", "INVALID"
|
||||
#define SIGNAL_STRINGS "START", "STOP", "ANSWER", "UP", "FLASH", "PROGRESS", \
|
||||
"PROGRESS_MEDIA", "TONE_DETECTED", "ALARM_TRAP", "ALARM_CLEAR", \
|
||||
"COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "INVALID"
|
||||
|
||||
/*! \brief Move from string to ftdm_signal_event_t and viceversa */
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t)
|
||||
|
|
|
@ -119,8 +119,21 @@ typedef int ftdm_socket_t;
|
|||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief FreeTDM channel.
|
||||
* This is the basic data structure used to place calls and I/O operations
|
||||
*/
|
||||
typedef struct ftdm_channel ftdm_channel_t;
|
||||
|
||||
/*!
|
||||
* \brief FreeTDM span.
|
||||
* Channel and signaling configuration container.
|
||||
* This is a logical span structure, a span may ( or may note ) contain channels
|
||||
* of other physical spans, depending on configuration (freetdm.conf) or if you
|
||||
* are not using configuration depends on how you call ftdm_span_add_channel
|
||||
*/
|
||||
typedef struct ftdm_span ftdm_span_t;
|
||||
|
||||
typedef struct ftdm_event ftdm_event_t;
|
||||
typedef struct ftdm_conf_node ftdm_conf_node_t;
|
||||
typedef struct ftdm_group ftdm_group_t;
|
||||
|
|
|
@ -136,8 +136,8 @@ typedef __int16 int16_t;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include <libteletone_generate.h>
|
||||
#include <libteletone_detect.h>
|
||||
#include "libteletone_generate.h"
|
||||
#include "libteletone_detect.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <libteletone.h>
|
||||
#include "libteletone.h"
|
||||
|
||||
/*! \file libteletone_detect.h
|
||||
\brief Tone Detection Routines
|
||||
|
|
|
@ -81,7 +81,7 @@ extern float powf (float, float);
|
|||
#endif
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <libteletone.h>
|
||||
#include "libteletone.h"
|
||||
|
||||
#define TELETONE_VOL_DB_MAX 0
|
||||
#define TELETONE_VOL_DB_MIN -63
|
||||
|
|
Loading…
Reference in New Issue