Index: channels/chan_zap.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v retrieving revision 1.437 diff -u -r1.437 chan_zap.c --- channels/chan_zap.c 4 May 2005 04:35:27 -0000 1.437 +++ channels/chan_zap.c 8 May 2005 04:08:20 -0000 @@ -288,6 +288,7 @@ AST_MUTEX_DEFINE_STATIC(pridebugfdlock); static int pridebugfd = -1; +static char pridebugfilename[1024]=""; /* Whether we answer on a Polarity Switch event */ static int answeronpolarityswitch = 0; @@ -8683,6 +8684,8 @@ close(pridebugfd); pridebugfd = myfd; + strncpy(pridebugfilename,argv[4],sizeof(pridebugfilename)-1); + ast_mutex_unlock(&pridebugfdlock); ast_cli(fd, "PRI debug output will be sent to '%s'\n", argv[4]); @@ -8830,6 +8833,36 @@ return RESULT_SUCCESS; } +static int handle_pri_show_debug(int fd, int argc, char *argv[]) +{ + int x; + int span; + int count=0; + int debug=0; + + for(span=0;span= 0) + ast_cli(fd, "Logging PRI debug to file %s\n", pridebugfilename); + ast_mutex_unlock(&pridebugfdlock); + + if (!count) + ast_cli(fd, "No debug set or no PRI running\n"); + return RESULT_SUCCESS; +} + static char pri_debug_help[] = "Usage: pri debug span \n" " Enables debugging on a given PRI span\n"; @@ -8858,6 +8891,9 @@ static struct ast_cli_entry pri_show_span = { { "pri", "show", "span", NULL }, handle_pri_show_span, "Displays PRI Information", pri_show_span_help, complete_span_4 }; +static struct ast_cli_entry pri_show_debug= { + { "pri", "show", "debug", NULL }, handle_pri_show_debug, "Displays current PRI debug settings", NULL, NULL }; + static struct ast_cli_entry pri_set_debug_file = { { "pri", "set", "debug", "file", NULL }, handle_pri_set_debug_file, "Sends PRI debug output to the specified file", NULL, NULL }; @@ -9420,6 +9456,7 @@ ast_cli_unregister(&pri_no_debug); ast_cli_unregister(&pri_really_debug); ast_cli_unregister(&pri_show_span); + ast_cli_unregister(&pri_show_debug); ast_cli_unregister(&pri_set_debug_file); ast_cli_unregister(&pri_unset_debug_file); #endif @@ -10299,6 +10336,7 @@ ast_cli_register(&pri_no_debug); ast_cli_register(&pri_really_debug); ast_cli_register(&pri_show_span); + ast_cli_register(&pri_show_debug); ast_cli_register(&pri_set_debug_file); ast_cli_register(&pri_unset_debug_file); #endif