--- main/rtp.c.orig 2010-06-04 14:47:12.000000000 +0200 +++ main/rtp.c 2010-06-04 15:11:52.000000000 +0200 @@ -4594,14 +4594,13 @@ enum ast_bridge_result ast_rtp_bridge(st return res; } -static char *rtp_do_debug_ip(struct ast_cli_args *a) +static char *rtp_do_debug_ip(int fd, const char *host) { struct hostent *hp; struct ast_hostent ahp; int port = 0; - char *p, *arg; + char *p, *arg = ast_strdupa(host); - arg = a->argv[3]; p = strstr(arg, ":"); if (p) { *p = '\0'; @@ -4610,28 +4609,27 @@ static char *rtp_do_debug_ip(struct ast_ } hp = ast_gethostbyname(arg, &ahp); if (hp == NULL) { - ast_cli(a->fd, "Lookup failed for '%s'\n", arg); + ast_cli(fd, "Lookup failed for '%s'\n", arg); return CLI_FAILURE; } rtpdebugaddr.sin_family = AF_INET; memcpy(&rtpdebugaddr.sin_addr, hp->h_addr, sizeof(rtpdebugaddr.sin_addr)); rtpdebugaddr.sin_port = htons(port); if (port == 0) - ast_cli(a->fd, "RTP Debugging Enabled for IP: %s\n", ast_inet_ntoa(rtpdebugaddr.sin_addr)); + ast_cli(fd, "RTP Debugging Enabled for IP: %s\n", ast_inet_ntoa(rtpdebugaddr.sin_addr)); else - ast_cli(a->fd, "RTP Debugging Enabled for IP: %s:%d\n", ast_inet_ntoa(rtpdebugaddr.sin_addr), port); + ast_cli(fd, "RTP Debugging Enabled for IP: %s:%d\n", ast_inet_ntoa(rtpdebugaddr.sin_addr), port); rtpdebug = 1; return CLI_SUCCESS; } -static char *rtcp_do_debug_ip(struct ast_cli_args *a) +static char *rtcp_do_debug_ip(int fd, const char *host) { struct hostent *hp; struct ast_hostent ahp; int port = 0; - char *p, *arg; + char *p, *arg = ast_strdupa(host); - arg = a->argv[3]; p = strstr(arg, ":"); if (p) { *p = '\0'; @@ -4640,16 +4638,16 @@ static char *rtcp_do_debug_ip(struct ast } hp = ast_gethostbyname(arg, &ahp); if (hp == NULL) { - ast_cli(a->fd, "Lookup failed for '%s'\n", arg); + ast_cli(fd, "Lookup failed for '%s'\n", arg); return CLI_FAILURE; } rtcpdebugaddr.sin_family = AF_INET; memcpy(&rtcpdebugaddr.sin_addr, hp->h_addr, sizeof(rtcpdebugaddr.sin_addr)); rtcpdebugaddr.sin_port = htons(port); if (port == 0) - ast_cli(a->fd, "RTCP Debugging Enabled for IP: %s\n", ast_inet_ntoa(rtcpdebugaddr.sin_addr)); + ast_cli(fd, "RTCP Debugging Enabled for IP: %s\n", ast_inet_ntoa(rtcpdebugaddr.sin_addr)); else - ast_cli(a->fd, "RTCP Debugging Enabled for IP: %s:%d\n", ast_inet_ntoa(rtcpdebugaddr.sin_addr), port); + ast_cli(fd, "RTCP Debugging Enabled for IP: %s:%d\n", ast_inet_ntoa(rtcpdebugaddr.sin_addr), port); rtcpdebug = 1; return CLI_SUCCESS; } @@ -4680,8 +4678,8 @@ static char *handle_cli_rtp_set_debug(st ast_cli(a->fd, "RTP Debugging Disabled\n"); return CLI_SUCCESS; } - } else if (a->argc == e->args +1) { /* ip */ - return rtp_do_debug_ip(a); + } else if (a->argc == e->args + 1) { /* ip */ + return rtp_do_debug_ip(a->fd, a->argv[4]); } return CLI_SHOWUSAGE; /* default, failure */ @@ -4713,8 +4711,8 @@ static char *handle_cli_rtcp_set_debug(s ast_cli(a->fd, "RTCP Debugging Disabled\n"); return CLI_SUCCESS; } - } else if (a->argc == e->args +1) { /* ip */ - return rtcp_do_debug_ip(a); + } else if (a->argc == e->args + 1) { /* ip */ + return rtcp_do_debug_ip(a->fd, a->argv[4]); } return CLI_SHOWUSAGE; /* default, failure */