Index: manager.c =================================================================== RCS file: /usr/cvsroot/asterisk/manager.c,v retrieving revision 1.17 diff -u -2 -r1.17 manager.c --- manager.c 13 Aug 2003 15:25:16 -0000 1.17 +++ manager.c 18 Aug 2003 07:57:25 -0000 @@ -146,16 +146,20 @@ } -void astman_send_error(struct mansession *s, char *error) +void astman_send_error(struct mansession *s, char *error, char *aid) { ast_mutex_lock(&s->lock); ast_cli(s->fd, "Response: Error\r\n"); + if (aid) + ast_cli(s->fd, "ActionID: %s\r\n", aid); ast_cli(s->fd, "Message: %s\r\n\r\n", error); ast_mutex_unlock(&s->lock); } -void astman_send_response(struct mansession *s, char *resp, char *msg) +void astman_send_response(struct mansession *s, char *resp, char *msg, char *aid) { ast_mutex_lock(&s->lock); ast_cli(s->fd, "Response: %s\r\n", resp); + if (aid) + ast_cli(s->fd, "ActionID: %s\r\n", aid); if (msg) ast_cli(s->fd, "Message: %s\r\n\r\n", msg); @@ -165,7 +169,7 @@ } -void astman_send_ack(struct mansession *s, char *msg) +void astman_send_ack(struct mansession *s, char *msg, char *aid) { - astman_send_response(s, "Success", msg); + astman_send_response(s, "Success", msg, aid); } @@ -274,5 +278,5 @@ static int action_ping(struct mansession *s, struct message *m) { - astman_send_response(s, "Pong", NULL); + astman_send_response(s, "Pong", NULL, NULL); return 0; } @@ -280,5 +284,5 @@ static int action_logoff(struct mansession *s, struct message *m) { - astman_send_response(s, "Goodbye", "Thanks for all the fish."); + astman_send_response(s, "Goodbye", "Thanks for all the fish.", NULL); return -1; } @@ -289,5 +293,5 @@ char *name = astman_get_header(m, "Channel"); if (!strlen(name)) { - astman_send_error(s, "No channel specified"); + astman_send_error(s, "No channel specified",NULL); return 0; } @@ -300,9 +304,9 @@ } if (!c) { - astman_send_error(s, "No such channel"); + astman_send_error(s, "No such channel",NULL); return 0; } ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT); - astman_send_ack(s, "Channel Hungup"); + astman_send_ack(s, "Channel Hungup", NULL); return 0; } @@ -311,10 +315,19 @@ { struct ast_channel *c; + char *ID = astman_get_header(m, "ID"); + char ActID[256] = ""; char bridge[256]; - astman_send_ack(s, "Channel status will follow"); + if (strlen(ID)) { + astman_send_ack(s, "Channel status will follow",ID); + } else { + astman_send_ack(s, "Channel status will follow",NULL); + }; c = ast_channel_walk(NULL); + if (strlen(ID)) + snprintf(ActID, sizeof(ActID), "ActionID: %s\r\n",ID); while(c) { if (c->bridge) snprintf(bridge, sizeof(bridge), "Link: %s\r\n", c->bridge->name); + else strcpy(bridge, ""); @@ -329,9 +342,10 @@ "Priority: %d\r\n" "%s" + "%s" "Uniqueid: %s\r\n" "\r\n", c->name, c->callerid ? c->callerid : "", ast_state2str(c->_state), c->context, - c->exten, c->priority, bridge, c->uniqueid); + c->exten, c->priority, bridge, ActID, c->uniqueid); } else { ast_cli(s->fd, @@ -341,8 +355,9 @@ "State: %s\r\n" "%s" + "%s" "Uniqueid: %s\r\n" "\r\n", c->name, c->callerid ? c->callerid : "", - ast_state2str(c->_state), bridge, c->uniqueid); + ast_state2str(c->_state), bridge, ActID, c->uniqueid); } c = ast_channel_walk(c); @@ -361,9 +376,9 @@ int res; if (!name || !strlen(name)) { - astman_send_error(s, "Channel not specified"); + astman_send_error(s, "Channel not specified",NULL); return 0; } if (strlen(priority) && (sscanf(priority, "%d", &pi) != 1)) { - astman_send_error(s, "Invalid priority\n"); + astman_send_error(s, "Invalid priority\n",NULL); return 0; } @@ -373,11 +388,11 @@ res = ast_async_goto_by_name(name2, context, exten, pi); if (!res) - astman_send_ack(s, "Dual Redirect successful"); + astman_send_ack(s, "Dual Redirect successful",NULL); else - astman_send_error(s, "Secondary redirect failed"); + astman_send_error(s, "Secondary redirect failed",NULL); } else - astman_send_ack(s, "Redirect successful"); + astman_send_ack(s, "Redirect successful",NULL); } else - astman_send_error(s, "Redirect failed"); + astman_send_error(s, "Redirect failed",NULL); return 0; } @@ -415,13 +430,13 @@ char tmp[256]; if (!name) { - astman_send_error(s, "Channel not specified"); + astman_send_error(s, "Channel not specified",NULL); return 0; } if (strlen(priority) && (sscanf(priority, "%d", &pi) != 1)) { - astman_send_error(s, "Invalid priority\n"); + astman_send_error(s, "Invalid priority\n",NULL); return 0; } if (strlen(timeout) && (sscanf(timeout, "%d", &to) != 1)) { - astman_send_error(s, "Invalid timeout\n"); + astman_send_error(s, "Invalid timeout\n",NULL); return 0; } @@ -430,5 +445,5 @@ data = strchr(tmp, '/'); if (!data) { - astman_send_error(s, "Invalid channel\n"); + astman_send_error(s, "Invalid channel\n",NULL); return 0; } @@ -441,7 +456,7 @@ } if (!res) - astman_send_ack(s, "Originate successfully queued"); + astman_send_ack(s, "Originate successfully queued",NULL); else - astman_send_error(s, "Originate failed"); + astman_send_error(s, "Originate failed",NULL); return 0; } @@ -451,5 +466,5 @@ char *mailbox = astman_get_header(m, "Mailbox"); if (!mailbox || !strlen(mailbox)) { - astman_send_error(s, "Mailbox not specified"); + astman_send_error(s, "Mailbox not specified",NULL); return 0; } @@ -466,5 +481,5 @@ int newmsgs = 0, oldmsgs = 0; if (!mailbox || !strlen(mailbox)) { - astman_send_error(s, "Mailbox not specified"); + astman_send_error(s, "Mailbox not specified",NULL); return 0; } @@ -487,5 +502,5 @@ int status; if (!exten || !strlen(exten)) { - astman_send_error(s, "Extension not specified"); + astman_send_error(s, "Extension not specified",NULL); return 0; } @@ -509,9 +524,9 @@ int timeout = atoi(astman_get_header(m, "Timeout")); if (!strlen(name)) { - astman_send_error(s, "No channel specified"); + astman_send_error(s, "No channel specified",NULL); return 0; } if (!timeout) { - astman_send_error(s, "No timeout specified"); + astman_send_error(s, "No timeout specified",NULL); return 0; } @@ -524,9 +539,9 @@ } if (!c) { - astman_send_error(s, "No such channel"); + astman_send_error(s, "No such channel",NULL); return 0; } ast_channel_setwhentohangup(c, timeout); - astman_send_ack(s, "Timeout Set"); + astman_send_ack(s, "Timeout Set",NULL); return 0; } @@ -541,5 +556,5 @@ if (!strlen(action)) { - astman_send_error(s, "Missing action in request"); + astman_send_error(s, "Missing action in request",NULL); return 0; } @@ -557,5 +572,5 @@ return 0; } else { - astman_send_error(s, "Must specify AuthType"); + astman_send_error(s, "Must specify AuthType",NULL); return 0; } @@ -563,5 +578,5 @@ if (authenticate(s, m)) { sleep(1); - astman_send_error(s, "Authentication failed"); + astman_send_error(s, "Authentication failed",NULL); return -1; } else { @@ -570,8 +585,8 @@ ast_verbose(VERBOSE_PREFIX_2 "Manager '%s' logged on from %s\n", s->username, inet_ntoa(s->sin.sin_addr)); ast_log(LOG_EVENT, "Manager '%s' logged on from %s\n", s->username, inet_ntoa(s->sin.sin_addr)); - astman_send_ack(s, "Authentication accepted"); + astman_send_ack(s, "Authentication accepted",NULL); } } else - astman_send_error(s, "Authentication Required"); + astman_send_error(s, "Authentication Required",NULL); } else { while( tmp ) { @@ -581,5 +596,5 @@ return -1; } else { - astman_send_error(s, "Permission denied"); + astman_send_error(s, "Permission denied",NULL); } return 0; @@ -587,5 +602,5 @@ tmp = tmp->next; } - astman_send_error(s, "Invalid/unknown command"); + astman_send_error(s, "Invalid/unknown command",NULL); } return 0; Index: res/res_monitor.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_monitor.c,v retrieving revision 1.3 diff -u -2 -r1.3 res_monitor.c --- res/res_monitor.c 13 Aug 2003 15:25:16 -0000 1.3 +++ res/res_monitor.c 18 Aug 2003 07:57:25 -0000 @@ -283,5 +283,5 @@ char *format = astman_get_header(m, "Format"); if((!name)||(!strlen(name))) { - astman_send_error(s, "No channel specified"); + astman_send_error(s, "No channel specified",NULL); return 0; } @@ -294,14 +294,14 @@ } if (!c) { - astman_send_error(s, "No such channel"); + astman_send_error(s, "No such channel",NULL); return 0; } if( ast_monitor_start( c, format, fname, 1 ) ) { if( ast_monitor_change_fname( c, fname, 1 ) ) { - astman_send_error(s, "Could not start monitoring channel"); + astman_send_error(s, "Could not start monitoring channel",NULL); return 0; } } - astman_send_ack(s, "Started monitoring channel"); + astman_send_ack(s, "Started monitoring channel",NULL); return 0; } @@ -312,5 +312,5 @@ char *name = astman_get_header(m, "Channel"); if((!name)||(!strlen(name))) { - astman_send_error(s, "No channel specified"); + astman_send_error(s, "No channel specified",NULL); return 0; } @@ -323,12 +323,12 @@ } if (!c) { - astman_send_error(s, "No such channel"); + astman_send_error(s, "No such channel",NULL); return 0; } if( ast_monitor_stop( c, 1 ) ) { - astman_send_error(s, "Could not stop monitoring channel"); + astman_send_error(s, "Could not stop monitoring channel",NULL); return 0; } - astman_send_ack(s, "Stopped monitoring channel"); + astman_send_ack(s, "Stopped monitoring channel",NULL); return 0; } @@ -340,9 +340,9 @@ char *fname = astman_get_header(m, "File"); if((!name) || (!strlen(name))) { - astman_send_error(s, "No channel specified"); + astman_send_error(s, "No channel specified",NULL); return 0; } if ((!fname)||(!strlen(fname))) { - astman_send_error(s, "No filename specified"); + astman_send_error(s, "No filename specified",NULL); return 0; } @@ -355,12 +355,12 @@ } if (!c) { - astman_send_error(s, "No such channel"); + astman_send_error(s, "No such channel",NULL); return 0; } if( ast_monitor_change_fname( c, fname, 1 ) ) { - astman_send_error(s, "Could not change monitored filename of channel"); + astman_send_error(s, "Could not change monitored filename of channel",NULL); return 0; } - astman_send_ack(s, "Stopped monitoring channel"); + astman_send_ack(s, "Stopped monitoring channel",NULL); return 0; } Index: apps/app_queue.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v retrieving revision 1.27 diff -u -2 -r1.27 app_queue.c --- apps/app_queue.c 15 Aug 2003 04:38:39 -0000 1.27 +++ apps/app_queue.c 18 Aug 2003 07:57:26 -0000 @@ -1394,5 +1394,5 @@ struct ast_call_queue *q; struct queue_ent *qe; - astman_send_ack(s, "Queue status will follow"); + astman_send_ack(s, "Queue status will follow",NULL); time(&now); q = queues; Index: include/asterisk/manager.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/manager.h,v retrieving revision 1.4 diff -u -2 -r1.4 manager.h --- include/asterisk/manager.h 13 Aug 2003 15:25:16 -0000 1.4 +++ include/asterisk/manager.h 18 Aug 2003 07:57:26 -0000 @@ -96,7 +96,7 @@ extern char *astman_get_header(struct message *m, char *var); -extern void astman_send_error(struct mansession *s, char *error); -extern void astman_send_response(struct mansession *s, char *resp, char *msg); -extern void astman_send_ack(struct mansession *s, char *msg); +extern void astman_send_error(struct mansession *s, char *error, char *aid); +extern void astman_send_response(struct mansession *s, char *resp, char *msg, char *aid); +extern void astman_send_ack(struct mansession *s, char *msg,char *aid); /* Called by Asterisk initialization */