aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/app_chanspy.c13
-rw-r--r--include/asterisk/options.h1
-rw-r--r--main/asterisk.c2
3 files changed, 12 insertions, 4 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 2646f5618..7615ad4c8 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -52,9 +52,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define AST_NAME_STRLEN 256
#define NUM_SPYGROUPS 128
- /* "DAHDI/pseudo" is twelve characters */
-#define PSEUDO_CHAN_LEN 12
-
static const char *tdesc = "Listen to a channel, and optionally whisper into it";
static const char *app_chan = "ChanSpy";
static const char *desc_chan =
@@ -221,7 +218,14 @@ AST_APP_OPTIONS(spy_opts, {
AST_APP_OPTION('d', OPTION_DTMF_SWITCH_MODES),
});
-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 */
@@ -1105,6 +1109,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);
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index c961d9175..3d6f89ceb 100644
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -142,6 +142,7 @@ extern pid_t ast_mainpid;
extern char record_cache_dir[AST_CACHE_DIR_LEN];
extern char dahdi_chan_name[AST_CHANNEL_NAME];
+extern int dahdi_chan_name_len;
extern int ast_language_is_prefix;
diff --git a/main/asterisk.c b/main/asterisk.c
index 9cd52efb5..21b649773 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -165,6 +165,7 @@ int option_maxfiles; /*!< Max number of open file handles (files, sockets) */
long option_minmemfree; /*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
#endif
char dahdi_chan_name[AST_CHANNEL_NAME] = "ZAP";
+int dahdi_chan_name_len = 3;
/*! @} */
@@ -2794,6 +2795,7 @@ static void ast_readconfig(void)
} else if (!strcasecmp(v->name, "dahdichanname")) {
if (!strcasecmp(v->value, "yes")) {
ast_copy_string(dahdi_chan_name, "DAHDI", sizeof(dahdi_chan_name));
+ dahdi_chan_name_len = 5;
}
} else if (!strcasecmp(v->name, "entityid")) {
struct ast_eid tmp_eid;