From f4fba89489c36aa6aad45369b37b2fdae3f8486a Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Fri, 4 Jan 2008 17:21:25 +0000 Subject: [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 --- channels/chan_zap.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'channels') 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, ¶ms)) >= 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) -- cgit v1.2.3