diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-23 19:39:47 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-23 19:39:47 +0000 |
commit | 69b8561975b4ad4220bba79e25eb746e9893df2e (patch) | |
tree | d8392832fa74bacc5141084bbea5321b4bade278 /apps/app_chanspy.c | |
parent | 16cfb7953f215a1299b3933fb4d38895017cb0d2 (diff) |
As suggested by seanbright, the PSEUDO_CHAN_LEN in
app_chanspy should be set at load time, not at compile
time, since dahdi_chan_name is determined at load time.
Also changed the next_unique_id_to_use to have the
static qualifier.
Also added the dahdi_chan_name_len variable so that
strlen(dahdi_chan_name) isn't necessary. Thanks to
seanbright for the suggestion.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@133169 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_chanspy.c')
-rw-r--r-- | apps/app_chanspy.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index d9f20a177..4a11c3b5a 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -58,11 +58,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /* "Zap/pseudo" is ten characters. * "DAHDI/pseudo" is twelve characters. */ -#ifdef HAVE_ZAPTEL -#define PSEUDO_CHAN_LEN 10 -#else -#define PSEUDO_CHAN_LEN 12 -#endif static const char *tdesc = "Listen to a channel, and optionally whisper into it"; static const char *app_chan = "ChanSpy"; @@ -151,7 +146,14 @@ AST_APP_OPTIONS(spy_opts, { AST_APP_OPTION_ARG('r', OPTION_RECORD, OPT_ARG_RECORD), }); -int next_unique_id_to_use = 0; +static int next_unique_id_to_use = 0; +static int PSEUDO_CHAN_LEN; + +static void determine_pseudo_chan_len(void) +{ + PSEUDO_CHAN_LEN = dahdi_chan_name_len + strlen("/pseudo"); +} + struct chanspy_translation_helper { /* spy data */ @@ -863,6 +865,7 @@ static int load_module(void) { int res = 0; + determine_pseudo_chan_len(); res |= ast_register_application(app_chan, chanspy_exec, tdesc, desc_chan); res |= ast_register_application(app_ext, extenspy_exec, tdesc, desc_ext); |