[asterisk-dev] number lookup functions

Christian Richter christian.richter at beronet.com
Sun Feb 5 03:56:15 MST 2006

Hi Steve,

> int ast_canmatch_extension(struct ast_channel *c, const char *context, 
> const char *exten, int priority, const char *callerid);
> int ast_matchmore_extension(struct ast_channel *c, const char 
> *context, const char *exten, int priority, const char *callerid);
> int ast_extension_match(const char *pattern, const char *extension);
> These are all yes/no type tests. In the general case what most things 
> need is a three way decision:
>    - it matches now
>    - it could match if there were some more digits
>    - it does not match.
> To get this effect things like chan_zap need to call 2 of the above 
> functions. This seems rather inefficient. Is there a good reason why a 
> three way function does not exist? Is it just that nobody ever 
> bothered to code one?
i think most channel drivers need only ast_canmatch and ast_matchmore to 
decide when to start the pbx, but you're right it would be more 
efficient and look better to have a single function returning an enum 
type, or something like that. That would reduce the code in each channel 
driver a bit.

The ast_extension_match function is quite useful in other modules than 
in channel drivers i think, since it does not even needs a channel. So i 
think this one needs still to be standalone.


More information about the asterisk-dev mailing list