@ -945,37 +945,38 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
q - > status = STATUS_NO_EXTENSION ;
q - > status = STATUS_NO_EXTENSION ;
/* scan the list trying to match extension and CID */
/* scan the list trying to match extension and CID */
for ( eroot = tmp - > root ; eroot ; eroot = eroot - > next ) {
eroot = NULL ;
while ( ( eroot = ast_walk_context_extensions ( tmp , eroot ) ) ) {
int match = extension_match_core ( eroot - > exten , exten , action ) ;
int match = extension_match_core ( eroot - > exten , exten , action ) ;
/* 0 on fail, 1 on match, 2 on earlymatch */
/* 0 on fail, 1 on match, 2 on earlymatch */
if ( match & & ( ! eroot - > matchcid | | matchcid ( eroot - > cidmatch , callerid ) ) ) {
if ( ! match | | ( eroot - > matchcid & & matchcid ( eroot - > cidmatch , callerid ) ) )
if ( match = = 2 & & action = = E_MATCHMORE ) {
continue; /* keep trying */
/* We match an extension ending in '!'.
if ( match = = 2 & & action = = E_MATCHMORE ) {
* The decision in this case is final and is NULL ( no match ) .
/* We match an extension ending in '!'.
*/
* The decision in this case is final and is NULL ( no match ) .
return NULL ;
*/
} else {
return NULL ;
if ( q - > status < STATUS_NO_PRIORITY )
}
q - > status = STATUS_NO_PRIORITY ;
/* found entry, now look for the right priority */
/* now look for the right priority */
if ( q - > status < STATUS_NO_PRIORITY )
for ( e = eroot ; e ; e = e - > peer ) {
q - > status = STATUS_NO_PRIORITY ;
/* Match priority */
e = NULL ;
if ( action = = E_FINDLABEL ) {
while ( ( e = ast_walk_extension_priorities ( eroot , e ) ) ) {
if ( q - > status < STATUS_NO_LABEL )
/* Match label or priority */
q - > status = STATUS_NO_LABEL ;
if ( action = = E_FINDLABEL ) {
if ( label & & e - > label & & ! strcmp ( label , e - > label ) ) {
if ( q - > status < STATUS_NO_LABEL )
q - > status = STATUS_ SUCCESS ;
q - > status = STATUS_ NO_LABEL ;
q - > foundcontext = context ;
if ( label & & e - > label & & ! strcmp ( label , e - > label ) )
return e ;
break ; /* found it */
}
} else if ( e - > priority = = priority ) {
} else if ( e - > priority = = priority ) {
break ; /* found it */
q - > status = STATUS_SUCCESS ;
} /* else keep searching */
q - > foundcontext = context ;
}
return e ;
if ( e ) { /* found a valid match */
}
q - > status = STATUS_SUCCESS ;
}
q - > foundcontext = context ;
}
return e ;
}
}
}
}
/* Check alternative switches */
/* Check alternative switches */