diff options
author | Mark Spencer <markster@digium.com> | 2004-06-02 16:35:06 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2004-06-02 16:35:06 +0000 |
commit | bc86e5de2a0f1f3da8b1ec0dd317f6555d522f08 (patch) | |
tree | bd3ea4e2605623b2e8aa89efce535a204e31d070 /channels | |
parent | 2587e6faa4c50cc712daaeea1297f4ed8a88940c (diff) |
Allocate pseudo channel if it's not explicitly listed
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3129 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_zap.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c index e0ea71e56..76743b19a 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -7208,9 +7208,10 @@ static int zap_destroy_channel(int fd, int argc, char **argv) static int zap_show_channels(int fd, int argc, char **argv) { -#define FORMAT "%4d %-10.10s %-15.15s %-10.10s %-20.20s\n" -#define FORMAT2 "%4s %-10.10s %-15.15s %-10.10s %-20.20s\n" +#define FORMAT "%7s %-10.10s %-15.15s %-10.10s %-20.20s\n" +#define FORMAT2 "%7s %-10.10s %-15.15s %-10.10s %-20.20s\n" struct zt_pvt *tmp = NULL; + char tmps[20]; if (argc != 3) return RESULT_SHOWUSAGE; @@ -7220,7 +7221,11 @@ static int zap_show_channels(int fd, int argc, char **argv) tmp = iflist; while (tmp) { - ast_cli(fd, FORMAT, tmp->channel, tmp->exten, tmp->context, tmp->language, tmp->musicclass); + if (tmp->channel > 0) { + sprintf(tmps, "%d", tmp->channel); + } else + strcpy(tmps, "pseudo"); + ast_cli(fd, FORMAT, tmps, tmp->exten, tmp->context, tmp->language, tmp->musicclass); tmp = tmp->next; } ast_mutex_unlock(&iflock); @@ -7593,6 +7598,7 @@ static int setup_zap(void) char *ringc; int start, finish,x; int y; + int found_pseudo = 0; int cur_radio = 0; #ifdef ZAPATA_PRI int offset; @@ -7633,6 +7639,7 @@ static int setup_zap(void) finish = start; } else if (!strcasecmp(chan, "pseudo")) { finish = start = CHAN_PSEUDO; + found_pseudo = 1; } else { ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'\n", v->value, chan); ast_destroy(cfg); @@ -8034,6 +8041,16 @@ static int setup_zap(void) ast_log(LOG_WARNING, "Ignoring %s\n", v->name); v = v->next; } + if (!found_pseudo) { + tmp = mkintf(CHAN_PSEUDO, cur_signalling, cur_radio); + + if (tmp) { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "Automatically generated pseudo channel\n"); + } else { + ast_log(LOG_WARNING, "Unable to register pseudo channel!\n"); + } + } ast_mutex_unlock(&iflock); ast_destroy(cfg); #ifdef ZAPATA_PRI |