Index: manager.c =================================================================== RCS file: /usr/cvsroot/asterisk/manager.c,v retrieving revision 1.41 diff -u -r1.41 manager.c --- manager.c 9 Mar 2004 20:01:46 -0000 1.41 +++ manager.c 29 Mar 2004 08:29:28 -0000 @@ -379,6 +379,40 @@ return 0; } + + +static int action_lookup(struct mansession *s, struct message *m) +{ + struct ast_channel *c = NULL; + char *name = astman_get_header(m, "Phone"); + char *startpoint; + if (!strlen(name)) { + astman_send_error(s, m, "No phone specified"); + return 0; + } + c = ast_channel_walk(NULL); + while(c) { + if( (startpoint=strchr( c->name, '/'))) { + startpoint++; + if (!strncasecmp( startpoint, name, strlen(name))) { + break; + } + } + c = ast_channel_walk(c); + } + if (!c) { + astman_send_error(s, m, "Phone is inactive"); + return 0; + } else { + ast_cli(s->fd, "Response: Success\r\n" + "Channel: %s\r\n", c->name); + } + return 0; +} + + + + static int action_status(struct mansession *s, struct message *m) { char *id = astman_get_header(m,"ActionID"); @@ -955,6 +989,7 @@ ast_manager_register( "ExtensionState", EVENT_FLAG_CALL, action_extensionstate, "Check Extension Status" ); ast_manager_register( "AbsoluteTimeout", EVENT_FLAG_CALL, action_timeout, "Set Absolute Timeout" ); ast_manager_register( "MailboxCount", EVENT_FLAG_CALL, action_mailboxcount, "Check Mailbox Message Count" ); + ast_manager_register( "Lookup", EVENT_FLAG_CALL, action_lookup, "Lookup channel detail" ); ast_cli_register(&show_mancmds_cli); ast_cli_register(&show_manconn_cli);