[asterisk-commits] jpeeler: branch jpeeler/asterisk-sigwork-trunk r193717 - /team/jpeeler/asteri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 11 16:28:07 CDT 2009


Author: jpeeler
Date: Mon May 11 16:28:03 2009
New Revision: 193717

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=193717
Log:
modify handle_notify_message callback to be able to also handle neon mwi
add forgotten event to analog_event2str
don't pass in unneeded params to dahdievent_to_analogevent


Modified:
    team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c?view=diff&rev=193717&r1=193716&r2=193717
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Mon May 11 16:28:03 2009
@@ -1543,7 +1543,7 @@
 	return index;
 }
 
-static enum analog_event dahdievent_to_analogevent(struct dahdi_pvt *p, int event);
+static enum analog_event dahdievent_to_analogevent(int event);
 static int bump_gains(struct dahdi_pvt *p);
 static int dahdi_setlinear(int dfd, int linear);
 
@@ -1590,7 +1590,7 @@
 	res = poll(&poller, 1, timeout);
 
 	if (poller.revents & POLLPRI) {
-		*ev = dahdievent_to_analogevent(p, dahdi_get_event(p->subs[SUB_REAL].dfd));
+		*ev = dahdievent_to_analogevent(dahdi_get_event(p->subs[SUB_REAL].dfd));
 		return 1;
 	}
 
@@ -2016,7 +2016,7 @@
 	return tone_zone_play_tone(p->subs[index].dfd, analog_tone_to_dahditone(tone));
 }
 
-static enum analog_event dahdievent_to_analogevent(struct dahdi_pvt *p, int event)
+static enum analog_event dahdievent_to_analogevent(int event)
 {
 	enum analog_event res = ANALOG_EVENT_ERROR;
 
@@ -2057,6 +2057,12 @@
 		case DAHDI_EVENT_PULSE_START:
 			res = ANALOG_EVENT_PULSE_START;
 			break;
+		case DAHDI_EVENT_NEONMWI_ACTIVE:
+			res = ANALOG_EVENT_NEONMWI_ACTIVE;
+			break;
+		case DAHDI_EVENT_NEONMWI_INACTIVE:
+			res = ANALOG_EVENT_NEONMWI_INACTIVE;
+			break;
 	}
 
 	return res;
@@ -2082,7 +2088,7 @@
 	} else
 		res = dahdi_get_event(p->subs[SUB_REAL].dfd);
 
-	return dahdievent_to_analogevent(p, res);
+	return dahdievent_to_analogevent(res);
 }
 
 static int my_is_off_hook(void *pvt)
@@ -2252,27 +2258,25 @@
 	}
 }
 
-static void my_handle_notify_message(struct ast_channel *chan, void *pvt, int flags)
+static void my_handle_notify_message(struct ast_channel *chan, void *pvt, int cid_flags, int neon_mwievent)
 {
 	struct dahdi_pvt *p = pvt;
 
+	if (neon_mwievent > -1 && !p->mwimonitor_neon)
+		return;
+
+	if (neon_mwievent == ANALOG_EVENT_NEONMWI_ACTIVE || cid_flags & CID_MSGWAITING) {
+		ast_log(LOG_NOTICE, "MWI: Channel %d message waiting, mailbox %s\n", p->channel, p->mailbox);
+		notify_message(p->mailbox, 1);
+	} else if (neon_mwievent == ANALOG_EVENT_NEONMWI_INACTIVE || cid_flags & CID_NOMSGWAITING) {
+		ast_log(LOG_NOTICE, "MWI: Channel %d no message waiting, mailbox %s\n", p->channel, p->mailbox);
+		notify_message(p->mailbox, 0);
+	}
 	/* If the CID had Message waiting payload, assume that this for MWI only and hangup the call */
-	if (flags & CID_MSGWAITING) {
-		ast_log(LOG_NOTICE, "MWI: Channel %d message waiting!\n", p->channel);
-		notify_message(p->mailbox, 1);
-		/* If generated using Ring Pulse Alert, then ring has been answered as a call and needs to be hungup */
-		if (p->mwimonitor_rpas) {
-			ast_hangup(chan);
-			return;
-		}
-	} else if (flags & CID_NOMSGWAITING) {
-		ast_log(LOG_NOTICE, "MWI: Channel %d no message waiting!\n", p->channel);
-		notify_message(p->mailbox, 0);
-		/* If generated using Ring Pulse Alert, then ring has been answered as a call and needs to be hungup */
-		if (p->mwimonitor_rpas) {
-			ast_hangup(chan);
-			return;
-		}
+	/* If generated using Ring Pulse Alert, then ring has been answered as a call and needs to be hungup */
+	if (neon_mwievent == -1 && p->mwimonitor_rpas) {
+		ast_hangup(chan);
+		return;
 	}
 }
 
@@ -9836,7 +9840,7 @@
 		if (cs)
 			callerid_free(cs);
 
-		my_handle_notify_message(chan, p, flags);
+		my_handle_notify_message(chan, p, flags, -1);
 
 		ast_setstate(chan, AST_STATE_RING);
 		chan->rings = 1;
@@ -10606,7 +10610,7 @@
 						/* Don't hold iflock while handling init events */
 						ast_mutex_unlock(&iflock);
 						if (analog_lib_handles(i->sig, i->radio, i->oprmode))
-							analog_handle_init_event(i->sig_pvt, dahdievent_to_analogevent(i, res));
+							analog_handle_init_event(i->sig_pvt, dahdievent_to_analogevent(res));
 						else
 							handle_init_event(i, res);
 						ast_mutex_lock(&iflock);
@@ -10675,7 +10679,7 @@
 					ast_mutex_unlock(&iflock);
 					if (0 == i->mwisendactive || 0 == mwi_send_process_event(i, res)) {
 						if (analog_lib_handles(i->sig, i->radio, i->oprmode))
-							analog_handle_init_event(i->sig_pvt, dahdievent_to_analogevent(i, res));
+							analog_handle_init_event(i->sig_pvt, dahdievent_to_analogevent(res));
 						else
 							handle_init_event(i, res);
 					}

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c?view=diff&rev=193717&r1=193716&r2=193717
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Mon May 11 16:28:03 2009
@@ -227,6 +227,15 @@
 			break;
 		case ANALOG_EVENT_RINGBEGIN:
 			res = "ANALOG_EVENT_RINGBEGIN";
+			break;
+		case ANALOG_EVENT_PULSE_START:
+			res = "ANALOG_EVENT_PULSE_START";
+			break;
+		case ANALOG_EVENT_NEONMWI_ACTIVE:
+			res = "ANALOG_EVENT_NEONMWI_ACTIVE";
+			break;
+		case ANALOG_EVENT_NEONMWI_INACTIVE:
+			res = "ANALOG_EVENT_NEONMWI_INACTIVE";
 			break;
 		default:
 			res = "UNKNOWN/OTHER";
@@ -1199,10 +1208,10 @@
 	}
 }
 
-static int analog_handle_notify_message(struct ast_channel *chan, struct analog_pvt *p, int flags)
+static int analog_handle_notify_message(struct ast_channel *chan, struct analog_pvt *p, int cid_flags, int neon_mwievent)
 {
 	if (p->calls->handle_notify_message) {
-		p->calls->handle_notify_message(chan, p->chan_pvt, flags);
+		p->calls->handle_notify_message(chan, p->chan_pvt, cid_flags, neon_mwievent);
 		return 0;
 	}
 	else
@@ -2120,7 +2129,7 @@
 		if (cs)
 			callerid_free(cs);
 
-		analog_handle_notify_message(chan, p, flags);
+		analog_handle_notify_message(chan, p, flags, -1);
 
 		ast_setstate(chan, AST_STATE_RING);
 		chan->rings = 1;
@@ -3137,6 +3146,12 @@
 				"interface %d\n", i->channel);
 		}
 		break;
+	case ANALOG_EVENT_NEONMWI_ACTIVE:
+		analog_handle_notify_message(NULL, i, -1, ANALOG_EVENT_NEONMWI_ACTIVE);
+		break;
+	case ANALOG_EVENT_NEONMWI_INACTIVE:
+		analog_handle_notify_message(NULL, i, -1, ANALOG_EVENT_NEONMWI_INACTIVE);
+		break;
 	}
 	pthread_attr_destroy(&attr);
 	return 0;

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h?view=diff&rev=193717&r1=193716&r2=193717
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h Mon May 11 16:28:03 2009
@@ -61,6 +61,8 @@
 	ANALOG_EVENT_RINGBEGIN,
 	ANALOG_EVENT_PULSE_START,
 	ANALOG_EVENT_ERROR,
+	ANALOG_EVENT_NEONMWI_ACTIVE,
+	ANALOG_EVENT_NEONMWI_INACTIVE,
 };
 
 enum analog_sub {
@@ -161,7 +163,7 @@
 
 	int (* const has_voicemail)(void *pvt);
 	int (* const check_for_conference)(void *pvt);
-	void (* const handle_notify_message)(struct ast_channel *chan, void *pvt, int flags);
+	void (* const handle_notify_message)(struct ast_channel *chan, void *pvt, int cid_flags, int neon_mwievent);
 
 };
 




More information about the asterisk-commits mailing list