summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels/chan_skinny.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 5f5c61156..1c89674b9 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -3179,38 +3179,36 @@ static void mwi_event_cb(const struct ast_event *event, void *userdata)
{
struct skinny_line *l = userdata;
struct skinny_device *d = l->device;
- if (d && d->session) {
- struct skinnysession *s = d->session;
- struct skinny_line *l2;
- int new_msgs = 0;
- int dev_msgs = 0;
-
- if (s) {
- if (event) {
- l->newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
- }
+ struct skinny_line *l2;
+ int dev_msgs = 0;
+
+ if (!d || !d->session) {
+ return;
+ }
- if (l->newmsgs) {
- transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, l->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
- } else {
- transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, SKINNY_LAMP_OFF);
- }
+ if (event) {
+ l->newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
+ }
- /* find out wether the device lamp should be on or off */
- AST_LIST_TRAVERSE(&d->lines, l2, list) {
- if (l2->newmsgs) {
- dev_msgs++;
- }
- }
+ if (l->newmsgs) {
+ transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, l->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
+ } else {
+ transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, SKINNY_LAMP_OFF);
+ }
- if (dev_msgs) {
- transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, d->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
- } else {
- transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, SKINNY_LAMP_OFF);
- }
- ast_verb(3, "Skinny mwi_event_cb found %d new messages\n", new_msgs);
+ /* find out wether the device lamp should be on or off */
+ AST_LIST_TRAVERSE(&d->lines, l2, list) {
+ if (l2->newmsgs) {
+ dev_msgs++;
}
}
+
+ if (dev_msgs) {
+ transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, d->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
+ } else {
+ transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, SKINNY_LAMP_OFF);
+ }
+ ast_verb(3, "Skinny mwi_event_cb found %d new messages\n", l->newmsgs);
}
/* I do not believe skinny can deal with video.