summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2008-01-04 17:21:25 +0000
committerKevin P. Fleming <kpfleming@digium.com>2008-01-04 17:21:25 +0000
commitf4fba89489c36aa6aad45369b37b2fdae3f8486a (patch)
tree5cded2cdb8c952c16de2a8ec8319a08b290d8ba2 /channels
parentcc00602238a1279d0e901b83db2f779b946eeb9d (diff)
[commit message]
(closes issue #10393) Reported by: tzafrir Patches: chan_alarm_asterisk.diff uploaded by tzafrir (license 46) (modified by me and added configure script support) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_zap.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 16543016d..1ede60885 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -4170,18 +4170,35 @@ static int check_for_conference(struct zt_pvt *p)
return 0;
}
+/*! Checks channel for alarms
+ * \param p a channel to check for alarms.
+ * \returns the alarms on the span to which the channel belongs, or alarms on
+ * the channel if no span alarms.
+ */
static int get_alarms(struct zt_pvt *p)
{
int res;
ZT_SPANINFO zi;
+#if defined(HAVE_ZAPTEL_CHANALARMS)
+ struct zt_params params;
+#endif
+
memset(&zi, 0, sizeof(zi));
zi.spanno = p->span;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SPANSTAT, &zi);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to determine alarm on channel %d\n", p->channel);
- return 0;
+ if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_SPANSTAT, &zi)) >= 0) {
+ if (zi.alarms != ZT_ALARM_NONE)
+ return zi.alarms;
}
- return zi.alarms;
+
+#if defined(HAVE_ZAPTEL_CHANALARMS)
+ /* No alarms on the span. Check for channel alarms. */
+ if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &params)) >= 0)
+ return params.chan_alarms;
+#endif
+
+ ast_log(LOG_WARNING, "Unable to determine alarm on channel %d\n", p->channel);
+
+ return ZT_ALARM_NONE;
}
static void zt_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)