--- manager.c.org 2008-04-22 11:27:12.000000000 -0700 +++ manager.c 2008-04-22 11:36:32.000000000 -0700 @@ -2397,6 +2397,22 @@ return NULL; } +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; +} + static int append_event(const char *str, int category) { struct eventqent *tmp, *prev = NULL; @@ -2843,6 +2859,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 );