[asterisk-commits] jpeeler: trunk r206998 - in /trunk/channels: chan_dahdi.c sig_analog.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 17 12:02:49 CDT 2009


Author: jpeeler
Date: Fri Jul 17 12:02:44 2009
New Revision: 206998

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206998
Log:
Fix segfault in sig_analog when using callwaiting, respect callwaiting options

Sig_analog handles allocating the sub channel for callwaiting, so no longer try
to do it in chan_dahdi. Modified analog_alloc_sub to only mark the sub as
allocated upon success of the alloc_sub callback, which was responsible for the
segfault. Also, the callwaiting and callwaitingcallerid options were being
unconditionally set to true. Now, the options are properly set from
chan_dahdi.conf.

(closes issue #15508)
Reported by: elguero
Tested by: elguero


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

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=206998&r1=206997&r2=206998
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Fri Jul 17 12:02:44 2009
@@ -10999,7 +10999,7 @@
 				analog_p->polarityonanswerdelay = conf->chan.polarityonanswerdelay;
 				analog_p->answeronpolarityswitch = conf->chan.answeronpolarityswitch;
 				analog_p->hanguponpolarityswitch = conf->chan.hanguponpolarityswitch;
-				analog_p->permcallwaiting = 1;
+				analog_p->permcallwaiting = conf->chan.callwaiting; /* permcallwaiting possibly modified in analog_config_complete */
 				analog_p->callreturn = conf->chan.callreturn;
 				analog_p->cancallforward = conf->chan.cancallforward;
 				analog_p->canpark = conf->chan.canpark;
@@ -11016,7 +11016,7 @@
 				analog_p->cid_signalling = conf->chan.cid_signalling;
 				analog_p->stripmsd = conf->chan.stripmsd;
 				analog_p->cid_start = ANALOG_CID_START_RING;
-				tmp->callwaitingcallerid = analog_p->callwaitingcallerid = 1;
+				analog_p->callwaitingcallerid = conf->chan.callwaitingcallerid;
 				analog_p->usedistinctiveringdetection = conf->chan.usedistinctiveringdetection;
 				analog_p->ringt = conf->chan.ringt;
 				analog_p->ringt_base = ringt_base;
@@ -11319,12 +11319,6 @@
 			if (p->channel == CHAN_PSEUDO) {
 				p = duplicate_pseudo(p);
 				if (!p) {
-					break;
-				}
-			}
-			if (p->owner) {
-				if (alloc_sub(p, SUB_CALLWAIT)) {
-					p = NULL;
 					break;
 				}
 			}

Modified: trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_analog.c?view=diff&rev=206998&r1=206997&r2=206998
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Fri Jul 17 12:02:44 2009
@@ -289,9 +289,13 @@
 
 static int analog_alloc_sub(struct analog_pvt *p, enum analog_sub x)
 {
-	p->subs[x].allocd = 1;
-	if (p->calls->allocate_sub)
-		return p->calls->allocate_sub(p->chan_pvt, x);
+	if (p->calls->allocate_sub) {
+		int res;
+		res = p->calls->allocate_sub(p->chan_pvt, x);
+		if (!res)
+			p->subs[x].allocd = 1;
+		return res;
+	}
 
 	return 0;
 }




More information about the asterisk-commits mailing list