AMI hook interface

This patch, originally submitted by jozza, enables custom modules to send actions to AMI
and receive messages from AMI via a hook interface. Included is a simple test module to
illustrate the interface.

(closes issue #14635)
Reported by: jozza

Review: https://reviewboard.asterisk.org/r/412/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
David Brooks
2009-11-03 21:26:28 +00:00
parent 7ed425ec80
commit d87006ca1c
3 changed files with 187 additions and 1 deletions

View File

@@ -73,6 +73,7 @@
#define EVENT_FLAG_DIALPLAN (1 << 11) /* Dialplan events (VarSet, NewExten) */
#define EVENT_FLAG_ORIGINATE (1 << 12) /* Originate a call to an extension */
#define EVENT_FLAG_AGI (1 << 13) /* AGI events */
#define EVENT_FLAG_HOOKRESPONSE (1 << 14) /* Hook Response */
/*@} */
/*! \brief Export manager structures */
@@ -107,6 +108,15 @@ void ast_manager_register_hook(struct manager_custom_hook *hook);
*/
void ast_manager_unregister_hook(struct manager_custom_hook *hook);
/*! \brief Registered hooks can call this function to invoke actions and they will receive responses through registered callback
* \param hookid the file identifier specified in manager_custom_hook struct when registering a hook
* \param msg ami action mesage string e.g. "Action: SipPeers\r\n"
* \retval 0 on Success
* \retval non-zero on Failure
*/
int ast_hook_send_action(struct manager_custom_hook *hook, const char *msg);
struct mansession;
struct message {