[asterisk-commits] murf: branch murf/macrogosub r43746 - in /team/murf/macrogosub: ./ apps/ chan...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Sep 26 20:17:02 MST 2006


Author: murf
Date: Tue Sep 26 22:17:01 2006
New Revision: 43746

URL: http://svn.digium.com/view/asterisk?rev=43746&view=rev
Log:
Merged revisions 43666-43667,43675,43677,43687,43696,43698,43701-43702,43704,43709,43715,43721,43727,43733,43740 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r43666 | qwell | 2006-09-26 11:09:01 -0600 (Tue, 26 Sep 2006) | 5 lines

Add optional queue_log_name config option for logger.conf, to change the
name of the queue_log file.

Issue #7363, patch by Steve Davies, slightly modified by me.

................
r43667 | tilghman | 2006-09-26 11:25:27 -0600 (Tue, 26 Sep 2006) | 2 lines

Gosub arguments (Issue 7780)

................
r43675 | qwell | 2006-09-26 12:10:07 -0600 (Tue, 26 Sep 2006) | 12 lines

Merged revisions 43674 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43674 | qwell | 2006-09-26 11:08:51 -0700 (Tue, 26 Sep 2006) | 4 lines

Issue #8015, patch by Dan Austin.

Maximum values were incorrect, which is why this is being put in 1.4

........

................
r43677 | kpfleming | 2006-09-26 12:39:01 -0600 (Tue, 26 Sep 2006) | 10 lines

Merged revisions 43676 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43676 | kpfleming | 2006-09-26 13:34:27 -0500 (Tue, 26 Sep 2006) | 2 lines

update to use 1.4.3 core sounds, with corrected beep/beeperr/tt-monkeys files

........

................
r43687 | kpfleming | 2006-09-26 13:37:48 -0600 (Tue, 26 Sep 2006) | 2 lines

start a CHANGES file for trunk... no need to force people to have to review commit logs after branching

................
r43696 | file | 2006-09-26 14:11:44 -0600 (Tue, 26 Sep 2006) | 10 lines

Merged revisions 43695 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43695 | file | 2006-09-26 16:09:41 -0400 (Tue, 26 Sep 2006) | 2 lines

Slight overhaul of the whisper support. 1. We need to duplicate the frame from ast_translate 2. We need to ensure we always have signed linear coming in for signed linear combining. 3. We need to ensure we are always feeding signed linear out. 4. Properly store and restore write format when beeping on the channel we are whispering on. 5. Properly discontinue the stream on the channel for the beep. (issue #8019 reported by timkelly1980)

........

................
r43698 | file | 2006-09-26 14:20:34 -0600 (Tue, 26 Sep 2006) | 10 lines

Merged revisions 43697 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43697 | file | 2006-09-26 16:19:33 -0400 (Tue, 26 Sep 2006) | 2 lines

Strip options off the argument passed for devicestate in chan_local. (issue #8034 reported by pcardozo)

........

................
r43701 | russell | 2006-09-26 14:26:00 -0600 (Tue, 26 Sep 2006) | 22 lines

Merged revisions 43700 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r43700 | russell | 2006-09-26 16:24:39 -0400 (Tue, 26 Sep 2006) | 14 lines

Merged revisions 43699 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r43699 | russell | 2006-09-26 16:23:15 -0400 (Tue, 26 Sep 2006) | 6 lines

When parsing the sections of voicemail.conf that contain mailbox definitions,
don't introduce a length limit on the definition by using a 256 byte temporary
storage buffer.  Instead, make the temporary buffer just as big as it needs
to be to hold the entire mailbox definition.
(fixes BE-68)

........

................

................
r43702 | qwell | 2006-09-26 14:30:18 -0600 (Tue, 26 Sep 2006) | 2 lines

update CHANGES file to reflect codec support in chan_skinny

................
r43704 | russell | 2006-09-26 14:33:37 -0600 (Tue, 26 Sep 2006) | 10 lines

Blocked revisions 43703 via svnmerge

........
r43703 | russell | 2006-09-26 16:30:36 -0400 (Tue, 26 Sep 2006) | 3 lines

Add missing newline character in the warning message about deprecated TOS values
in configuration.

........

................
r43709 | file | 2006-09-26 14:51:36 -0600 (Tue, 26 Sep 2006) | 18 lines

Merged revisions 43707 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r43707 | file | 2006-09-26 16:47:26 -0400 (Tue, 26 Sep 2006) | 10 lines

Merged revisions 43705 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r43705 | file | 2006-09-26 16:38:06 -0400 (Tue, 26 Sep 2006) | 2 lines

Use proper type to represent the group variable (issue #8025 reported by makoto)

........

................

................
r43715 | russell | 2006-09-26 15:01:02 -0600 (Tue, 26 Sep 2006) | 25 lines

Merged revisions 43710 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r43710 | russell | 2006-09-26 16:56:42 -0400 (Tue, 26 Sep 2006) | 17 lines

(This was actually BE-65)

Merged revisions 43708 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r43708 | russell | 2006-09-26 16:49:21 -0400 (Tue, 26 Sep 2006) | 7 lines

Back in revision 4798, this message was changed from using ast_cli() to directly
calling write().  During this change, checking if this was a remote console was
removed.  This caused this message about using "exit" or "quit" to exit an
Asterisk console to come up in times where it did not make sense.  This change
restores the check to see if this is a remote console before printing the
message.  (fixes BE-4)

........

................

................
r43721 | qwell | 2006-09-26 15:30:41 -0600 (Tue, 26 Sep 2006) | 5 lines

Add QueueSummary manager action.
Gives "at a glance" information about a single queue, or all queues.

Issue #8035, patch by rgollent, slightly modified (formatting) by me.

................
r43727 | qwell | 2006-09-26 16:18:04 -0600 (Tue, 26 Sep 2006) | 4 lines

Fire a manager event when a meetme is started/stopped.

Issue #7891, patch by suhler.

................
r43733 | file | 2006-09-26 19:39:39 -0600 (Tue, 26 Sep 2006) | 2 lines

Clean up code and convert last two things (firmware/dialplan cache) to linked list macros.

................
r43740 | murf | 2006-09-26 20:46:50 -0600 (Tue, 26 Sep 2006) | 9 lines

Merged revisions 43739 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43739 | murf | 2006-09-26 20:32:47 -0600 (Tue, 26 Sep 2006) | 1 line

This change to extensions.ael was to fix bug 8031; the install scripts are causing it to be copied to /etc/asterisk/extensions.ael, and because it is a fairly direct conversion of the original extensions.conf, the macro and context names clash with the existing extensions.conf. So, I put an ael- in front of all macros and contexts, and checked every goto and macro call. Also, this file compiles under aelparse.
........

................

Modified:
    team/murf/macrogosub/   (props changed)
    team/murf/macrogosub/.cleancount
    team/murf/macrogosub/CHANGES
    team/murf/macrogosub/apps/app_chanspy.c
    team/murf/macrogosub/apps/app_meetme.c
    team/murf/macrogosub/apps/app_queue.c
    team/murf/macrogosub/apps/app_stack.c
    team/murf/macrogosub/apps/app_voicemail.c
    team/murf/macrogosub/channels/chan_iax2.c
    team/murf/macrogosub/channels/chan_local.c
    team/murf/macrogosub/channels/chan_sip.c
    team/murf/macrogosub/configs/extensions.ael.sample
    team/murf/macrogosub/configs/logger.conf.sample
    team/murf/macrogosub/doc/rtp-packetization.txt
    team/murf/macrogosub/include/asterisk/channel.h
    team/murf/macrogosub/main/asterisk.c
    team/murf/macrogosub/main/channel.c
    team/murf/macrogosub/main/cli.c
    team/murf/macrogosub/main/frame.c
    team/murf/macrogosub/main/logger.c
    team/murf/macrogosub/main/slinfactory.c
    team/murf/macrogosub/sounds/Makefile

Propchange: team/murf/macrogosub/
------------------------------------------------------------------------------
    automerge = yes

Propchange: team/murf/macrogosub/
------------------------------------------------------------------------------
--- branch-1.4-blocked (original)
+++ branch-1.4-blocked Tue Sep 26 22:17:01 2006
@@ -1,1 +1,1 @@
-/branches/1.4:43484,43510,43582,43626
+/branches/1.4:43484,43510,43582,43626,43703

Propchange: team/murf/macrogosub/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Tue Sep 26 22:17:01 2006
@@ -1,1 +1,1 @@
-/branches/1.4:1-43376,43383,43386,43388,43392,43396,43405,43410,43422,43441,43445,43450,43454,43456,43464,43466,43469,43477,43482,43486,43489,43492,43518,43524,43553,43564,43616,43640,43642,43650
+/branches/1.4:1-43376,43383,43386,43388,43392,43396,43405,43410,43422,43441,43445,43450,43454,43456,43464,43466,43469,43477,43482,43486,43489,43492,43518,43524,43553,43564,43616,43640,43642,43650,43674,43676,43695,43697,43700,43707,43710,43739

Propchange: team/murf/macrogosub/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Sep 26 22:17:01 2006
@@ -1,1 +1,1 @@
-/trunk:1-43663
+/trunk:1-43740

Modified: team/murf/macrogosub/.cleancount
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/.cleancount?rev=43746&r1=43745&r2=43746&view=diff
==============================================================================
--- team/murf/macrogosub/.cleancount (original)
+++ team/murf/macrogosub/.cleancount Tue Sep 26 22:17:01 2006
@@ -1,1 +1,1 @@
-24
+25

Modified: team/murf/macrogosub/CHANGES
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/CHANGES?rev=43746&r1=43745&r2=43746&view=diff
==============================================================================
--- team/murf/macrogosub/CHANGES (original)
+++ team/murf/macrogosub/CHANGES Tue Sep 26 22:17:01 2006
@@ -1,127 +1,15 @@
-Changes since Asterisk 1.2.0-beta2:
+Changes since Asterisk 1.4-beta was branched:
 
-   * Cygwin build system portability
-   * Optional generation of outbound silence during channel recording
+  * Argument support for Gosub application
+  * MailboxExists converted to dialplan function
+  * Ability to set process limits without restarting Asterisk
+  * SS7 support in chan_zap (via libss7 library)
+  * Proper codec support in chan_skinny.
+  * AEL upgraded to use the Gosub with Arguments instead
+     of Macro application, to hopefully reduce the problems
+     seen with the artificially low stack ceiling that 
+     Macro bumps into. Macros can only call other Macros
+     to a depth of 7. Tests run using gosub, show depths
+     limited only by virtual memory. A small test demonstrated
+     recursive call depths of 100,000 without problems.
 
-Changes since Asterisk 1.2.0-beta1:
-
-   * Many, many bug fixes
-   * Documentation and sample configuration updates
-   * Vastly improved presence/subscription support in the SIP channel driver
-   * A new (experimental) mISDN channel driver
-   * A new monitoring application (MixMonitor)
-   * More portability fixes for non-Linux platforms
-   * New dialplan functions replacing old applications
-   * Significant deadlock and performance upgrades for the Manager interface
-   * An upgrade to the 'new' dialplan expression parser for all users
-   * New Zaptel echo cancellers with improved performance
-   * Support for the latest OSP toolkit from TransNexus
-   * Support user-controlled volume adjustment in MeetMe application
-   * More dialplan applications now return status variables instead of priority jumping
-   * Much more powerful ENUM support in the dialplan
-   * SIP domain support for authentication and virtual hosting
-   * Many PRI protocol updates and fixes, including more complete Q.SIG support
-   * New applications: Pickup() and Page()
-
-Changes since Asterisk 1.0:
-
-This list currently only containts changes made from the end of November until
-March 26, 2005.
-
-   * Add new applications:
-     -- AgentMonitorOutgoing
-     -- Curl
-     -- ExecIf
-     -- ExecIfTime
-     -- IAX2Provision
-     -- MacroExit
-     -- MacroIf
-     -- PauseQueueMember
-     -- ReadFile
-     -- SetRDNIS
-     -- SIPAddHeader
-     -- SIPGetHeader
-     -- StartMusicOnHold
-     -- StopMusicOnHold
-     -- UnpauseQueueMember
-     -- WaitForSilence
-     -- While / EndWhile
-   * app Answer
-     -- added delay option
-   * app ChanIsAvail
-     -- added 's' option
-   * app Dial
-     -- add option to specify the class for musiconhold with m option
-   * app EnumLookup
-     -- added "reload enum" for configuration
-   * app Goto
-     -- added relative priorities
-   * app GotoIf
-     -- added relative priorities
-   * app MeetMe
-     -- added 'i' option
-     -- added 'r' option
-     -- added 'T' option
-     -- added 'P' option
-     -- added 'c' option
-     -- added adminpin to meetme.conf
-     -- added reload command
-   * app PrivacyManager
-     -- add config file privacy.conf
-   * app queue
-     -- queues.conf
-        -- added persistentmembers option to queues.conf
-        -- changed music option to musiconhold
-        -- added weight option
-        -- added note about why agent groups probably shouldn't be used
-        -- added timeoutrestart option
-   * app Read
-     -- added attempts parameter
-     -- added timeout parameter
-   * app Record
-     -- added 'q' option
-   * app SendDTMF
-     -- add timeout option
-   * app SMS
-     -- document alternative syntax for queueing messages
-   * app Voicemail
-     -- add info about VM_CATEGORY
-     -- voicemail.conf
-        -- added usedirectory option
-        -- added VM_CIDNUM and VM_CIDNAME in message config
-   * chan IAX2
-     -- new jitterbuffer
-     -- added setvar option
-     -- added regex to iax2 show peers/users
-     -- allow multiple bindaddr lines in iax.conf
-     -- added reload command
-     -- added forcejitterbuffer option
-     -- added note about specifying bindport before bindaddr
-     -- added trunktimestamps option
-   * chan Agent
-     -- added agent logoff CLI command
-   * chan OSS
-     -- added Flash CLI command
-   * chan SIP
-     -- added setvar option
-     -- added compactheaders option
-     -- added usereqphone option
-     -- added registertimeout option
-     -- added externhost option
-     -- added sip notify CLI command
-     -- added sip_notify.conf
-     -- added allowguest option
-   * chan Zap
-     -- added hanguponplarityswitch option
-     -- added sendcalleridafter option
-     -- added priresetinterval option
-     -- added TON/NPI config options (the ones right above the resetinterval option)
-     -- added answeronpolarityswitch option
-     -- added "never" for resetinterval
-   * extensions
-     -- allow '*' when including files (#include "sip-*.conf")
-     -- added eswitch
-   * General
-     -- added #exec syntax for including output from a command
-     -- added show features CLI command
-     -- added configuration templates for category inheritance

Modified: team/murf/macrogosub/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/apps/app_chanspy.c?rev=43746&r1=43745&r2=43746&view=diff
==============================================================================
--- team/murf/macrogosub/apps/app_chanspy.c (original)
+++ team/murf/macrogosub/apps/app_chanspy.c Tue Sep 26 22:17:01 2006
@@ -277,8 +277,10 @@
 
 	if (ast_test_flag(flags, OPTION_WHISPER)) {
 		struct ast_filestream *beepstream;
+		int old_write_format = 0;
 
 		ast_channel_whisper_start(csth.spy.chan);
+		old_write_format = chan->writeformat;
 		if ((beepstream = ast_openstream_full(chan, "beep", chan->language, 1))) {
 			struct ast_frame *f;
 
@@ -288,7 +290,10 @@
 			}
 
 			ast_closestream(beepstream);
-		}
+			chan->stream = NULL;
+		}
+		if (old_write_format)
+			ast_set_write_format(chan, old_write_format);
 	}
 
 	if (ast_test_flag(flags, OPTION_PRIVATE))

Modified: team/murf/macrogosub/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/apps/app_meetme.c?rev=43746&r1=43745&r2=43746&view=diff
==============================================================================
--- team/murf/macrogosub/apps/app_meetme.c (original)
+++ team/murf/macrogosub/apps/app_meetme.c Tue Sep 26 22:17:01 2006
@@ -651,6 +651,7 @@
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno);
 			AST_LIST_INSERT_HEAD(&confs, cnf, list);
+			manager_event(EVENT_FLAG_CALL, "MeetmeStart", "Meetme: %s\r\n", cnf->confno);
 		} 
 	}
  cnfout:
@@ -946,6 +947,7 @@
 	int x;
 	
 	AST_LIST_REMOVE(&confs, conf, list);
+	manager_event(EVENT_FLAG_CALL, "MeetmeEnd", "Meetme: %s\r\n", conf->confno);
 
 	if (conf->recording == MEETME_RECORD_ACTIVE) {
 		conf->recording = MEETME_RECORD_TERMINATE;

Modified: team/murf/macrogosub/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/apps/app_queue.c?rev=43746&r1=43745&r2=43746&view=diff
==============================================================================
--- team/murf/macrogosub/apps/app_queue.c (original)
+++ team/murf/macrogosub/apps/app_queue.c Tue Sep 26 22:17:01 2006
@@ -3984,8 +3984,66 @@
 	return RESULT_SUCCESS;
 }
 
+/* Dump summary of queue info */
+static int manager_queues_summary(struct mansession *s, struct message *m)
+{
+	time_t now;
+	int qmemcount = 0;
+	int qmemavail = 0;
+	int qchancount = 0;
+	char *id = astman_get_header(m, "ActionID");
+	char *queuefilter = astman_get_header(m, "Queue");
+	char idText[256] = "";
+	struct call_queue *q;
+	struct queue_ent *qe;
+	struct member *mem;
+
+	astman_send_ack(s, m, "Queue summary will follow");
+	time(&now);
+	AST_LIST_LOCK(&queues);
+	if (!ast_strlen_zero(id))
+		snprintf(idText, 256, "ActionID: %s\r\n", id);
+        AST_LIST_TRAVERSE(&queues, q, list) {
+		ast_mutex_lock(&q->lock);
+
+		/* List queue properties */
+		if (ast_strlen_zero(queuefilter) || !strcmp(q->name, queuefilter)) {
+			/* List Queue Members */
+			for (mem = q->members; mem; mem = mem->next) {
+				if ((mem->status != AST_DEVICE_UNAVAILABLE) && (mem->status != AST_DEVICE_INVALID)) {
+					++qmemcount;
+					if (((mem->status == AST_DEVICE_NOT_INUSE) || (mem->status == AST_DEVICE_UNKNOWN)) && !(mem->paused)) {
+						++qmemavail;
+					}
+				}
+			}
+			for (qe = q->head; qe; qe = qe->next) {
+				++qchancount;
+			}
+			astman_append(s, "Event: QueueSummary\r\n"
+				"Queue: %s\r\n"
+				"LoggedIn: %d\r\n"
+				"Available: %d\r\n"
+				"Callers: %d\r\n" 
+				"HoldTime: %d\r\n"
+				"%s"
+				"\r\n",
+				q->name, qmemcount, qmemavail, qchancount, q->holdtime, idText);
+		}
+		ast_mutex_unlock(&q->lock);
+	}
+	astman_append(s,
+		"Event: QueueSummaryComplete\r\n"
+		"%s"
+		"\r\n", idText);
+
+	AST_LIST_UNLOCK(&queues);
+
+	return RESULT_SUCCESS;
+}
+
 /* Dump queue status */
-static int manager_queues_status( struct mansession *s, struct message *m )
+static int manager_queues_status(struct mansession *s, struct message *m)
 {
 	time_t now;
 	int pos;
@@ -4369,6 +4427,7 @@
 	res = ast_manager_unregister("QueueStatus");
 	res |= ast_manager_unregister("Queues");
 	res |= ast_manager_unregister("QueueStatus");
+	res |= ast_manager_unregister("QueueSummary");
 	res |= ast_manager_unregister("QueueAdd");
 	res |= ast_manager_unregister("QueueRemove");
 	res |= ast_manager_unregister("QueuePause");
@@ -4405,6 +4464,7 @@
 	res |= ast_register_application(app_ql, ql_exec, app_ql_synopsis, app_ql_descrip);
 	res |= ast_manager_register("Queues", 0, manager_queues_show, "Queues");
 	res |= ast_manager_register("QueueStatus", 0, manager_queues_status, "Queue Status");
+	res |= ast_manager_register("QueueSummary", 0, manager_queues_summary, "Queue Summary");
 	res |= ast_manager_register("QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member, "Add interface to queue.");
 	res |= ast_manager_register("QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member, "Remove interface from queue.");
 	res |= ast_manager_register("QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable");

Modified: team/murf/macrogosub/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/apps/app_stack.c?rev=43746&r1=43745&r2=43746&view=diff
==============================================================================
--- team/murf/macrogosub/apps/app_stack.c (original)
+++ team/murf/macrogosub/apps/app_stack.c Tue Sep 26 22:17:01 2006
@@ -96,7 +96,7 @@
 static int return_exec(struct ast_channel *chan, void *data)
 {
 	const char *label = pbx_builtin_getvar_helper(chan, STACKVAR);
-	char argname[15];
+	char argname[15], *retval = data;
 	int numargs, i;
 
 	if (ast_strlen_zero(label)) {
@@ -121,6 +121,9 @@
 
 	/* Remove the current frame from the Gosub stack */
 	pbx_builtin_setvar_helper(chan, STACKVAR, NULL);
+
+	/* Set a return value, if any */
+	pbx_builtin_setvar_helper(chan, "GOSUB_RETVAL", S_OR(retval, ""));
 	return 0;
 }
 

Modified: team/murf/macrogosub/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/apps/app_voicemail.c?rev=43746&r1=43745&r2=43746&view=diff
==============================================================================
--- team/murf/macrogosub/apps/app_voicemail.c (original)
+++ team/murf/macrogosub/apps/app_voicemail.c Tue Sep 26 22:17:01 2006
@@ -6506,12 +6506,13 @@
 static int append_mailbox(char *context, char *mbox, char *data)
 {
 	/* Assumes lock is already held */
-	char tmp[256] = "";
+	char *tmp;
 	char *stringp;
 	char *s;
 	struct ast_vm_user *vmu;
 
-	ast_copy_string(tmp, data, sizeof(tmp));
+	tmp = ast_strdupa(data);
+
 	if ((vmu = find_or_create(context, mbox))) {
 		populate_defaults(vmu);
 

Modified: team/murf/macrogosub/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/macrogosub/channels/chan_iax2.c?rev=43746&r1=43745&r2=43746&view=diff
==============================================================================
--- team/murf/macrogosub/channels/chan_iax2.c (original)
+++ team/murf/macrogosub/channels/chan_iax2.c Tue Sep 26 22:17:01 2006
@@ -228,7 +228,6 @@
 static pthread_t netthreadid = AST_PTHREADT_NULL;
 static pthread_t schedthreadid = AST_PTHREADT_NULL;
 AST_MUTEX_DEFINE_STATIC(sched_lock);
-static int sched_halt = 0;
 static ast_cond_t sched_cond;
 
 enum {
@@ -382,7 +381,7 @@
 AST_MUTEX_DEFINE_STATIC(tpeerlock);
 
 struct iax_firmware {
-	struct iax_firmware *next;
+	AST_LIST_ENTRY(iax_firmware) list;
 	int fd;
 	int mmaplen;
 	int dead;
@@ -608,7 +607,7 @@
 	int calling_tns;
 	int calling_pres;
 	int amaflags;
-	struct iax2_dpcache *dpentries;
+	AST_LIST_HEAD_NOLOCK(, iax2_dpcache) dpentries;
 	struct ast_variable *vars;
 	/*! last received remote rr */
 	struct iax_rr remote_rr;
@@ -631,10 +630,7 @@
 
 static AST_LIST_HEAD_STATIC(peers, iax2_peer);
 
-static struct ast_firmware_list {
-	struct iax_firmware *wares;
-	ast_mutex_t lock;
-} waresl;
+static AST_LIST_HEAD_STATIC(firmwares, iax_firmware);
 
 /*! Extension exists */
 #define CACHE_FLAG_EXISTS		(1 << 0)
@@ -653,7 +649,7 @@
 /*! Matchmore */
 #define CACHE_FLAG_MATCHMORE		(1 << 7)
 
-static struct iax2_dpcache {
+struct iax2_dpcache {
 	char peercontext[AST_MAX_CONTEXT];
 	char exten[AST_MAX_EXTENSION];
 	struct timeval orig;
@@ -661,11 +657,11 @@
 	int flags;
 	unsigned short callno;
 	int waiters[256];
-	struct iax2_dpcache *next;
-	struct iax2_dpcache *peer;	/*!< For linking in peers */
-} *dpcache;
-
-AST_MUTEX_DEFINE_STATIC(dpcache_lock);
+	AST_LIST_ENTRY(iax2_dpcache) cache_list;
+	AST_LIST_ENTRY(iax2_dpcache) peer_list;
+};
+
+static AST_LIST_HEAD_STATIC(dpcache, iax2_dpcache);
 
 static void reg_source_db(struct iax2_peer *p);
 static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in *sin);
@@ -693,7 +689,6 @@
 	char curfunc[80];
 #endif	
 	int actions;
-	int halt;
 	pthread_t threadid;
 	int threadnum;
 	struct sockaddr_in iosin;
@@ -1069,6 +1064,8 @@
 	jbconf.max_contig_interp = maxjitterinterps;
 	jb_setconf(tmp->jb,&jbconf);
 
+	AST_LIST_HEAD_INIT_NOLOCK(&tmp->dpentries);
+
 	return tmp;
 }
 
@@ -1304,34 +1301,31 @@
 static int try_firmware(char *s)
 {
 	struct stat stbuf;
-	struct iax_firmware *cur;
-	int ifd;
-	int fd;
-	int res;
-	
+	struct iax_firmware *cur = NULL;
+	int ifd, fd, res, len, chunk;
 	struct ast_iax2_firmware_header *fwh, fwh2;
 	struct MD5Context md5;
-	unsigned char sum[16];
-	unsigned char buf[1024];
-	int len, chunk;
-	char *s2;
-	char *last;
-	s2 = alloca(strlen(s) + 100);
-	if (!s2) {
+	unsigned char sum[16], buf[1024];
+	char *s2, *last;
+
+	if (!(s2 = alloca(strlen(s) + 100))) {
 		ast_log(LOG_WARNING, "Alloca failed!\n");
 		return -1;
 	}
+
 	last = strrchr(s, '/');
 	if (last)
 		last++;
 	else
 		last = s;
+
 	snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)ast_random());
-	res = stat(s, &stbuf);
-	if (res < 0) {
+
+	if ((res = stat(s, &stbuf) < 0)) {
 		ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno));
 		return -1;
 	}
+
 	/* Make sure it's not a directory */
 	if (S_ISDIR(stbuf.st_mode))
 		return -1;
@@ -1409,8 +1403,8 @@
 		close(fd);
 		return -1;
 	}
-	cur = waresl.wares;
-	while(cur) {
+
+	AST_LIST_TRAVERSE(&firmwares, cur, list) {
 		if (!strcmp((char *)cur->fwh->devname, (char *)fwh->devname)) {
 			/* Found a candidate */
 			if (cur->dead || (ntohs(cur->fwh->version) < ntohs(fwh->version)))
@@ -1422,20 +1416,16 @@
 			close(fd);
 			return 0;
 		}
-		cur = cur->next;
-	}
-	if (!cur) {
-		/* Allocate a new one and link it */
-		if ((cur = ast_calloc(1, sizeof(*cur)))) {
-			cur->fd = -1;
-			cur->next = waresl.wares;
-			waresl.wares = cur;
-		}
-	}
+	}
+	
+	if (!cur && ((cur = ast_calloc(1, sizeof(*cur))))) {
+		cur->fd = -1;
+		AST_LIST_INSERT_TAIL(&firmwares, cur, list);
+	}
+	
 	if (cur) {
-		if (cur->fwh) {
+		if (cur->fwh)
 			munmap(cur->fwh, cur->mmaplen);
-		}
 		if (cur->fd > -1)
 			close(cur->fd);
 		cur->fwh = fwh;
@@ -1443,25 +1433,27 @@
 		cur->mmaplen = stbuf.st_size;
 		cur->dead = 0;
 	}
+	
 	return 0;
 }
 
 static int iax_check_version(char *dev)
 {
 	int res = 0;
-	struct iax_firmware *cur;
-	if (!ast_strlen_zero(dev)) {
-		ast_mutex_lock(&waresl.lock);
-		cur = waresl.wares;
-		while(cur) {
-			if (!strcmp(dev, (char *)cur->fwh->devname)) {
-				res = ntohs(cur->fwh->version);
-				break;
-			}
-			cur = cur->next;
-		}
-		ast_mutex_unlock(&waresl.lock);
-	}
+	struct iax_firmware *cur = NULL;
+
+	if (ast_strlen_zero(dev))
+		return 0;
+
+	AST_LIST_LOCK(&firmwares);
+	AST_LIST_TRAVERSE(&firmwares, cur, list) {
+		if (!strcmp(dev, (char *)cur->fwh->devname)) {
+			res = ntohs(cur->fwh->version);
+			break;
+		}
+	}
+	AST_LIST_UNLOCK(&firmwares);
+
 	return res;
 }
 
@@ -1472,51 +1464,52 @@
 	unsigned int start = (desc >> 8) & 0xffffff;
 	unsigned int bytes;
 	struct iax_firmware *cur;
-	if (!ast_strlen_zero((char *)dev) && bs) {
-		start *= bs;
-		ast_mutex_lock(&waresl.lock);
-		cur = waresl.wares;
-		while(cur) {
-			if (!strcmp((char *)dev, (char *)cur->fwh->devname)) {
-				iax_ie_append_int(ied, IAX_IE_FWBLOCKDESC, desc);
-				if (start < ntohl(cur->fwh->datalen)) {
-					bytes = ntohl(cur->fwh->datalen) - start;
-					if (bytes > bs)
-						bytes = bs;
-					iax_ie_append_raw(ied, IAX_IE_FWBLOCKDATA, cur->fwh->data + start, bytes);
-				} else {
-					bytes = 0;
-					iax_ie_append(ied, IAX_IE_FWBLOCKDATA);
-				}
-				if (bytes == bs)
-					res = 0;
-				else
-					res = 1;
-				break;
-			}
-			cur = cur->next;
-		}
-		ast_mutex_unlock(&waresl.lock);
-	}
+
+	if (ast_strlen_zero((char *)dev) || !bs)
+		return -1;
+
+	start *= bs;
+	
+	AST_LIST_LOCK(&firmwares);
+	AST_LIST_TRAVERSE(&firmwares, cur, list) {
+		if (strcmp((char *)dev, (char *)cur->fwh->devname))
+			continue;
+		iax_ie_append_int(ied, IAX_IE_FWBLOCKDESC, desc);
+		if (start < ntohl(cur->fwh->datalen)) {
+			bytes = ntohl(cur->fwh->datalen) - start;
+			if (bytes > bs)
+				bytes = bs;
+			iax_ie_append_raw(ied, IAX_IE_FWBLOCKDATA, cur->fwh->data + start, bytes);
+		} else {
+			bytes = 0;
+			iax_ie_append(ied, IAX_IE_FWBLOCKDATA);
+		}
+		if (bytes == bs)
+			res = 0;
+		else
+			res = 1;
+		break;
+	}
+	AST_LIST_UNLOCK(&firmwares);
+
 	return res;
 }
 
 
 static void reload_firmware(void)
 {
-	struct iax_firmware *cur, *curl, *curp;
+	struct iax_firmware *cur = NULL;
 	DIR *fwd;
 	struct dirent *de;
-	char dir[256];
-	char fn[256];
+	char dir[256], fn[256];
+
+	AST_LIST_LOCK(&firmwares);
+
 	/* Mark all as dead */
-	ast_mutex_lock(&waresl.lock);
-	cur = waresl.wares;
-	while(cur) {
+	AST_LIST_TRAVERSE(&firmwares, cur, list)
 		cur->dead = 1;
-		cur = cur->next;
-	}
-	/* Now that we've freed them, load the new ones */
+
+	/* Now that we have marked them dead... load new ones */
 	snprintf(dir, sizeof(dir), "%s/firmware/iax", (char *)ast_config_AST_DATA_DIR);
 	fwd = opendir(dir);
 	if (fwd) {
@@ -1534,23 +1527,13 @@
 		ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", dir, strerror(errno));
 
 	/* Clean up leftovers */
-	cur = waresl.wares;
-	curp = NULL;
-	while(cur) {
-		curl = cur;
-		cur = cur->next;
-		if (curl->dead) {
-			if (curp) {
-				curp->next = cur;
-			} else {
-				waresl.wares = cur;
-			}
-			destroy_firmware(curl);
-		} else {
-			curp = cur;
-		}
-	}
-	ast_mutex_unlock(&waresl.lock);
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&firmwares, cur, list) {
+		if (!cur->dead)
+			continue;
+		AST_LIST_REMOVE_CURRENT(&firmwares, list);
+		destroy_firmware(cur);
+	}
+	AST_LIST_TRAVERSE_SAFE_END
 }
 
 static int __do_deliver(void *data)
@@ -1687,20 +1670,22 @@
 
 static int iax2_predestroy(int callno)
 {
-	struct ast_channel *c;
-	struct chan_iax2_pvt *pvt;
+	struct ast_channel *c = NULL;
+	struct chan_iax2_pvt *pvt = NULL;
+
 	ast_mutex_lock(&iaxsl[callno]);
-	pvt = iaxs[callno];
-	if (!pvt) {
+
+	if (!(pvt = iaxs[callno])) {
 		ast_mutex_unlock(&iaxsl[callno]);
 		return -1;
 	}
+
 	if (!ast_test_flag(pvt, IAX_ALREADYGONE)) {
 		iax2_destroy_helper(pvt);
 		ast_set_flag(pvt, IAX_ALREADYGONE);	
 	}
-	c = pvt->owner;
-	if (c) {
+
+	if ((c = pvt->owner)) {
 		c->_softhangup |= AST_SOFTHANGUP_DEV;
 		c->tech_pvt = NULL;
 		ast_queue_hangup(c);
@@ -1708,7 +1693,9 @@
 		ast_atomic_fetchadd_int(&usecnt, -1);
 		ast_update_use_count();
 	}
+
 	ast_mutex_unlock(&iaxsl[callno]);
+
 	return 0;
 }
 
@@ -1723,9 +1710,9 @@
 
 static void iax2_destroy(int callno)
 {
-	struct chan_iax2_pvt *pvt;
-	struct iax_frame *cur;
-	struct ast_channel *owner;
+	struct chan_iax2_pvt *pvt = NULL;
+	struct iax_frame *cur = NULL;
+	struct ast_channel *owner = NULL;
 
 retry:
 	ast_mutex_lock(&iaxsl[callno]);
@@ -2096,16 +2083,18 @@
 
 static int iax2_show_cache(int fd, int argc, char *argv[])
 {
-	struct iax2_dpcache *dp;
-	char tmp[1024], *pc;
-	int s;
-	int x,y;
+	struct iax2_dpcache *dp = NULL;
+	char tmp[1024], *pc = NULL;
+	int s, x, y;
 	struct timeval tv;
+
 	gettimeofday(&tv, NULL);
-	ast_mutex_lock(&dpcache_lock);
-	dp = dpcache;
+
+	AST_LIST_LOCK(&dpcache);
+
 	ast_cli(fd, "%-20.20s %-12.12s %-9.9s %-8.8s %s\n", "Peer/Context", "Exten", "Exp.", "Wait.", "Flags");
-	while(dp) {
+
+	AST_LIST_TRAVERSE(&dpcache, dp, cache_list) {
 		s = dp->expiry.tv_sec - tv.tv_sec;
 		tmp[0] = '\0';
 		if (dp->flags & CACHE_FLAG_EXISTS)
@@ -2142,9 +2131,10 @@
 			ast_cli(fd, "%-20.20s %-12.12s %-9d %-8d %s\n", pc, dp->exten, s, y, tmp);
 		else
 			ast_cli(fd, "%-20.20s %-12.12s %-9.9s %-8d %s\n", pc, dp->exten, "(expired)", y, tmp);
-		dp = dp->next;
-	}
-	ast_mutex_unlock(&dpcache_lock);
+	}
+
+	AST_LIST_LOCK(&dpcache);
+
 	return RESULT_SUCCESS;
 }
 
@@ -4198,18 +4188,21 @@
 #else /* __FreeBSD__ */
 #define FORMAT "%-15.15s  %-15d %-15d\n" /* XXX 2.95 ? */
 #endif /* __FreeBSD__ */
-	struct iax_firmware *cur;
+	struct iax_firmware *cur = NULL;
+
 	if ((argc != 3) && (argc != 4))
 		return RESULT_SHOWUSAGE;
-	ast_mutex_lock(&waresl.lock);
+
+	AST_LIST_LOCK(&firmwares);
 	
 	ast_cli(fd, FORMAT2, "Device", "Version", "Size");
-	for (cur = waresl.wares;cur;cur = cur->next) {
+	AST_LIST_TRAVERSE(&firmwares, cur, list)
 		if ((argc == 3) || (!strcasecmp(argv[3], (char *)cur->fwh->devname))) 
 			ast_cli(fd, FORMAT, cur->fwh->devname, ntohs(cur->fwh->version),
 				(int)ntohl(cur->fwh->datalen));
-	}
-	ast_mutex_unlock(&waresl.lock);
+
+	AST_LIST_UNLOCK(&firmwares);
+
 	return RESULT_SUCCESS;
 #undef FORMAT
 #undef FORMAT2
@@ -5231,15 +5224,12 @@
 static int complete_dpreply(struct chan_iax2_pvt *pvt, struct iax_ies *ies)
 {
 	char exten[256] = "";
-	int status = CACHE_FLAG_UNKNOWN;
-	int expiry = iaxdefaultdpcache;
-	int x;
-	int matchmore = 0;
-	struct iax2_dpcache *dp, *prev;
+	int status = CACHE_FLAG_UNKNOWN, expiry = iaxdefaultdpcache, x, matchmore = 0;
+	struct iax2_dpcache *dp = NULL;
 	
 	if (ies->called_number)
 		ast_copy_string(exten, ies->called_number, sizeof(exten));
-
+	
 	if (ies->dpstatus & IAX_DPSTATUS_EXISTS)
 		status = CACHE_FLAG_EXISTS;
 	else if (ies->dpstatus & IAX_DPSTATUS_CANEXIST)
@@ -5247,40 +5237,31 @@
 	else if (ies->dpstatus & IAX_DPSTATUS_NONEXISTENT)
 		status = CACHE_FLAG_NONEXISTENT;
 
-	if (ies->dpstatus & IAX_DPSTATUS_IGNOREPAT) {
-		/* Don't really do anything with this */
-	}
 	if (ies->refresh)
 		expiry = ies->refresh;
 	if (ies->dpstatus & IAX_DPSTATUS_MATCHMORE)
 		matchmore = CACHE_FLAG_MATCHMORE;
-	ast_mutex_lock(&dpcache_lock);
-	prev = NULL;
-	dp = pvt->dpentries;
-	while(dp) {
-		if (!strcmp(dp->exten, exten)) {
-			/* Let them go */
-			if (prev)
-				prev->peer = dp->peer;
-			else
-				pvt->dpentries = dp->peer;
-			dp->peer = NULL;
-			dp->callno = 0;
-			dp->expiry.tv_sec = dp->orig.tv_sec + expiry;
-			if (dp->flags & CACHE_FLAG_PENDING) {
-				dp->flags &= ~CACHE_FLAG_PENDING;
-				dp->flags |= status;
-				dp->flags |= matchmore;
-			}
-			/* Wake up waiters */
-			for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++)
-				if (dp->waiters[x] > -1)
-					write(dp->waiters[x], "asdf", 4);
-		}
-		prev = dp;
-		dp = dp->peer;
-	}
-	ast_mutex_unlock(&dpcache_lock);
+	
+	AST_LIST_LOCK(&dpcache);
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&dpcache, dp, peer_list) {
+		if (strcmp(dp->exten, exten))
+			continue;
+		AST_LIST_REMOVE_CURRENT(&dpcache, peer_list);
+		dp->callno = 0;
+		dp->expiry.tv_sec = dp->orig.tv_sec + expiry;
+		if (dp->flags & CACHE_FLAG_PENDING) {
+			dp->flags &= ~CACHE_FLAG_PENDING;
+			dp->flags |= status;
+			dp->flags |= matchmore;
+		}
+		/* Wake up waiters */
+		for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++)
+			if (dp->waiters[x] > -1)
+				write(dp->waiters[x], "asdf", 4);
+	}
+	AST_LIST_TRAVERSE_SAFE_END
+	AST_LIST_UNLOCK(&dpcache);
+
 	return 0;
 }
 
@@ -7024,15 +7005,11 @@
 						}
 					}
 				}
-				ast_mutex_lock(&dpcache_lock);
-				dp = iaxs[fr->callno]->dpentries;
-				while(dp) {
-					if (!(dp->flags & CACHE_FLAG_TRANSMITTED)) {
+				AST_LIST_LOCK(&dpcache);
+				AST_LIST_TRAVERSE(&iaxs[fr->callno]->dpentries, dp, peer_list)
+					if (!(dp->flags & CACHE_FLAG_TRANSMITTED))
 						iax2_dprequest(dp, fr->callno);
-					}
-					dp = dp->peer;
-				}
-				ast_mutex_unlock(&dpcache_lock);
+				AST_LIST_UNLOCK(&dpcache);
 				break;
 			case IAX_COMMAND_POKE:
 				/* Send back a pong packet with the original timestamp */
@@ -7607,11 +7584,6 @@
 		}
 		ast_mutex_unlock(&thread->lock);
 
-		/* If we were signalled, then we are already out of both lists or we are shutting down */
-		if (thread->halt) {
-			break;
-		}
-
 		/* Add ourselves to the active list now */
 		AST_LIST_LOCK(&active_list);
 		AST_LIST_INSERT_HEAD(&active_list, thread, list);
@@ -7654,11 +7626,6 @@
 			AST_LIST_UNLOCK(&idle_list);
 		}
 	}
-
-	/* Free our own memory */
-	ast_mutex_destroy(&thread->lock);
-	ast_cond_destroy(&thread->cond);
-	free(thread);
 
 	return NULL;
 }
@@ -8015,17 +7982,17 @@
 		ts.tv_sec = tv.tv_sec;
 		ts.tv_nsec = tv.tv_usec * 1000;
 
+		pthread_testcancel();
 		ast_mutex_lock(&sched_lock);
 		ast_cond_timedwait(&sched_cond, &sched_lock, &ts);
-		if (sched_halt == 1)
-			break;
 		ast_mutex_unlock(&sched_lock);
+		pthread_testcancel();
 
 		count = ast_sched_runq(sched);
 		if (count >= 20)
 			ast_log(LOG_DEBUG, "chan_iax2: ast_sched_runq ran %d scheduled tasks all at once\n", count);
 	}
-	ast_mutex_unlock(&sched_lock);
+
 	return NULL;
 }
 
@@ -9211,48 +9178,32 @@
 
 static struct iax2_dpcache *find_cache(struct ast_channel *chan, const char *data, const char *context, const char *exten, int priority)
 {
-	struct iax2_dpcache *dp, *prev = NULL, *next;
+	struct iax2_dpcache *dp = NULL;
 	struct timeval tv;
-	int x;
-	int com[2];
-	int timeout;
-	int old=0;
-	int outfd;
-	int abort;
-	int callno;
-	struct ast_channel *c;
-	struct ast_frame *f;
+	int x, com[2], timeout, old = 0, outfd, abort, callno;
+	struct ast_channel *c = NULL;
+	struct ast_frame *f = NULL;
+
 	gettimeofday(&tv, NULL);
-	dp = dpcache;
-	while(dp) {
-		next = dp->next;
-		/* Expire old caches */
+
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&dpcache, dp, cache_list) {
 		if (ast_tvcmp(tv, dp->expiry) > 0) {
-				/* It's expired, let it disappear */
-				if (prev)
-					prev->next = dp->next;
-				else
-					dpcache = dp->next;
-				if (!dp->peer && !(dp->flags & CACHE_FLAG_PENDING) && !dp->callno) {
-					/* Free memory and go again */
-					free(dp);
-				} else {
-					ast_log(LOG_WARNING, "DP still has peer field or pending or callno (flags = %d, peer = %p callno = %d)\n", dp->flags, dp->peer, dp->callno);
-				}
-				dp = next;
-				continue;
-		}
-		/* We found an entry that matches us! */
-		if (!strcmp(dp->peercontext, data) && !strcmp(dp->exten, exten)) 
+			AST_LIST_REMOVE_CURRENT(&dpcache, cache_list);
+			if ((dp->flags & CACHE_FLAG_PENDING) || dp->callno)
+				ast_log(LOG_WARNING, "DP still has peer field or pending or callno (flags = %d, peer = blah, callno = %d)\n", dp->flags, dp->callno);
+			else
+				free(dp);
+			continue;
+		}
+		if (!strcmp(dp->peercontext, data) && !strcmp(dp->exten, exten))
 			break;
-		prev = dp;
-		dp = next;
-	}
+	}
+	AST_LIST_TRAVERSE_SAFE_END
+
 	if (!dp) {
 		/* No matching entry.  Create a new one. */
 		/* First, can we make a callno? */
-		callno = cache_get_callno_locked(data);
-		if (callno < 0) {
+		if ((callno = cache_get_callno_locked(data)) < 0) {
 			ast_log(LOG_WARNING, "Unable to generate call for '%s'\n", data);
 			return NULL;
 		}
@@ -9266,18 +9217,18 @@
 		dp->orig = dp->expiry;
 		/* Expires in 30 mins by default */
 		dp->expiry.tv_sec += iaxdefaultdpcache;
-		dp->next = dpcache;
 		dp->flags = CACHE_FLAG_PENDING;
 		for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++)
 			dp->waiters[x] = -1;
-		dpcache = dp;
-		dp->peer = iaxs[callno]->dpentries;
-		iaxs[callno]->dpentries = dp;
+		/* Insert into the lists */
+		AST_LIST_INSERT_TAIL(&dpcache, dp, cache_list);
+		AST_LIST_INSERT_TAIL(&iaxs[callno]->dpentries, dp, peer_list);
 		/* Send the request if we're already up */
 		if (ast_test_flag(&iaxs[callno]->state, IAX_STATE_STARTED))
 			iax2_dprequest(dp, callno);
 		ast_mutex_unlock(&iaxsl[callno]);
 	}
+
 	/* By here we must have a dp */
 	if (dp->flags & CACHE_FLAG_PENDING) {
 		/* Okay, here it starts to get nasty.  We need a pipe now to wait
@@ -9299,31 +9250,27 @@
 		/* Okay, now we wait */
 		timeout = iaxdefaulttimeout * 1000;
 		/* Temporarily unlock */
-		ast_mutex_unlock(&dpcache_lock);
+		AST_LIST_UNLOCK(&dpcache);
 		/* Defer any dtmf */
 		if (chan)
 			old = ast_channel_defer_dtmf(chan);
 		abort = 0;
 		while(timeout) {
 			c = ast_waitfor_nandfds(&chan, chan ? 1 : 0, &com[0], 1, NULL, &outfd, &timeout);
-			if (outfd > -1) {
+			if (outfd > -1)
+				break;
+			if (!c)
+				continue;
+			if (!(f = ast_read(c))) {
+				abort = 1;
 				break;
 			}
-			if (c) {
-				f = ast_read(c);
-				if (f)
-					ast_frfree(f);
-				else {
-					/* Got hung up on, abort! */
-					break;
-					abort = 1;
-				}
-			}
+			ast_frfree(f);
 		}
 		if (!timeout) {
 			ast_log(LOG_WARNING, "Timeout waiting for %s exten %s\n", data, exten);
 		}
-		ast_mutex_lock(&dpcache_lock);
+		AST_LIST_LOCK(&dpcache);

[... 966 lines stripped ...]


More information about the asterisk-commits mailing list