pbx: Add support for autohints.

This change introduces the concept of autohints. These are hints
which are created as a result of device state changes occurring within
the core. When this happens a hint will be created (if it does not
exist already) using the device name as the extension.

For example if a device state change is received for "PJSIP/bob"
and autohints are enabled on a context then a hint will exist in
that context for "bob" with a device of "PJSIP/bob".

For virtual or custom device states the name after the type will
be used. For example if the device state of "Custom:bob" changes
then a hint will exist in that context for "bob" with a device of
"Custom:bob".

This functionality can be enabled in extensions.conf by placing
"autohints=yes" in a context.

ASTERISK-25881 #close

Change-Id: I7e444c7da41b7b7d33374420fec658beeb18584e
This commit is contained in:
Joshua Colp
2016-03-28 13:31:29 -03:00
parent 051da5c3af
commit 1dc5e28624
4 changed files with 221 additions and 14 deletions

View File

@@ -287,6 +287,15 @@ int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data);
*/
struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar);
/*!
* \brief Enable or disable autohints support on a context
*
* \param con pointer to the context
* \param enabled whether autohints are enabled
*
*/
void ast_context_set_autohints(struct ast_context *con, int enabled);
/*!
* \brief Merge the temporary contexts into a global contexts list and delete from the
* global list the ones that are being added