freetdm: fix dchan libpri

This commit is contained in:
Moises Silva 2010-04-21 16:34:43 -04:00 committed by Moises Silva
parent d4f93843a1
commit de2a4ea100
4 changed files with 7 additions and 10 deletions

View File

@ -950,7 +950,8 @@ static int on_restart(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve
ftdm_channel_t *ftdmchan; ftdm_channel_t *ftdmchan;
ftdm_log(FTDM_LOG_NOTICE, "-- Restarting %d:%d\n", spri->span->span_id, pevent->restart.channel); ftdm_log(FTDM_LOG_NOTICE, "-- Restarting %d:%d\n", spri->span->span_id, pevent->restart.channel);
spri->dchan->state = FTDM_CHANNEL_STATE_UP;
ftdmchan = span->channels[pevent->restart.channel]; ftdmchan = span->channels[pevent->restart.channel];
if (!ftdmchan) { if (!ftdmchan) {
@ -1132,6 +1133,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj)
} }
ftdm_log(FTDM_LOG_CRIT, "PRI down on span %d\n", isdn_data->spri.span->span_id); ftdm_log(FTDM_LOG_CRIT, "PRI down on span %d\n", isdn_data->spri.span->span_id);
isdn_data->spri.dchan->state = FTDM_CHANNEL_STATE_DOWN;
if (!down) { if (!down) {
ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART);

View File

@ -950,23 +950,15 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms)
} }
if (alarms & WAN_TE_BIT_ALARM_AIS) { if (alarms & WAN_TE_BIT_ALARM_AIS) {
ftdmchan->alarm_flags |= FTDM_ALARM_AIS;
ftdmchan->alarm_flags |= FTDM_ALARM_BLUE; ftdmchan->alarm_flags |= FTDM_ALARM_BLUE;
alarms &= ~WAN_TE_BIT_ALARM_AIS; alarms &= ~WAN_TE_BIT_ALARM_AIS;
} }
if (alarms & WAN_TE_BIT_ALARM_RAI) { if (alarms & WAN_TE_BIT_ALARM_RAI) {
ftdmchan->alarm_flags |= FTDM_ALARM_RAI;
ftdmchan->alarm_flags |= FTDM_ALARM_YELLOW; ftdmchan->alarm_flags |= FTDM_ALARM_YELLOW;
alarms &= ~WAN_TE_BIT_ALARM_RAI; alarms &= ~WAN_TE_BIT_ALARM_RAI;
} }
/* still missing to map:
* FTDM_ALARM_RECOVER
* FTDM_ALARM_LOOPBACK
* FTDM_ALARM_NOTOPEN
* */
/* if we still have alarms that we did not map, set the general alarm */ /* if we still have alarms that we did not map, set the general alarm */
if (alarms) { if (alarms) {
ftdm_log(FTDM_LOG_DEBUG, "Unmapped wanpipe alarms: %d\n", alarms); ftdm_log(FTDM_LOG_DEBUG, "Unmapped wanpipe alarms: %d\n", alarms);

View File

@ -175,6 +175,7 @@ typedef enum {
FTDM_STR2ENUM_P(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t) FTDM_STR2ENUM_P(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t)
#define FTDM_IS_VOICE_CHANNEL(ftdm_chan) ((ftdm_chan)->type != FTDM_CHAN_TYPE_DQ921 && (ftdm_chan)->type != FTDM_CHAN_TYPE_DQ931) #define FTDM_IS_VOICE_CHANNEL(ftdm_chan) ((ftdm_chan)->type != FTDM_CHAN_TYPE_DQ921 && (ftdm_chan)->type != FTDM_CHAN_TYPE_DQ931)
#define FTDM_IS_DCHAN(ftdm_chan) ((ftdm_chan)->type == FTDM_CHAN_TYPE_DQ921 || (ftdm_chan)->type == FTDM_CHAN_TYPE_DQ931)
typedef void (*ftdm_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...); typedef void (*ftdm_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...);

View File

@ -647,7 +647,9 @@ static __inline__ void ftdm_set_state_all(ftdm_span_t *span, ftdm_channel_state_
uint32_t j; uint32_t j;
ftdm_mutex_lock(span->mutex); ftdm_mutex_lock(span->mutex);
for(j = 1; j <= span->chan_count; j++) { for(j = 1; j <= span->chan_count; j++) {
ftdm_set_state_locked((span->channels[j]), state); if (!FTDM_IS_DCHAN(span->channels[j])) {
ftdm_set_state_locked((span->channels[j]), state);
}
} }
ftdm_mutex_unlock(span->mutex); ftdm_mutex_unlock(span->mutex);
} }