[asterisk-commits] rmudgett: trunk r210869 - /trunk/channels/sig_analog.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 6 15:15:14 CDT 2009


Author: rmudgett
Date: Thu Aug  6 15:15:11 2009
New Revision: 210869

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=210869
Log:
Miscellaneous minor fixes to sig_analog.

*  Sanity adjustments to __analog_ss_thread for sig_analog environment.
*  Deleted some duplicated code.
*  Fixed analog_ss_thread_start passing the wrong pointer.

Modified:
    trunk/channels/sig_analog.c

Modified: trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_analog.c?view=diff&rev=210869&r1=210868&r2=210869
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Thu Aug  6 15:15:11 2009
@@ -1337,10 +1337,14 @@
 
 	ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
 
+	if (!chan) {
+		/* What happened to the channel? */
+		goto quit;
+	}
 	/* in the bizarre case where the channel has become a zombie before we
 	   even get started here, abort safely
 	*/
-	if (!p) {
+	if (!chan->tech_pvt) {
 		ast_log(LOG_WARNING, "Channel became a zombie before simple switch could be started (%s)\n", chan->name);
 		ast_hangup(chan);
 		goto quit;
@@ -2098,13 +2102,11 @@
 		goto quit;
 	default:
 		ast_log(LOG_WARNING, "Don't know how to handle simple switch with signalling %s on channel %d\n", analog_sigtype_to_str(p->sig), p->channel);
-		res = analog_play_tone(p, index, ANALOG_TONE_CONGESTION);
-		if (res < 0)
-				ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", p->channel);
+		break;
 	}
 	res = analog_play_tone(p, index, ANALOG_TONE_CONGESTION);
 	if (res < 0)
-			ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", p->channel);
+		ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", p->channel);
 	ast_hangup(chan);
 quit:
 	analog_decrease_ss_count(p);
@@ -2114,7 +2116,8 @@
 int analog_ss_thread_start(struct analog_pvt *p, struct ast_channel *chan)
 {
 	pthread_t threadid;
-	return ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, chan);
+
+	return ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, p);
 }
 
 static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_channel *ast)




More information about the asterisk-commits mailing list