[asterisk-commits] mmichelson: branch 1.4 r133169 - in /branches/1.4: apps/ channels/ include/as...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 23 14:39:48 CDT 2008
Author: mmichelson
Date: Wed Jul 23 14:39:47 2008
New Revision: 133169
URL: http://svn.digium.com/view/asterisk?view=rev&rev=133169
Log:
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.
Modified:
branches/1.4/apps/app_chanspy.c
branches/1.4/channels/chan_dahdi.c
branches/1.4/include/asterisk/options.h
branches/1.4/main/asterisk.c
Modified: branches/1.4/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_chanspy.c?view=diff&rev=133169&r1=133168&r2=133169
==============================================================================
--- branches/1.4/apps/app_chanspy.c (original)
+++ branches/1.4/apps/app_chanspy.c Wed Jul 23 14:39:47 2008
@@ -58,11 +58,6 @@
/* "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_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 @@
{
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);
Modified: branches/1.4/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_dahdi.c?view=diff&rev=133169&r1=133168&r2=133169
==============================================================================
--- branches/1.4/channels/chan_dahdi.c (original)
+++ branches/1.4/channels/chan_dahdi.c Wed Jul 23 14:39:47 2008
@@ -5234,7 +5234,7 @@
int features;
char *b2 = NULL;
DAHDI_PARAMS ps;
- char chanprefix[strlen(dahdi_chan_name) + 4];
+ char chanprefix[dahdi_chan_name_len + 4];
if (i->subs[index].owner) {
ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]);
Modified: branches/1.4/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/options.h?view=diff&rev=133169&r1=133168&r2=133169
==============================================================================
--- branches/1.4/include/asterisk/options.h (original)
+++ branches/1.4/include/asterisk/options.h Wed Jul 23 14:39:47 2008
@@ -123,6 +123,7 @@
extern char record_cache_dir[AST_CACHE_DIR_LEN];
extern char debug_filename[AST_FILENAME_MAX];
extern const char *dahdi_chan_name;
+extern int dahdi_chan_name_len;
extern enum dahdi_chan_modes {
CHAN_ZAP_MODE,
CHAN_DAHDI_PLUS_ZAP_MODE,
Modified: branches/1.4/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/asterisk.c?view=diff&rev=133169&r1=133168&r2=133169
==============================================================================
--- branches/1.4/main/asterisk.c (original)
+++ branches/1.4/main/asterisk.c Wed Jul 23 14:39:47 2008
@@ -174,12 +174,15 @@
char debug_filename[AST_FILENAME_MAX] = "";
#ifdef HAVE_ZAPTEL
char _dahdi_chan_name[AST_CHANNEL_NAME] = "Zap";
+int _dahdi_chan_name_len = 3;
enum dahdi_chan_modes dahdi_chan_mode = CHAN_ZAP_MODE;
#else
char _dahdi_chan_name[AST_CHANNEL_NAME] = "DAHDI";
+int _dahdi_chan_name_len = 5;
enum dahdi_chan_modes dahdi_chan_mode = CHAN_DAHDI_PLUS_ZAP_MODE;
#endif
const char *dahdi_chan_name;
+int dahdi_chan_name_len;
static int ast_socket = -1; /*!< UNIX Socket for allowing remote control */
static int ast_consock = -1; /*!< UNIX Socket for controlling another asterisk */
@@ -2593,11 +2596,13 @@
#ifdef HAVE_ZAPTEL
if (ast_true(v->value)) {
strcpy(_dahdi_chan_name, "DAHDI");
+ _dahdi_chan_name_len = 5;
dahdi_chan_mode = CHAN_DAHDI_PLUS_ZAP_MODE;
}
#else
if (ast_false(v->value)) {
strcpy(_dahdi_chan_name, "Zap");
+ _dahdi_chan_name_len = 3;
dahdi_chan_mode = CHAN_ZAP_MODE;
}
#endif
@@ -2983,6 +2988,7 @@
}
dahdi_chan_name = _dahdi_chan_name;
+ dahdi_chan_name_len = _dahdi_chan_name_len;
#ifdef HAVE_ZAPTEL
{
More information about the asterisk-commits
mailing list