don't dump non-existant channels (OPENZAP-47)

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@646 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris 2009-02-05 02:37:04 +00:00
parent cfc1495bc6
commit e9c2bc56e1
1 changed files with 7 additions and 6 deletions

View File

@ -2023,7 +2023,6 @@ static switch_status_t load_config(void)
void dump_chan(zap_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream) void dump_chan(zap_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream)
{ {
if (chan_id > span->chan_count) { if (chan_id > span->chan_count) {
stream->write_function(stream, "ERROR\n");
return; return;
} }
@ -2094,12 +2093,16 @@ SWITCH_STANDARD_API(oz_function)
stream->write_function(stream, "-ERR invalid span\n"); stream->write_function(stream, "-ERR invalid span\n");
} else { } else {
if (chan_id) { if (chan_id) {
dump_chan(span, chan_id, stream); if(chan_id > span->chan_count) {
stream->write_function(stream, "-ERR invalid channel\n");
} else {
dump_chan(span, chan_id, stream);
}
} else { } else {
int j; int j;
stream->write_function(stream, "+OK\n"); stream->write_function(stream, "+OK\n");
for(j = 1; j <= span->chan_count; j++) { for (j = 1; j <= span->chan_count; j++) {
dump_chan(span, j, stream); dump_chan(span, j, stream);
} }
@ -2161,14 +2164,12 @@ SWITCH_STANDARD_API(oz_function)
stream->write_function(stream, "-ERR invalid span\n"); stream->write_function(stream, "-ERR invalid span\n");
} else { } else {
if (chan_id) { if (chan_id) {
//dump_chan(span, chan_id, stream);
zap_log(ZAP_LOG_INFO,"Bounce span: %d, chan: %d\n", span_id, chan_id); zap_log(ZAP_LOG_INFO,"Bounce span: %d, chan: %d\n", span_id, chan_id);
} else { } else {
int j; int j;
stream->write_function(stream, "+OK\n"); stream->write_function(stream, "+OK\n");
for(j = 1; j <= span->chan_count; j++) { for (j = 1; j <= span->chan_count; j++) {
//dump_chan(span, j, stream);
zap_log(ZAP_LOG_INFO,"Bounce span: %d, chan: %d\n", span_id, j); zap_log(ZAP_LOG_INFO,"Bounce span: %d, chan: %d\n", span_id, j);
} }