[asterisk-commits] jpeeler: trunk r217744 - /trunk/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 10 15:18:35 CDT 2009


Author: jpeeler
Date: Thu Sep 10 15:18:30 2009
New Revision: 217744

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=217744
Log:
Stop caller id transmission when offhook event detected.

This fixes the problem that would occur if an analog phone was picked up while
the caller id was being sent. The caller id before sent the whole spill even
after pickup and is now corrected.


Modified:
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_analog.c
    trunk/channels/sig_analog.h

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=217744&r1=217743&r2=217744
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Thu Sep 10 15:18:30 2009
@@ -2104,6 +2104,15 @@
 	return 0;
 }
 
+static void my_cancel_cidspill(void *pvt)
+{
+	struct dahdi_pvt *p = pvt;
+	if (p->cidspill) {
+		ast_free(p->cidspill);
+		p->cidspill = NULL;
+	}
+}
+
 static void my_increase_ss_count(void)
 {
 	ast_mutex_lock(&ss_thread_lock);
@@ -2434,6 +2443,8 @@
 	struct dahdi_pvt *p = pvt;
 	int res;
 	struct dahdi_params par;
+
+	memset(&par, 0, sizeof(par));
 
 	if (p->subs[SUB_REAL].dfd > -1)
 		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &par);
@@ -2833,6 +2844,7 @@
 	.check_waitingfordt = my_check_waitingfordt,
 	.set_confirmanswer = my_set_confirmanswer,
 	.check_confirmanswer = my_check_confirmanswer,
+	.cancel_cidspill = my_cancel_cidspill,
 };
 
 static struct dahdi_pvt *round_robin[32];
@@ -4359,6 +4371,7 @@
 	}
 	while (p->cidpos < p->cidlen) {
 		res = write(p->subs[SUB_REAL].dfd, p->cidspill + p->cidpos, p->cidlen - p->cidpos);
+		ast_debug(4, "writing callerid at pos %d of %d, res = %d\n", p->cidpos, p->cidlen, res);
 		if (res < 0) {
 			if (errno == EAGAIN)
 				return 0;

Modified: trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_analog.c?view=diff&rev=217744&r1=217743&r2=217744
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Thu Sep 10 15:18:30 2009
@@ -769,6 +769,15 @@
 	}
 
 	return 0;
+}
+
+static void analog_cancel_cidspill(struct analog_pvt *p)
+{
+	if (!p->calls->cancel_cidspill) {
+		return;
+	}
+
+	p->calls->cancel_cidspill(p->chan_pvt);
 }
 
 static int analog_set_linear_mode(struct analog_pvt *p, int index, int linear_mode)
@@ -2541,6 +2550,7 @@
 				/* Make sure it stops ringing */
 				analog_off_hook(p);
 				ast_debug(1, "channel %d answered\n", p->channel);
+				analog_cancel_cidspill(p);
 				analog_set_dialing(p, 0);
 				p->callwaitcas = 0;
 				if (analog_check_confirmanswer(p)) {
@@ -2662,6 +2672,7 @@
 		}
 
 		if (ast->rings > p->cidrings) {
+			analog_cancel_cidspill(p);
 			p->callwaitcas = 0;
 		}
 		p->subs[index].f.frametype = AST_FRAME_CONTROL;
@@ -3187,6 +3198,7 @@
 			if (res && (errno == EBUSY)) {
 				break;
 			}
+			analog_cancel_cidspill(i);
 			if (i->immediate) {
 				analog_set_echocanceller(i, 1);
 				/* The channel is immediately up.  Start right away */

Modified: trunk/channels/sig_analog.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_analog.h?view=diff&rev=217744&r1=217743&r2=217744
==============================================================================
--- trunk/channels/sig_analog.h (original)
+++ trunk/channels/sig_analog.h Thu Sep 10 15:18:30 2009
@@ -201,6 +201,7 @@
 	int (* const check_waitingfordt)(void *pvt);
 	void (* const set_confirmanswer)(void *pvt, int flag);
 	int (* const check_confirmanswer)(void *pvt);
+	void (* const cancel_cidspill)(void *pvt);
 };
 
 




More information about the asterisk-commits mailing list