Index: pbx.c =================================================================== RCS file: /usr/cvsroot/asterisk/pbx.c,v retrieving revision 1.179 diff -u -r1.179 pbx.c --- pbx.c 1 Dec 2004 01:28:07 -0000 1.179 +++ pbx.c 2 Dec 2004 03:21:24 -0000 @@ -2825,7 +2825,9 @@ struct ast_context *c; char *exten = NULL, *context = NULL; int context_existence = 0, extension_existence = 0; - + /* Variables used for different counters */ + int total_context = 0, total_exten = 0, total_prio = 0; + if (argc != 3 && argc != 2) return -1; /* we obtain [exten@]context? if yes, split them ... */ @@ -2875,6 +2877,7 @@ * if we our extension only */ if (!exten) { + total_context++; ast_cli(fd, "[ Context '%s' created by '%s' ]\n", ast_get_context_name(c), ast_get_context_registrar(c)); context_info_printed = 1; @@ -2899,11 +2902,13 @@ /* may we print context info? */ if (!context_info_printed) { + total_context++; ast_cli(fd, "[ Context '%s' created by '%s' ]\n", ast_get_context_name(c), ast_get_context_registrar(c)); context_info_printed = 1; } + total_prio++; /* write extension name and first peer */ bzero(buf, sizeof(buf)); @@ -2919,9 +2924,11 @@ ast_cli(fd, " %-17s %-45s [%s]\n", buf, buf2, ast_get_extension_registrar(e)); + total_exten++; /* walk next extension peers */ p = ast_walk_extension_priorities(e, e); while (p) { + total_prio++; bzero((void *)buf2, sizeof(buf2)); bzero((void *)buf, sizeof(buf)); if (ast_get_extension_label(p)) @@ -3008,7 +3015,8 @@ exten); return RESULT_FAILURE; } - + ast_cli(fd,"-= %d extensions (%d priorities) in %d contexts. =-\n",total_exten, total_prio, total_context); + /* everything ok */ return RESULT_SUCCESS; }