mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 00:24:05 +00:00
Fri Feb 28 07:00:01 CET 2003
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3194,6 +3194,8 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
|
|||||||
/* Use this as the basis */
|
/* Use this as the basis */
|
||||||
if (sipdebug)
|
if (sipdebug)
|
||||||
ast_verbose("Using latest request as basis request\n");
|
ast_verbose("Using latest request as basis request\n");
|
||||||
|
/* This call is no longer outgoing if it ever was */
|
||||||
|
p->outgoing = 0;
|
||||||
copy_request(&p->initreq, req);
|
copy_request(&p->initreq, req);
|
||||||
check_via(p, req);
|
check_via(p, req);
|
||||||
if (strlen(get_header(req, "Content-Type"))) {
|
if (strlen(get_header(req, "Content-Type"))) {
|
||||||
|
@@ -694,6 +694,29 @@ static char *events[] = {
|
|||||||
"Pulse Start"
|
"Pulse Start"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
int alarm;
|
||||||
|
char *name;
|
||||||
|
} alarms[] = {
|
||||||
|
{ ZT_ALARM_RED, "Red Alarm" },
|
||||||
|
{ ZT_ALARM_YELLOW, "Yellow Alarm" },
|
||||||
|
{ ZT_ALARM_BLUE, "Blue Alarm" },
|
||||||
|
{ ZT_ALARM_RECOVER, "Recovering" },
|
||||||
|
{ ZT_ALARM_LOOPBACK, "Loopback" },
|
||||||
|
{ ZT_ALARM_NOTOPEN, "Not Open" },
|
||||||
|
{ ZT_ALARM_NONE, "None" },
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *alarm2str(int alarm)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
for (x=0;x<sizeof(alarms) / sizeof(alarms[0]); x++) {
|
||||||
|
if (alarms[x].alarm & alarm)
|
||||||
|
return alarms[x].name;
|
||||||
|
}
|
||||||
|
return alarm ? "Unknown Alarm" : "No Alarm";
|
||||||
|
}
|
||||||
|
|
||||||
static char *event2str(int event)
|
static char *event2str(int event)
|
||||||
{
|
{
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
@@ -2297,6 +2320,20 @@ static int check_for_conference(struct zt_pvt *p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int get_alarms(struct zt_pvt *p)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
ZT_SPANINFO zi;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
return zi.alarms;
|
||||||
|
}
|
||||||
|
|
||||||
static struct ast_frame *zt_handle_event(struct ast_channel *ast)
|
static struct ast_frame *zt_handle_event(struct ast_channel *ast)
|
||||||
{
|
{
|
||||||
int res,x;
|
int res,x;
|
||||||
@@ -2375,7 +2412,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
|
|||||||
break;
|
break;
|
||||||
case ZT_EVENT_ALARM:
|
case ZT_EVENT_ALARM:
|
||||||
p->inalarm = 1;
|
p->inalarm = 1;
|
||||||
ast_log(LOG_WARNING, "Detected alarm on channel %d\n", p->channel);
|
res = get_alarms(p);
|
||||||
|
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", p->channel, alarm2str(res));
|
||||||
/* fall through intentionally */
|
/* fall through intentionally */
|
||||||
case ZT_EVENT_ONHOOK:
|
case ZT_EVENT_ONHOOK:
|
||||||
if (p->radio)
|
if (p->radio)
|
||||||
@@ -2543,6 +2581,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
|
|||||||
break;
|
break;
|
||||||
case ZT_EVENT_NOALARM:
|
case ZT_EVENT_NOALARM:
|
||||||
p->inalarm = 0;
|
p->inalarm = 0;
|
||||||
|
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
|
||||||
break;
|
break;
|
||||||
case ZT_EVENT_WINKFLASH:
|
case ZT_EVENT_WINKFLASH:
|
||||||
if (p->inalarm) break;
|
if (p->inalarm) break;
|
||||||
@@ -4080,7 +4119,8 @@ static int handle_init_event(struct zt_pvt *i, int event)
|
|||||||
break;
|
break;
|
||||||
case ZT_EVENT_ALARM:
|
case ZT_EVENT_ALARM:
|
||||||
i->inalarm = 1;
|
i->inalarm = 1;
|
||||||
ast_log(LOG_WARNING, "Alarm detected on channel %d\n", i->channel);
|
res = get_alarms(i);
|
||||||
|
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", i->channel, alarm2str(res));
|
||||||
/* fall thru intentionally */
|
/* fall thru intentionally */
|
||||||
case ZT_EVENT_ONHOOK:
|
case ZT_EVENT_ONHOOK:
|
||||||
/* Back on hook. Hang up. */
|
/* Back on hook. Hang up. */
|
||||||
|
Reference in New Issue
Block a user