Index: asterisk/manager.c =================================================================== RCS file: /usr/cvsroot/asterisk/manager.c,v retrieving revision 1.111 diff -u -r1.111 manager.c --- asterisk/manager.c 14 Sep 2005 20:46:49 -0000 1.111 +++ asterisk/manager.c 28 Sep 2005 23:40:45 -0000 @@ -919,18 +919,28 @@ "Context: %s\r\n" "Exten: %s\r\n" "Reason: %d\r\n" - "Uniqueid: %s\r\n", - in->idtext, in->tech, in->data, in->context, in->exten, reason, chan ? chan->uniqueid : ""); + "Uniqueid: %s\r\n" + "CallerID: %s\r\n" + "CallerIDName: %s\r\n", + in->idtext, in->tech, in->data, in->context, in->exten, reason, chan ? chan->uniqueid : "", + in->cid_num ? in->cid_num : "", + in->cid_name ? in->cid_name : "" + ); else manager_event(EVENT_FLAG_CALL, "OriginateFailure", - "%s" - "Channel: %s/%s\r\n" - "Context: %s\r\n" - "Exten: %s\r\n" - "Reason: %d\r\n" - "Uniqueid: %s\r\n", - in->idtext, in->tech, in->data, in->context, in->exten, reason, chan ? chan->uniqueid : ""); + "%s" + "Channel: %s/%s\r\n" + "Context: %s\r\n" + "Exten: %s\r\n" + "Reason: %d\r\n" + "Uniqueid: %s\r\n" + "CallerID: %s\r\n" + "CallerIDName: %s\r\n", + in->idtext, in->tech, in->data, in->context, in->exten, reason, chan ? chan->uniqueid : "", + in->cid_num ? in->cid_num : "", + in->cid_name ? in->cid_name : "" + ); /* Locked by ast_pbx_outgoing_exten or ast_pbx_outgoing_app */ if (chan) @@ -1425,6 +1435,23 @@ 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"; + +/*--- action_command: Manager command "command" - execute CLI command */ +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; +} + /*--- manager_event: Send AMI event to client */ int manager_event(int category, char *event, char *fmt, ...) { @@ -1560,7 +1587,8 @@ ast_manager_register2("Logoff", 0, action_logoff, "Logoff Manager", mandescr_logoff); ast_manager_register2("Hangup", EVENT_FLAG_CALL, action_hangup, "Hangup Channel", mandescr_hangup); 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("Setvar", EVENT_FLAG_CALL, action_setvar, "Set Channel Variable", mandescr_setvar ); + ast_manager_register2("SendEvent", EVENT_FLAG_USER, action_sendevent, "Send Manager Event", mandescr_sendevent ); ast_manager_register2("Getvar", EVENT_FLAG_CALL, action_getvar, "Gets a Channel Variable", mandescr_getvar ); ast_manager_register2("Redirect", EVENT_FLAG_CALL, action_redirect, "Redirect (transfer) a call", mandescr_redirect ); ast_manager_register2("Originate", EVENT_FLAG_CALL, action_originate, "Originate Call", mandescr_originate);