[asterisk-dev] Strange behaviour of Incomplete() application - BUG FOUND!

Pavel Troller patrol at sinus.cz
Thu Sep 10 23:53:10 CDT 2009


> > 
> > I have a suspicion that you aren't showing us your entire dialplan, given that
> > your dialplan output doesn't match your dialplan.  In any case, if the
> > dialplan detects that there's only one extension that could match (i.e. that
> > matchmore returns false), then the invalid extension "i" is triggered.  That's
> > probably what is happening here, although with your incomplete dialplan, we
> > cannot show you why it is the case.
> > 
Hi!
  Thank you for your hint with ast_matchmore_extension(), I've looked for it
in the sources, found it in __ast_pbx_run, in the branch handling
AST_PBX_INCOMPLETE. There is IMHO a bug there! The extension was searched with
a _current_ priority, i.e. with a priority moreless randomly given by the
position of Incomplete() app in the incomplete dialing handler. Of course 
sometimes a match was found, but sometimes not! It caused such a "mystic"
behaviour I was observing (yes, I was "cheating" in my first post, the
Incomplete() app was really on the priority 2, which EXACTLY explains the bug -
there is a prio 2 for 2244 but no prio 2 for 225X at all).
  I've changed the code to set the priority to 1 in the matchmore call. Now it
works exactly as I want, it always finds all the extensions and never triggers
an invalid extension when it shouldn't, still protecting the handler from being
cycled.
  The patch is attached. 
    WIth regards, Pavel Troller
  
-------------- next part --------------
--- main/pbx.c	2009-09-11 06:48:14.000000000 +0200
+++ main/pbx.c.new	2009-09-11 06:48:09.000000000 +0200
@@ -3778,7 +3778,7 @@
 				ast_verb(2, "Spawn extension (%s, %s, %d) exited INCOMPLETE on '%s'\n", c->context, c->exten, c->priority, c->name);
 
 				/* Don't cycle on incomplete - this will happen if the only extension that matches is our "incomplete" extension */
-				if (!ast_matchmore_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) {
+				if (!ast_matchmore_extension(c, c->context, c->exten, 1, c->cid.cid_num)) {
 					invalid = 1;
 				} else {
 					ast_copy_string(dst_exten, c->exten, sizeof(dst_exten));


More information about the asterisk-dev mailing list