[asterisk-commits] branch oej/strictrouting r9518 - in /team/oej/strictrouting: ./ apps/ cdr/ ch...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Feb 11 06:44:37 MST 2006


Author: oej
Date: Sat Feb 11 07:43:47 2006
New Revision: 9518

URL: http://svn.digium.com/view/asterisk?rev=9518&view=rev
Log:
Update

Added:
    team/oej/strictrouting/codecs/gsm/libgsm.vcproj
      - copied unchanged from r9508, trunk/codecs/gsm/libgsm.vcproj
    team/oej/strictrouting/codecs/ilbc/libilbc.vcproj
      - copied unchanged from r9508, trunk/codecs/ilbc/libilbc.vcproj
    team/oej/strictrouting/codecs/lpc10/liblpc10.vcproj
      - copied unchanged from r9508, trunk/codecs/lpc10/liblpc10.vcproj
    team/oej/strictrouting/configs/smdi.conf.sample
      - copied unchanged from r9508, trunk/configs/smdi.conf.sample
    team/oej/strictrouting/doc/smdi.txt
      - copied unchanged from r9508, trunk/doc/smdi.txt
    team/oej/strictrouting/funcs/func_sha1.c
      - copied unchanged from r9508, trunk/funcs/func_sha1.c
    team/oej/strictrouting/include/asterisk/sha1.h
      - copied unchanged from r9508, trunk/include/asterisk/sha1.h
    team/oej/strictrouting/include/asterisk/smdi.h
      - copied unchanged from r9508, trunk/include/asterisk/smdi.h
    team/oej/strictrouting/res/res_smdi.c
      - copied unchanged from r9508, trunk/res/res_smdi.c
    team/oej/strictrouting/sha1.c
      - copied unchanged from r9508, trunk/sha1.c
Removed:
    team/oej/strictrouting/apps/app_intercom.c
    team/oej/strictrouting/apps/app_sql_postgres.c
    team/oej/strictrouting/funcs/pbx_functions.c
Modified:
    team/oej/strictrouting/   (props changed)
    team/oej/strictrouting/Makefile
    team/oej/strictrouting/UPGRADE.txt
    team/oej/strictrouting/apps/Makefile
    team/oej/strictrouting/apps/app_macro.c
    team/oej/strictrouting/apps/app_osplookup.c
    team/oej/strictrouting/apps/app_voicemail.c
    team/oej/strictrouting/cdr.c
    team/oej/strictrouting/cdr/Makefile
    team/oej/strictrouting/channel.c
    team/oej/strictrouting/channels/Makefile
    team/oej/strictrouting/channels/chan_iax2.c
    team/oej/strictrouting/channels/chan_local.c
    team/oej/strictrouting/channels/chan_mgcp.c
    team/oej/strictrouting/channels/chan_misdn.c
    team/oej/strictrouting/channels/chan_misdn_config.c
    team/oej/strictrouting/channels/chan_oss.c
    team/oej/strictrouting/channels/chan_sip.c
    team/oej/strictrouting/channels/chan_vpb.c
    team/oej/strictrouting/channels/chan_zap.c
    team/oej/strictrouting/channels/misdn/   (props changed)
    team/oej/strictrouting/channels/misdn/Makefile
    team/oej/strictrouting/channels/misdn/chan_misdn_config.h
    team/oej/strictrouting/channels/misdn/isdn_lib.c
    team/oej/strictrouting/channels/misdn/isdn_lib.h
    team/oej/strictrouting/channels/misdn/isdn_lib_intern.h
    team/oej/strictrouting/channels/misdn/isdn_msg_parser.c
    team/oej/strictrouting/cli.c
    team/oej/strictrouting/codecs/gsm/src/add.c
    team/oej/strictrouting/codecs/gsm/src/code.c
    team/oej/strictrouting/codecs/gsm/src/decode.c
    team/oej/strictrouting/codecs/gsm/src/long_term.c
    team/oej/strictrouting/codecs/gsm/src/lpc.c
    team/oej/strictrouting/codecs/gsm/src/preprocess.c
    team/oej/strictrouting/codecs/gsm/src/rpe.c
    team/oej/strictrouting/codecs/gsm/src/short_term.c
    team/oej/strictrouting/codecs/lpc10/bsynz.c
    team/oej/strictrouting/codecs/lpc10/decode.c
    team/oej/strictrouting/codecs/lpc10/encode.c
    team/oej/strictrouting/codecs/lpc10/energy.c
    team/oej/strictrouting/codecs/lpc10/f2clib.c
    team/oej/strictrouting/codecs/lpc10/irc2pc.c
    team/oej/strictrouting/codecs/lpc10/lpc10.h
    team/oej/strictrouting/codecs/lpc10/onset.c
    team/oej/strictrouting/codecs/lpc10/pitsyn.c
    team/oej/strictrouting/codecs/lpc10/tbdm.c
    team/oej/strictrouting/codecs/lpc10/voicin.c
    team/oej/strictrouting/codecs/lpc10/vparms.c
    team/oej/strictrouting/config.c
    team/oej/strictrouting/configs/misdn.conf.sample
    team/oej/strictrouting/configs/voicemail.conf.sample
    team/oej/strictrouting/configs/zapata.conf.sample
    team/oej/strictrouting/db.c
    team/oej/strictrouting/devicestate.c
    team/oej/strictrouting/dnsmgr.c
    team/oej/strictrouting/doc/channelvariables.txt
    team/oej/strictrouting/doc/misdn.txt
    team/oej/strictrouting/dsp.c
    team/oej/strictrouting/enum.c
    team/oej/strictrouting/file.c
    team/oej/strictrouting/funcs/Makefile
    team/oej/strictrouting/funcs/func_base64.c   (contents, props changed)
    team/oej/strictrouting/funcs/func_callerid.c
    team/oej/strictrouting/funcs/func_cdr.c
    team/oej/strictrouting/funcs/func_cut.c
    team/oej/strictrouting/funcs/func_db.c
    team/oej/strictrouting/funcs/func_enum.c
    team/oej/strictrouting/funcs/func_env.c
    team/oej/strictrouting/funcs/func_groupcount.c
    team/oej/strictrouting/funcs/func_language.c
    team/oej/strictrouting/funcs/func_logic.c
    team/oej/strictrouting/funcs/func_math.c
    team/oej/strictrouting/funcs/func_md5.c
    team/oej/strictrouting/funcs/func_moh.c
    team/oej/strictrouting/funcs/func_odbc.c
    team/oej/strictrouting/funcs/func_rand.c
    team/oej/strictrouting/funcs/func_strings.c
    team/oej/strictrouting/funcs/func_timeout.c
    team/oej/strictrouting/funcs/func_uri.c
    team/oej/strictrouting/include/asterisk/callerid.h
    team/oej/strictrouting/include/asterisk/channel.h
    team/oej/strictrouting/include/asterisk/utils.h
    team/oej/strictrouting/logger.c
    team/oej/strictrouting/res/Makefile
    team/oej/strictrouting/utils.c

Propchange: team/oej/strictrouting/
------------------------------------------------------------------------------
    automerge = volvo

Propchange: team/oej/strictrouting/
------------------------------------------------------------------------------
    automerge-email = oej at edvina.net

Propchange: team/oej/strictrouting/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/oej/strictrouting/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/strictrouting/
            ('svnmerge-blocked' removed)

Propchange: team/oej/strictrouting/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Feb 11 07:43:47 2006
@@ -1,1 +1,1 @@
-/trunk:1-9097
+/trunk:1-9517

Modified: team/oej/strictrouting/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/Makefile?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/Makefile (original)
+++ team/oej/strictrouting/Makefile Sat Feb 11 07:43:47 2006
@@ -3,7 +3,7 @@
 # 
 # Top level Makefile
 #
-# Copyright (C) 1999-2005, Mark Spencer
+# Copyright (C) 1999-2006, Digium, Inc.
 #
 # Mark Spencer <markster at digium.com>
 #
@@ -72,6 +72,11 @@
 #ifneq ($(CROSS_COMPILE),)
 #OPTIONS += -DLOW_MEMORY
 #endif
+
+#
+# Asterisk SMDI integration
+#
+WITH_SMDI = 1
 
 # Optional debugging parameters
 DEBUG_THREADS = #-DDUMP_SCHEDULER #-DDEBUG_SCHEDULER #-DDEBUG_THREADS #-DDO_CRASH #-DDETECT_DEADLOCKS
@@ -349,7 +354,7 @@
 	astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
 	utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
 	netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
-	cryptostub.o
+	cryptostub.o sha1.o
 
 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
   OBJS+= poll.o
@@ -943,4 +948,4 @@
 	rm -rf $(DESTDIR)$(ASTSPOOLDIR)
 	rm -rf $(DESTDIR)$(ASTETCDIR)
 	rm -rf $(DESTDIR)$(ASTLOGDIR)
-	
+

Modified: team/oej/strictrouting/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/UPGRADE.txt?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/UPGRADE.txt (original)
+++ team/oej/strictrouting/UPGRADE.txt Sat Feb 11 07:43:47 2006
@@ -35,6 +35,11 @@
 * The function ${CHECK_MD5()} has been deprecated in favor of using an
   expression: $[${MD5(<string>)} = ${saved_md5}].
 
+* The 'builtin' functions that used to be combined in pbx_functions.so are
+  now built as separate modules. If you are not using 'autoload=yes' in your
+  modules.conf file then you will need to explicitly load the modules that
+  contain the functions you want to use.
+
 The SIP channel:
 
 * The "incominglimit" setting is replaced by the "call-limit" setting in sip.conf.

Modified: team/oej/strictrouting/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/apps/Makefile?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/apps/Makefile (original)
+++ team/oej/strictrouting/apps/Makefile Sat Feb 11 07:43:47 2006
@@ -26,12 +26,6 @@
      app_userevent.so app_url.so app_verbose.so app_voicemail.so               \
      app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so   \
      app_morsecode.so
-     
-#
-# Obsolete things...
-#
-#APPS+=app_sql_postgres.so
-#APPS+=app_sql_odbc.so
 
 #
 # Experimental things
@@ -65,7 +59,12 @@
 APPS+=app_sms.so
 endif
 
+# Asterisk SMDI integration
 #
+ifeq (${WITH_SMDI},1)
+CFLAGS+=-DWITH_SMDI
+endif
+
 # If you have UnixODBC you can use ODBC voicemail
 # storage
 #
@@ -97,15 +96,6 @@
 app_curl.so: app_curl.o
 	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
 
-app_sql_postgres.o: app_sql_postgres.c
-	$(CC) -pipe -I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include -I$(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
-
-app_sql_postgres.so: app_sql_postgres.o
-	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq
-
-app_sql_odbc.so: app_sql_odbc.o
-	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
-
 look:	look.c
 	$(CC) -pipe -O6 -g look.c -o look -lncurses
 

Modified: team/oej/strictrouting/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/apps/app_macro.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/apps/app_macro.c (original)
+++ team/oej/strictrouting/apps/app_macro.c Sat Feb 11 07:43:47 2006
@@ -107,7 +107,7 @@
 	char oldcontext[AST_MAX_CONTEXT] = "";
 	int offset, depth = 0;
 	int setmacrocontext=0;
-	int autoloopflag;
+	int autoloopflag, dead = 0;
   
 	char *save_macro_exten;
 	char *save_macro_context;
@@ -208,8 +208,8 @@
 				break;
 			}
 			switch(res) {
-	        	case MACRO_EXIT_RESULT:
-                        	res = 0;
+			case MACRO_EXIT_RESULT:
+				res = 0;
 				goto out;
 			case AST_PBX_KEEPALIVE:
 				if (option_debug)
@@ -223,6 +223,7 @@
 					ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
 				else if (option_verbose > 1)
 					ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
+				dead = 1;
 				goto out;
 			}
 		}
@@ -242,37 +243,44 @@
 	out:
 	/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
 	snprintf(depthc, sizeof(depthc), "%d", depth);
-	pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
-
-	ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
-  	for (x=1; x<argc; x++) {
+	if (!dead) {
+		pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
+
+		ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
+	}
+
+  	for (x = 1; x < argc; x++) {
   		/* Restore old arguments and delete ours */
 		snprintf(varname, sizeof(varname), "ARG%d", x);
   		if (oldargs[x]) {
-			pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
+			if (!dead)
+				pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
 			free(oldargs[x]);
-		} else {
+		} else if (!dead) {
 			pbx_builtin_setvar_helper(chan, varname, NULL);
 		}
   	}
 
 	/* Restore macro variables */
-	pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
+	if (!dead) {
+		pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
+		pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
+		pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
+	}
 	if (save_macro_exten)
 		free(save_macro_exten);
-	pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
 	if (save_macro_context)
 		free(save_macro_context);
-	pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
 	if (save_macro_priority)
 		free(save_macro_priority);
-	if (setmacrocontext) {
+
+	if (!dead && setmacrocontext) {
 		chan->macrocontext[0] = '\0';
 		chan->macroexten[0] = '\0';
 		chan->macropriority = 0;
 	}
 
-	if (!strcasecmp(chan->context, fullmacro)) {
+	if (!dead && !strcasecmp(chan->context, fullmacro)) {
   		/* If we're leaving the macro normally, restore original information */
 		chan->priority = oldpriority;
 		ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
@@ -292,7 +300,8 @@
 		}
 	}
 
-	pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
+	if (!dead)
+		pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
 	if (save_macro_offset)
 		free(save_macro_offset);
 	LOCAL_USER_REMOVE(u);

Modified: team/oej/strictrouting/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/apps/app_osplookup.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/apps/app_osplookup.c (original)
+++ team/oej/strictrouting/apps/app_osplookup.c Sat Feb 11 07:43:47 2006
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -184,6 +184,7 @@
 	int res=0;
 	struct localuser *u;
 	char *temp;
+	const char *val;
 	int cause;
 	struct ast_osp_result result;
 	int priority_jump = 0;
@@ -212,11 +213,11 @@
 	}
 
 	cause = str2cause(args.cause);
-	temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
+	val = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
 	result.handle = -1;
-	if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
-		temp = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
-		if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.numresults) != 1)) {
+	if (!ast_strlen_zero(val) && (sscanf(val, "%d", &result.handle) == 1) && (result.handle > -1)) {
+		val = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
+		if (ast_strlen_zero(val) || (sscanf(val, "%d", &result.numresults) != 1)) {
 			result.numresults = 0;
 		}
 		if ((res = ast_osp_next(&result, cause)) > 0) {
@@ -255,6 +256,7 @@
 	int res=0;
 	struct localuser *u;
 	char *temp;
+	const char *val;
 	int cause;
 	time_t start=0, duration=0;
 	struct ast_osp_result result;
@@ -293,9 +295,9 @@
 		ast_log(LOG_WARNING, "OSPFinish called on channel '%s' with no CDR!\n", chan->name);
 	
 	cause = str2cause(args.status);
-	temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
+	val = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
 	result.handle = -1;
-	if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
+	if (!ast_strlen_zero(val) && (sscanf(val, "%d", &result.handle) == 1) && (result.handle > -1)) {
 		if (!ast_osp_terminate(result.handle, cause, start, duration)) {
 			pbx_builtin_setvar_helper(chan, "_OSPHANDLE", "");
 			pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", "SUCCESS");

Modified: team/oej/strictrouting/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/apps/app_voicemail.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/apps/app_voicemail.c (original)
+++ team/oej/strictrouting/apps/app_voicemail.c Sat Feb 11 07:43:47 2006
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -73,6 +73,10 @@
 #include "asterisk/cli.h"
 #include "asterisk/utils.h"
 #include "asterisk/stringfields.h"
+#ifdef WITH_SMDI
+#include "asterisk/smdi.h"
+#define SMDI_MWI_WAIT_TIMEOUT 1000 /* 1 second */
+#endif
 #ifdef USE_ODBC_STORAGE
 #include "asterisk/res_odbc.h"
 #endif
@@ -393,7 +397,9 @@
 static char serveremail[80];
 static char mailcmd[160];	/* Configurable mail cmd */
 static char externnotify[160]; 
-
+#ifdef WITH_SMDI
+static struct ast_smdi_interface *smdi_iface = NULL;
+#endif
 static char vmfmts[80];
 static int vmminmessage;
 static int vmmaxmessage;
@@ -2318,13 +2324,37 @@
 	char arguments[255];
 	char ext_context[256] = "";
 	int newvoicemails = 0, oldvoicemails = 0;
+#ifdef WITH_SMDI
+	struct ast_smdi_mwi_message *mwi_msg;
+#endif
 
 	if (!ast_strlen_zero(context))
 		snprintf(ext_context, sizeof(ext_context), "%s@%s", extension, context);
 	else
 		ast_copy_string(ext_context, extension, sizeof(ext_context));
 
+#ifdef WITH_SMDI
+	if (!strcasecmp(externnotify, "smdi")) {
+		if (ast_app_has_voicemail(ext_context, NULL)) 
+			ast_smdi_mwi_set(smdi_iface, extension);
+		else
+			ast_smdi_mwi_unset(smdi_iface, extension);
+
+		if ((mwi_msg = ast_smdi_mwi_message_wait(smdi_iface, SMDI_MWI_WAIT_TIMEOUT))) {
+			ast_log(LOG_ERROR, "Error executing SMDI MWI change for %s on %s\n", extension, smdi_iface->name);
+			if (!strncmp(mwi_msg->cause, "INV", 3))
+				ast_log(LOG_ERROR, "Invalid MWI extension: %s\n", mwi_msg->fwd_st);
+			else if (!strncmp(mwi_msg->cause, "BLK", 3))
+				ast_log(LOG_WARNING, "MWI light was already on or off for %s\n", mwi_msg->fwd_st);
+			ast_log(LOG_WARNING, "The switch reported '%s'\n", mwi_msg->cause);
+			ASTOBJ_UNREF(mwi_msg, ast_smdi_mwi_message_destroy);
+		} else {
+			ast_log(LOG_DEBUG, "Successfully executed SMDI MWI change for %s on %s\n", extension, smdi_iface->name);
+		}
+	} else if (!ast_strlen_zero(externnotify)) {
+#else
 	if (!ast_strlen_zero(externnotify)) {
+#endif
 		if (messagecount(ext_context, &newvoicemails, &oldvoicemails)) {
 			ast_log(LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
 		} else {
@@ -5842,6 +5872,9 @@
 	char *cat;
 	struct ast_variable *var;
 	char *notifystr = NULL;
+#ifdef WITH_SMDI
+	char *smdistr = NULL;
+#endif
 	char *astattach;
 	char *astsearch;
 	char *astsaycid;
@@ -5951,6 +5984,24 @@
 		if ((notifystr = ast_variable_retrieve(cfg, "general", "externnotify"))) {
 			ast_copy_string(externnotify, notifystr, sizeof(externnotify));
 			ast_log(LOG_DEBUG, "found externnotify: %s\n", externnotify);
+#ifdef WITH_SMDI
+			if (!strcasecmp(externnotify, "smdi")) {
+				ast_log(LOG_DEBUG, "Using SMDI for external voicemail notification\n");
+				if ((smdistr = ast_variable_retrieve(cfg, "general", "smdiport"))) {
+					smdi_iface = ast_smdi_interface_find(smdistr);
+				} else {
+					ast_log(LOG_DEBUG, "No SMDI interface set, trying default (/dev/ttyS0)\n");
+					smdi_iface = ast_smdi_interface_find("/dev/ttyS0");
+				}
+
+				if (!smdi_iface) {
+					ast_log(LOG_ERROR, "No valid SMDI interface specfied, disabling external voicemail notification\n");
+					externnotify[0] = '\0';
+				} else {
+					ast_log(LOG_DEBUG, "Using SMDI port %s\n", smdi_iface->name);
+				}
+			}
+#endif
 		} else {
 			externnotify[0] = '\0';
 		}

Modified: team/oej/strictrouting/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/cdr.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/cdr.c (original)
+++ team/oej/strictrouting/cdr.c Sat Feb 11 07:43:47 2006
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -1181,8 +1181,6 @@
 	   if it does not exist */
 	if (enabled && batchmode && (!was_enabled || !was_batchmode) && (cdr_thread == AST_PTHREADT_NULL)) {
 		ast_cond_init(&cdr_pending_cond, NULL);
-		pthread_attr_init(&attr);
-		pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 		if (ast_pthread_create(&cdr_thread, &attr, do_cdr, NULL) < 0) {
 			ast_log(LOG_ERROR, "Unable to start CDR thread.\n");
 			ast_sched_del(sched, cdr_sched);

Modified: team/oej/strictrouting/cdr/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/cdr/Makefile?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/cdr/Makefile (original)
+++ team/oej/strictrouting/cdr/Makefile Sat Feb 11 07:43:47 2006
@@ -45,11 +45,11 @@
 #
 # FreeTDS stuff...
 #
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h),)
-  ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.63),1)
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/freetds/tds.h),)
+  ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/include/freetds/tdsver.h | grep -c 0.63),1)
     CFLAGS += -DFREETDS_0_63
   else
-	ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.62),1)
+	ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/include/freetds/tdsver.h | grep -c 0.62),1)
       CFLAGS += -DFREETDS_0_62
     else
       CFLAGS += -DFREETDS_PRE_0_62

Modified: team/oej/strictrouting/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/channel.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/channel.c (original)
+++ team/oej/strictrouting/channel.c Sat Feb 11 07:43:47 2006
@@ -72,6 +72,7 @@
 #include "asterisk/app.h"
 #include "asterisk/transcap.h"
 #include "asterisk/devicestate.h"
+#include "asterisk/sha1.h"
 
 struct channel_spy_trans {
 	int last_format;
@@ -163,6 +164,22 @@
 	{ AST_CAUSE_INTERWORKING, "Interworking, unspecified" },
 };
 
+
+struct ast_variable *ast_channeltype_list(void)
+{
+	struct chanlist *cl;
+	struct ast_variable *var=NULL, *prev = NULL;
+	AST_LIST_TRAVERSE(&backends, cl, list) {
+		if (prev)  {
+			if ((prev->next = ast_variable_new(cl->tech->type, cl->tech->description)))
+				prev = prev->next;
+		} else {
+			var = ast_variable_new(cl->tech->type, cl->tech->description);
+			prev = var;
+		}
+	}
+	return var;
+}
 
 static int show_channeltypes(int fd, int argc, char *argv[])
 {

Modified: team/oej/strictrouting/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/channels/Makefile?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/channels/Makefile (original)
+++ team/oej/strictrouting/channels/Makefile Sat Feb 11 07:43:47 2006
@@ -65,11 +65,18 @@
   CHANNEL_LIBS+=chan_phone.so
 endif
 
+#
+# Asterisk SMDI integration
+#
+ifeq (${WITH_SMDI},1)
+CFLAGS+=-DWITH_SMDI
+endif
+
 ifneq ($(wildcard h323/libchanh323.a),)
   CHANNEL_LIBS+=chan_h323.so
 endif
 
-ifneq ($(wildcard misdn/chan_misdn_lib.a),)
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/mISDNuser/mISDNlib.h),)
   CHANNEL_LIBS+=chan_misdn.so
   CFLAGS+=-Imisdn 
 endif
@@ -224,11 +231,18 @@
 	$(CC) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
 endif
 
+misdn/chan_misdn_lib.a:
+	make -C misdn
+
 chan_misdn.so: chan_misdn.o chan_misdn_config.o misdn/chan_misdn_lib.a
 	$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN
 
 chan_misdn.o: chan_misdn.c
-	$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.2.1\" -c $< -o $@
+	$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
+
+chan_misdn_config.o: chan_misdn_config.c misdn/chan_misdn_config.h
+	$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
+
 
 install: all
 	for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done

Modified: team/oej/strictrouting/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/channels/chan_iax2.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/channels/chan_iax2.c (original)
+++ team/oej/strictrouting/channels/chan_iax2.c Sat Feb 11 07:43:47 2006
@@ -234,7 +234,8 @@
 enum {
 	IAX_STATE_STARTED = 		(1 << 0),
 	IAX_STATE_AUTHENTICATED = 	(1 << 1),
-	IAX_STATE_TBD = 		(1 << 2)
+	IAX_STATE_TBD = 		(1 << 2),
+	IAX_STATE_UNCHANGED = 		(1 << 3),
 } iax2_state;
 
 struct iax2_context {
@@ -5011,7 +5012,7 @@
 	int x;
 	int expire = 0;
 
-	ast_clear_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED);
+	ast_clear_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED | IAX_STATE_UNCHANGED);
 	iaxs[callno]->peer[0] = '\0';
 	if (ies->username)
 		ast_copy_string(peer, ies->username, sizeof(peer));
@@ -5056,6 +5057,8 @@
 			destroy_peer(p);
 		return -1;
 	}
+	if (!inaddrcmp(&p->addr, sin))
+		ast_set_flag(&iaxs[callno]->state, IAX_STATE_UNCHANGED);
 	ast_copy_string(iaxs[callno]->secret, p->secret, sizeof(iaxs[callno]->secret));
 	ast_copy_string(iaxs[callno]->inkeys, p->inkeys, sizeof(iaxs[callno]->inkeys));
 	/* Check secret against what we have on file */
@@ -7362,7 +7365,8 @@
 					auth_fail(fr.callno, IAX_COMMAND_REGREJ);
 					break;
 				}
-				if ((ast_strlen_zero(iaxs[fr.callno]->secret) && ast_strlen_zero(iaxs[fr.callno]->inkeys)) || ast_test_flag(&iaxs[fr.callno]->state, IAX_STATE_AUTHENTICATED)) {
+				if ((ast_strlen_zero(iaxs[fr.callno]->secret) && ast_strlen_zero(iaxs[fr.callno]->inkeys)) || 
+						ast_test_flag(&iaxs[fr.callno]->state, IAX_STATE_AUTHENTICATED | IAX_STATE_UNCHANGED)) {
 					if (f.subclass == IAX_COMMAND_REGREL)
 						memset(&sin, 0, sizeof(sin));
 					if (update_registry(iaxs[fr.callno]->peer, &sin, fr.callno, ies.devicetype, fd, ies.refresh))
@@ -8131,6 +8135,7 @@
 		peer->pokefreqok = DEFAULT_FREQ_OK;
 		peer->pokefreqnotok = DEFAULT_FREQ_NOTOK;
 		peer->context[0] = '\0';
+		peer->peercontext[0] = '\0';
 		while(v) {
 			if (!strcasecmp(v->name, "secret")) {
 				if (!ast_strlen_zero(peer->secret)) {

Modified: team/oej/strictrouting/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/channels/chan_local.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/channels/chan_local.c (original)
+++ team/oej/strictrouting/channels/chan_local.c Sat Feb 11 07:43:47 2006
@@ -69,9 +69,6 @@
 
 #define IS_OUTBOUND(a,b) (a == b->chan ? 1 : 0)
 
-/* Protect the interface list (of sip_pvt's) */
-AST_MUTEX_DEFINE_STATIC(locallock);
-
 static struct ast_channel *local_request(const char *type, int format, void *data, int *cause);
 static int local_digit(struct ast_channel *ast, char digit);
 static int local_call(struct ast_channel *ast, char *dest, int timeout);
@@ -101,7 +98,7 @@
 	.send_html = local_sendhtml,
 };
 
-static struct local_pvt {
+struct local_pvt {
 	ast_mutex_t lock;			/* Channel private lock */
 	char context[AST_MAX_CONTEXT];		/* Context to call */
 	char exten[AST_MAX_EXTENSION];		/* Extension to call */
@@ -113,8 +110,10 @@
 	int nooptimization;			/* Don't leave masq state */
 	struct ast_channel *owner;		/* Master Channel */
 	struct ast_channel *chan;		/* Outbound channel */
-	struct local_pvt *next;			/* Next entity */
-} *locals = NULL;
+	AST_LIST_ENTRY(local_pvt) list;		/* Next entity */
+};
+
+static AST_LIST_HEAD_STATIC(locals, local_pvt);
 
 static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
 {
@@ -357,23 +356,19 @@
 #if 0
 static void local_destroy(struct local_pvt *p)
 {
-	struct local_pvt *cur, *prev = NULL;
-	ast_mutex_lock(&locallock);
-	cur = locals;
-	while(cur) {
+	struct local_pvt *cur;
+
+	AST_LIST_LOCK(&locals);
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&locals, cur, list) {
 		if (cur == p) {
-			if (prev)
-				prev->next = cur->next;
-			else
-				locals = cur->next;
-			ast_mutex_destroy(cur);
+			AST_LIST_REMOVE_CURRENT(&locals, list);
+			ast_mutex_destroy(&cur->lock);
 			free(cur);
 			break;
 		}
-		prev = cur;
-		cur = cur->next;
-	}
-	ast_mutex_unlock(&locallock);
+	}
+	AST_LIST_TRAVERSE_SAFE_END
+	AST_LIST_UNLOCK(&locals);
 	if (!cur)
 		ast_log(LOG_WARNING, "Unable ot find local '%s@%s' in local list\n", p->exten, p->context);
 }
@@ -385,7 +380,6 @@
 	struct local_pvt *p = ast->tech_pvt;
 	int isoutbound;
 	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
-	struct local_pvt *cur, *prev=NULL;
 	struct ast_channel *ochan = NULL;
 	int glaredetect;
 	const char *status;
@@ -394,7 +388,7 @@
 	isoutbound = IS_OUTBOUND(ast, p);
 	if (isoutbound) {
 		status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");
-		if(status)
+		if ((status) && (p->owner))
 			pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
 		p->chan = NULL;
 		p->launchedpbx = 0;
@@ -415,20 +409,9 @@
 			p->cancelqueue = 1;
 		ast_mutex_unlock(&p->lock);
 		/* Remove from list */
-		ast_mutex_lock(&locallock);
-		cur = locals;
-		while(cur) {
-			if (cur == p) {
-				if (prev)
-					prev->next = cur->next;
-				else
-					locals = cur->next;
-				break;
-			}
-			prev = cur;
-			cur = cur->next;
-		}
-		ast_mutex_unlock(&locallock);
+		AST_LIST_LOCK(&locals);
+		AST_LIST_REMOVE(&locals, p, list);
+		AST_LIST_UNLOCK(&locals);
 		/* Grab / release lock just in case */
 		ast_mutex_lock(&p->lock);
 		ast_mutex_unlock(&p->lock);
@@ -484,10 +467,9 @@
 		tmp = NULL;
 	} else {
 		/* Add to list */
-		ast_mutex_lock(&locallock);
-		tmp->next = locals;
-		locals = tmp;
-		ast_mutex_unlock(&locallock);
+		AST_LIST_LOCK(&locals);
+		AST_LIST_INSERT_HEAD(&locals, tmp, list);
+		AST_LIST_UNLOCK(&locals);
 	}
 	
 	return tmp;
@@ -563,17 +545,15 @@
 
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
-	ast_mutex_lock(&locallock);
-	p = locals;
-	while(p) {
+	if (AST_LIST_EMPTY(&locals))
+		ast_cli(fd, "No local channels in use\n");
+	AST_LIST_LOCK(&locals);
+	AST_LIST_TRAVERSE(&locals, p, list) {
 		ast_mutex_lock(&p->lock);
 		ast_cli(fd, "%s -- %s@%s\n", p->owner ? p->owner->name : "<unowned>", p->exten, p->context);
 		ast_mutex_unlock(&p->lock);
-		p = p->next;
-	}
-	if (!locals)
-		ast_cli(fd, "No local channels in use\n");
-	ast_mutex_unlock(&locallock);
+	}
+	AST_LIST_UNLOCK(&locals);
 	return RESULT_SUCCESS;
 }
 
@@ -611,16 +591,14 @@
 	/* First, take us out of the channel loop */
 	ast_cli_unregister(&cli_show_locals);
 	ast_channel_unregister(&local_tech);
-	if (!ast_mutex_lock(&locallock)) {
+	if (!AST_LIST_LOCK(&locals)) {
 		/* Hangup all interfaces if they have an owner */
-		p = locals;
-		while(p) {
+		AST_LIST_TRAVERSE(&locals, p, list) {
 			if (p->owner)
 				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-			p = p->next;
 		}
-		locals = NULL;
-		ast_mutex_unlock(&locallock);
+		AST_LIST_UNLOCK(&locals);
+		AST_LIST_HEAD_DESTROY(&locals);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
 		return -1;

Modified: team/oej/strictrouting/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/channels/chan_mgcp.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/channels/chan_mgcp.c (original)
+++ team/oej/strictrouting/channels/chan_mgcp.c Sat Feb 11 07:43:47 2006
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -3528,10 +3528,6 @@
 
 static int restart_monitor(void)
 {
-	pthread_attr_t attr;
-	pthread_attr_init(&attr);
-        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);	
-
 	/* If we're supposed to be stopped -- stay stopped */
 	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
@@ -3549,7 +3545,7 @@
 		pthread_kill(monitor_thread, SIGURG);
 	} else {
 		/* Start a new monitor */
-		if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
+		if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
 			ast_mutex_unlock(&monlock);
 			ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
 			return -1;

Modified: team/oej/strictrouting/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/strictrouting/channels/chan_misdn.c?rev=9518&r1=9517&r2=9518&view=diff
==============================================================================
--- team/oej/strictrouting/channels/chan_misdn.c (original)
+++ team/oej/strictrouting/channels/chan_misdn.c Sat Feb 11 07:43:47 2006
@@ -60,8 +60,8 @@
 #include <asterisk/features.h>
 #include <asterisk/stringfields.h>
 
-#include "chan_misdn_config.h"
-#include "isdn_lib.h"
+#include <chan_misdn_config.h>
+#include <isdn_lib.h>
 
 ast_mutex_t release_lock_mutex;
 
@@ -103,12 +103,24 @@
 
 /* BEGIN: chan_misdn.h */
 
+
+enum tone_e {
+	TONE_NONE=0,
+	TONE_DIAL,
+	TONE_ALERTING,
+	TONE_BUSY,
+	TONE_CUSTOM,
+	TONE_FILE
+};
+
+
 enum misdn_chan_state {
 	MISDN_NOTHING,		/*!< at beginning */
 	MISDN_WAITING4DIGS, /*!<  when waiting for infos */
 	MISDN_EXTCANTMATCH, /*!<  when asterisk couldnt match our ext */
 	MISDN_DIALING, /*!<  when pbx_start */
 	MISDN_PROGRESS, /*!<  we got a progress */
+	MISDN_PROCEEDING, /*!<  we got a progress */
 	MISDN_CALLING, /*!<  when misdn_call is called */
 	MISDN_CALLING_ACKNOWLEDGE, /*!<  when we get SETUP_ACK */
 	MISDN_ALERTING, /*!<  when Alerting */
@@ -147,6 +159,8 @@
 
 	int ast_dsp;
 
+	int jb_len;
+	int jb_upper_threshold;
 	struct misdn_jb *jb;
 	
 	struct ast_dsp *dsp;
@@ -161,6 +175,8 @@
 	int addr;
 
 	char context[BUFFERSIZE];
+
+	const struct tone_zone_sound *ts;
 	
 	struct chan_list *peer;
 	struct chan_list *next;
@@ -266,6 +282,7 @@
 
 
 
+static int tone_indicate( struct chan_list *cl, enum tone_e tone);
 
 static int start_bc_tones(struct chan_list *cl);
 static int stop_bc_tones(struct chan_list *cl);
@@ -300,25 +317,6 @@
 	return NULL;
 }
 
-static char* tone2str(struct misdn_bchannel *bc)
-{
-	static struct {
-		char name[16];
-		enum tone_e tone;
-	} *tone, tone_buf[] = {
-		{"NOTONE",TONE_NONE},
-		{"DIAL",TONE_DIAL},
-		{"BUSY",TONE_BUSY},
-		{"ALERT",TONE_ALERTING},
-		{"",TONE_NONE}
-	};
-  
-  
-	for (tone=&tone_buf[0]; tone->name[0]; tone++) {
-		if (tone->tone == bc->tone) return tone->name;
-	}
-	return NULL;
-}
 
 static char *bearer2str(int cap) {
 	static char *bearers[]={
@@ -529,12 +527,12 @@
 	
 	if (argc == 3 || onlyport == 0) {
 		ast_cli(fd,"Misdn General-Config: \n"); 
-		ast_cli(fd," ->  VERSION: " CHAN_MISDN_VERSION "\n");
-		
+		ast_cli(fd," -> Version: chan_misdn-" CHAN_MISDN_VERSION "\n");
 		for (elem = MISDN_GEN_FIRST + 1, linebreak = 1; elem < MISDN_GEN_LAST; elem++, linebreak++) {
 			misdn_cfg_get_config_string( 0, elem, buffer, BUFFERSIZE);
 			ast_cli(fd, "%-36s%s", buffer, !(linebreak % 2) ? "\n" : "");
 		}
+		ast_cli(fd, "\n");
 	}
 
 	if (onlyport < 0) {
@@ -600,25 +598,29 @@
 	return NULL;
 }
 
-static int misdn_reload (int fd, int argc, char *argv[])
+
+
+void reload_config(void)
 {
 	int i, cfg_debug;
-	
-	ast_cli(fd, "Reloading mISDN Config\n");
 	chan_misdn_log(-1, 0, "Dynamic Crypting Activation is not support during reload at the moment\n");
 	
 	free_robin_list();
-
 	misdn_cfg_reload();
-	
+	misdn_cfg_update_ptp();
 	misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
-	
 	misdn_cfg_get( 0, MISDN_GEN_DEBUG, &cfg_debug, sizeof(int));
+
 	for (i = 0;  i <= max_ports; i++) {
 		misdn_debug[i] = cfg_debug;
 		misdn_debug_only[i] = 0;
 	}
-	
+}
+
+static int misdn_reload (int fd, int argc, char *argv[])
+{
+	ast_cli(fd, "Reloading mISDN Config\n");
+	reload_config();
 	return 0;
 }
 
@@ -643,7 +645,6 @@
 			"  --> ch_addr: %x\n"
 			"  --> bc_addr: %x\n"
 			"  --> bc_l3id: %x\n"
-			"  --> tone: %s\n"
 			"  --> display: %s\n"
 			"  --> activated: %d\n"
 			"  --> capability: %s\n"
@@ -655,7 +656,6 @@
 			help->addr,
 			bc->addr,
 			bc?bc->l3_id:-1,
-			tone2str(bc),
 			bc->display,
 			
 			bc->active,
@@ -893,7 +893,7 @@
 	return RESULT_SUCCESS ;
 }
 
-static char *complete_ch_helper(char *line, char *word, int pos, int state, int rpos)
+static char *complete_ch_helper(const char *line, const char *word, int pos, int state, int rpos)
 {
 	struct ast_channel *c;
 	int which=0;
@@ -917,12 +917,12 @@
 	return ret;
 }
 
-static char *complete_ch(char *line, char *word, int pos, int state)
+static char *complete_ch(const char *line, const char *word, int pos, int state)
 {
 	return complete_ch_helper(line, word, pos, state, 3);
 }
 
-static char *complete_debug_port (char *line, char *word, int pos, int state)
+static char *complete_debug_port (const char *line, const char *word, int pos, int state)
 {
 	if (state)
 		return NULL;
@@ -1059,14 +1059,13 @@
 /*** CLI END ***/
 
 
-
-static int read_config(struct chan_list *ch, int orig) {
-
+static int update_config (struct chan_list *ch, int orig) 
+{
 	if (!ch) {
 		ast_log(LOG_WARNING, "Cannot configure without chanlist\n");
 		return -1;
 	}
-
+	
 	struct ast_channel *ast=ch->ast;
 	struct misdn_bchannel *bc=ch->bc;
 	if (! ast || ! bc ) {
@@ -1076,6 +1075,124 @@
 	
 	int port=bc->port;
 	
+	chan_misdn_log(1,port,"update_config: Getting Config\n");
+
+	
+	int pres, screen;
+			
+	misdn_cfg_get( port, MISDN_CFG_PRES, &pres, sizeof(int));
+	misdn_cfg_get( port, MISDN_CFG_SCREEN, &screen, sizeof(int));
+	chan_misdn_log(2,port," --> pres: %d screen: %d\n",pres, screen);
+		
+	if ( (pres + screen) < 0 ) {
+
+		chan_misdn_log(2,port," --> pres: %x\n", ast->cid.cid_pres);
+			
+		switch (ast->cid.cid_pres & 0x60){
+				
+		case AST_PRES_RESTRICTED:
+			bc->pres=1;
+			chan_misdn_log(2, port, " --> PRES: Restricted (0x1)\n");
+			break;
+				
+				
+		case AST_PRES_UNAVAILABLE:
+			bc->pres=2;
+			chan_misdn_log(2, port, " --> PRES: Unavailable (0x2)\n");
+			break;
+				
+		default:
+			bc->pres=0;
+			chan_misdn_log(2, port, " --> PRES: Allowed (0x0)\n");
+		}
+			
+		switch (ast->cid.cid_pres & 0x3){
+				
+		case AST_PRES_USER_NUMBER_UNSCREENED:
+			bc->screen=0;
+			chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
+			break;
+
+		case AST_PRES_USER_NUMBER_PASSED_SCREEN:
+			bc->screen=1;
+			chan_misdn_log(2, port, " --> SCREEN: Passed Screen (0x1)\n");
+			break;
+		case AST_PRES_USER_NUMBER_FAILED_SCREEN:
+			bc->screen=2;
+			chan_misdn_log(2, port, " --> SCREEN: Failed Screen (0x2)\n");
+			break;
+				
+		case AST_PRES_NETWORK_NUMBER:
+			bc->screen=3;
+			chan_misdn_log(2, port, " --> SCREEN: Network Nr. (0x3)\n");
+			break;
+				
+		default:
+			bc->screen=0;
+			chan_misdn_log(2, port, " --> SCREEN: Unscreened (0x0)\n");
+		}
+
+			
+	} else {
+		bc->screen=screen;
+		bc->pres=pres;
+	}
+
+	return 0;
+	
+}
+
+
+
+
+void config_jitterbuffer(struct chan_list *ch)
+{
+	struct misdn_bchannel *bc=ch->bc;
+	int len=ch->jb_len, threshold=ch->jb_upper_threshold;
+	
+	chan_misdn_log(1,bc->port, "config_jb: Called\n");
+	
+	if ( ! len ) {

[... 9131 lines stripped ...]


More information about the asterisk-commits mailing list