[asterisk-commits] rmudgett: trunk r261007 - /trunk/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 4 16:11:02 CDT 2010
Author: rmudgett
Date: Tue May 4 16:10:58 2010
New Revision: 261007
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=261007
Log:
The inalarm flag is not passed up from the sig_analog and sig_pri submodules.
The CLI "dahdi show channel" command was not correctly reporting the
InAlarm status.
The inalarm flag is now consistently passed between chan_dahdi and
submodules.
Modified:
trunk/channels/chan_dahdi.c
trunk/channels/sig_analog.c
trunk/channels/sig_analog.h
trunk/channels/sig_pri.c
trunk/channels/sig_pri.h
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=261007&r1=261006&r2=261007
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Tue May 4 16:10:58 2010
@@ -2103,19 +2103,28 @@
}
}
-static void my_set_dialing(void *pvt, int flag)
+static void my_set_alarm(void *pvt, int in_alarm)
{
struct dahdi_pvt *p = pvt;
- p->dialing = flag;
+
+ p->inalarm = in_alarm;
+}
+
+static void my_set_dialing(void *pvt, int is_dialing)
+{
+ struct dahdi_pvt *p = pvt;
+
+ p->dialing = is_dialing;
}
#if defined(HAVE_PRI)
-static void my_set_digital(void *pvt, int flag)
+static void my_set_digital(void *pvt, int is_digital)
{
struct dahdi_pvt *p = pvt;
- p->digital = flag;
-}
-#endif
+
+ p->digital = is_digital;
+}
+#endif /* defined(HAVE_PRI) */
static void my_set_ringtimeout(void *pvt, int ringt)
{
@@ -2994,6 +3003,7 @@
.unlock_private = my_unlock_private,
.new_ast_channel = my_new_pri_ast_channel,
.fixup_chans = my_pri_fixup_chans,
+ .set_alarm = my_set_alarm,
.set_dialing = my_set_dialing,
.set_digital = my_set_digital,
.set_callerid = my_pri_set_callerid,
@@ -3125,6 +3135,7 @@
.get_sigpvt_bridged_channel = my_get_sigpvt_bridged_channel,
.get_sub_fd = my_get_sub_fd,
.set_cadence = my_set_cadence,
+ .set_alarm = my_set_alarm,
.set_dialing = my_set_dialing,
.set_ringtimeout = my_set_ringtimeout,
.set_waitingfordt = my_set_waitingfordt,
@@ -7399,16 +7410,16 @@
}
break;
case DAHDI_EVENT_ALARM:
-#ifdef HAVE_PRI
switch (p->sig) {
+#if defined(HAVE_PRI)
case SIG_PRI_LIB_HANDLE_CASES:
sig_pri_chan_alarm_notify(p->sig_pvt, 0);
break;
+#endif /* defined(HAVE_PRI) */
default:
+ p->inalarm = 1;
break;
}
-#endif
- p->inalarm = 1;
res = get_alarms(p);
handle_alarms(p, res);
#ifdef HAVE_PRI
@@ -7731,16 +7742,16 @@
case DAHDI_EVENT_RINGERON:
break;
case DAHDI_EVENT_NOALARM:
-#ifdef HAVE_PRI
switch (p->sig) {
+#if defined(HAVE_PRI)
case SIG_PRI_LIB_HANDLE_CASES:
sig_pri_chan_alarm_notify(p->sig_pvt, 1);
break;
+#endif /* defined(HAVE_PRI) */
default:
+ p->inalarm = 0;
break;
}
-#endif
- p->inalarm = 0;
handle_clear_alarms(p);
break;
case DAHDI_EVENT_WINKFLASH:
@@ -10308,10 +10319,20 @@
case DAHDI_EVENT_BITSCHANGED:
break;
case DAHDI_EVENT_NOALARM:
+ if (analog_lib_handles(mtd->pvt->sig, mtd->pvt->radio, mtd->pvt->oprmode)) {
+ struct analog_pvt *analog_p = mtd->pvt->sig_pvt;
+
+ analog_p->inalarm = 0;
+ }
mtd->pvt->inalarm = 0;
handle_clear_alarms(mtd->pvt);
break;
case DAHDI_EVENT_ALARM:
+ if (analog_lib_handles(mtd->pvt->sig, mtd->pvt->radio, mtd->pvt->oprmode)) {
+ struct analog_pvt *analog_p = mtd->pvt->sig_pvt;
+
+ analog_p->inalarm = 1;
+ }
mtd->pvt->inalarm = 1;
res = get_alarms(mtd->pvt);
handle_alarms(mtd->pvt, res);
@@ -10726,11 +10747,29 @@
}
break;
case DAHDI_EVENT_NOALARM:
- i->inalarm = 0;
+ switch (i->sig) {
+#if defined(HAVE_PRI)
+ case SIG_PRI_LIB_HANDLE_CASES:
+ sig_pri_chan_alarm_notify(i->sig_pvt, 1);
+ break;
+#endif /* defined(HAVE_PRI) */
+ default:
+ i->inalarm = 0;
+ break;
+ }
handle_clear_alarms(i);
break;
case DAHDI_EVENT_ALARM:
- i->inalarm = 1;
+ switch (i->sig) {
+#if defined(HAVE_PRI)
+ case SIG_PRI_LIB_HANDLE_CASES:
+ sig_pri_chan_alarm_notify(i->sig_pvt, 0);
+ break;
+#endif /* defined(HAVE_PRI) */
+ default:
+ i->inalarm = 1;
+ break;
+ }
res = get_alarms(i);
handle_alarms(i, res);
/* fall thru intentionally */
@@ -12030,9 +12069,9 @@
#endif
default:
tmp->inalarm = 1;
- handle_alarms(tmp, res);
break;
}
+ handle_alarms(tmp, res);
}
}
Modified: trunk/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_analog.c?view=diff&rev=261007&r1=261006&r2=261007
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Tue May 4 16:10:58 2010
@@ -760,11 +760,19 @@
}
}
-static void analog_set_dialing(struct analog_pvt *p, int flag)
-{
- p->dialing = flag;
+static void analog_set_dialing(struct analog_pvt *p, int is_dialing)
+{
+ p->dialing = is_dialing;
if (p->calls->set_dialing) {
- return p->calls->set_dialing(p->chan_pvt, flag);
+ return p->calls->set_dialing(p->chan_pvt, is_dialing);
+ }
+}
+
+static void analog_set_alarm(struct analog_pvt *p, int in_alarm)
+{
+ p->inalarm = in_alarm;
+ if (p->calls->set_alarm) {
+ return p->calls->set_alarm(p->chan_pvt, in_alarm);
}
}
@@ -2202,7 +2210,7 @@
if (res == 1) {
if (ev == ANALOG_EVENT_NOALARM) {
- p->inalarm = 0;
+ analog_set_alarm(p, 0);
}
if (p->cid_signalling == CID_SIG_V23_JP) {
if (ev == ANALOG_EVENT_RINGBEGIN) {
@@ -2291,7 +2299,7 @@
if (res == 1 || res == 2) {
if (ev == ANALOG_EVENT_NOALARM) {
- p->inalarm = 0;
+ analog_set_alarm(p, 0);
} else if (ev == ANALOG_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
ast_debug(1, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
p->polarity = POLARITY_IDLE;
@@ -2507,7 +2515,7 @@
}
break;
case ANALOG_EVENT_ALARM:
- p->inalarm = 1;
+ analog_set_alarm(p, 1);
analog_get_and_handle_alarms(p);
case ANALOG_EVENT_ONHOOK:
@@ -2803,7 +2811,7 @@
case ANALOG_EVENT_RINGERON:
break;
case ANALOG_EVENT_NOALARM:
- p->inalarm = 0;
+ analog_set_alarm(p, 0);
if (!p->unknown_alarm) {
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
@@ -3403,7 +3411,7 @@
}
break;
case ANALOG_EVENT_NOALARM:
- i->inalarm = 0;
+ analog_set_alarm(i, 0);
if (!i->unknown_alarm) {
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
@@ -3413,7 +3421,7 @@
}
break;
case ANALOG_EVENT_ALARM:
- i->inalarm = 1;
+ analog_set_alarm(i, 1);
analog_get_and_handle_alarms(i);
/* fall thru intentionally */
Modified: trunk/channels/sig_analog.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_analog.h?view=diff&rev=261007&r1=261006&r2=261007
==============================================================================
--- trunk/channels/sig_analog.h (original)
+++ trunk/channels/sig_analog.h Tue May 4 16:10:58 2010
@@ -205,7 +205,8 @@
void * (* const get_sigpvt_bridged_channel)(struct ast_channel *chan);
int (* const get_sub_fd)(void *pvt, enum analog_sub sub);
void (* const set_cadence)(void *pvt, int *cidrings, struct ast_channel *chan);
- void (* const set_dialing)(void *pvt, int flag);
+ void (* const set_alarm)(void *pvt, int in_alarm);
+ void (* const set_dialing)(void *pvt, int is_dialing);
void (* const set_ringtimeout)(void *pvt, int ringt);
void (* const set_waitingfordt)(void *pvt, struct ast_channel *ast);
int (* const check_waitingfordt)(void *pvt);
Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=261007&r1=261006&r2=261007
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Tue May 4 16:10:58 2010
@@ -128,17 +128,27 @@
pri->calls->handle_dchan_exception(pri, index);
}
-static void sig_pri_set_dialing(struct sig_pri_chan *p, int flag)
-{
- if (p->calls->set_dialing)
- p->calls->set_dialing(p->chan_pvt, flag);
-}
-
-static void sig_pri_set_digital(struct sig_pri_chan *p, int flag)
-{
- p->digital = flag;
- if (p->calls->set_digital)
- p->calls->set_digital(p->chan_pvt, flag);
+static void sig_pri_set_dialing(struct sig_pri_chan *p, int is_dialing)
+{
+ if (p->calls->set_dialing) {
+ p->calls->set_dialing(p->chan_pvt, is_dialing);
+ }
+}
+
+static void sig_pri_set_digital(struct sig_pri_chan *p, int is_digital)
+{
+ p->digital = is_digital;
+ if (p->calls->set_digital) {
+ p->calls->set_digital(p->chan_pvt, is_digital);
+ }
+}
+
+static void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
+{
+ p->inalarm = in_alarm;
+ if (p->calls->set_alarm) {
+ p->calls->set_alarm(p->chan_pvt, in_alarm);
+ }
}
static const char *sig_pri_get_orig_dialstring(struct sig_pri_chan *p)
@@ -2830,7 +2840,7 @@
/* Take the channels from inalarm condition */
for (i = 0; i < pri->numchans; i++) {
if (pri->pvts[i]) {
- pri->pvts[i]->inalarm = 0;
+ sig_pri_set_alarm(pri->pvts[i], 0);
}
}
sig_pri_span_devstate_changed(pri);
@@ -2861,7 +2871,7 @@
if (p->owner)
ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_DEV);
}
- p->inalarm = 1;
+ sig_pri_set_alarm(p, 1);
}
}
sig_pri_span_devstate_changed(pri);
@@ -4854,8 +4864,8 @@
void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm)
{
+ sig_pri_set_alarm(p, !noalarm);
if (!noalarm) {
- p->inalarm = 1;
if (!p->pri || !p->pri->pri || (pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0)) {
/* T309 is not enabled : hangup calls when alarm occurs */
if (p->call) {
@@ -4873,8 +4883,6 @@
if (p->owner)
ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_DEV);
}
- } else {
- p->inalarm = 0;
}
}
Modified: trunk/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.h?view=diff&rev=261007&r1=261006&r2=261007
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Tue May 4 16:10:58 2010
@@ -103,8 +103,9 @@
/* Note: Called with PRI lock held */
void (* const handle_dchan_exception)(struct sig_pri_pri *pri, int index);
- void (* const set_dialing)(void *pvt, int flag);
- void (* const set_digital)(void *pvt, int flag);
+ void (* const set_alarm)(void *pvt, int in_alarm);
+ void (* const set_dialing)(void *pvt, int is_dialing);
+ void (* const set_digital)(void *pvt, int is_digital);
void (* const set_callerid)(void *pvt, const struct ast_party_caller *caller);
void (* const set_dnid)(void *pvt, const char *dnid);
void (* const set_rdnis)(void *pvt, const char *rdnis);
More information about the asterisk-commits
mailing list