From d669ba24d7789874dd1649c3bcc45a56f5d60812 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Thu, 6 Aug 2009 20:15:11 +0000 Subject: [PATCH] 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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@210869 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/sig_analog.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/channels/sig_analog.c b/channels/sig_analog.c index 6556b0e615..8bcd88ba29 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -1337,10 +1337,14 @@ static void *__analog_ss_thread(void *data) 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 @@ static void *__analog_ss_thread(void *data) 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 @@ quit: 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)