--- manager.c.org 2007-09-05 19:42:07.000000000 -0700 +++ manager.c 2007-09-05 19:48:47.000000000 -0700 @@ -2336,6 +2336,22 @@ return 0; } +static char mandescr_sendevent[] = +"Description: Send an event to manager sessions.\n" +"Variables: (Names marked with * are required)\n" +" *Event: EventStringToSend\n" +" Body: Optional string to send.\n"; + +static int action_sendevent(struct mansession *s, struct message *m) +{ + char *event = astman_get_header(m, "Event"); + char *body = astman_get_header(m, "Body"); + + manager_event(EVENT_FLAG_USER, "ManagerUserEvent", "Event: %s\r\nBody: %s\r\n", event, body ? body : ""); + + return 0; +} + /*! \brief manager_event: Send AMI event to client */ int manager_event(int category, const char *event, const char *fmt, ...) { @@ -2751,6 +2767,7 @@ ast_manager_register("Status", EVENT_FLAG_CALL, action_status, "Lists channel status" ); ast_manager_register2("Setvar", EVENT_FLAG_CALL, action_setvar, "Set Channel Variable", mandescr_setvar ); ast_manager_register2("Getvar", EVENT_FLAG_CALL, action_getvar, "Gets a Channel Variable", mandescr_getvar ); + ast_manager_register2("SendEvent", EVENT_FLAG_USER, action_sendevent, "Send Manager Event", mandescr_sendevent ); ast_manager_register2("GetConfig", EVENT_FLAG_CONFIG, action_getconfig, "Retrieve configuration", mandescr_getconfig); ast_manager_register2("UpdateConfig", EVENT_FLAG_CONFIG, action_updateconfig, "Update basic configuration", mandescr_updateconfig); ast_manager_register2("Redirect", EVENT_FLAG_CALL, action_redirect, "Redirect (transfer) a call", mandescr_redirect );