[svn-commits] russell: branch russell/events r89214 - in /team/russell/events: ./ apps/ cdr...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 12 21:47:32 CST 2007


Author: russell
Date: Mon Nov 12 21:47:31 2007
New Revision: 89214

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89214
Log:
sync with trunk

Modified:
    team/russell/events/   (props changed)
    team/russell/events/Makefile
    team/russell/events/apps/app_exec.c
    team/russell/events/apps/app_mixmonitor.c
    team/russell/events/apps/app_queue.c
    team/russell/events/cdr/cdr_manager.c
    team/russell/events/channels/chan_misdn.c
    team/russell/events/channels/chan_sip.c
    team/russell/events/channels/chan_unistim.c
    team/russell/events/channels/misdn/chan_misdn_config.h
    team/russell/events/channels/misdn/isdn_lib.c
    team/russell/events/channels/misdn/isdn_lib.h
    team/russell/events/channels/misdn/isdn_lib_intern.h
    team/russell/events/channels/misdn/isdn_msg_parser.c
    team/russell/events/channels/misdn_config.c
    team/russell/events/configs/misdn.conf.sample
    team/russell/events/funcs/func_logic.c
    team/russell/events/include/asterisk/cli.h
    team/russell/events/include/asterisk/config.h
    team/russell/events/include/asterisk/hashtab.h
    team/russell/events/include/asterisk/pbx.h
    team/russell/events/include/asterisk/stringfields.h
    team/russell/events/main/ast_expr2f.c
    team/russell/events/main/channel.c
    team/russell/events/main/hashtab.c
    team/russell/events/main/pbx.c
    team/russell/events/pbx/pbx_dundi.c
    team/russell/events/pbx/pbx_lua.c
    team/russell/events/pbx/pbx_realtime.c
    team/russell/events/res/res_clioriginate.c
    team/russell/events/res/res_config_sqlite.c
    team/russell/events/res/res_convert.c
    team/russell/events/res/res_crypto.c
    team/russell/events/res/res_features.c
    team/russell/events/res/res_monitor.c
    team/russell/events/utils/Makefile
    team/russell/events/utils/hashtest.c

Propchange: team/russell/events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/russell/events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Nov 12 21:47:31 2007
@@ -1,1 +1,1 @@
-/trunk:1-89162
+/trunk:1-89210

Modified: team/russell/events/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/events/Makefile?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/Makefile (original)
+++ team/russell/events/Makefile Mon Nov 12 21:47:31 2007
@@ -753,7 +753,7 @@
 	@CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect gmenuselect CONFIGURE_SILENT="--silent"
 
 menuselect/makeopts:
-	@CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C makeopts CONFIGURE_SILENT="--silent"
+	@CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect makeopts CONFIGURE_SILENT="--silent"
 
 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml configure
 	@echo "Generating input for menuselect ..."

Modified: team/russell/events/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_exec.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/apps/app_exec.c (original)
+++ team/russell/events/apps/app_exec.c Mon Nov 12 21:47:31 2007
@@ -99,6 +99,7 @@
 		return 0;
 	
 	s = ast_strdupa(data);
+	args[0] = 0;
 	appname = strsep(&s, "(");
 	if (s) {
 		endargs = strrchr(s, ')');
@@ -129,6 +130,7 @@
 		return 0;
 
 	s = ast_strdupa(data);
+	args[0] = 0;
 	appname = strsep(&s, "(");
 	if (s) {
 		endargs = strrchr(s, ')');

Modified: team/russell/events/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_mixmonitor.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/apps/app_mixmonitor.c (original)
+++ team/russell/events/apps/app_mixmonitor.c Mon Nov 12 21:47:31 2007
@@ -220,11 +220,12 @@
 {
 	pthread_t thread;
 	struct mixmonitor *mixmonitor;
-	char postprocess2[1024];
+	char postprocess2[1024] = "";
 	size_t len;
 
 	len = sizeof(*mixmonitor) + strlen(chan->name) + strlen(filename) + 2;
 
+	postprocess2[0] = 0;
 	/* If a post process system command is given attach it to the structure */
 	if (!ast_strlen_zero(post_process)) {
 		char *p1, *p2;
@@ -308,7 +309,7 @@
 		return -1;
 	}
 
-	if (args.options) {
+	if (args.argc > 1 && args.options) {
 		char *opts[OPT_ARG_ARRAY_SIZE] = { NULL, };
 
 		ast_app_parse_options(mixmonitor_opts, &flags, opts, args.options);
@@ -359,7 +360,7 @@
 	ast_mkdir(tmp, 0777);
 
 	pbx_builtin_setvar_helper(chan, "MIXMONITOR_FILENAME", args.filename);
-	launch_monitor_thread(chan, args.filename, flags.flags, readvol, writevol, args.post_process);
+	launch_monitor_thread(chan, args.filename, flags.flags, readvol, writevol, args.argc > 2 ? args.post_process : "");
 
 	return 0;
 }

Modified: team/russell/events/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_queue.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/apps/app_queue.c (original)
+++ team/russell/events/apps/app_queue.c Mon Nov 12 21:47:31 2007
@@ -2703,6 +2703,8 @@
 	struct ao2_iterator memi;
 
 	memset(&bridge_config, 0, sizeof(bridge_config));
+	tmpid[0] = 0;
+	meid[0] = 0;
 	time(&now);
 		
 	for (; options && *options; options++)

Modified: team/russell/events/cdr/cdr_manager.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/cdr/cdr_manager.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/cdr/cdr_manager.c (original)
+++ team/russell/events/cdr/cdr_manager.c Mon Nov 12 21:47:31 2007
@@ -142,6 +142,7 @@
 	ast_localtime(&cdr->end, &timeresult, NULL);
 	ast_strftime(strEndTime, sizeof(strEndTime), DATE_FORMAT, &timeresult);
 
+	buf[0] = 0;
 	/* Custom fields handling */
 	if (customfields != NULL && customfields->used > 0) {
 		memset(&dummy, 0, sizeof(dummy));

Modified: team/russell/events/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_misdn.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/chan_misdn.c (original)
+++ team/russell/events/channels/chan_misdn.c Mon Nov 12 21:47:31 2007
@@ -706,6 +706,7 @@
 misdn_overlap_dial_task_disconnect:
 			hanguptone_indicate(ch);
 			ch->bc->out_cause=1;
+			ch->state=MISDN_CLEANING;
 			misdn_lib_send_event(ch->bc, EVENT_DISCONNECT);
 		}
 		ch->overlap_dial_task = -1;
@@ -2654,6 +2655,7 @@
 		start_bc_tones(p);
 		hanguptone_indicate(p);
 		
+		p->state=MISDN_CLEANING;
 		if (bc->need_disconnect)
 			misdn_lib_send_event( bc, EVENT_DISCONNECT);
 		break;
@@ -2689,7 +2691,8 @@
 		/*p->state=MISDN_CLEANING;*/
 		break;
 	case MISDN_DISCONNECTED:
-		misdn_lib_send_event( bc, EVENT_RELEASE);
+		if (bc->need_release)
+			misdn_lib_send_event( bc, EVENT_RELEASE);
 		p->state = MISDN_CLEANING; /* MISDN_HUNGUP_FROM_AST; */
 		break;
 
@@ -2707,13 +2710,15 @@
 		chan_misdn_log(1, bc->port, " --> out_cause %d\n", bc->out_cause);
 
 		bc->out_cause = -1;
-		misdn_lib_send_event(bc, EVENT_RELEASE);
+		if (bc->need_release)
+			misdn_lib_send_event(bc, EVENT_RELEASE);
 		p->state = MISDN_CLEANING;
 		break;
 	default:
 		if (bc->nt) {
 			bc->out_cause = -1;
-			misdn_lib_send_event(bc, EVENT_RELEASE);
+			if (bc->need_release)
+				misdn_lib_send_event(bc, EVENT_RELEASE);
 			p->state = MISDN_CLEANING; 
 		} else {
 			if (bc->need_disconnect)
@@ -4437,6 +4442,17 @@
 			break;
 		}
 
+
+		/*
+		 * When we are NT and overlapdial is set and if 
+		 * the number is empty, we wait for the ISDN timeout
+		 * instead of our own timer.
+		 */
+		if (ch->overlap_dial && bc->nt && !bc->dad[0] ) {
+			wait_for_digits(ch, bc, chan);
+			break;
+		}
+
 		/* 
 		 * If overlapdial we will definitely send a SETUP_ACKNOWLEDGE and wait for more 
 		 * Infos with a Interdigit Timeout.
@@ -5024,7 +5040,7 @@
 static int load_module(void)
 {
 	int i, port;
-	int ntflags = 0;
+	int ntflags = 0, ntkc = 0;
 	char ports[256] = "";
 	char tempbuf[BUFFERSIZE + 1];
 	char ntfile[BUFFERSIZE + 1];
@@ -5085,13 +5101,14 @@
 
 	if (!ast_strlen_zero(ports))
 		chan_misdn_log(0, 0, "Got: %s from get_ports\n", ports);
-
 	if (misdn_lib_init(ports, &iface, NULL))
 		chan_misdn_log(0, 0, "No te ports initialized\n");
 
 	misdn_cfg_get(0, MISDN_GEN_NTDEBUGFLAGS, &ntflags, sizeof(ntflags));
 	misdn_cfg_get(0, MISDN_GEN_NTDEBUGFILE, &ntfile, sizeof(ntfile));
-
+	misdn_cfg_get( 0, MISDN_GEN_NTKEEPCALLS, &ntkc, sizeof(ntkc));
+
+	misdn_lib_nt_keepcalls(ntkc);
 	misdn_lib_nt_debug_init(ntflags, ntfile);
 
 	if (ast_channel_register(&misdn_tech)) {

Modified: team/russell/events/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_sip.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/chan_sip.c (original)
+++ team/russell/events/channels/chan_sip.c Mon Nov 12 21:47:31 2007
@@ -2423,8 +2423,16 @@
 		transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, TRUE);	/* Send last notification */
 		p->subscribed = NONE;
 		append_history(p, "Subscribestatus", "timeout");
-		ast_debug(3, "Re-scheduled destruction of SIP subsription %s\n", p->callid ? p->callid : "<unknown>");
+		ast_debug(3, "Re-scheduled destruction of SIP subscription %s\n", p->callid ? p->callid : "<unknown>");
 		return 10000;	/* Reschedule this destruction so that we know that it's gone */
+	}
+
+	/* If there are packets still waiting for delivery, delay the destruction */
+	if (p->packets) {
+		if (option_debug > 2)
+			ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP call %s\n", p->callid ? p->callid : "<unknown>");
+		append_history(p, "ReliableXmit", "timeout");
+		return 10000;
 	}
 
 	if (p->subscribed == MWI_NOTIFICATION)

Modified: team/russell/events/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_unistim.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/chan_unistim.c (original)
+++ team/russell/events/channels/chan_unistim.c Mon Nov 12 21:47:31 2007
@@ -41,6 +41,7 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#include <sys/stat.h>
 #include <net/if.h>
 #include <errno.h>
 #include <stdlib.h>
@@ -385,7 +386,7 @@
 	ast_mutex_t lock;
 	/*! Like 200 */
 	char name[80];
-	/*! Like USTM/200 at black */
+	/*! Like USTM/200\@black */
 	char fullname[80];
 	/*! pointer to our current connection, channel... */
 	struct unistim_subchannel *subs[MAX_SUBS];

Modified: team/russell/events/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/misdn/chan_misdn_config.h?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/misdn/chan_misdn_config.h (original)
+++ team/russell/events/channels/misdn/chan_misdn_config.h Mon Nov 12 21:47:31 2007
@@ -97,6 +97,7 @@
 	MISDN_GEN_DYNAMIC_CRYPT,       /* int (bool) */
 	MISDN_GEN_CRYPT_PREFIX,        /* char[] */
 	MISDN_GEN_CRYPT_KEYS,          /* char[] */
+	MISDN_GEN_NTKEEPCALLS,          /* int (bool) */
 	MISDN_GEN_NTDEBUGFLAGS,          /* int */
 	MISDN_GEN_NTDEBUGFILE,          /* char[] */
 	MISDN_GEN_LAST

Modified: team/russell/events/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/misdn/isdn_lib.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/misdn/isdn_lib.c (original)
+++ team/russell/events/channels/misdn/isdn_lib.c Mon Nov 12 21:47:31 2007
@@ -28,6 +28,8 @@
 struct misdn_stack* get_misdn_stack( void );
 
 static int set_chan_in_stack(struct misdn_stack *stack, int channel);
+
+int release_cr(struct misdn_stack *stack, mISDNuser_head_t *hh);
 
 int misdn_lib_port_is_pri(int port)
 {
@@ -777,15 +779,12 @@
 	/* Pull Up L1 */ 
 	iframe_t act;
 	act.prim = PH_DEACTIVATE | REQUEST; 
-	act.addr = (stack->upper_id | FLG_MSG_DOWN)  ;
-
-	
+	act.addr = stack->lower_id|FLG_MSG_DOWN;
 	act.dinfo = 0;
 	act.len = 0;
 
+	cb_log(1, stack->port, "SENDING PH_DEACTIVATE | REQ\n");
 	return mISDN_write(stack->midev, &act, mISDN_HEADER_LEN+act.len, TIMEOUT_1SEC);
-
-
 }
 
 
@@ -1568,6 +1567,11 @@
 				bc->channel=0;
 
 			if (find_free_chan_in_stack(stack, bc, bc->channel, 0)<0){
+				if (!stack->pri && !stack->ptp)  {
+					bc->cw=1;
+					break;
+				}
+
 				cb_log(0, stack->port, "Any Channel Requested, but we have no more!!\n");
 				misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
 				return -1;
@@ -1768,6 +1772,38 @@
 }
 
 
+int release_cr(struct misdn_stack *stack, mISDNuser_head_t *hh)
+{
+	struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
+	struct misdn_bchannel dummybc;
+	iframe_t frm; /* fake te frm to remove callref from global callreflist */
+	frm.dinfo = hh->dinfo;
+
+	frm.addr=stack->upper_id | FLG_MSG_DOWN;
+
+	frm.prim = CC_RELEASE_CR|INDICATION;
+	cb_log(4, stack->port, " --> CC_RELEASE_CR: Faking Realease_cr for %x l3id:%x\n",frm.addr, frm.dinfo);
+	/** removing procid **/
+	if (!bc) {
+		cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
+		misdn_make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
+		bc=&dummybc; 
+	}
+
+	if (bc) {
+		if ( (bc->l3_id & 0xff00) == 0xff00) {
+			cb_log(4, stack->port, " --> Removing Process Id:%x on this port.\n", bc->l3_id&0xff);
+			stack->procids[bc->l3_id&0xff] = 0 ;
+		}
+	}
+	else cb_log(0, stack->port, "Couldnt find BC so I couldnt remove the Process!!!! this is a bad port.\n");
+
+	if (handle_cr(stack, &frm)<0) {
+	}
+
+	return 0 ;
+}
+
 int
 handle_event_nt(void *dat, void *arg)
 {
@@ -1916,43 +1952,23 @@
 			break;
 
 		case CC_RELEASE|CONFIRM:
+			{
+				struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
+
+				if (bc) { 
+					cb_log(1, stack->port, "CC_RELEASE|CONFIRM (l3id:%x), sending RELEASE_COMPLETE\n", hh->dinfo);
+					misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE);
+				}
+			}
 			break;
 			
 		case CC_RELEASE|INDICATION:
 			break;
 
 		case CC_RELEASE_CR|INDICATION:
-		{
-			struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
-			struct misdn_bchannel dummybc;
-			iframe_t frm; /* fake te frm to remove callref from global callreflist */
-			frm.dinfo = hh->dinfo;
-
-			frm.addr=stack->upper_id | FLG_MSG_DOWN;
-
-			frm.prim = CC_RELEASE_CR|INDICATION;
-			cb_log(4, stack->port, " --> Faking Realease_cr for %x\n",frm.addr);
-			/** removing procid **/
-			if (!bc) {
-				cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
-				misdn_make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
-				bc=&dummybc; 
-			}
-	
-			if (bc) {
-				if ( (bc->l3_id & 0xff00) == 0xff00) {
-					cb_log(4, stack->port, " --> Removing Process Id:%x on this port.\n", bc->l3_id&0xff);
-					stack->procids[bc->l3_id&0xff] = 0 ;
-				}
-			}
-			else cb_log(0, stack->port, "Couldnt find BC so I couldnt remove the Process!!!! this is a bad port.\n");
-	
-			if (handle_cr(stack, &frm)<0) {
-			}
-
+			release_cr(stack, hh);
 			free_msg(msg);
 			return 0 ;
-		}
 		break;
       
 		case CC_NEW_CR|INDICATION:
@@ -1984,7 +2000,16 @@
 				cb_log(0, stack->port, "%% GOT L2 Activate Info. but we're activated already.. this l2 is faulty, blocking port\n");
 				cb_event(EVENT_PORT_ALARM, &stack->bc[0], glob_mgr->user_data);
 			}
-			
+
+			if (stack->ptp && !stack->restart_sent) {
+				/* make sure we restart the interface of the 
+				 * other side */
+				stack->restart_sent=1;
+				misdn_lib_send_restart(stack->port, -1);
+
+			}
+		
+			/* when we get the L2 UP, the L1 is UP definitely too*/
 			stack->l2link = 1;
 			stack->l2upcnt=0;
 			
@@ -2082,7 +2107,6 @@
 				}
 				cb_event(event, bc, glob_mgr->user_data);
 			}
-      
 		} else {
 			cb_log(4, stack->port, "No BC found with l3id: prim %x dinfo %x\n",hh->prim, hh->dinfo);
 		}
@@ -2752,12 +2776,14 @@
 	case PH_DEACTIVATE | CONFIRM:
 	case PH_DEACTIVATE | INDICATION:
 		cb_log (3, stack->port, "L1: PH L1Link Down! \n");
-		
+	
+#if 0
 		for (i=0; i<=stack->b_num; i++) {
 			if (global_state == MISDN_INITIALIZED)  {
 				cb_event(EVENT_CLEANUP, &stack->bc[i], glob_mgr->user_data);
 			}
 		}
+#endif
 		
 		if (stack->nt) {
 			if (stack->nst.l1_l2(&stack->nst, msg))
@@ -2859,7 +2885,9 @@
 		case SSTATUS_L1_DEACTIVATED:
 			cb_log(3, 0, "MGMT: SSTATUS: L1_DEACTIVATED \n");
 			stack->l1link=0;
+#if 0
 			clear_l3(stack);
+#endif
 			break;
 
 		case SSTATUS_L2_ESTABLISHED:
@@ -3677,30 +3705,29 @@
 	struct misdn_stack *stack=find_stack_by_port(port);
 	struct misdn_bchannel dummybc;
 	/*default is all channels*/
-	int max = stack->pri ? 30 : 2;
-	int i = 1;
-	
 	cb_log(0, port, "Sending Restarts on this port.\n");
 	
 	misdn_make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0);
 
+	/*default is all channels*/
+	if (channel <0) {
+		dummybc.channel=-1;
+		cb_log(0, port, "Restarting and all Interfaces\n");
+		misdn_lib_send_event(&dummybc, EVENT_RESTART);
+
+		return 0;
+	}
+
 	/*if a channel is specified we restart only this one*/
-	if (channel > 0) {
-		i=channel;
-		max=channel;
-	}
-
-	for (;i<=max;i++) {
+	if (channel >0) {
 		int cnt;
-		dummybc.channel=i;
-		cb_log(0, port, "Restarting and cleaning channel %d\n",i);
+		dummybc.channel=channel;
+		cb_log(0, port, "Restarting and cleaning channel %d\n",channel);
 		misdn_lib_send_event(&dummybc, EVENT_RESTART);
-		/*do we need to wait before we get an EVENT_RESTART_ACK ?*/
-
 		/* clean up chan in stack, to be sure we don't think it's
 		 * in use anymore */
 		for (cnt=0; cnt<=stack->b_num; cnt++) {
-			if (stack->bc[cnt].channel == i) {
+			if (stack->bc[cnt].channel == channel) {
 				empty_bc(&stack->bc[cnt]);
 				clean_up_bc(&stack->bc[cnt]);
 				stack->bc[cnt].in_use=0;
@@ -3866,6 +3893,18 @@
 }
 
 
+void misdn_lib_nt_keepcalls( int kc)
+{
+#ifdef FEATURE_NET_KEEPCALLS
+	if (kc) {
+		struct misdn_stack *stack=get_misdn_stack();
+		for ( ; stack; stack=stack->next) {
+			stack->nst.feature |= FEATURE_NET_KEEPCALLS;
+		}
+	}
+#endif
+}
+
 void misdn_lib_nt_debug_init( int flags, char *file ) 
 {
 	int static init=0;

Modified: team/russell/events/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/misdn/isdn_lib.h?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/misdn/isdn_lib.h (original)
+++ team/russell/events/channels/misdn/isdn_lib.h Mon Nov 12 21:47:31 2007
@@ -382,6 +382,8 @@
 
 /***** USER IFACE **********/
 
+void misdn_lib_nt_keepcalls(int kc);
+
 void misdn_lib_nt_debug_init( int flags, char *file );
 
 int misdn_lib_init(char *portlist, struct misdn_lib_iface* iface, void *user_data);

Modified: team/russell/events/channels/misdn/isdn_lib_intern.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/misdn/isdn_lib_intern.h?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/misdn/isdn_lib_intern.h (original)
+++ team/russell/events/channels/misdn/isdn_lib_intern.h Mon Nov 12 21:47:31 2007
@@ -80,6 +80,9 @@
 	time_t l2establish;
   
 	int l1link;
+
+	int restart_sent;
+
 	int midev;
   
 	int nt;

Modified: team/russell/events/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/misdn/isdn_msg_parser.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/misdn/isdn_msg_parser.c (original)
+++ team/russell/events/channels/misdn/isdn_msg_parser.c Mon Nov 12 21:47:31 2007
@@ -840,8 +840,13 @@
 #ifdef DEBUG 
 	printf("Building RESTART Msg\n"); 
 #endif
-	enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
-	enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
+
+	if (bc->channel > 0) {
+		enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
+		enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
+	} else {
+		enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x87, nt, bc);
+	}
 
 	cb_log(0,bc->port, "Restarting channel %d\n", bc->channel);
 	return msg; 

Modified: team/russell/events/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/misdn_config.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/channels/misdn_config.c (original)
+++ team/russell/events/channels/misdn_config.c Mon Nov 12 21:47:31 2007
@@ -369,6 +369,10 @@
 	{ "crypt_keys", MISDN_GEN_CRYPT_KEYS, MISDN_CTYPE_STR, NO_DEFAULT, NONE,
 		"Keys for cryption, you reference them in the dialplan\n"
 		"\tLater also in dynamic encr." },
+ 	{ "ntkeepcalls", MISDN_GEN_NTKEEPCALLS, MISDN_CTYPE_BOOL, "no", NONE, 
+		"avoid dropping calls if the L2 goes down. some nortel pbx\n" 
+		"do put down the L2/L1 for some milliseconds even if there\n"
+		"are running calls. with this option you can avoid dropping them\n" },
 	{ "ntdebugflags", MISDN_GEN_NTDEBUGFLAGS, MISDN_CTYPE_INT, "0", NONE,
 	  	"No description yet."},
 	{ "ntdebugfile", MISDN_GEN_NTDEBUGFILE, MISDN_CTYPE_STR, "/var/log/misdn-nt.log", NONE,

Modified: team/russell/events/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/events/configs/misdn.conf.sample?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/configs/misdn.conf.sample (original)
+++ team/russell/events/configs/misdn.conf.sample Mon Nov 12 21:47:31 2007
@@ -56,6 +56,12 @@
 ntdebugflags=0
 ntdebugfile=/var/log/misdn-nt.log
 
+
+; some pbx systems do cut the L1 for some milliseconds, to avoid 
+; dropping running calls, we can set this flag to yes and tell
+; mISDNuser not to drop the calls on L2_RELEASE
+ntkeepcalls=no
+
 ; the big trace
 ;
 ; default value: [not set]
@@ -262,6 +268,13 @@
 ; default value: standard
 ;
 method=standard
+
+
+; specify if chan_misdn should collect digits before going into the 
+; dialplan, you can choose yes=4 Seconds, no, or specify the amount
+; of seconds you need;
+; 
+overlapdial=yes
 
 ;
 ; dialplan means Type Of Number in ISDN Terms (for outgoing calls)

Modified: team/russell/events/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/funcs/func_logic.c?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/funcs/func_logic.c (original)
+++ team/russell/events/funcs/func_logic.c Mon Nov 12 21:47:31 2007
@@ -157,7 +157,7 @@
 		AST_APP_ARG(varname);
 	);
 	AST_STANDARD_APP_ARGS(args, data);
-
+	buf[0] = 0;
 	if (!ast_strlen_zero(args.varname)) {
 		struct ast_channel *chan2 = ast_get_channel_by_name_locked(args.channel);
 		if (chan2) {

Modified: team/russell/events/include/asterisk/cli.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/cli.h?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/include/asterisk/cli.h (original)
+++ team/russell/events/include/asterisk/cli.h Mon Nov 12 21:47:31 2007
@@ -220,6 +220,8 @@
 /*! 
  * \brief Interprets a command
  * Interpret a command s, sending output to fd
+ * \param fd pipe
+ * \param s incoming string
  * \retval 0 on success
  * \retval -1 on failure
  */
@@ -227,14 +229,16 @@
 
 /*! 
  * \brief Executes multiple CLI commands
- * Interpret strings separated by '\0' and execute each one, sending output to fd
+ * Interpret strings separated by NULL and execute each one, sending output to fd
+ * \param fd pipe
  * \param size is the total size of the string
+ * \param s incoming string
  * \retval number of commands executed
  */
 int ast_cli_command_multiple(int fd, size_t size, const char *s);
 
 /*! \brief Registers a command or an array of commands
- * \param e which cli entry to register
+ * \param e which cli entry to register.
  * Register your own command
  * \retval 0 on success
  * \retval -1 on failure
@@ -252,7 +256,7 @@
  * \brief Unregisters a command or an array of commands
  * \param e which cli entry to unregister
  * Unregister your own command.  You must pass a completed ast_cli_entry structure
- * \return 0.
+ * \return 0
  */
 int ast_cli_unregister(struct ast_cli_entry *e);
 
@@ -280,14 +284,14 @@
  *
  * The first entry (offset 0) of the result is the longest common substring
  * in the results, useful to extend the string that has been completed.
- * Subsequent entries are all possible values, followe by a NULL.
+ * Subsequent entries are all possible values, followed by a NULL.
  * All strings and the array itself are malloc'ed and must be freed
  * by the caller.
  */
 char **ast_cli_completion_matches(const char *, const char *);
 
 /*!
- * \brief Command completion for the list of active channels
+ * \brief Command completion for the list of active channels.
  *
  * This can be called from a CLI command completion function that wants to
  * complete from the list of active channels.  'rpos' is the required

Modified: team/russell/events/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/config.h?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/include/asterisk/config.h (original)
+++ team/russell/events/include/asterisk/config.h Mon Nov 12 21:47:31 2007
@@ -113,7 +113,7 @@
 /*! \brief Goes through categories 
  * \param config Which config structure you wish to "browse"
  * \param prev A pointer to a previous category.
- * This funtion is kind of non-intuitive in it's use.  To begin, one passes NULL as the second arguement.  It will return a pointer to the string of the first category in the file.  From here on after, one must then pass the previous usage's return value as the second pointer, and it will return a pointer to the category name afterwards.
+ * This function is kind of non-intuitive in it's use.  To begin, one passes NULL as the second argument.  It will return a pointer to the string of the first category in the file.  From here on after, one must then pass the previous usage's return value as the second pointer, and it will return a pointer to the category name afterwards.
  *
  * \retval a category on success
  * \retval NULL on failure/no-more-categories

Modified: team/russell/events/include/asterisk/hashtab.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/hashtab.h?view=diff&rev=89214&r1=89213&r2=89214
==============================================================================
--- team/russell/events/include/asterisk/hashtab.h (original)
+++ team/russell/events/include/asterisk/hashtab.h Mon Nov 12 21:47:31 2007
@@ -19,9 +19,10 @@
 #define _ASTERISK_HASHTAB_H_
 #define __USE_UNIX98 1          /* to get the MUTEX_RECURSIVE stuff */
 
-/* generic (perhaps overly so) hashtable implementation */
-
-/* notes:
+/*! \file
+ * \brief Generic (perhaps overly so) hashtable implementation
+*/
+/*! \note
 
 A hash table is a structure that allows for an exact-match search
 in O(1) (or close to that) time.
@@ -67,35 +68,36 @@
 
 struct ast_hashtab_bucket
 {
-	const void *object;                    /* whatever it is we are storing in this table */
-	struct ast_hashtab_bucket *next;       /* a DLL of buckets in hash collision */
-	struct ast_hashtab_bucket *prev;       /* a DLL of buckets in hash collision */
-	struct ast_hashtab_bucket *tnext;      /* a DLL of all the hash buckets for traversal */
-	struct ast_hashtab_bucket *tprev;      /* a DLL of all the hash buckets for traversal */
+	const void *object;                    /*!< whatever it is we are storing in this table */
+	struct ast_hashtab_bucket *next;       /*!< a DLL of buckets in hash collision */
+	struct ast_hashtab_bucket *prev;       /*!< a DLL of buckets in hash collision */
+	struct ast_hashtab_bucket *tnext;      /*!< a DLL of all the hash buckets for traversal */
+	struct ast_hashtab_bucket *tprev;      /*!< a DLL of all the hash buckets for traversal */
 };
 
 struct ast_hashtab
 {
 	struct ast_hashtab_bucket **array;
-	struct ast_hashtab_bucket *tlist; /* the head of a DLList of all the hashbuckets in the table (for traversal). */
+	struct ast_hashtab_bucket *tlist;		/*!< the head of a DLList of all the hashbuckets in the table (for traversal). */
 	
-	int (*compare) (const void *a, const void *b);            /* a ptr to func that returns int, and take two void* ptrs, compares them, 
+	int (*compare) (const void *a, const void *b);	/*!< a ptr to func that returns int, and take two void* ptrs, compares them, 
 													 rets -1 if a < b; rets 0 if a==b; rets 1 if a>b */
-	int (*newsize) (struct ast_hashtab *tab);     /* a ptr to func that returns int, a new size for hash tab, based on curr_size */
-	int (*resize) (struct ast_hashtab *tab);      /* a function to decide whether this hashtable should be resized now */
-	unsigned int (*hash) (const void *obj);         /* a hash func ptr for this table. Given a raw ptr to an obj, 
+	int (*newsize) (struct ast_hashtab *tab);	/*!< a ptr to func that returns int, a new size for hash tab, based on curr_size */
+	int (*resize) (struct ast_hashtab *tab);	/*!< a function to decide whether this hashtable should be resized now */
+	unsigned int (*hash) (const void *obj);         /*!< a hash func ptr for this table. Given a raw ptr to an obj, 
 													 it calcs a hash.*/
-	int hash_tab_size;                            /* the size of the bucket array */
-	int hash_tab_elements;                        /* the number of objects currently stored in the table */
-	int largest_bucket_size;                      /* a stat on the health of the table */
-	int resize_count;                             /* a count of the number of times this table has been
+	int hash_tab_size;                            /*!< the size of the bucket array */
+	int hash_tab_elements;                        /*!< the number of objects currently stored in the table */
+	int largest_bucket_size;                      /*!< a stat on the health of the table */
+	int resize_count;                             /*!< a count of the number of times this table has been
 													 resized */
-	int do_locking;                               /* if 1, use locks to guarantee safety of insertions/deletions */
+	int do_locking;                               /*!< if 1 use locks to guarantee safety of insertions/deletions */
 	/* this spot reserved for the proper lock storage */
 	ast_rwlock_t lock;                                /* is this as good as it sounds? */
 };
 
-struct ast_hashtab_iter              /* an iterator for traversing the buckets */
+/*! \brief an iterator for traversing the buckets */
+struct ast_hashtab_iter
 {
 	struct ast_hashtab *tab;
 	struct ast_hashtab_bucket *next;
@@ -104,42 +106,67 @@
 
 /* some standard, default routines for general use */
 
-int isPrime(int num); /* this one is handy for sizing the hash table, tells if num is prime or not */
-
-int ast_hashtab_compare_strings(const void *a, const void *b); /* assumes a and b are char * and returns 0 if they match */
-
-
-int ast_hashtab_compare_strings_nocase(const void *a, const void *b); /* assumes a & b are strings, returns 0 if they match (strcasecmp) */
-
-
-int ast_hashtab_compare_ints(const void *a, const void *b);  /* assumes a & b are int *, returns a != b */
-
-
-int ast_hashtab_compare_shorts(const void *a, const void *b);  /* assumes a & b are short *, returns a != b */
-
-
-int ast_hashtab_resize_java(struct ast_hashtab *tab); /* returns 1 if the table is 75% full or more */
-
-
-int ast_hashtab_resize_tight(struct ast_hashtab *tab); /* not yet specified; probably will return 1 if table is 100% full */
-
-
-int ast_hashtab_resize_none(struct ast_hashtab *tab); /* no resizing; always return 0 */
-
-
-int ast_hashtab_newsize_java(struct ast_hashtab *tab);  /* returns a prime number roughly 2x the current table size */
-
-
-int ast_hashtab_newsize_tight(struct ast_hashtab *tab); /* not yet specified, probably will return 1.5x the current table size */
-
-
-int ast_hashtab_newsize_none(struct ast_hashtab *tab); /* always return current size -- no resizing */
-
-
-unsigned int ast_hashtab_hash_string(const void *obj); /* hashes a string to a number, mod is applied so it in the range 0 to mod-1 */
-
-
-unsigned int ast_hashtab_hash_string_nocase(const void *obj);  /* upcases each char before using them for a hash */
+/*! \brief For sizing the hash table, tells if num is prime or not */
+int isPrime(int num);
+
+/*! 
+ * \brief assumes a and b are char * 
+ * \return 0 if they match 
+*/
+int ast_hashtab_compare_strings(const void *a, const void *b);
+
+/*!
+ * \brief assumes a & b are strings
+ * \return 0 if they match (strcasecmp) 
+*/
+int ast_hashtab_compare_strings_nocase(const void *a, const void *b);
+
+/*!
+ * \brief assumes a & b are int *
+ * \retval 0 if match
+ * \retval 1 a > b
+ * \retval -1 a < b
+*/
+int ast_hashtab_compare_ints(const void *a, const void *b);
+
+/*!
+ * \brief assumes a & b are short *
+ * \retval 0 if match
+ * \retval 1 a > b
+ * \retval -1 a < b
+*/
+int ast_hashtab_compare_shorts(const void *a, const void *b);
+
+/*!
+ * \brief determine if resize should occur
+ * \returns 1 if the table is 75% full or more
+*/
+int ast_hashtab_resize_java(struct ast_hashtab *tab);
+
+/*! \brief no resizing; always return 0 */
+int ast_hashtab_resize_tight(struct ast_hashtab *tab);
+
+/*! \brief no resizing; always return 0 */
+int ast_hashtab_resize_none(struct ast_hashtab *tab);
+
+/*! \brief Create a prime number roughly 2x the current table size */
+int ast_hashtab_newsize_java(struct ast_hashtab *tab);
+
+/* not yet specified, probably will return 1.5x the current table size */
+int ast_hashtab_newsize_tight(struct ast_hashtab *tab);
+
+/*! \brief always return current size -- no resizing */
+int ast_hashtab_newsize_none(struct ast_hashtab *tab);
+
+/*! 
+ * \brief Hashes a string to a number
+ * \param obj
+ * \note A modulus is applied so it in the range 0 to mod-1 
+*/
+unsigned int ast_hashtab_hash_string(const void *obj);
+
+/*! \brief Upperases each char before using them for a hash */
+unsigned int ast_hashtab_hash_string_nocase(const void *obj);
 
 
 unsigned int ast_hashtab_hash_string_sax(const void *obj); /* from Josh */
@@ -151,94 +178,127 @@
 unsigned int ast_hashtab_hash_short(const short num);
 
 
+/*!
+ * \brief Create the hashtable list
+ * \param initial_buckets starting number of buckets
+ * \param compare a func ptr to compare two elements in the hash -- cannot be null 
+ * \param resize a func ptr to decide if the table needs to be resized, a NULL ptr here will cause a default to be used
+ * \param newsize a func ptr that returns a new size of the array. A NULL will cause a default to be used
+ * \param hash a func ptr to do the hashing
+ * \param do_locking use locks to guarantee safety of iterators/insertion/deletion -- real simpleminded right now
+*/
 struct ast_hashtab * ast_hashtab_create(int initial_buckets,
-					int (*compare)(const void *a, const void *b),        /* a func to compare two elements in the hash -- cannot be null  */
-					int (*resize)(struct ast_hashtab *),     /* a func to decide if the table needs to be resized, 
-										a NULL ptr here will cause a default to be used */
-					int (*newsize)(struct ast_hashtab *tab), /* a ptr to func that returns a new size of the array. 
-										A NULL will cause a default to be used */
-					unsigned int (*hash)(const void *obj),     /* a func to do the hashing */
-					int do_locking );                        /* use locks to guarantee safety of iterators/insertion/deletion */
-
-
-	/* this func will free the hash table and all its memory. It
-	   doesn't touch the objects stored in it */
+					int (*compare)(const void *a, const void *b), 
+					int (*resize)(struct ast_hashtab *),	
+					int (*newsize)(struct ast_hashtab *tab),
+					unsigned int (*hash)(const void *obj), 
+					int do_locking );
+
+/*!
+ * \brief This func will free the hash table and all its memory. 
+ * \note It doesn't touch the objects stored in it
+ * \param tab
+ * \param objdestroyfunc
+*/
 void ast_hashtab_destroy( struct ast_hashtab *tab, void (*objdestroyfunc)(void *obj));
 
 
-	/* normally, you'd insert "safely" by checking to see if the element is
-	   already there; in this case, you must already have checked. If an element
-	   is already in the hashtable, that matches this one, most likely this one
-	   will be found first. */
-	/* will force a resize if the resize func returns 1 */
-	/* returns 1 on success, 0 if there's a problem */
+/*!
+ * \brief Insert without checking 
+ * \param tab
+ * \param obj
+ *
+ * Normally, you'd insert "safely" by checking to see if the element is
+ * already there; in this case, you must already have checked. If an element
+ * is already in the hashtable, that matches this one, most likely this one
+ * will be found first. 
+ * \note will force a resize if the resize func returns 1
+ * \retval 1 on success
+ * \retval 0 if there's a problem
+*/
 int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj);
 
-	/* same as the above, but h is the hash index; won't hash to find the index */
-int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, int h);
-
-
-	/* check to see if the element is already there; insert only if
-	   it is not there.*/
-	/* will force a resize if the resize func returns 1 */
-	/* returns 1 on success, 0 if there's a problem, or it's already there. */
+/*!
+ * \brief Insert without checking, hashing or locking
+ * \param tab
+ * \param obj
+ * \param h hashed index value
+ * 
+ * \note Will force a resize if the resize func returns 1
+ * \retval 1 on success
+ * \retval 0 if there's a problem
+*/
+int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h);
+
+/*!
+ * \brief Check and insert new object only if it is not there.
+ * \note Will force a resize if the resize func returns 1
+ * \retval 1 on success
+ * \retval  0 if there's a problem, or it's already there. 
+*/
 int ast_hashtab_insert_safe(struct ast_hashtab *tab, const void *obj);
 
-
-	/* lookup this object in the hash table. return a ptr if found, or NULL if not */
+/*!
+ * \brief Lookup this object in the hash table. 
+ * \param tab 
+ * \param obj 
+ * \retval a ptr if found
+ * \retval NULL if not found
+*/
 void * ast_hashtab_lookup(struct ast_hashtab *tab, const void *obj);
 
-    /* if you know the hash val for the object, then use this and avoid the recalc

[... 500 lines stripped ...]



More information about the svn-commits mailing list