[asterisk-commits] seanbright: branch group/asterisk-cpp r168709 - in /team/group/asterisk-cpp: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 15 10:24:36 CST 2009


Author: seanbright
Date: Thu Jan 15 10:24:36 2009
New Revision: 168709

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168709
Log:
Merged revisions 168562,168575,168578-168579,168585,168588,168591,168594,168599,168601,168604,168609-168610,168613,168615,168619,168623,168626,168629,168636,168638-168639,168705 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r168562 | russell | 2009-01-13 14:22:13 -0500 (Tue, 13 Jan 2009) | 10 lines
  
  Merged revisions 168561 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r168561 | russell | 2009-01-13 13:13:05 -0600 (Tue, 13 Jan 2009) | 2 lines
  
  Revert unnecessary indications API change from rev 122314
  
  ........
................
  r168575 | mmichelson | 2009-01-13 16:18:13 -0500 (Tue, 13 Jan 2009) | 13 lines
  
  Allow specifying a port number in the user portion of a register => line in sip.conf
  
  With this commit, a register => line in sip.conf may contain a port number in the
  "user" section of the line. Please see CHANGES and sip.conf.sample for more
  details regarding this.
  
  (closes issue #14198)
  Reported by: Nick_Lewis
  Patches:
        chan_sip.c-domainport2.patch uploaded by Nick (license 657)
  Tested by: Nick_Lewis
................
  r168578 | twilson | 2009-01-13 17:22:34 -0500 (Tue, 13 Jan 2009) | 14 lines
  
  Merged revisions 168551 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r168551 | twilson | 2009-01-13 12:34:14 -0600 (Tue, 13 Jan 2009) | 7 lines
    
    Don't pass a value with a side effect to a macro
    
    (closes issue #14176)
    Reported by: paraeco
    Patches: 
          chan_sip.c.diff uploaded by paraeco (license 658)
  ........
................
  r168579 | mmichelson | 2009-01-13 17:30:59 -0500 (Tue, 13 Jan 2009) | 13 lines
  
  Clarify a message that app_queue prints and change to a debug-level message
  
  The "No one is answering..." verbose message contained 3 numbers that were not
  explained in any way to whoever was viewing the message. It is more helpful now
  since the message explains what the numbers mean. Also, the message has been
  downgraded to "DEBUG" level.
  
  (closes issue #14172)
  Reported by: caio1982
  Patches:
        queue_answering_debug.diff uploaded by caio1982 (license 22)
................
  r168585 | twilson | 2009-01-13 18:00:27 -0500 (Tue, 13 Jan 2009) | 8 lines
  
  Add option to hide console connect messages
  
  (closes issue #14222)
  Reported by: jamesgolovich
  Patches: 
        asterisk-hideconnect.diff.txt uploaded by jamesgolovich (license 176)
  Tested by: otherwiseguy
................
  r168588 | twilson | 2009-01-13 18:05:43 -0500 (Tue, 13 Jan 2009) | 5 lines
  
  Fully overwrite a same-named file when uploading
  
  (closes issue #14190)
  Reported by: timking
................
  r168591 | tilghman | 2009-01-13 18:57:46 -0500 (Tue, 13 Jan 2009) | 6 lines
  
  Janitor patch for chan_misdn (make channel variable access safe)
  (closes issue #12887)
   Reported by: pputman
   Patches: 
         chan_misdn_threadsafe.patch uploaded by pputman (license 81)
................
  r168594 | twilson | 2009-01-13 21:00:40 -0500 (Tue, 13 Jan 2009) | 27 lines
  
  Merged revisions 168593 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r168593 | twilson | 2009-01-13 19:27:18 -0600 (Tue, 13 Jan 2009) | 20 lines
    
    Don't overflow when paging more than 128 extensions
    
    The number of available slots for calls in app_page was hardcoded to 128.
    Proper bounds checking was not in place to enforce this limit, so if more than
    128 extensions were passed to the Page() app, Asterisk would crash.  This patch
    instead dynamically allocates memory for the ast_dial structures and removes
    the (non-functional) arbitrary limit.
    
    This issue would have special importance to anyone who is dynamically creating
    the argument passed to the Page application and allowing more than 128
    extensions to be added by an outside user via some external interface.
    
    The patch posted by a_villacis was slightly modified for some coding guidelines
    and other cleanups.  Thanks, a_villacis!
    (closes issue #14217)
    Reported by: a_villacis
    Patches: 
          20080912-asterisk-app_page-fix-buffer-overflow.patch uploaded by a (license 660)
    Tested by: otherwiseguy
  ........
................
  r168599 | mmichelson | 2009-01-14 11:20:37 -0500 (Wed, 14 Jan 2009) | 15 lines
  
  Blocked revisions 168598 via svnmerge
  
  ........
  r168598 | mmichelson | 2009-01-14 10:19:26 -0600 (Wed, 14 Jan 2009) | 8 lines
  
  Fix a logic error I found while searching through chan_agent.c
  
  I found that the allow_multiple_logins function would never return
  0 due to an incorrect comparison being used when traversing the
  list of agents. While I was modifying this function, I also did
  a little bit of coding guidelines cleanup, too.
  
  
  ........
................
  r168601 | tilghman | 2009-01-14 13:27:57 -0500 (Wed, 14 Jan 2009) | 2 lines
  
  Mostly spacing changes; no functionality change at all.
................
  r168604 | tilghman | 2009-01-14 14:11:14 -0500 (Wed, 14 Jan 2009) | 14 lines
  
  Merged revisions 168603 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r168603 | tilghman | 2009-01-14 13:02:55 -0600 (Wed, 14 Jan 2009) | 7 lines
    
    Don't read into a buffer without first checking if a value is beyond the end.
    (closes issue #13600)
     Reported by: atis
     Patches: 
           20090106__bug13600.diff.txt uploaded by Corydon76 (license 14)
     Tested by: atis
  ........
................
  r168609 | mvanbaak | 2009-01-14 14:36:57 -0500 (Wed, 14 Jan 2009) | 13 lines
  
  Fix compilation on FreeBSD and OSX
  
  This started as work to fix the 'core show sysinfo'
  CLI command but while working on it oej
  pointed out that read_credentials did not compile neither.
  So while being there, fix that as well.
  
  Thanks for all the testing oej!
  
  (closes issue #14129)
  Reported by: ys
  Tested by: oej, mvanbaak
................
  r168610 | mmichelson | 2009-01-14 15:13:48 -0500 (Wed, 14 Jan 2009) | 9 lines
  
  Restore the "sip show users" and "sip show user" CLI commands
  
  (closes issue #14180)
  Reported by: amorsen
  Patches:
        sip_show_users_161v3.diff uploaded by putnopvut (license 60)
  Tested by: blitzrage, amorsen
................
  r168613 | murf | 2009-01-14 15:51:26 -0500 (Wed, 14 Jan 2009) | 9 lines
  
  Merged revisions 168608 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r168608 | murf | 2009-01-14 12:34:35 -0700 (Wed, 14 Jan 2009) | 1 line
    
    app_page was failing to compile in dev-mode on my gcc-4.2.4 system. This change gets rid of the warning.
  ........
................
  r168615 | seanbright | 2009-01-14 15:58:26 -0500 (Wed, 14 Jan 2009) | 16 lines
  
  Merged revisions 168614 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r168614 | seanbright | 2009-01-14 15:52:00 -0500 (Wed, 14 Jan 2009) | 9 lines
    
    Update autosupport script to supply info for both Zaptel and DAHDI in 1.4 and
    be sure to run dahdi_test in 1.6.x and trunk instead of zttest.
    
    (closes issue #14132)
    Reported by: dsedivec
    Patches:
          asterisk-1.4-autosupport.patch uploaded by dsedivec (license 638)
          asterisk-trunk-autosupport.patch uploaded by dsedivec (license 638)
  ........
................
  r168619 | dbailey | 2009-01-14 16:19:45 -0500 (Wed, 14 Jan 2009) | 8 lines
  
  This fixes a problem where MWI FSK spills were being injected onto off hook fxs lines.
  (closes issue #14143)
  Reported by: alecdavis
  Patches:
        chan_dahdi-14143.patch.txt uploaded by dbailey (license )
  Tested by: alecdavis
................
  r168623 | rmudgett | 2009-01-14 16:51:06 -0500 (Wed, 14 Jan 2009) | 11 lines
  
  Merged revisions 168622 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r168622 | rmudgett | 2009-01-14 15:48:22 -0600 (Wed, 14 Jan 2009) | 4 lines
    
    *  Fixed create_process() allocation of process ID values.
    The allocated process IDs could overflow their respective
    NT and TE fields.  Affects outgoing calls.
  ........
................
  r168626 | seanbright | 2009-01-14 18:10:48 -0500 (Wed, 14 Jan 2009) | 7 lines
  
  Don't crash when typing 'core set verbose' or 'core set debug' by themselves.
  
  (closes issue #14219)
  Reported by: jamesgolovich
  Patches:
        asterisk-setverbosecrash.diff.txt uploaded by jamesgolovich (license 176)
................
  r168629 | mmichelson | 2009-01-14 19:14:17 -0500 (Wed, 14 Jan 2009) | 24 lines
  
  Merged revisions 168628 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r168628 | mmichelson | 2009-01-14 18:11:01 -0600 (Wed, 14 Jan 2009) | 16 lines
  
  Fix some crashes from bad datastore handling in app_queue.c
  
  * The queue_transfer_fixup function was searching for and removing
    the datastore from the incorrect channel, so this was fixed.
  
  * Most datastore operations regarding the queue_transfer datastore
    were being done without the channel locked, so proper channel locking
    was added, too.
  
  (closes issue #14086)
  Reported by: ZX81
  Patches:
        14086v2.patch uploaded by putnopvut (license 60)
  Tested by: ZX81, festr
  
  
  ........
................
  r168636 | oej | 2009-01-15 08:01:52 -0500 (Thu, 15 Jan 2009) | 5 lines
  
  Add support for setting the Reason header when cancelling a call in the queue 
  because someone else answered. Previously, only dial() was supported.
  
  EDV-102
................
  r168638 | oej | 2009-01-15 08:35:50 -0500 (Thu, 15 Jan 2009) | 8 lines
  
  Add capability to remove added SIP headers *before* INVITE is generated.
  
  (closes issue #14246)
  Reported by: klaus3000
  Patches: 
        2patch_chan_sip_SIPRemoveHeader_trunk.txt uploaded by klaus3000 (license 65)
................
  r168639 | oej | 2009-01-15 08:37:46 -0500 (Thu, 15 Jan 2009) | 3 lines
  
  Related to issue #14246
  Update changes for SIPRemoveHeader()
................
  r168705 | seanbright | 2009-01-15 10:33:18 -0500 (Thu, 15 Jan 2009) | 11 lines
  
  Add a missing unlock and properly handle the 'maxusers' setting on MeetMe
  conferences.  We were using the 'user number' field to compare against the
  maximum allowed users, which works assuming users with lower user numbers
  didn't leave the conference.
  
  (closes issue #14117)
  Reported by: sergedevorop
  Patches:
        20090114__bug14117-2.diff.txt uploaded by seanbright (license 71)
  Tested by: sergedevorop
................

Modified:
    team/group/asterisk-cpp/   (props changed)
    team/group/asterisk-cpp/CHANGES
    team/group/asterisk-cpp/CREDITS
    team/group/asterisk-cpp/Makefile
    team/group/asterisk-cpp/apps/app_disa.c
    team/group/asterisk-cpp/apps/app_meetme.c
    team/group/asterisk-cpp/apps/app_page.c
    team/group/asterisk-cpp/apps/app_queue.c
    team/group/asterisk-cpp/apps/app_read.c
    team/group/asterisk-cpp/apps/app_readexten.c
    team/group/asterisk-cpp/channels/chan_dahdi.c
    team/group/asterisk-cpp/channels/chan_misdn.c
    team/group/asterisk-cpp/channels/chan_sip.c
    team/group/asterisk-cpp/channels/chan_skinny.c
    team/group/asterisk-cpp/channels/chan_unistim.c
    team/group/asterisk-cpp/channels/misdn/isdn_lib.c
    team/group/asterisk-cpp/configs/sip.conf.sample
    team/group/asterisk-cpp/contrib/scripts/autosupport
    team/group/asterisk-cpp/funcs/func_channel.c
    team/group/asterisk-cpp/include/asterisk/channel.h
    team/group/asterisk-cpp/include/asterisk/indications.h
    team/group/asterisk-cpp/include/asterisk/options.h
    team/group/asterisk-cpp/main/app.c
    team/group/asterisk-cpp/main/asterisk.c
    team/group/asterisk-cpp/main/channel.c
    team/group/asterisk-cpp/main/cli.c
    team/group/asterisk-cpp/main/indications.c
    team/group/asterisk-cpp/main/pbx.c
    team/group/asterisk-cpp/main/udptl.c
    team/group/asterisk-cpp/res/res_http_post.c
    team/group/asterisk-cpp/res/res_indications.c
    team/group/asterisk-cpp/res/snmp/agent.c

Propchange: team/group/asterisk-cpp/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/asterisk-cpp/
------------------------------------------------------------------------------
    (empty)

Propchange: team/group/asterisk-cpp/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/group/asterisk-cpp/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/asterisk-cpp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 15 10:24:36 2009
@@ -1,1 +1,1 @@
-/trunk:1-168559
+/trunk:1-168708

Modified: team/group/asterisk-cpp/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/CHANGES?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/CHANGES (original)
+++ team/group/asterisk-cpp/CHANGES Thu Jan 15 10:24:36 2009
@@ -41,6 +41,11 @@
    option is required to interoperate with devices that have non-standard SDP
    session version implementations (observed with Microsoft OCS).  This option
    is diabled by default.
+ * The parsing of register => lines in sip.conf has been modified to allow a port
+   to be present in the "user" portion. Please see the sip.conf.sample file for more
+   information
+ * Added a function to remove SIP headers added in the dialplan before the
+   first INVITE is generated - SIPRemoveHeader()
 
 Skinny Changes
 --------------

Modified: team/group/asterisk-cpp/CREDITS
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/CREDITS?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/CREDITS (original)
+++ team/group/asterisk-cpp/CREDITS Thu Jan 15 10:24:36 2009
@@ -192,6 +192,8 @@
 	- See http://voip-info.org/users/view/sergee
 	serg(AT)voipsolutions.ru
 
+Klaus Darillon - the SIPremoveHeader function in chan_sip
+
 === OTHER CONTRIBUTIONS ===
 John Todd - Monkey sounds and associated teletorture prompt
 Michael Jerris - bug marshaling

Modified: team/group/asterisk-cpp/Makefile
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/Makefile?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/Makefile (original)
+++ team/group/asterisk-cpp/Makefile Thu Jan 15 10:24:36 2009
@@ -727,6 +727,7 @@
 		echo ";rungroup = asterisk ; The group to run as" ; \
 		echo ";lightbackground = yes ; If your terminal is set for a light-colored background" ; \
 		echo "documentation_language = en_US ; Set the Language you want Documentation displayed in. Value is in the same format as locale names" ; \
+		echo ";hideconnect = yes ; Hide messages displayed when a remote console connects and disconnects" ; \
 		echo "" ; \
 		echo "; Changing the following lines may compromise your security." ; \
 		echo ";[files]" ; \

Modified: team/group/asterisk-cpp/apps/app_disa.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/apps/app_disa.c?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/apps/app_disa.c (original)
+++ team/group/asterisk-cpp/apps/app_disa.c Thu Jan 15 10:24:36 2009
@@ -124,7 +124,7 @@
 
 static void play_dialtone(struct ast_channel *chan, char *mailbox)
 {
-	const struct ind_tone_zone_sound *ts = NULL;
+	const struct tone_zone_sound *ts = NULL;
 	if(ast_app_has_voicemail(mailbox, NULL))
 		ts = ast_get_indication_tone(chan->zone, "dialrecall");
 	else

Modified: team/group/asterisk-cpp/apps/app_meetme.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/apps/app_meetme.c?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/apps/app_meetme.c (original)
+++ team/group/asterisk-cpp/apps/app_meetme.c Thu Jan 15 10:24:36 2009
@@ -2187,10 +2187,12 @@
 		user->user_no = AST_LIST_LAST(&conf->userlist)->user_no + 1;
 
 	if (rt_schedule && conf->maxusers)
-		if (user->user_no > conf->maxusers) {
+		if (conf->users >= conf->maxusers) {
 			/* Sorry, but this confernce has reached the participant limit! */	
 			if (!ast_streamfile(chan, "conf-full", chan->language))
 				ast_waitstream(chan, "");
+			ast_mutex_unlock(&conf->playlock);
+			user->user_no = 0;
 			goto outrun;
 		}
 

Modified: team/group/asterisk-cpp/apps/app_page.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/apps/app_page.c?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/apps/app_page.c (original)
+++ team/group/asterisk-cpp/apps/app_page.c Thu Jan 15 10:24:36 2009
@@ -117,7 +117,6 @@
 	AST_APP_OPTION('i', PAGE_IGNORE_FORWARDS),
 });
 
-#define MAX_DIALS 128
 
 static int page_exec(struct ast_channel *chan, void *data)
 {
@@ -127,7 +126,8 @@
 	unsigned int confid = ast_random();
 	struct ast_app *app;
 	int res = 0, pos = 0, i = 0;
-	struct ast_dial *dials[MAX_DIALS];
+	struct ast_dial **dial_list;
+	unsigned int num_dials;
 	int timeout = 0;
 	char *parse;
 
@@ -166,6 +166,18 @@
 
 	snprintf(meetmeopts, sizeof(meetmeopts), "MeetMe,%ud,%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
 		(ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );
+
+	/* Count number of extensions in list by number of ampersands + 1 */
+	num_dials = 1;
+	tmp = args.devices;
+	while (*tmp && *tmp++ == '&') {
+		num_dials++;
+	}
+
+	if (!(dial_list = ast_calloc(num_dials, sizeof(void *)))) {
+		ast_log(LOG_ERROR, "Can't allocate %ld bytes for dial list\n", (long)(sizeof(void *) * num_dials));
+		return -1;
+	}
 
 	/* Go through parsing/calling each device */
 	while ((tech = strsep(&args.devices, "&"))) {
@@ -222,7 +234,7 @@
 		ast_dial_run(dial, chan, 1);
 
 		/* Put in our dialing array */
-		dials[pos++] = dial;
+		dial_list[pos++] = dial;
 	}
 
 	if (!ast_test_flag(&flags, PAGE_QUIET)) {
@@ -239,7 +251,7 @@
 
 	/* Go through each dial attempt cancelling, joining, and destroying */
 	for (i = 0; i < pos; i++) {
-		struct ast_dial *dial = dials[i];
+		struct ast_dial *dial = dial_list[i];
 
 		/* We have to wait for the async thread to exit as it's possible Meetme won't throw them out immediately */
 		ast_dial_join(dial);

Modified: team/group/asterisk-cpp/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/apps/app_queue.c?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/apps/app_queue.c (original)
+++ team/group/asterisk-cpp/apps/app_queue.c Thu Jan 15 10:24:36 2009
@@ -2228,9 +2228,13 @@
 	struct callattempt *oo;
 
 	while (outgoing) {
+		/* If someone else answered the call we should indicate this in the CANCEL */
 		/* Hangup any existing lines we have open */
-		if (outgoing->chan && (outgoing->chan != exception))
+		if (outgoing->chan && (outgoing->chan != exception)) {
+			if (exception)
+				ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE);
 			ast_hangup(outgoing->chan);
+		}
 		oo = outgoing;
 		outgoing = outgoing->q_next;
 		if (oo->member)
@@ -2761,7 +2765,7 @@
 			if (numlines == (numbusies + numnochan)) {
 				ast_debug(1, "Everyone is busy at this time\n");
 			} else {
-				ast_log(LOG_NOTICE, "No one is answering queue '%s' (%d/%d/%d)\n", queue, numlines, numbusies, numnochan);
+				ast_debug(3, "No one is answering queue '%s' (%d numlines / %d busies / %d failed channels)\n", queue, numlines, numbusies, numnochan);
 			}
 			*to = 0;
 			return NULL;
@@ -3332,8 +3336,9 @@
 
 	update_queue(qe->parent, member, callcompletedinsl, (time(NULL) - callstart));
 	
-	if ((datastore = ast_channel_datastore_find(new_chan, &queue_transfer_info, NULL))) {
-		ast_channel_datastore_remove(new_chan, datastore);
+	/* No need to lock the channels because they are already locked in ast_do_masquerade */
+	if ((datastore = ast_channel_datastore_find(old_chan, &queue_transfer_info, NULL))) {
+		ast_channel_datastore_remove(old_chan, datastore);
 	} else {
 		ast_log(LOG_WARNING, "Can't find the queue_transfer datastore.\n");
 	}
@@ -3344,6 +3349,8 @@
  * When a caller is atxferred, then the queue_transfer_info datastore
  * is removed from the channel. If it's still there after the bridge is
  * broken, then the caller was not atxferred.
+ *
+ * \note Only call this with chan locked
  */
 static int attended_transfer_occurred(struct ast_channel *chan)
 {
@@ -3667,9 +3674,11 @@
 	 * to which the datastore was moved hangs up, it will attempt to free this
 	 * datastore again, causing a crash
 	 */
+	ast_channel_lock(qe->chan);
 	if (datastore && !ast_channel_datastore_remove(qe->chan, datastore)) {
 		ast_datastore_free(datastore);
 	}
+	ast_channel_unlock(qe->chan);
 	ao2_lock(qe->parent);
 	if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY) {
 		store_next_rr(qe, outgoing);
@@ -4078,6 +4087,7 @@
 		/* If the queue member did an attended transfer, then the TRANSFER already was logged in the queue_log
 		 * when the masquerade occurred. These other "ending" queue_log messages are unnecessary
 		 */
+		ast_channel_lock(qe->chan);
 		if (!attended_transfer_occurred(qe->chan)) {
 			struct ast_datastore *tds;
 			if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
@@ -4094,17 +4104,16 @@
 					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
 				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
 			}
-			ast_channel_lock(qe->chan);
-			if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
+			if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {	
 				ast_channel_datastore_remove(qe->chan, tds);
 			}
-			ast_channel_unlock(qe->chan);
 			update_queue(qe->parent, member, callcompletedinsl, (time(NULL) - callstart));
 		}
 
 		if (transfer_ds) {
 			ast_datastore_free(transfer_ds);
 		}
+		ast_channel_unlock(qe->chan);
 		ast_hangup(peer);
 		res = bridge ? bridge : 1;
 		ao2_ref(member, -1);

Modified: team/group/asterisk-cpp/apps/app_read.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/apps/app_read.c?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/apps/app_read.c (original)
+++ team/group/asterisk-cpp/apps/app_read.c Thu Jan 15 10:24:36 2009
@@ -132,7 +132,7 @@
 	int tries = 1, to = 0, x = 0;
 	double tosec;
 	char *argcopy = NULL;
-	struct ind_tone_zone_sound *ts = NULL;
+	struct tone_zone_sound *ts = NULL;
 	struct ast_flags flags = {0};
 	const char *status = "ERROR";
 

Modified: team/group/asterisk-cpp/apps/app_readexten.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/apps/app_readexten.c?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/apps/app_readexten.c (original)
+++ team/group/asterisk-cpp/apps/app_readexten.c Thu Jan 15 10:24:36 2009
@@ -132,7 +132,7 @@
 	int maxdigits = sizeof(exten) - 1;
 	int timeout = 0, digit_timeout = 0, x = 0;
 	char *argcopy = NULL, *status = "";
-	struct ind_tone_zone_sound *ts = NULL;
+	struct tone_zone_sound *ts = NULL;
 	struct ast_flags flags = {0};
 
 	 AST_DECLARE_APP_ARGS(arglist,

Modified: team/group/asterisk-cpp/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/channels/chan_dahdi.c?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/channels/chan_dahdi.c (original)
+++ team/group/asterisk-cpp/channels/chan_dahdi.c Thu Jan 15 10:24:36 2009
@@ -728,6 +728,7 @@
 	struct ast_event_sub *mwi_event_sub;
 	char dialdest[256];
 	int onhooktime;
+	int fxsoffhookstate;
 	int msgstate;
 	int distinctivering;				/*!< Which distinctivering to use */
 	int cidrings;					/*!< Which ring to deliver CID on */
@@ -3433,6 +3434,7 @@
 					tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
 				else
 					tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
+				p->fxsoffhookstate = par.rxisoffhook;
 			}
 			break;
 		case SIG_FXSGS:
@@ -4648,6 +4650,7 @@
 			case SIG_FXOGS:
 			case SIG_FXOKS:
 				p->onhooktime = time(NULL);
+				p->fxsoffhookstate = 0;
 				p->msgstate = -1;
 				/* Check for some special conditions regarding call waiting */
 				if (idx == SUB_REAL) {
@@ -4799,6 +4802,7 @@
 			case SIG_FXOLS:
 			case SIG_FXOGS:
 			case SIG_FXOKS:
+				p->fxsoffhookstate = 1;
 				switch (ast->_state) {
 				case AST_STATE_RINGING:
 					dahdi_enable_ec(p);
@@ -7887,6 +7891,7 @@
 		case SIG_FXOGS:
 		case SIG_FXOKS:
 			res = dahdi_set_hook(i->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
+			i->fxsoffhookstate = 1;
 			if (res && (errno == EBUSY))
 				break;
 			if (i->cidspill) {
@@ -8040,6 +8045,9 @@
 			res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, -1);
 			return -1;
 		}
+		if (i->sig == SIG_FXOLS || i->sig == SIG_FXOGS || i->sig == SIG_FXOKS) {
+			i->fxsoffhookstate = 0;
+		}
 		break;
 	case DAHDI_EVENT_POLARITY:
 		switch (i->sig) {
@@ -8182,7 +8190,10 @@
 				if (!found && ((i == last) || ((i == iflist) && !last))) {
 					last = i;
 					if (last) {
-						if (!last->mwisendactive &&	 last->sig & __DAHDI_SIG_FXO) {
+						/* Only allow MWI to be initiated on a quiescent fxs port */
+						if (!last->mwisendactive &&	last->sig & __DAHDI_SIG_FXO &&
+								!last->fxsoffhookstate && !last->owner &&
+								!ast_strlen_zero(last->mailbox) && (thispass - last->onhooktime > 3)) {
 							res = has_voicemail(last);
 							if (last->msgstate != res) {
 								/* Set driver resources for signalling VMWI */
@@ -8948,6 +8959,14 @@
 				AST_EVENT_IE_END);
 		}
 		tmp->msgstate = -1;
+		if ((chan_sig == SIG_FXOKS) || (chan_sig == SIG_FXOLS) || (chan_sig == SIG_FXOGS)) {
+			memset(&p, 0, sizeof(p));
+			res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
+			if (!res) {
+				tmp->fxsoffhookstate = p.rxisoffhook;
+			}
+		}
+		tmp->onhooktime = time(NULL);
 		tmp->group = conf->chan.group;
 		tmp->callgroup = conf->chan.callgroup;
 		tmp->pickupgroup= conf->chan.pickupgroup;
@@ -8958,7 +8977,6 @@
 		tmp->rxgain = conf->chan.rxgain;
 		tmp->txgain = conf->chan.txgain;
 		tmp->tonezone = conf->chan.tonezone;
-		tmp->onhooktime = time(NULL);
 		if (tmp->subs[SUB_REAL].dfd > -1) {
 			set_actual_gain(tmp->subs[SUB_REAL].dfd, 0, tmp->rxgain, tmp->txgain, tmp->law);
 			if (tmp->dsp)

Modified: team/group/asterisk-cpp/channels/chan_misdn.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/channels/chan_misdn.c?view=diff&rev=168709&r1=168708&r2=168709
==============================================================================
--- team/group/asterisk-cpp/channels/chan_misdn.c (original)
+++ team/group/asterisk-cpp/channels/chan_misdn.c Thu Jan 15 10:24:36 2009
@@ -114,27 +114,27 @@
 ast_mutex_t release_lock;
 
 enum misdn_chan_state {
-	MISDN_NOTHING=0,	/*!< at beginning */
-	MISDN_WAITING4DIGS, /*!<  when waiting for infos */
-	MISDN_EXTCANTMATCH, /*!<  when asterisk couldn't match our ext */
-	MISDN_INCOMING_SETUP, /*!<  for incoming setups*/
-	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 */
-	MISDN_BUSY, /*!<  when BUSY */
-	MISDN_CONNECTED, /*!<  when connected */
-	MISDN_PRECONNECTED, /*!<  when connected */
-	MISDN_DISCONNECTED, /*!<  when connected */
-	MISDN_RELEASED, /*!<  when connected */
-	MISDN_BRIDGED, /*!<  when bridged */
-	MISDN_CLEANING, /*!< when hangup from * but we were connected before */
-	MISDN_HUNGUP_FROM_MISDN, /*!< when DISCONNECT/RELEASE/REL_COMP  came from misdn */
-	MISDN_HUNGUP_FROM_AST, /*!< when DISCONNECT/RELEASE/REL_COMP came out of misdn_hangup */
-	MISDN_HOLDED, /*!< if this chan is holded */
-	MISDN_HOLD_DISCONNECT, /*!< if this chan is holded */
+	MISDN_NOTHING = 0,         /*!< at beginning */
+	MISDN_WAITING4DIGS,        /*!< when waiting for info */
+	MISDN_EXTCANTMATCH,        /*!< when asterisk couldn't match our ext */
+	MISDN_INCOMING_SETUP,      /*!< for incoming setup */
+	MISDN_DIALING,             /*!< when pbx_start */
+	MISDN_PROGRESS,            /*!< we have progress */
+	MISDN_PROCEEDING,          /*!< we have progress */
+	MISDN_CALLING,             /*!< when misdn_call is called */
+	MISDN_CALLING_ACKNOWLEDGE, /*!< when we get SETUP_ACK */
+	MISDN_ALERTING,            /*!< when Alerting */
+	MISDN_BUSY,                /*!< when BUSY */
+	MISDN_CONNECTED,           /*!< when connected */
+	MISDN_PRECONNECTED,        /*!< when connected */
+	MISDN_DISCONNECTED,        /*!< when connected */
+	MISDN_RELEASED,            /*!< when connected */
+	MISDN_BRIDGED,             /*!< when bridged */
+	MISDN_CLEANING,            /*!< when hangup from * but we were connected before */
+	MISDN_HUNGUP_FROM_MISDN,   /*!< when DISCONNECT/RELEASE/REL_COMP came from misdn */
+	MISDN_HUNGUP_FROM_AST,     /*!< when DISCONNECT/RELEASE/REL_COMP came out of misdn_hangup */
+	MISDN_HOLDED,              /*!< when on hold */
+	MISDN_HOLD_DISCONNECT,     /*!< when on hold */
   
 };
 
@@ -196,7 +196,7 @@
 	 */
 	int noautorespond_on_setup;
 	
-	int norxtone;	/* Boolean assigned values but the value is not used. */
+	int norxtone;	/*!< Boolean assigned values but the value is not used. */
 
 	/*!
 	 * \brief TRUE if we are not to generate tones (Playtones)
@@ -341,7 +341,9 @@
 	 */
 	char mohinterpret[MAX_MUSICCLASS];
 
-	//int zero_read_cnt;	/* Not used */
+#if 0
+	int zero_read_cnt;	/* Not used */
+#endif
 
 	/*!
 	 * \brief Number of outgoing audio frames dropped since last debug gripe message.
@@ -377,7 +379,7 @@
 	 * \brief Tone zone sound used for dialtone generation.
 	 * \note Used as a boolean.  Non-NULL to prod generation if enabled. 
 	 */
-	const struct ind_tone_zone_sound *ts;
+	const struct tone_zone_sound *ts;
 	
 	/*!
 	 * \brief Enables overlap dialing for the set amount of seconds.  (0 = Disabled)
@@ -399,38 +401,39 @@
 	 * \brief Overlap timer start time.  Timer restarted for every digit received.
 	 */
 	struct timeval overlap_tv;
-  
-	//struct chan_list *peer;	/* Not used */
+
+#if 0
+	struct chan_list *peer;     /* Not used */
+#endif
 
 	/*!
 	 * \brief Next channel call record in the list.
 	 */
 	struct chan_list *next;
-	//struct chan_list *prev;		/* Not used */
-	//struct chan_list *first;	/* Not used */
+#if 0
+	struct chan_list *prev;     /* Not used */
+	struct chan_list *first;    /* Not used */
+#endif
 };
 
+
+int MAXTICS = 8;
 
 
 void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch);
 void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch);
-
-struct robin_list {
+static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame *frame);
+
+static struct robin_list {
 	char *group;
 	int port;
 	int channel;
 	struct robin_list *next;
 	struct robin_list *prev;
-};
-static struct robin_list *robin = NULL;
-
-
-
-static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame *frame);
-
-
-
-static inline void free_robin_list_r (struct robin_list *r)
+} *robin = NULL;
+
+
+static inline void free_robin_list_r(struct robin_list *r)
 {
 	if (r) {
 		if (r->next)
@@ -441,22 +444,23 @@
 	}
 }
 
-static void free_robin_list ( void )
+static void free_robin_list(void)
 {
 	free_robin_list_r(robin);
 	robin = NULL;
 }
 
-static struct robin_list* get_robin_position (char *group) 
+static struct robin_list* get_robin_position(char *group) 
 {
 	struct robin_list *new;
 	struct robin_list *iter = robin;
 	for (; iter; iter = iter->next) {
-		if (!strcasecmp(iter->group, group))
+		if (!strcasecmp(iter->group, group)) {
 			return iter;
+		}
 	}
 	new = ast_calloc(1, sizeof(*new));
-	new->group = strndup(group, strlen(group));
+	new->group = strdup(group);
 	new->channel = 1;
 	if (robin) {
 		new->next = robin;
@@ -491,7 +495,7 @@
 
 static const char misdn_type[] = "mISDN";
 
-static int tracing = 0 ;
+static int tracing = 0;
 
 /*! \brief Only alaw and mulaw is allowed for now */
 static int prefformat =  AST_FORMAT_ALAW ; /*  AST_FORMAT_SLINEAR ;  AST_FORMAT_ULAW | */
@@ -502,7 +506,6 @@
 
 static int *misdn_in_calls;
 static int *misdn_out_calls;
-
 
 struct chan_list dummy_cl;
 
@@ -522,8 +525,6 @@
 static struct chan_list *find_chan_by_bc(struct chan_list *list, struct misdn_bchannel *bc);
 static struct chan_list *find_chan_by_pid(struct chan_list *list, int pid);
 
-
-
 static int dialtone_indicate(struct chan_list *cl);
 static int hanguptone_indicate(struct chan_list *cl);
 static int stop_indicate(struct chan_list *cl);
@@ -538,9 +539,7 @@
 
 int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len);
 
-
 void debug_numplan(int port, int numplan, char *type);
-
 
 int add_out_calls(int port);
 int add_in_calls(int port);
@@ -560,8 +559,10 @@
 {
 	struct chan_list *tmp;
   
-	for (tmp=cl_te; tmp; tmp = tmp->next) {
-		if ( tmp->ast == ast ) return tmp;
+	for (tmp = cl_te; tmp; tmp = tmp->next) {
+		if (tmp->ast == ast) {
+			return tmp;
+		}
 	}
   
 	return NULL;
@@ -571,8 +572,10 @@
 {
 	struct chan_list *tmp;
   
-	for (tmp=cl_te; tmp; tmp = tmp->next) {
-		if ( tmp->ast  && strcmp(tmp->ast->name,name) == 0) return tmp;
+	for (tmp = cl_te; tmp; tmp = tmp->next) {
+		if (tmp->ast && strcmp(tmp->ast->name, name) == 0) {
+			return tmp;
+		}
 	}
   
 	return NULL;
@@ -581,10 +584,10 @@
 
 
 struct allowed_bearers {
-	char *name;			/*!< Bearer capability name string used in /etc/misdn.conf allowed_bearers */
-	char *display;		/*!< Bearer capability displayable name */
-	int cap;			/*!< SETUP message bearer capability field code value */
-	int deprecated;		/*!< TRUE if this entry is deprecated. (Misspelled or bad name to use) */
+	char *name;         /*!< Bearer capability name string used in /etc/misdn.conf allowed_bearers */
+	char *display;      /*!< Bearer capability displayable name */
+	int cap;            /*!< SETUP message bearer capability field code value */
+	int deprecated;     /*!< TRUE if this entry is deprecated. (Misspelled or bad name to use) */
 };
 
 /* *INDENT-OFF* */
@@ -618,56 +621,57 @@
 	switch (fac->Function) {
 #ifdef HAVE_MISDN_FAC_RESULT
 	case Fac_RESULT:
-		chan_misdn_log(0, bc->port," --> Received RESULT Operation\n");
+		chan_misdn_log(0, bc->port, " --> Received RESULT Operation\n");
 		break;
 #endif
 #ifdef HAVE_MISDN_FAC_ERROR
 	case Fac_ERROR:
-		chan_misdn_log(0, bc->port," --> Received Error Operation\n");
-		chan_misdn_log(0, bc->port," --> Value:%d Error:%s\n",fac->u.ERROR.errorValue, fac->u.ERROR.error);
+		chan_misdn_log(0, bc->port, " --> Received Error Operation\n");
+		chan_misdn_log(0, bc->port, " --> Value:%d Error:%s\n", fac->u.ERROR.errorValue, fac->u.ERROR.error);
 		break;
 #endif
 	case Fac_CD:
-		chan_misdn_log(1,bc->port," --> calldeflect to: %s, presentable: %s\n", fac->u.CDeflection.DeflectedToNumber,
+		chan_misdn_log(1, bc->port, " --> calldeflect to: %s, presentable: %s\n", fac->u.CDeflection.DeflectedToNumber,
 			fac->u.CDeflection.PresentationAllowed ? "yes" : "no");
 		break;
 	case Fac_AOCDCurrency:
-		if (fac->u.AOCDcur.chargeNotAvailable)
-			chan_misdn_log(1,bc->port," --> AOCD currency: charge not available\n");
-		else if (fac->u.AOCDcur.freeOfCharge)
-			chan_misdn_log(1,bc->port," --> AOCD currency: free of charge\n");
-		else if (fac->u.AOCDchu.billingId >= 0)
-			chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s billingId:%d\n",
+		if (fac->u.AOCDcur.chargeNotAvailable) {
+			chan_misdn_log(1, bc->port, " --> AOCD currency: charge not available\n");
+		} else if (fac->u.AOCDcur.freeOfCharge) {
+			chan_misdn_log(1, bc->port, " --> AOCD currency: free of charge\n");
+		} else if (fac->u.AOCDchu.billingId >= 0) {
+			chan_misdn_log(1, bc->port, " --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s billingId:%d\n",
 				fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
 				(fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDcur.billingId);
-		else
-			chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s\n",
+		} else {
+			chan_misdn_log(1, bc->port, " --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s\n",
 				fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
 				(fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total");
+		}
 		break;
 	case Fac_AOCDChargingUnit:
-		if (fac->u.AOCDchu.chargeNotAvailable)
-			chan_misdn_log(1,bc->port," --> AOCD charging unit: charge not available\n");
-		else if (fac->u.AOCDchu.freeOfCharge)
-			chan_misdn_log(1,bc->port," --> AOCD charging unit: free of charge\n");
-		else if (fac->u.AOCDchu.billingId >= 0)
-			chan_misdn_log(1,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s billingId:%d\n",
+		if (fac->u.AOCDchu.chargeNotAvailable) {
+			chan_misdn_log(1, bc->port, " --> AOCD charging unit: charge not available\n");
+		} else if (fac->u.AOCDchu.freeOfCharge) {
+			chan_misdn_log(1, bc->port, " --> AOCD charging unit: free of charge\n");
+		} else if (fac->u.AOCDchu.billingId >= 0) {
+			chan_misdn_log(1, bc->port, " --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s billingId:%d\n",
 				fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDchu.billingId);
-		else
-			chan_misdn_log(1,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s\n",
+		} else {
+			chan_misdn_log(1, bc->port, " --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s\n",
 				fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total");
+		}
 		break;
 	case Fac_None:
 	default:
-		chan_misdn_log(1,bc->port," --> unknown facility\n");
+		chan_misdn_log(1, bc->port, " --> unknown facility\n");
 		break;
 	}
 }
 
 static void print_bearer(struct misdn_bchannel *bc) 
 {
-	
-	chan_misdn_log(2, bc->port, " --> Bearer: %s\n",bearer2str(bc->capability));
+	chan_misdn_log(2, bc->port, " --> Bearer: %s\n", bearer2str(bc->capability));
 	
 	switch(bc->law) {
 	case INFO_CODEC_ALAW:
@@ -683,48 +687,51 @@
 {
 	char buf[128];
 
-	if (!bc->AOCD_need_export || !ast)
+	if (!bc->AOCD_need_export || !ast) {
 		return;
+	}
 
 	if (originator == ORG_AST) {
-		ast = ast_bridged_channel(ast);
-		if (!ast)
+		if (!(ast = ast_bridged_channel(ast))) {
 			return;
+		}
 	}
 
 	switch (bc->AOCDtype) {
 	case Fac_AOCDCurrency:
 		pbx_builtin_setvar_helper(ast, "AOCD_Type", "currency");
-		if (bc->AOCD.currency.chargeNotAvailable)
+		if (bc->AOCD.currency.chargeNotAvailable) {

[... 4137 lines stripped ...]



More information about the asterisk-commits mailing list