From 6a81da594d4a2fbe6299db3760c56fcd70024444 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Mon, 28 Apr 2008 16:37:45 +0000 Subject: Add incomplete matching to PBX code and app_dial (closes issue #12351) Reported by: Corydon76 Patches: 20080402__pbx_incomplete__3.diff.txt uploaded by Corydon76 (license 14) pbx_incomplete_with_timeout.diff uploaded by fabled (license 448) Tested by: Corydon76, fabled git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114773 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_dial.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'apps/app_dial.c') diff --git a/apps/app_dial.c b/apps/app_dial.c index 0cc865a1a..5730d99d7 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1619,6 +1619,13 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags } else { /* Nobody answered, next please? */ res = 0; } + + /* SIP, in particular, sends back this error code to indicate an + * overlap dialled number needs more digits. */ + if (chan->hangupcause == AST_CAUSE_INVALID_NUMBER_FORMAT) { + res = AST_PBX_INCOMPLETE; + } + /* almost done, although the 'else' block is 400 lines */ } else { const char *number; @@ -1958,7 +1965,7 @@ out: senddialendevent(chan, pa.status); ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status); - if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE)) { + if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE) && (res != AST_PBX_INCOMPLETE)) { if (calldurationlimit) chan->whentohangup = 0; res = 0; @@ -2059,9 +2066,9 @@ static int retrydial_exec(struct ast_channel *chan, void *data) } } - if (res < 0) + if (res < 0 || res == AST_PBX_INCOMPLETE) { break; - else if (res > 0) { /* Trying to send the call elsewhere (1 digit ext) */ + } else if (res > 0) { /* Trying to send the call elsewhere (1 digit ext) */ if (onedigit_goto(chan, context, (char) res, 1)) { res = 0; break; -- cgit v1.2.3