Changeset 203

Show
Ignore:
Timestamp:
12/27/07 17:30:44 (8 months ago)
Author:
sip
Message:

"h324m debug level" cmd implemented.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • app_h324m/app_h324m.c

    r200 r203  
    3838#include <asterisk/causes.h> 
    3939#include <asterisk/time.h> 
     40#include "asterisk/cli.h" 
    4041 
    4142#ifndef AST_FORMAT_AMRNB 
     
    114115        "audio and video). To use this function with H324M calls you first have to use\n" 
    115116        "the h324m_gw() function.\n"; 
     117 
     118/* Commands */ 
     119static int h324m_do_debug(int fd, int argc, char *argv[]) 
     120{ 
     121        int level; 
     122 
     123        /* Check number of arguments */ 
     124        if (argc != 4) 
     125                return RESULT_SHOWUSAGE; 
     126 
     127        /* Get level */ 
     128        level = atoi(argv[3]); 
     129 
     130        /* Check it's correct */ 
     131        if((level < 0) || (level > 9)) 
     132                return RESULT_SHOWUSAGE; 
     133 
     134        /* Print result */       
     135        if(level) 
     136                ast_cli(fd, "app_h324m Debugging enabled level: %d\n", level); 
     137        else 
     138                ast_cli(fd, "app_h324m Debugging disabled\n"); 
     139 
     140        /* Set log level */ 
     141        H324MLoggerSetLevel(level); 
     142 
     143        /* Exit */ 
     144        return RESULT_SUCCESS; 
     145} 
     146 
     147static char debug_usage[] = 
     148"Usage: h324m debug level {0-9}\n" 
     149"       Enables debug messages in app_h324m\n" 
     150"        0 - No debug\n" 
     151"        1 - Error messages\n" 
     152"        2 - Log messages\n" 
     153"        3 - Warning messages\n" 
     154"        4 - Debug messages\n" 
     155"        5 - File dumps\n"; 
     156 
     157 
     158static struct ast_cli_entry  cli_debug = 
     159        { { "h324m", "debug", "level" }, h324m_do_debug, 
     160                "Set app_h324m debug log level", debug_usage }; 
     161 
    116162 
    117163static short blockSize[16] = { 13, 14, 16, 18, 19, 21, 26, 31,  6, -1, -1, -1, -1, -1, -1, -1}; 
     
    12971343        res &= ast_register_application(name_h324m_gw_answer, app_h324m_gw_answer, syn_h324m_gw_answer, des_h324m_gw_answer); 
    12981344        res &= ast_register_application(name_video_loopback, app_video_loopback, syn_video_loopback, des_video_loopback); 
     1345 
     1346        ast_cli_register(&cli_debug); 
     1347         
     1348        /* No loging by default */ 
     1349        H324MLoggerSetLevel(1); 
     1350 
    12991351        return 0; 
    13001352} 
Copyright 2006 - Sergio García Murillo
Powered by Trac - Edgewall Software