From: Richard Mudgett Date: Wed, 15 Sep 2010 18:30:54 +0000 (+0000) Subject: Merged revisions 286904-286905 via svnmerge from X-Git-Tag: 11.0.0-beta1~2328 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3fa5ec3be50368e0ad740641eee8ca2eeb0f19a;p=thirdparty%2Fasterisk.git Merged revisions 286904-286905 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r286904 | rmudgett | 2010-09-15 13:28:05 -0500 (Wed, 15 Sep 2010) | 12 lines Unable to originate calls using E&M over T1. When originating a call from Unit Under Test to Reference Unit using E&M RBS signaling mode, I get the following warning message: "Ring/Off-hook in strange state 3 on channel 1". Fixed the sig_analog outgoing flag. It was never set when sig_analog was extracted from chan_dahdi. JIRA SWP-2191 JIRA AST-408 ........ r286905 | rmudgett | 2010-09-15 13:29:21 -0500 (Wed, 15 Sep 2010) | 1 line Simplify some code in sig_analog. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@286906 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/sig_analog.c b/channels/sig_analog.c index 90e8628e87..7bb3c293c5 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -691,6 +691,8 @@ static int analog_update_conf(struct analog_pvt *p) struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor) { + struct ast_channel *ast; + ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel); *callwait = (p->owner != NULL); @@ -701,7 +703,13 @@ struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const s } } - return analog_new_ast_channel(p, AST_STATE_RESERVED, 0, p->owner ? ANALOG_SUB_CALLWAIT : ANALOG_SUB_REAL, requestor); + p->outgoing = 1; + ast = analog_new_ast_channel(p, AST_STATE_RESERVED, 0, + p->owner ? ANALOG_SUB_CALLWAIT : ANALOG_SUB_REAL, requestor); + if (!ast) { + p->outgoing = 0; + } + return ast; } int analog_available(struct analog_pvt *p) @@ -912,6 +920,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int } p->dialednone = 0; + p->outgoing = 1; mysig = p->sig; if (p->outsigmod > -1) { @@ -2801,29 +2810,39 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ case ANALOG_SIG_SF_FEATD: case ANALOG_SIG_SF_FEATDMF: case ANALOG_SIG_SF_FEATB: - if (ast->_state == AST_STATE_PRERING) { + switch (ast->_state) { + case AST_STATE_PRERING: ast_setstate(ast, AST_STATE_RING); - } - if ((ast->_state == AST_STATE_DOWN) || (ast->_state == AST_STATE_RING)) { + /* Fall through */ + case AST_STATE_DOWN: + case AST_STATE_RING: ast_debug(1, "Ring detected\n"); p->subs[index].f.frametype = AST_FRAME_CONTROL; p->subs[index].f.subclass.integer = AST_CONTROL_RING; - } else if (p->outgoing && ((ast->_state == AST_STATE_RINGING) || (ast->_state == AST_STATE_DIALING))) { - ast_debug(1, "Line answered\n"); - if (analog_check_confirmanswer(p)) { - p->subs[index].f.frametype = AST_FRAME_NULL; - p->subs[index].f.subclass.integer = 0; - } else { - p->subs[index].f.frametype = AST_FRAME_CONTROL; - p->subs[index].f.subclass.integer = AST_CONTROL_ANSWER; - ast_setstate(ast, AST_STATE_UP); + break; + case AST_STATE_RINGING: + case AST_STATE_DIALING: + if (p->outgoing) { + ast_debug(1, "Line answered\n"); + if (analog_check_confirmanswer(p)) { + p->subs[index].f.frametype = AST_FRAME_NULL; + p->subs[index].f.subclass.integer = 0; + } else { + p->subs[index].f.frametype = AST_FRAME_CONTROL; + p->subs[index].f.subclass.integer = AST_CONTROL_ANSWER; + ast_setstate(ast, AST_STATE_UP); + } + break; } - } else if (ast->_state != AST_STATE_RING) { + /* Fall through */ + default: ast_log(LOG_WARNING, "Ring/Off-hook in strange state %d on channel %d\n", ast->_state, p->channel); + break; } break; default: ast_log(LOG_WARNING, "Don't know how to handle ring/off hook for signalling %d\n", p->sig); + break; } break; #ifdef ANALOG_EVENT_RINGBEGIN