[asterisk-commits] mmichelson: trunk r133171 - in /trunk: ./ apps/ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 23 14:48:04 CDT 2008


Author: mmichelson
Date: Wed Jul 23 14:48:03 2008
New Revision: 133171

URL: http://svn.digium.com/view/asterisk?view=rev&rev=133171
Log:
Merged revisions 133169 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r133169 | mmichelson | 2008-07-23 14:39:47 -0500 (Wed, 23 Jul 2008) | 12 lines

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:
    trunk/   (props changed)
    trunk/apps/app_chanspy.c
    trunk/include/asterisk/options.h
    trunk/main/asterisk.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=133171&r1=133170&r2=133171
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Wed Jul 23 14:48:03 2008
@@ -51,9 +51,6 @@
 
 #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";
@@ -221,7 +218,14 @@
 	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 @@
 {
 	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: trunk/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/options.h?view=diff&rev=133171&r1=133170&r2=133171
==============================================================================
--- trunk/include/asterisk/options.h (original)
+++ trunk/include/asterisk/options.h Wed Jul 23 14:48:03 2008
@@ -142,6 +142,7 @@
 
 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;
 

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=133171&r1=133170&r2=133171
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Wed Jul 23 14:48:03 2008
@@ -165,6 +165,7 @@
 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 @@
 		} 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;




More information about the asterisk-commits mailing list