[asterisk-commits] russell: branch russell/fxo_mwi r90948 - in /team/russell/fxo_mwi: ./ apps/ c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 4 13:04:02 CST 2007


Author: russell
Date: Tue Dec  4 13:04:01 2007
New Revision: 90948

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

Added:
    team/russell/fxo_mwi/include/asterisk/global_datastores.h
      - copied unchanged from r90930, trunk/include/asterisk/global_datastores.h
    team/russell/fxo_mwi/main/global_datastores.c
      - copied unchanged from r90930, trunk/main/global_datastores.c
Modified:
    team/russell/fxo_mwi/   (props changed)
    team/russell/fxo_mwi/CHANGES
    team/russell/fxo_mwi/Makefile
    team/russell/fxo_mwi/apps/app_dial.c
    team/russell/fxo_mwi/apps/app_queue.c
    team/russell/fxo_mwi/apps/app_voicemail.c
    team/russell/fxo_mwi/channels/chan_local.c
    team/russell/fxo_mwi/channels/chan_zap.c
    team/russell/fxo_mwi/include/asterisk/channel.h
    team/russell/fxo_mwi/include/asterisk/compat.h
    team/russell/fxo_mwi/main/Makefile
    team/russell/fxo_mwi/main/channel.c
    team/russell/fxo_mwi/main/pbx.c
    team/russell/fxo_mwi/res/Makefile
    team/russell/fxo_mwi/res/res_agi.c

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

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

Propchange: team/russell/fxo_mwi/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Dec  4 13:04:01 2007
@@ -1,1 +1,1 @@
-/trunk:1-90748
+/trunk:1-90947

Modified: team/russell/fxo_mwi/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/CHANGES?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/CHANGES (original)
+++ team/russell/fxo_mwi/CHANGES Tue Dec  4 13:04:01 2007
@@ -48,6 +48,7 @@
 
 CLI Changes
 -----------
+  * New CLI command "core show hint" (usage: core show hint <exten>)
   * New CLI command "core show settings"
   * Added 'core show channels count' CLI command.
   * Added the ability to set the core debug and verbose values on a per-file basis.
@@ -157,6 +158,8 @@
 
 Queue changes
 -------------
+  * Added the general option 'shared_lastcall' so that member's wrapuptime may be
+     used across multiple queues.
   * Added QUEUE_VARIABLES function to set queue variables added setqueuevar and 
      setqueueentryvar options for each queue, see queues.conf.sample for details.
   * Added keepstats option to queues.conf which will keep queue

Modified: team/russell/fxo_mwi/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/Makefile?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/Makefile (original)
+++ team/russell/fxo_mwi/Makefile Tue Dec  4 13:04:01 2007
@@ -774,7 +774,8 @@
 	@echo "Generating input for menuselect ..."
 	@build_tools/prep_moduledeps > $@
 
+pdf: asterisk.pdf
 asterisk.pdf:
 	$(MAKE) -C doc/tex asterisk.pdf
 
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts
+.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts

Modified: team/russell/fxo_mwi/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/apps/app_dial.c?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/apps/app_dial.c (original)
+++ team/russell/fxo_mwi/apps/app_dial.c Tue Dec  4 13:04:01 2007
@@ -54,6 +54,7 @@
 #include "asterisk/manager.h"
 #include "asterisk/privacy.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/global_datastores.h"
 
 static char *app = "Dial";
 
@@ -326,7 +327,6 @@
 	struct chanlist *next;
 	struct ast_channel *chan;
 	uint64_t flags;
-	int forwards;
 };
 
 
@@ -346,8 +346,6 @@
 		ast_free(oo);
 	}
 }
-
-#define AST_MAX_FORWARDS   8
 
 #define AST_MAX_WATCHERS 256
 
@@ -480,28 +478,22 @@
 		tech = "Local";
 	}
 	/* Before processing channel, go ahead and check for forwarding */
-	o->forwards++;
-	if (o->forwards < AST_MAX_FORWARDS) {
-		ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name);
-		/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
-		if (ast_test_flag64(peerflags, OPT_IGNORE_FORWARDING)) {
-			ast_verb(3, "Forwarding %s to '%s/%s' prevented.\n", in->name, tech, stuff);
-			c = o->chan = NULL;
-			cause = AST_CAUSE_BUSY;
-		} else {
-			/* Setup parameters */
-			c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
-			if (c) {
-				if (single)
-					ast_channel_make_compatible(o->chan, in);
-				ast_channel_inherit_variables(in, o->chan);
-			} else
-				ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
-		}
+	ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name);
+	/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
+	if (ast_test_flag64(peerflags, OPT_IGNORE_FORWARDING)) {
+		ast_verb(3, "Forwarding %s to '%s/%s' prevented.\n", in->name, tech, stuff);
+		c = o->chan = NULL;
+		cause = AST_CAUSE_BUSY;
 	} else {
-		ast_verb(3, "Too many forwards from %s\n", c->name);
-		cause = AST_CAUSE_CONGESTION;
-		c = o->chan = NULL;
+		/* Setup parameters */
+		c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
+		if (c) {
+			if (single)
+				ast_channel_make_compatible(o->chan, in);
+			ast_channel_inherit_variables(in, o->chan);
+			ast_channel_datastore_inherit(in, o->chan);
+		} else
+			ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
 	}
 	if (!c) {
 		ast_clear_flag64(o, DIAL_STILLGOING);	
@@ -1252,6 +1244,8 @@
 	);
 	struct ast_flags64 opts = { 0, };
 	char *opt_args[OPT_ARG_ARRAY_SIZE];
+	struct ast_datastore *datastore = NULL;
+	int fulldial = 0, num_dialed = 0;
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
@@ -1333,7 +1327,13 @@
 		struct ast_channel *tc;	/* channel for this destination */
 		/* Get a technology/[device:]number pair */
 		char *number = cur;
+		char *interface = ast_strdupa(number);
 		char *tech = strsep(&number, "/");
+		/* find if we already dialed this interface */
+		int dialed = 0;
+		struct ast_dialed_interface *di;
+		AST_LIST_HEAD(, ast_dialed_interface) *dialed_interfaces;
+		num_dialed++;
 		if (!number) {
 			ast_log(LOG_WARNING, "Dial argument takes format (technology/[device:]number1)\n");
 			goto out;
@@ -1353,6 +1353,50 @@
 		}
 		ast_copy_string(numsubst, number, sizeof(numsubst));
 		/* Request the peer */
+		if (!(datastore = ast_channel_datastore_find(chan, &dialed_interface_info, NULL))) {
+			if(!(datastore = ast_channel_datastore_alloc(&dialed_interface_info, NULL))) {
+				ast_log(LOG_WARNING, "Unable to create channel datastore for dialed interfaces. Aborting!\n"); 
+				free(tmp);
+				goto out;
+			}
+			else {
+				datastore->inheritance = DATASTORE_INHERIT_FOREVER;
+				if((dialed_interfaces = ast_calloc(1, sizeof(*dialed_interfaces)))) {
+					datastore->data = dialed_interfaces;
+					AST_LIST_HEAD_INIT(dialed_interfaces);
+					ast_channel_datastore_add(chan, datastore);
+				} else {
+					free(tmp);
+					goto out;
+				}
+			}
+		} else 
+			dialed_interfaces = datastore->data;
+		AST_LIST_LOCK(dialed_interfaces);
+		AST_LIST_TRAVERSE(dialed_interfaces, di, list) {
+			/* XXX case sensitive??? */
+			if(!strcasecmp(di->interface, interface)) {
+				dialed = 1;
+				break;
+			}
+		}
+		if(!dialed && strcasecmp(tech, "Local")) {
+			if(!(di = ast_calloc(1, sizeof(*di) + strlen(interface)))) {
+				AST_LIST_UNLOCK(dialed_interfaces);
+				free(tmp);
+				goto out;
+			}
+			strcpy(di->interface, interface);
+			AST_LIST_INSERT_TAIL(dialed_interfaces, di, list);
+		} else {
+			AST_LIST_UNLOCK(dialed_interfaces);
+			ast_log(LOG_WARNING, "Skipping dialing interface '%s' again since it has already been dialed\n", di->interface);
+			fulldial++;
+			free(tmp);
+			continue;
+		}
+		AST_LIST_UNLOCK(dialed_interfaces);
+
 		tc = ast_request(tech, chan->nativeformats, numsubst, &cause);
 		if (!tc) {
 			/* If we can't, just go on to the next call */
@@ -1365,50 +1409,6 @@
 			continue;
 		}
 		pbx_builtin_setvar_helper(tc, "DIALEDPEERNUMBER", numsubst);
-		if (!ast_strlen_zero(tc->call_forward)) {
-			char tmpchan[256];
-			char *stuff;
-			char *tech;
-			ast_copy_string(tmpchan, tc->call_forward, sizeof(tmpchan));
-			if ((stuff = strchr(tmpchan, '/'))) {
-				*stuff++ = '\0';
-				tech = tmpchan;
-			} else {
-				snprintf(tmpchan, sizeof(tmpchan), "%s@%s", tc->call_forward, tc->context);
-				stuff = tmpchan;
-				tech = "Local";
-			}
-			tmp->forwards++;
-			if (tmp->forwards < AST_MAX_FORWARDS) {
-				ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n",
-					chan->name, tech, stuff, tc->name);
-				ast_hangup(tc);
-				/* If we have been told to ignore forwards, just set this channel to null
-				 * and continue processing extensions normally */
-				if (ast_test_flag64(&opts, OPT_IGNORE_FORWARDING)) {
-					tc = NULL;
-					cause = AST_CAUSE_BUSY;
-					ast_verb(3, "Forwarding %s to '%s/%s' prevented.\n",
-							chan->name, tech, stuff);
-				} else {
-					tc = ast_request(tech, chan->nativeformats, stuff, &cause);
-				}
-				if (!tc)
-					ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s' (cause = %d)\n", tech, stuff, cause);
-				else
-					ast_channel_inherit_variables(chan, tc);
-			} else {
-				ast_verb(3, "Too many forwards from %s\n", tc->name);
-				ast_hangup(tc);
-				tc = NULL;
-				cause = AST_CAUSE_CONGESTION;
-			}
-			if (!tc) {
-				handle_cause(cause, &num);
-				ast_free(tmp);
-				continue;
-			}
-		}
 
 		/* Setup outgoing SDP to match incoming one */
 		ast_rtp_make_compatible(tc, chan, !outgoing && !rest);
@@ -1498,6 +1498,10 @@
 
 	if (!outgoing) {
 		strcpy(pa.status, "CHANUNAVAIL");
+		if(fulldial == num_dialed) {
+			res = -1;
+			goto out;
+		}
 	} else {
 		/* Our status will at least be NOANSWER */
 		strcpy(pa.status, "NOANSWER");
@@ -1520,7 +1524,9 @@
 
 	time(&start_time);
 	peer = wait_for_answer(chan, outgoing, &to, peerflags, &pa, &num, &result);
-	
+
+	ast_channel_datastore_remove(chan, datastore);
+	ast_channel_datastore_free(datastore);
 	if (!peer) {
 		if (result) {
 			res = result;

Modified: team/russell/fxo_mwi/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/apps/app_queue.c?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/apps/app_queue.c (original)
+++ team/russell/fxo_mwi/apps/app_queue.c Tue Dec  4 13:04:01 2007
@@ -87,6 +87,7 @@
 #include "asterisk/event.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/strings.h"
+#include "asterisk/global_datastores.h"
 
 enum {
 	QUEUE_STRATEGY_RINGALL = 0,
@@ -729,15 +730,15 @@
 
 		handle_statechange(sc);
 
-		free(sc);
+		ast_free(sc);
 		sc = NULL;
 	}
 
 	if (sc)
-		free(sc);
+		ast_free(sc);
 
 	while ((sc = AST_LIST_REMOVE_HEAD(&device_state.state_change_q, entry)))
-		free(sc);
+		ast_free(sc);
 
 	return NULL;
 }
@@ -2295,6 +2296,7 @@
 						numnochan++;
 					} else {
 						ast_channel_inherit_variables(in, o->chan);
+						ast_channel_datastore_inherit(in, o->chan);
 						if (o->chan->cid.cid_num)
 							ast_free(o->chan->cid.cid_num);
 						o->chan->cid.cid_num = ast_strdup(in->cid.cid_num);
@@ -2733,6 +2735,7 @@
 	int forwardsallowed = 1;
 	int callcompletedinsl;
 	struct ao2_iterator memi;
+	struct ast_datastore *datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL);
 
 	memset(&bridge_config, 0, sizeof(bridge_config));
 	tmpid[0] = 0;
@@ -2802,7 +2805,9 @@
 	memi = ao2_iterator_init(qe->parent->members, 0);
 	while ((cur = ao2_iterator_next(&memi))) {
 		struct callattempt *tmp = ast_calloc(1, sizeof(*tmp));
-
+		struct ast_dialed_interface *di;
+		int dialed = 0;
+		AST_LIST_HEAD(, ast_dialed_interface) *dialed_interfaces;
 		if (!tmp) {
 			ao2_ref(cur, -1);
 			ao2_unlock(qe->parent);
@@ -2810,6 +2815,49 @@
 				ao2_unlock(queues);
 			goto out;
 		}
+		if (!datastore) {
+			if(!(datastore = ast_channel_datastore_alloc(&dialed_interface_info, NULL))) {
+				ao2_ref(cur, -1);
+				ao2_unlock(qe->parent);
+				if(use_weight)
+					ao2_unlock(queues);
+				free(tmp);
+				goto out;
+			}
+			datastore->inheritance = DATASTORE_INHERIT_FOREVER;
+			dialed_interfaces = ast_calloc(1, sizeof(*dialed_interfaces));
+			datastore->data = dialed_interfaces;
+			AST_LIST_HEAD_INIT(dialed_interfaces);
+			ast_channel_datastore_add(qe->chan, datastore);
+		} else
+			dialed_interfaces = datastore->data;
+		AST_LIST_LOCK(dialed_interfaces);
+		AST_LIST_TRAVERSE(dialed_interfaces, di, list) {
+			/* XXX case sensitive ?? */
+			if(!strcasecmp(cur->interface, di->interface)) {
+				dialed = 1;
+				break;
+			}
+		}
+		if (!dialed && strncasecmp(cur->interface, "Local/", 6)) {
+			if(!(di = ast_calloc(1, sizeof(*di) + strlen(cur->interface)))) {
+				ao2_ref(cur, -1);
+				AST_LIST_UNLOCK(dialed_interfaces);
+				ao2_unlock(qe->parent);
+				if(use_weight)
+					ao2_unlock(queues);
+				free(tmp);
+				goto out;
+			}
+			strcpy(di->interface, cur->interface);
+			AST_LIST_INSERT_TAIL(dialed_interfaces, di, list);
+		} else {
+			AST_LIST_UNLOCK(dialed_interfaces);
+			ast_log(LOG_DEBUG, "Skipping dialing interface '%s' since it has already been dialed\n", di->interface);
+			free(tmp);
+			continue;
+		}
+		AST_LIST_UNLOCK(dialed_interfaces);
 		tmp->stillgoing = -1;
 		tmp->member = cur;
 		tmp->oldstatus = cur->status;
@@ -2829,7 +2877,7 @@
 				break;
 		} else {
 			ao2_ref(cur, -1);
-			free(tmp);
+			ast_free(tmp);
 		}
 	}
 	if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout))
@@ -2842,6 +2890,8 @@
 	if (use_weight)
 		ao2_unlock(queues);
 	lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed);
+	ast_channel_datastore_remove(qe->chan, datastore);
+	ast_channel_datastore_free(datastore);
 	ao2_lock(qe->parent);
 	if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY) {
 		store_next_rr(qe, outgoing);

Modified: team/russell/fxo_mwi/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/apps/app_voicemail.c?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/apps/app_voicemail.c (original)
+++ team/russell/fxo_mwi/apps/app_voicemail.c Tue Dec  4 13:04:01 2007
@@ -148,7 +148,7 @@
 static void update_messages_by_imapuser(const char *user, unsigned long number);
 
 static int imap_remove_file (char *dir, int msgnum);
-static int imap_retrieve_file (char *dir, int msgnum, char *mailbox, char *context);
+static int imap_retrieve_file (char *dir, int msgnum, const char *mailbox, char *context);
 static int imap_delete_old_greeting (char *dir, struct vm_state *vms);
 struct vmstate {
 	struct vm_state *vms;

Modified: team/russell/fxo_mwi/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/channels/chan_local.c?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/channels/chan_local.c (original)
+++ team/russell/fxo_mwi/channels/chan_local.c Tue Dec  4 13:04:01 2007
@@ -473,6 +473,7 @@
 			AST_LIST_INSERT_TAIL(&p->chan->varshead, new, entries);
 		}
 	}
+	ast_channel_datastore_inherit(p->owner, p->chan);
 
 	/* Start switch on sub channel */
 	if (!(res = ast_pbx_start(p->chan)))

Modified: team/russell/fxo_mwi/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/channels/chan_zap.c?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/channels/chan_zap.c (original)
+++ team/russell/fxo_mwi/channels/chan_zap.c Tue Dec  4 13:04:01 2007
@@ -5855,7 +5855,10 @@
 	tmp->cid.cid_pres = i->callingpres;
 	tmp->cid.cid_ton = i->cid_ton;
 	tmp->cid.cid_ani2 = i->cid_ani2;
-#if defined(HAVE_PRI) || defined(HAVE_SS7)
+/* TODO: enable this code for HAVE_SS7 when PRI_TRANS_CAP_DIGITAL gets renamed
+   and doesn't come from libpri.h any longer
+*/
+#if defined(HAVE_PRI)
 	tmp->transfercapability = transfercapability;
 	pbx_builtin_setvar_helper(tmp, "TRANSFERCAPABILITY", ast_transfercapability2str(transfercapability));
 	if (transfercapability & PRI_TRANS_CAP_DIGITAL)
@@ -8657,8 +8660,14 @@
 	return tmp;
 }
 
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
+static int zt_setlaw(int zfd, int law)
+{
+	return ioctl(zfd, ZT_SETLAW, &law);
+}
+#endif
+
 #ifdef HAVE_SS7
-static int zt_setlaw(int zfd, int law);
 
 static int ss7_find_cic(struct zt_ss7 *linkset, int cic)
 {
@@ -9675,14 +9684,6 @@
 	}
 }
 
-static int zt_setlaw(int zfd, int law)
-{
-	int res;
-	res = ioctl(zfd, ZT_SETLAW, &law);
-	if (res)
-		return res;
-	return 0;
-}
 
 static void *pri_dchannel(void *vpri)
 {
@@ -11876,9 +11877,11 @@
 {
 	int x;
 	struct zt_pvt *p, *pl;
-
-#ifdef HAVE_PRI
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
 	int i;
+#endif
+
+#if defined(HAVE_PRI)
 	for (i = 0; i < NUM_SPANS; i++) {
 		if (pris[i].master != AST_PTHREADT_NULL) 
 			pthread_cancel(pris[i].master);
@@ -11886,6 +11889,7 @@
 	ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(struct ast_cli_entry));
 	ast_unregister_application(zap_send_keypad_facility_app);
 #endif
+
 	ast_cli_unregister_multiple(zap_cli, sizeof(zap_cli) / sizeof(struct ast_cli_entry));
 	ast_manager_unregister( "ZapDialOffhook" );
 	ast_manager_unregister( "ZapHangup" );
@@ -11934,20 +11938,23 @@
 	iflist = NULL;
 	ifcount = 0;
 	ast_mutex_unlock(&iflock);
-#ifdef HAVE_PRI		
+
+#if defined(HAVE_PRI)
 	for (i = 0; i < NUM_SPANS; i++) {
 		if (pris[i].master && (pris[i].master != AST_PTHREADT_NULL))
 			pthread_join(pris[i].master, NULL);
 		zt_close(pris[i].fds[i]);
 	}
-#endif
-#ifdef HAVE_SS7
+#endif /* HAVE_PRI */
+
+#if defined(HAVE_SS7)
 	for (i = 0; i < NUM_SPANS; i++) {
 		if (linksets[i].master && (linksets[i].master != AST_PTHREADT_NULL))
 			pthread_join(linksets[i].master, NULL);
 		zt_close(linksets[i].fds[i]);
 	}
 #endif /* HAVE_SS7 */
+
 	return 0;
 }
 

Modified: team/russell/fxo_mwi/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/include/asterisk/channel.h?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/include/asterisk/channel.h (original)
+++ team/russell/fxo_mwi/include/asterisk/channel.h Tue Dec  4 13:04:01 2007
@@ -649,6 +649,7 @@
  * \retval 0 success
  * \retval non-zero failure
  */
+
 int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore);
 
 /*! 

Modified: team/russell/fxo_mwi/include/asterisk/compat.h
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/include/asterisk/compat.h?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/include/asterisk/compat.h (original)
+++ team/russell/fxo_mwi/include/asterisk/compat.h Tue Dec  4 13:04:01 2007
@@ -138,6 +138,7 @@
 #include <sys/stat.h>
 #include <signal.h>
 #include <netinet/in.h>
+#include <sys/loadavg.h>
 #include <dat/dat_platform_specific.h>
 
 #ifndef BYTE_ORDER

Modified: team/russell/fxo_mwi/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/main/Makefile?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/main/Makefile (original)
+++ team/russell/fxo_mwi/main/Makefile Tue Dec  4 13:04:01 2007
@@ -27,7 +27,7 @@
 	netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
 	cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
 	strcompat.o threadstorage.o dial.o event.o adsistub.o audiohook.o \
-	astobj2.o hashtab.o
+	astobj2.o hashtab.o global_datastores.o
 
 # we need to link in the objects statically, not as a library, because
 # otherwise modules will not have them available if none of the static

Modified: team/russell/fxo_mwi/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/main/channel.c?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/main/channel.c (original)
+++ team/russell/fxo_mwi/main/channel.c Tue Dec  4 13:04:01 2007
@@ -673,6 +673,10 @@
 	if (needqueue) {
 		if (pipe(tmp->alertpipe)) {
 			ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe!\n");
+#ifdef HAVE_ZAPTEL
+			if (tmp->timingfd > -1)
+				close(tmp->timingfd);
+#endif
 			sched_context_destroy(tmp->sched);
 			ast_string_field_free_memory(tmp);
 			ast_free(tmp);

Modified: team/russell/fxo_mwi/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/main/pbx.c?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/main/pbx.c (original)
+++ team/russell/fxo_mwi/main/pbx.c Tue Dec  4 13:04:01 2007
@@ -4201,6 +4201,83 @@
 	return CLI_SUCCESS;
 }
 
+/*! \brief autocomplete for CLI command 'core show hint' */
+static char *complete_core_show_hint(const char *line, const char *word, int pos, int state)
+{
+	struct ast_hint *hint;
+	char *ret = NULL;
+	int which = 0;
+	int wordlen;
+
+	if (pos != 3)
+		return NULL;
+	
+	wordlen = strlen(word);
+
+	AST_RWLIST_RDLOCK(&hints);
+	/* walk through all hints */
+	AST_RWLIST_TRAVERSE(&hints, hint, list) {
+		if (!strncasecmp(word, ast_get_extension_name(hint->exten), wordlen) && ++which > state) {
+			ret = ast_strdup(ast_get_extension_name(hint->exten));
+			break;
+		}
+	}
+	AST_RWLIST_UNLOCK(&hints);
+
+        return ret;
+}
+
+/*! \brief  handle_show_hint: CLI support for listing registered dial plan hint */
+static char *handle_show_hint(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct ast_hint *hint;
+	int watchers;
+	int num = 0, extenlen;
+	struct ast_state_cb *watcher;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "core show hint";
+		e->usage =
+			"Usage: core show hint <exten>\n"
+			"       List registered hint\n";
+		return NULL;
+	case CLI_GENERATE:
+		return complete_core_show_hint(a->line, a->word, a->pos, a->n);
+	}
+
+	if (a->argc < 4)
+		return CLI_SHOWUSAGE;
+
+	AST_RWLIST_RDLOCK(&hints);
+	if (AST_RWLIST_EMPTY(&hints)) {
+		ast_cli(a->fd, "There are no registered dialplan hints\n");
+		AST_RWLIST_UNLOCK(&hints);
+		return CLI_SUCCESS;
+	}
+	extenlen = strlen(a->argv[3]);
+	AST_RWLIST_TRAVERSE(&hints, hint, list) {
+		if (!strncasecmp(ast_get_extension_name(hint->exten), a->argv[3], extenlen)) {
+			watchers = 0;
+			for (watcher = hint->callbacks; watcher; watcher = watcher->next)
+				watchers++;
+			ast_cli(a->fd, "   %20s@%-20.20s: %-20.20s  State:%-15.15s Watchers %2d\n",
+				ast_get_extension_name(hint->exten),
+				ast_get_context_name(ast_get_extension_context(hint->exten)),
+				ast_get_extension_app(hint->exten),
+				ast_extension_state2str(hint->laststate), watchers);
+			num++;
+		}
+	}
+	AST_RWLIST_UNLOCK(&hints);
+	if (!num)
+		ast_cli(a->fd, "No hints matching extension %s\n", a->argv[3]);
+	else
+		ast_cli(a->fd, "%d hint%s matching extension %s\n", num, (num!=1 ? "s":""), a->argv[3]);
+	return CLI_SUCCESS;
+}
+
+
 /*! \brief  handle_show_switches: CLI support for listing registered dial plan switches */
 static char *handle_show_switches(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
@@ -4929,6 +5006,7 @@
 	AST_CLI_DEFINE(handle_show_functions, "Shows registered dialplan functions"),
 	AST_CLI_DEFINE(handle_show_switches, "Show alternative switches"),
 	AST_CLI_DEFINE(handle_show_hints, "Show dialplan hints"),
+	AST_CLI_DEFINE(handle_show_hint, "Show dialplan hint"),
 	AST_CLI_DEFINE(handle_show_globals, "Show global dialplan variables"),
 	AST_CLI_DEFINE(handle_show_function, "Describe a specific dialplan function"),
 	AST_CLI_DEFINE(handle_show_application, "Describe a specific dialplan application"),

Modified: team/russell/fxo_mwi/res/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/res/Makefile?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/res/Makefile (original)
+++ team/russell/fxo_mwi/res/Makefile Tue Dec  4 13:04:01 2007
@@ -26,10 +26,13 @@
 include $(ASTTOPDIR)/Makefile.moddir_rules
 
 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
-  # order-only dependency: build res_monitor before res_features
+  # cygwin has some dependencies among res_ things.
+  # We use order-only dependencies, and then add the libraries as required.
   res_features.so: | res_monitor.so
-  # res_features uses some functions from res_monitor
   res_features.so_LIBS:= -lres_monitor.so
+  #
+  res_agi.so: | res_speech.so
+  res_agi.so_LIBS:= -lres_speech.so
 endif
 
 ael/ael_lex.o: ael/ael_lex.c ../include/asterisk/ael_structs.h ael/ael.tab.h

Modified: team/russell/fxo_mwi/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/russell/fxo_mwi/res/res_agi.c?view=diff&rev=90948&r1=90947&r2=90948
==============================================================================
--- team/russell/fxo_mwi/res/res_agi.c (original)
+++ team/russell/fxo_mwi/res/res_agi.c Tue Dec  4 13:04:01 2007
@@ -51,6 +51,7 @@
 #include "asterisk/lock.h"
 #include "asterisk/strings.h"
 #include "asterisk/agi.h"
+#include "asterisk/version.h"
 #include "asterisk/speech.h"
 
 #define MAX_ARGS 128
@@ -370,6 +371,7 @@
 	ast_agi_fdprintf(chan, fd, "agi_language: %s\n", chan->language);
 	ast_agi_fdprintf(chan, fd, "agi_type: %s\n", chan->tech->type);
 	ast_agi_fdprintf(chan, fd, "agi_uniqueid: %s\n", chan->uniqueid);
+	ast_agi_fdprintf(chan, fd, "agi_version: %s\n", ASTERISK_VERSION);
 
 	/* ANI/DNIS */
 	ast_agi_fdprintf(chan, fd, "agi_callerid: %s\n", S_OR(chan->cid.cid_num, "unknown"));




More information about the asterisk-commits mailing list