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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 9 17:57:56 CDT 2009


Author: jpeeler
Date: Thu Jul  9 17:57:52 2009
New Revision: 205727

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205727
Log:
add a few more callbacks so that the analog_ss_thread retains full functionality

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=205727&r1=205726&r2=205727
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Thu Jul  9 17:57:52 2009
@@ -1577,6 +1577,7 @@
 	}
 
 	if (poller.revents & POLLIN) {
+/* jpeeler, note return 2 */
 		/*** NOTES ***/
 		/* Change API: remove cid_signalling from get_callerid, add a new start_cid_detect and stop_cid_detect function
 		 * to enable slin mode and allocate cid detector.  get_callerid should be able to be called any number of times until
@@ -1791,7 +1792,7 @@
 {
 	struct dahdi_pvt *p = pvt;
 
-	ast_log(LOG_ERROR, "Starting cid spill\n");
+	ast_debug(2, "Starting cid spill\n");
 
 	if (p->cidspill) {
 		ast_log(LOG_WARNING, "cidspill already exists??\n");
@@ -1944,15 +1945,30 @@
 static void my_lock_private(void *pvt)
 {
 	struct dahdi_pvt *p = pvt;
-
 	ast_mutex_lock(&p->lock);
 }
 
 static void my_unlock_private(void *pvt)
 {
 	struct dahdi_pvt *p = pvt;
-
 	ast_mutex_unlock(&p->lock);
+}
+
+static int my_set_linear_mode(void *pvt, int idx, int linear_mode)
+{
+	struct dahdi_pvt *p = pvt;
+	if (!linear_mode)
+		linear_mode = p->subs[idx].linear;
+	return dahdi_setlinear(p->subs[idx].dfd, linear_mode);
+}
+
+static void my_get_and_handle_alarms(void *pvt)
+{
+	int res;
+	struct dahdi_pvt *p = pvt;
+	
+	res = get_alarms(p);
+	handle_alarms(p, res);
 }
 
 static void my_increase_ss_count(void)
@@ -2596,6 +2612,8 @@
 	.increase_ss_count = my_increase_ss_count,
 	.decrease_ss_count = my_decrease_ss_count,
 	.distinctive_ring = my_distinctive_ring,
+	.set_linear_mode = my_set_linear_mode,
+	.get_and_handle_alarms = my_get_and_handle_alarms,
 };
 
 static struct dahdi_pvt *round_robin[32];
@@ -7695,8 +7713,10 @@
 	if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
 		struct analog_pvt *ap = p->sig_pvt;
 
-		if (ap->dialing)
+		if (ap->dialing) {
+			ast_debug(1, "Dropping frame since I'm still dialing on %s...\n",ast->name);
 			return 0;
+		}
 	}
 	if (p->dialing) {
 		ast_debug(1, "Dropping frame since I'm still dialing on %s...\n",ast->name);

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=205727&r1=205726&r2=205727
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Thu Jul  9 17:57:52 2009
@@ -1043,9 +1043,6 @@
 	if (!p->subs[ANALOG_SUB_REAL].owner && !p->subs[ANALOG_SUB_CALLWAIT].owner && !p->subs[ANALOG_SUB_THREEWAY].owner) {
 		p->owner = NULL;
 		p->ringt = 0;
-#if 0 /* Since we set it in _call */
-		p->cidrings = 1;
-#endif
 		p->outgoing = 0;
 
 		/* Perform low level hangup if no owner left */
@@ -1263,13 +1260,23 @@
 		return -1;
 
 }
+
+static int analog_set_linear_mode(struct analog_pvt *p, int index, int linear_mode)
+{
+	if (p->calls->set_linear_mode) {
+		return p->calls->set_linear_mode(p->chan_pvt, index, linear_mode);
+	} else
+		return -1;
+}
+
+static void analog_get_and_handle_alarms(struct analog_pvt *p)
+{
+	if (p->calls->get_and_handle_alarms)
+		return p->calls->get_and_handle_alarms(p->chan_pvt);
+}
+
 #define ANALOG_NEED_MFDETECT(p) (((p)->sig == ANALOG_SIG_FEATDMF) || ((p)->sig == ANALOG_SIG_FEATDMF_TA) || ((p)->sig == ANALOG_SIG_E911) || ((p)->sig == ANALOG_SIG_FGC_CAMA) || ((p)->sig == ANALOG_SIG_FGC_CAMAMF) || ((p)->sig == ANALOG_SIG_FEATB))
 
-/* Note by jpeeler: This function has a rather large section of code ifdefed
- * away. I'd like to leave the code there until more testing is done and I
- * know for sure that nothing got left out. The plan is at the latest for this
- * comment and code below to be removed shortly after the merging of sig_pri.
- */
 static void *__analog_ss_thread(void *data)
 {
 	struct analog_pvt *p = data;
@@ -1283,16 +1290,6 @@
 	struct callerid_state *cs = NULL;
 	char *name = NULL, *number = NULL;
 	int flags;
-#if 0
-	unsigned char buf[256];
-	int distMatches;
-	int curRingData[3];
-	int receivedRingT;
-	int samples = 0;
-	int counter1;
-	int counter;
-	int i;
-#endif
 	int timeout;
 	int getforward = 0;
 	char *s1, *s2;
@@ -1859,9 +1856,9 @@
 				cs = NULL;
 				ast_debug(1, "Receiving DTMF cid on "
 					"channel %s\n", chan->name);
-#if 0
-				dahdi_setlinear(p->subs[index].dfd, 0);
-#endif
+
+				analog_set_linear_mode(p, index, 0);
+
 				res = 2000;
 				for (;;) {
 					struct ast_frame *f;
@@ -1885,9 +1882,9 @@
 						break; /* Got ring */
 				}
 				dtmfbuf[i] = '\0';
-#if 0
-				dahdi_setlinear(p->subs[index].dfd, p->subs[index].linear);
-#endif
+
+				analog_set_linear_mode(p, index, 1);
+
 				/* Got cid and ring. */
 				ast_debug(1, "CID got string '%s'\n", dtmfbuf);
 				callerid_get_dtmf(dtmfbuf, dtmfcid, &flags);
@@ -2180,10 +2177,8 @@
 		break;
 	case ANALOG_EVENT_ALARM:
 		p->inalarm = 1;
-#if 0
-		res = get_alarms(p);
-		handle_alarms(p, res);	
-#endif
+		analog_get_and_handle_alarms(p);
+
 	case ANALOG_EVENT_ONHOOK:
 		switch (p->sig) {
 		case ANALOG_SIG_FXOLS:
@@ -3026,10 +3021,8 @@
 		break;
 	case ANALOG_EVENT_ALARM:
 		i->inalarm = 1;
-#if 0
-		res = get_alarms(i);
-		handle_alarms(i, res);	
-#endif
+		analog_get_and_handle_alarms(p);
+
 		/* fall thru intentionally */
 	case ANALOG_EVENT_ONHOOK:
 		/* Back on hook.  Hang up. */

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=205727&r1=205726&r2=205727
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h Thu Jul  9 17:57:52 2009
@@ -187,6 +187,8 @@
 	void (* const decrease_ss_count)(void);
 
 	int (* const distinctive_ring)(struct ast_channel *chan, void *pvt, int idx, int *ringdata);
+	int (* const set_linear_mode)(void *pvt, int idx, int linear_mode);
+	void (* const get_and_handle_alarms)(void *pvt);
 };
 
 




More information about the asterisk-commits mailing list