[asterisk-commits] murf: branch murf/bug11210 r111440 - in /team/murf/bug11210: ./ apps/ channel...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 27 12:17:34 CDT 2008


Author: murf
Date: Thu Mar 27 12:17:34 2008
New Revision: 111440

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111440
Log:
Merged revisions 111067,111083,111123,111127,111130,111132,111185,111213,111246,111285,111295,111360,111410 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r111067 | mmichelson | 2008-03-26 13:26:23 -0600 (Wed, 26 Mar 2008) | 17 lines

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

........
r111049 | mmichelson | 2008-03-26 14:22:16 -0500 (Wed, 26 Mar 2008) | 9 lines

Add a lock to the vm_state structure and use the lock around mail_open calls
to prevent concurrent access of the same mailstream. This, along with trunk's
ability to configure TCP timeouts for IMAP storage will help to prevent
crashes and hangs when using voicemail with IMAP storage.

(closes issue #10487)
Reported by: ewilhelmsen


........

................
r111083 | file | 2008-03-26 13:29:26 -0600 (Wed, 26 Mar 2008) | 4 lines

Add expiry value to the sip show subscriptions CLI command.
(closes issue #12025)
Reported by: agx

................
r111123 | mmichelson | 2008-03-26 13:39:23 -0600 (Wed, 26 Mar 2008) | 12 lines

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

........
r111121 | mmichelson | 2008-03-26 14:37:36 -0500 (Wed, 26 Mar 2008) | 4 lines

This code change is made just for clarification. It does exactly
the same thing as before. It just doesn't look as wrong.


........

................
r111127 | kpfleming | 2008-03-26 13:52:27 -0600 (Wed, 26 Mar 2008) | 18 lines

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

................
r111126 | kpfleming | 2008-03-26 14:51:24 -0500 (Wed, 26 Mar 2008) | 10 lines

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

........
r111125 | kpfleming | 2008-03-26 14:49:30 -0500 (Wed, 26 Mar 2008) | 2 lines

update UPGRADE notes to document usage of the script

........

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

................
r111130 | file | 2008-03-26 13:56:40 -0600 (Wed, 26 Mar 2008) | 14 lines

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

........
r111129 | file | 2008-03-26 16:55:08 -0300 (Wed, 26 Mar 2008) | 6 lines

Update autosupport script.
(closes issue #12310)
Reported by: angler
Patches:
      autosupport.diff uploaded by angler (license 106)

........

................
r111132 | tilghman | 2008-03-26 13:58:09 -0600 (Wed, 26 Mar 2008) | 2 lines

Simplify new macro, simplify configfile logic, now that list is sorted

................
r111185 | tilghman | 2008-03-26 14:34:05 -0600 (Wed, 26 Mar 2008) | 2 lines

Oops, missed one

................
r111213 | twilson | 2008-03-26 15:23:29 -0600 (Wed, 26 Mar 2008) | 2 lines

Stupid strcasecmp function :-)

................
r111246 | qwell | 2008-03-26 17:27:33 -0600 (Wed, 26 Mar 2008) | 17 lines

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

........
r111245 | qwell | 2008-03-26 18:26:33 -0500 (Wed, 26 Mar 2008) | 9 lines

Remove excessive smoother optimization that was causing audio glitches (small "pops")
 after (about 200ms later) an "incorrectly" sized frame was received.

While it would be very nice to keep this as optimized as possible, it makes no sense
 for the smoother to be dropping random bits of audio like this.  Isn't that the
 whole point of a smoother?

Closes issue #12093.

........

................
r111285 | qwell | 2008-03-26 18:25:56 -0600 (Wed, 26 Mar 2008) | 9 lines

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

........
r111280 | qwell | 2008-03-26 19:25:13 -0500 (Wed, 26 Mar 2008) | 1 line

Put this flag back so we don't change the API.
........

................
r111295 | qwell | 2008-03-26 18:27:35 -0600 (Wed, 26 Mar 2008) | 1 line

But we can change the API here.
................
r111360 | murf | 2008-03-26 22:47:12 -0600 (Wed, 26 Mar 2008) | 23 lines

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

........
r111341 | murf | 2008-03-26 21:21:05 -0600 (Wed, 26 Mar 2008) | 15 lines


(closes issue #12302)
Reported by: pj
Tested by: murf

These changes will set a channel variable ~~EXTEN~~ just before generating code
for a switch, with the value of ${EXTEN}. The exten is marked as having a switch, 
and ever after that, till the end of the exten, we substitute any ${EXTEN} 
with ${~~EXTEN~~} instead in application arguments; (and the ${EXTEN: also). 
The reason for this, is that because switches are coded using 
separate extensions to provide pattern matching, and
jumping to/from these switch extensions messes up the ${EXTEN} value, 
which blows the minds of users.


........

................
r111410 | murf | 2008-03-27 07:29:41 -0600 (Thu, 27 Mar 2008) | 17 lines

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

........
r111391 | murf | 2008-03-27 07:03:28 -0600 (Thu, 27 Mar 2008) | 9 lines

These small documentation updates made in response to a query in
asterisk-users, where a user was using Playback, but needed the
features of Background, and had no idea that Background existed,
or that it might provide the features he needed. I thought the
best way to avert these kinds of queries was to provide "See Also"
references in all three of "Background", "Playback", "WaitExten".
Perhaps a project to do this with all related apps is in order.


........

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

Modified:
    team/murf/bug11210/   (props changed)
    team/murf/bug11210/UPGRADE.txt
    team/murf/bug11210/apps/app_playback.c
    team/murf/bug11210/apps/app_voicemail.c
    team/murf/bug11210/channels/chan_sip.c
    team/murf/bug11210/channels/misdn_config.c
    team/murf/bug11210/contrib/scripts/autosupport
    team/murf/bug11210/include/asterisk/ael_structs.h
    team/murf/bug11210/include/asterisk/linkedlists.h
    team/murf/bug11210/include/asterisk/pval.h
    team/murf/bug11210/main/config.c
    team/murf/bug11210/main/frame.c
    team/murf/bug11210/main/http.c
    team/murf/bug11210/main/pbx.c
    team/murf/bug11210/pbx/pbx_ael.c
    team/murf/bug11210/res/ael/pval.c

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
    automerge = yep

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Mar 27 12:17:34 2008
@@ -1,1 +1,1 @@
-/trunk:1-111055
+/trunk:1-111439

Modified: team/murf/bug11210/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/UPGRADE.txt?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/UPGRADE.txt (original)
+++ team/murf/bug11210/UPGRADE.txt Thu Mar 27 12:17:34 2008
@@ -195,15 +195,8 @@
   (http://www.gipscorp.com). This code is not licensed for
   distribution, and thus has been removed from the Asterisk source
   code distribution. If you wish to use codec_ilbc to support iLBC
-  channels in Asterisk, you must go to:
-
-  http://ilbcfreeware.org
-
-  and obtain the iLBC source code from that site, including agreeing
-  to the license agreement specified. The site has instructions on how
-  to extract the source code from the RFC file where it has been
-  published; after you have done that, copy the resulting *.c and *.h
-  files into the codecs/ilbc directory of the Asterisk source code
-  tree and follow your normal steps of building Asterisk. You will
-  need to run 'menuselect' and enable the iLBC codec in the 'Codec
-  Translators' category.
+  channels in Asterisk, you can run the contrib/scripts/get_ilbc_source.sh
+  script to download the source and put it in the proper place in
+  the Asterisk build tree. Once that is done you can follow your normal
+  steps of building Asterisk. You will need to run 'menuselect' and enable
+  the iLBC codec in the 'Codec  Translators' category.

Modified: team/murf/bug11210/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_playback.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/apps/app_playback.c (original)
+++ team/murf/bug11210/apps/app_playback.c Thu Mar 27 12:17:34 2008
@@ -55,6 +55,8 @@
 "This application sets the following channel variable upon completion:\n"
 " PLAYBACKSTATUS    The status of the playback attempt as a text string, one of\n"
 "               SUCCESS | FAILED\n"
+"See Also: Background (application) -- for playing soundfiles that are interruptible\n"
+"          WaitExten (application) -- wait for digits from caller, optionally play music on hold\n"
 ;
 
 

Modified: team/murf/bug11210/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_voicemail.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/apps/app_voicemail.c (original)
+++ team/murf/bug11210/apps/app_voicemail.c Thu Mar 27 12:17:34 2008
@@ -416,6 +416,7 @@
 	int starting;
 	int repeats;
 #ifdef IMAP_STORAGE
+	ast_mutex_t lock;
 	int updated;                         /*!< decremented on each mail check until 1 -allows delay */
 	long msgArray[256];
 	MAILSTREAM *mailstream;
@@ -5042,7 +5043,9 @@
 #endif
 		/* Connect to mailbox to get mailstream so we can get delimiter */ 
 		imap_mailbox_name(tmp, sizeof(tmp), vms, 0, 1);
+		ast_mutex_lock(&vms->lock);
 		stream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
+		ast_mutex_unlock(&vms->lock);
 		if (stream == NIL) {
 			ast_log(LOG_ERROR, "Can't connect to imap server %s\n", tmp);
 			return -1;
@@ -5057,7 +5060,9 @@
 	/* Now connect to the target folder */
 	imap_mailbox_name(tmp, sizeof(tmp), vms, box, 1);
 	ast_debug(3, "Before mail_open, server: %s, box:%d\n", tmp, box);
-	vms->mailstream = mail_open(stream, tmp, debug ? OP_DEBUG : NIL);
+	ast_mutex_lock(&vms->lock);
+	vms->mailstream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
+	ast_mutex_unlock(&vms->lock);
 	if (vms->mailstream == NIL) {
 		return -1;
 	} else {
@@ -9793,8 +9798,10 @@
 	AST_LIST_TRAVERSE_SAFE_END
 	AST_LIST_UNLOCK(&vmstates);
 	
-	if (vc)
+	if (vc) {
+		ast_mutex_destroy(&vc->vms->lock);
 		ast_free(vc);
+	}
 	else
 		ast_log(LOG_ERROR, "No vmstate found for user:%s, mailbox %s\n", vms->imapuser, vms->username);
 }
@@ -9823,6 +9830,7 @@
 	for (x = 0; x < 256; x++) {
 		vms->msgArray[x] = 0;
 	}
+	ast_mutex_init(&vms->lock);
 }
 
 static void check_msgArray(struct vm_state *vms) 

Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Thu Mar 27 12:17:34 2008
@@ -13875,8 +13875,9 @@
 	int numchans;   /* return value */
 };
 
-#define FORMAT3 "%-15.15s  %-10.10s  %-15.15s  %-15.15s  %-13.13s  %-15.15s %-10.10s\n"
-#define FORMAT2 "%-15.15s  %-10.10s  %-15.15s  %-15.15s  %-7.7s  %-15.15s\n"
+#define FORMAT4 "%-15.15s  %-10.10s  %-15.15s  %-15.15s  %-13.13s  %-15.15s %-10.10s %-6.6d\n"
+#define FORMAT3 "%-15.15s  %-10.10s  %-15.15s  %-15.15s  %-13.13s  %-15.15s %-10.10s %-6.6s\n"
+#define FORMAT2 "%-15.15s  %-10.10s  %-15.15s  %-15.15s  %-7.7s  %-15.15s %-6.6s\n"
 #define FORMAT  "%-15.15s  %-10.10s  %-15.15s  %-15.15s  %-3.3s %-3.3s  %-15.15s %-10.10s\n"
 
 /*! \brief callback for show channel|subscription */
@@ -13907,14 +13908,15 @@
 		struct ast_str *mailbox_str = ast_str_alloca(512);
 		if (cur->subscribed == MWI_NOTIFICATION && cur->relatedpeer)
 			peer_mailboxes_to_str(&mailbox_str, cur->relatedpeer);
-		ast_cli(arg->fd, FORMAT3, ast_inet_ntoa(dst->sin_addr),
+		ast_cli(arg->fd, FORMAT4, ast_inet_ntoa(dst->sin_addr),
 				S_OR(cur->username, S_OR(cur->cid_num, "(None)")), 
 			   	cur->callid,
 				/* the 'complete' exten/context is hidden in the refer_to field for subscriptions */
 				cur->subscribed == MWI_NOTIFICATION ? "--" : cur->subscribeuri,
 				cur->subscribed == MWI_NOTIFICATION ? "<none>" : ast_extension_state2str(cur->laststate), 
 				subscription_type2str(cur->subscribed),
-				cur->subscribed == MWI_NOTIFICATION ? S_OR(mailbox_str->str, "<none>") : "<none>"
+				cur->subscribed == MWI_NOTIFICATION ? S_OR(mailbox_str->str, "<none>") : "<none>",
+				cur->expiry
 			);
 		arg->numchans++;
 	}
@@ -13946,9 +13948,9 @@
 		return CLI_SHOWUSAGE;
 	arg.subscriptions = !strcasecmp(a->argv[e->args - 1], "subscriptions");
 	if (!arg.subscriptions)
-		ast_cli(arg.fd, FORMAT2, "Peer", "User/ANR", "Call ID", "Format", "Hold", "Last Message");
+		ast_cli(arg.fd, FORMAT2, "Peer", "User/ANR", "Call ID", "Format", "Hold", "Last Message", "Expiry");
 	else
-		ast_cli(arg.fd, FORMAT3, "Peer", "User", "Call ID", "Extension", "Last state", "Type", "Mailbox");
+		ast_cli(arg.fd, FORMAT3, "Peer", "User", "Call ID", "Extension", "Last state", "Type", "Mailbox", "Expiry");
 
 	/* iterate on the container and invoke the callback on each item */
 	ao2_t_callback(dialogs, OBJ_NODATA, show_channels_cb, &arg, "callback to show channels");

Modified: team/murf/bug11210/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/misdn_config.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/channels/misdn_config.c (original)
+++ team/murf/bug11210/channels/misdn_config.c Thu Mar 27 12:17:34 2008
@@ -38,9 +38,6 @@
 #include "asterisk/pbx.h"
 #include "asterisk/strings.h"
 #include "asterisk/utils.h"
-
-#define AST_LOAD_CFG ast_config_load
-#define AST_DESTROY_CFG ast_config_destroy
 
 #define NO_DEFAULT "<>"
 #define NONE 0
@@ -1095,7 +1092,7 @@
 	struct ast_variable *v;
 	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 
-	if (!(cfg = AST_LOAD_CFG(config, config_flags))) {
+	if (!(cfg = ast_config_load2(config, "chan_misdn", config_flags))) {
 		ast_log(LOG_WARNING, "missing file: misdn.conf\n");
 		return -1;
 	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
@@ -1149,7 +1146,7 @@
 	_fill_defaults();
 
 	misdn_cfg_unlock();
-	AST_DESTROY_CFG(cfg);
+	ast_config_destroy(cfg);
 
 	return 0;
 }

Modified: team/murf/bug11210/contrib/scripts/autosupport
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/contrib/scripts/autosupport?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/contrib/scripts/autosupport (original)
+++ team/murf/bug11210/contrib/scripts/autosupport Thu Mar 27 12:17:34 2008
@@ -12,12 +12,15 @@
 
 OUTPUT=$HOME/digiuminfo
 
-if [ $UID -ne  0 ]; then
+MYUID=$(id -u);
+
+if [ $MYUID -ne  0 ]; then
 
   echo "You must be root to run this."
- 
-exit 1
+  exit 1
 fi
+
+clear
 
 echo
 echo "This will gather information about your system such as:"
@@ -31,9 +34,16 @@
   rm -f $OUTPUT
 
   echo "------------------" >> $OUTPUT;
-  echo "PCI LIST " >> $OUTPUT;
+  echo "PCI LIST" >> $OUTPUT;
   echo "------------------" >> $OUTPUT;
-  lspci -vb >> $OUTPUT;
+  lspci -vvvb >> $OUTPUT;
+  echo >> $OUTPUT;
+  echo >> $OUTPUT;
+
+  echo "------------------" >> $OUTPUT;
+  echo "PCI LIST(no lookup)" >> $OUTPUT;
+  echo "------------------" >> $OUTPUT;
+  lspci -vvvbn >> $OUTPUT;
   echo >> $OUTPUT;
   echo >> $OUTPUT;
 
@@ -41,13 +51,6 @@
   echo "INTERRUPTS" >> $OUTPUT;
   echo "------------------" >> $OUTPUT;
   cat /proc/interrupts >> $OUTPUT;
-  echo >> $OUTPUT;
-  echo >> $OUTPUT;
-
-  echo "------------------" >> $OUTPUT;
-  echo "DMESG OUTPUT" >> $OUTPUT;
-  echo "------------------" >> $OUTPUT;
-  dmesg >> $OUTPUT;
   echo >> $OUTPUT;
   echo >> $OUTPUT;
 
@@ -73,10 +76,44 @@
   echo >> $OUTPUT;
 
   echo "------------------" >> $OUTPUT;
-  echo "HDPARM STATUS" >> $OUTPUT;
+  echo "VERSION INFO" >> $OUTPUT;
   echo "------------------" >> $OUTPUT;
-  hdparm /dev/hda >> $OUTPUT;
-  hdparm -i /dev/hda >> $OUTPUT;
+  cat /proc/version >> $OUTPUT;
+  echo >> $OUTPUT;
+  echo >> $OUTPUT;
+
+  echo "------------------" >> $OUTPUT;
+  echo "CMDLINE INFO" >> $OUTPUT;
+  echo "------------------" >> $OUTPUT;
+  cat /proc/cmdline >> $OUTPUT;
+  echo >> $OUTPUT;
+  echo >> $OUTPUT;
+
+  echo "------------------" >> $OUTPUT;
+  echo "LOADED MODULES" >> $OUTPUT;
+  echo "------------------" >> $OUTPUT;
+  lsmod >> $OUTPUT;
+  echo >> $OUTPUT;
+  echo >> $OUTPUT;
+
+  echo "------------------" >> $OUTPUT;
+  echo "ZTTEST" >> $OUTPUT;
+  echo "------------------" >> $OUTPUT;
+  zttest -c 20 >> $OUTPUT;
+  echo >> $OUTPUT;
+  echo >> $OUTPUT;
+
+  echo "------------------" >> $OUTPUT;
+  echo "DMESG OUTPUT" >> $OUTPUT;
+  echo "------------------" >> $OUTPUT;
+  dmesg >> $OUTPUT;
+  echo >> $OUTPUT;
+  echo >> $OUTPUT;
+
+  echo "------------------" >> $OUTPUT;
+  echo "DMIDECODE" >> $OUTPUT;
+  echo "------------------" >> $OUTPUT;
+  dmidecode >> $OUTPUT;
   echo >> $OUTPUT;
   echo >> $OUTPUT;
 
@@ -101,22 +138,18 @@
   echo >> $OUTPUT;
   echo >> $OUTPUT;
 
-  echo "------------------" >> $OUTPUT;
-  echo "ZTTEST" >> $OUTPUT;
-  echo "------------------" >> $OUTPUT;
-  /usr/src/zaptel/zttest -c 20 >> $OUTPUT;
-  echo >> $OUTPUT;
-  echo >> $OUTPUT;
-
 else
   echo "terminated";
 exit
 fi
 
+clear
+
 echo
 echo "Digium may require root level access to the system to help debug";
 echo "the problem you are experiencing. Do you want to provide login";
-echo "information at this time?";
+echo "information at this time? Please note that if you do so, change";
+echo "your root password to a secure temporary password for Digium support";
 echo "Press 'y' for yes and any other key to exit and save the previous info collected"
 read login
 
@@ -146,15 +179,17 @@
 
   echo "Additional login info: "$adinfo >> $OUTPUT
 
+  clear
   echo 
   echo "All information has been stored in $OUTPUT,"
-  echo "Please attach this file to an email ticket you already"
+  echo "Please attach this file to an email case you already"
   echo "have open with Digium Tech Support."
 
 else
+  clear
   echo
   echo "All information except login info has been stored in $OUTPUT,"
-  echo "Please send this file to an email ticket you already"
+  echo "Please send this file to an email case you already"
   echo "have open with Digium Tech Support."
 exit
 fi

Modified: team/murf/bug11210/include/asterisk/ael_structs.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/include/asterisk/ael_structs.h?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/include/asterisk/ael_structs.h (original)
+++ team/murf/bug11210/include/asterisk/ael_structs.h Thu Mar 27 12:17:34 2008
@@ -107,6 +107,7 @@
 	char *hints;
 	int regexten;
 	int is_switch;
+	int has_switch;
 	
 	struct ast_context *context;
 	

Modified: team/murf/bug11210/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/include/asterisk/linkedlists.h?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/include/asterisk/linkedlists.h (original)
+++ team/murf/bug11210/include/asterisk/linkedlists.h Thu Mar 27 12:17:34 2008
@@ -712,15 +712,12 @@
 			prev = cur;                                             \
 			cur = cur->field.next;                                  \
 		}                                                           \
-		if (!prev) {       /* Same as INSERT_HEAD */                \
-			(elm)->field.next = (head)->first;                      \
-			(head)->first = (elm);                                  \
-		} else if (!cur) { /* Same as INSERT_TAIL */                \
-			(head)->last->field.next = (elm);                       \
-			(head)->last = (elm);                                   \
+		if (!prev) {                                                \
+			AST_LIST_INSERT_HEAD(head, elm, field);                 \
+		} else if (!cur) {                                          \
+			AST_LIST_INSERT_TAIL(head, elm, field);                 \
 		} else {                                                    \
-			(elm)->field.next = cur;                                \
-			(prev)->field.next = (elm);                             \
+			AST_LIST_INSERT_AFTER(head, prev, elm, field);          \
 		}                                                           \
 	}                                                               \
 } while (0)

Modified: team/murf/bug11210/include/asterisk/pval.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/include/asterisk/pval.h?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/include/asterisk/pval.h (original)
+++ team/murf/bug11210/include/asterisk/pval.h Thu Mar 27 12:17:34 2008
@@ -138,7 +138,7 @@
 struct pval *find_macro(char *name);
 struct ael_priority *new_prio(void);
 struct ael_extension *new_exten(void);
-void linkprio(struct ael_extension *exten, struct ael_priority *prio);
+void linkprio(struct ael_extension *exten, struct ael_priority *prio, struct ael_extension *mother_exten);
 void destroy_extensions(struct ael_extension *exten);
 /* static void linkexten(struct ael_extension *exten, struct ael_extension *add);
    static void gen_prios(struct ael_extension *exten, char *label, pval *statement, struct ael_extension *mother_exten, struct ast_context *context ); */

Modified: team/murf/bug11210/main/config.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/config.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/main/config.c (original)
+++ team/murf/bug11210/main/config.c Thu Mar 27 12:17:34 2008
@@ -2348,12 +2348,7 @@
 static char *handle_cli_config_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct cache_file_mtime *cfmtime;
-	struct seenlist {
-		AST_LIST_ENTRY(seenlist) list;
-		char filename[0];
-	} *seenlist;
-	AST_LIST_HEAD_NOLOCK(, seenlist) seenhead = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
-	char *completion_value = NULL;
+	char *prev = "", *completion_value = NULL;
 	int wordlen, which = 0;
 
 	switch (cmd) {
@@ -2372,15 +2367,13 @@
 
 		AST_LIST_LOCK(&cfmtime_head);
 		AST_LIST_TRAVERSE(&cfmtime_head, cfmtime, list) {
-			int seen = 0;
-			AST_LIST_TRAVERSE(&seenhead, seenlist, list) {
-				if (strcmp(seenlist->filename, cfmtime->filename) == 0) {
-					seen = 1;
-					break;
-				}
-			}
-
-			if (seen) {
+			/* Skip duplicates - this only works because the list is sorted by filename */
+			if (strcmp(cfmtime->filename, prev) == 0) {
+				continue;
+			}
+
+			/* Core configs cannot be reloaded */
+			if (ast_strlen_zero(cfmtime->who_asked)) {
 				continue;
 			}
 
@@ -2390,18 +2383,9 @@
 			}
 
 			/* Otherwise save that we've seen this filename */
-			if (!(seenlist = ast_malloc(sizeof(*seenlist) + strlen(cfmtime->filename) + 1))) {
-				break;
-			}
-			strcpy(seenlist->filename, cfmtime->filename);
-			AST_LIST_INSERT_HEAD(&seenhead, seenlist, list);
+			prev = cfmtime->filename;
 		}
 		AST_LIST_UNLOCK(&cfmtime_head);
-
-		/* Remove seenlist */
-		while ((seenlist = AST_LIST_REMOVE_HEAD(&seenhead, list))) {
-			ast_free(seenlist);
-		}
 
 		return completion_value;
 	}
@@ -2440,7 +2424,7 @@
 
 	AST_LIST_LOCK(&cfmtime_head);
 	AST_LIST_TRAVERSE(&cfmtime_head, cfmtime, list) {
-		ast_cli(a->fd, "%-20.20s %-50s\n", cfmtime->who_asked, cfmtime->filename);
+		ast_cli(a->fd, "%-20.20s %-50s\n", S_OR(cfmtime->who_asked, "core"), cfmtime->filename);
 	}
 	AST_LIST_UNLOCK(&cfmtime_head);
 

Modified: team/murf/bug11210/main/frame.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/frame.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/main/frame.c (original)
+++ team/murf/bug11210/main/frame.c Thu Mar 27 12:17:34 2008
@@ -85,7 +85,6 @@
 	int size;
 	int format;
 	int readdata;
-	int optimizablestream;
 	int flags;
 	float samplesperbyte;
 	struct ast_frame f;
@@ -182,23 +181,8 @@
 				ast_swapcopy_samples(f->data, f->data, f->samples);
 			s->opt = f;
 			return 0;
-		} else {
-			s->optimizablestream++;
-			if (s->optimizablestream > 10) {
-				/* For the past 10 rounds, we have input and output
-				   frames of the correct size for this smoother, yet
-				   we were unable to optimize because there was still
-				   some cruft left over.  Lets just drop the cruft so
-				   we can move to a fully optimized path */
-				if (swap)
-					ast_swapcopy_samples(f->data, f->data, f->samples);
-				s->len = 0;
-				s->opt = f;
-				return 0;
-			}
-		}
-	} else 
-		s->optimizablestream = 0;
+		}
+	}
 	if (s->flags & AST_SMOOTHER_FLAG_G729) {
 		if (s->len % 10) {
 			ast_log(LOG_NOTICE, "Dropping extra frame of G.729 since we already have a VAD frame at the end\n");

Modified: team/murf/bug11210/main/http.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/http.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/main/http.c (original)
+++ team/murf/bug11210/main/http.c Thu Mar 27 12:17:34 2008
@@ -908,7 +908,7 @@
 		out = ast_http_error(501, "Not Implemented", NULL,
 				     "Attempt to use unimplemented / unsupported method");
 	} else {	/* try to serve it */
-		out = handle_uri(ser, uri, (strcasecmp(buf, "get")) ? AST_HTTP_GET : AST_HTTP_POST,
+		out = handle_uri(ser, uri, (!strcasecmp(buf, "get")) ? AST_HTTP_GET : AST_HTTP_POST,
 				 &status, &title, &contentlength, &vars, &static_content);
 	}
 

Modified: team/murf/bug11210/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/pbx.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/main/pbx.c (original)
+++ team/murf/bug11210/main/pbx.c Thu Mar 27 12:17:34 2008
@@ -467,6 +467,8 @@
 	"This application sets the following channel variable upon completion:\n"
 	" BACKGROUNDSTATUS    The status of the background attempt as a text string, one of\n"
 	"               SUCCESS | FAILED\n"
+	"See Also: Playback (application) -- Play sound file(s) to the channel,\n"
+	"                                    that cannot be interrupted\n"
 	},
 
 	{ "Busy", pbx_builtin_busy,
@@ -678,6 +680,7 @@
 	"  Options:\n"
 	"    m[(x)] - Provide music on hold to the caller while waiting for an extension.\n"
 	"               Optionally, specify the class for music on hold within parenthesis.\n"
+	"See Also: Playback(application), Background(application).\n"
 	},
 
 	{ "KeepAlive", pbx_builtin_keepalive,

Modified: team/murf/bug11210/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/pbx/pbx_ael.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/pbx/pbx_ael.c (original)
+++ team/murf/bug11210/pbx/pbx_ael.c Thu Mar 27 12:17:34 2008
@@ -85,7 +85,6 @@
 struct pval *find_macro(char *name);
 struct ael_priority *new_prio(void);
 struct ael_extension *new_exten(void);
-void linkprio(struct ael_extension *exten, struct ael_priority *prio);
 void destroy_extensions(struct ael_extension *exten);
 void set_priorities(struct ael_extension *exten);
 void add_extensions(struct ael_extension *exten);

Modified: team/murf/bug11210/res/ael/pval.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/res/ael/pval.c?view=diff&rev=111440&r1=111439&r2=111440
==============================================================================
--- team/murf/bug11210/res/ael/pval.c (original)
+++ team/murf/bug11210/res/ael/pval.c Thu Mar 27 12:17:34 2008
@@ -2915,8 +2915,10 @@
 	return x;
 }
 
-void linkprio(struct ael_extension *exten, struct ael_priority *prio)
-{
+void linkprio(struct ael_extension *exten, struct ael_priority *prio, struct ael_extension *mother_exten)
+{
+	char *p1, *p2;
+	
 	if (!exten->plist) {
 		exten->plist = prio;
 		exten->plist_last = prio;
@@ -2926,6 +2928,33 @@
 	}
 	if( !prio->exten )
 		prio->exten = exten; /* don't override the switch value */
+	/* The following code will cause all priorities within an extension 
+	   to have ${EXTEN} or ${EXTEN: replaced with ~~EXTEN~~, which is
+	   set just before the first switch in an exten. The switches
+	   will muck up the original ${EXTEN} value, so we save it away
+	   and the user accesses this copy instead. */
+	if (prio->appargs && ((mother_exten && mother_exten->has_switch) || exten->has_switch) ) {
+		while ((p1 = strstr(prio->appargs, "${EXTEN}"))) {
+			p2 = malloc(strlen(prio->appargs)+5);
+			*p1 = 0;
+			strcpy(p2, prio->appargs);
+			strcat(p2, "${~~EXTEN~~}");
+			if (*(p1+8))
+				strcat(p2, p1+8);
+			free(prio->appargs);
+			prio->appargs = p2;
+		}
+		while ((p1 = strstr(prio->appargs, "${EXTEN:"))) {
+			p2 = malloc(strlen(prio->appargs)+5);
+			*p1 = 0;
+			strcpy(p2, prio->appargs);
+			strcat(p2, "${~~EXTEN~~:");
+			if (*(p1+8))
+				strcat(p2, p1+8);
+			free(prio->appargs);
+			prio->appargs = p2;
+		}
+	}
 }
 
 void destroy_extensions(struct ael_extension *exten)
@@ -3040,7 +3069,7 @@
 	struct ael_priority *pr;
 	struct ael_priority *for_init, *for_test, *for_inc, *for_loop, *for_end;
 	struct ael_priority *while_test, *while_loop, *while_end;
-	struct ael_priority *switch_test, *switch_end, *fall_thru, *switch_empty;
+	struct ael_priority *switch_set, *switch_test, *switch_end, *fall_thru, *switch_empty;
 	struct ael_priority *if_test, *if_end, *if_skip, *if_false;
 #ifdef OLD_RAND_ACTION
 	struct ael_priority *rand_test, *rand_end, *rand_skip;
@@ -3066,7 +3095,7 @@
 			remove_spaces_before_equals(buf1);
 			pr->appargs = strdup(buf1);
 			pr->origin = p;
-			linkprio(exten, pr);
+			linkprio(exten, pr, mother_exten);
 			break;
 
 		case PV_LOCALVARDEC:
@@ -3077,7 +3106,7 @@
 			remove_spaces_before_equals(buf1);
 			pr->appargs = strdup(buf1);
 			pr->origin = p;
-			linkprio(exten, pr);
+			linkprio(exten, pr, mother_exten);
 			break;
 
 		case PV_GOTO:
@@ -3109,7 +3138,7 @@
 				pr->appargs = strdup(buf1);
 			}
 			pr->origin = p;
-			linkprio(exten, pr);
+			linkprio(exten, pr, mother_exten);
 			break;
 
 		case PV_LABEL:
@@ -3117,7 +3146,7 @@
 			pr->type = AEL_LABEL;
 			pr->origin = p;
 			p->u3.compiled_label = exten;
-			linkprio(exten, pr);
+			linkprio(exten, pr, mother_exten);
 			break;
 
 		case PV_FOR:
@@ -3240,8 +3269,8 @@
 			for_end->app = strdup("NoOp");
 			for_end->appargs = strdup(buf1);
 			/* link & load! */
-			linkprio(exten, for_init);
-			linkprio(exten, for_test);
+			linkprio(exten, for_init, mother_exten);
+			linkprio(exten, for_test, mother_exten);
 			
 			/* now, put the body of the for loop here */
 			exten->loop_break = for_end;
@@ -3249,9 +3278,9 @@
 			
 			gen_prios(exten, new_label, p->u4.for_statements, mother_exten, this_context); /* this will link in all the statements here */
 			
-			linkprio(exten, for_inc);
-			linkprio(exten, for_loop);
-			linkprio(exten, for_end);
+			linkprio(exten, for_inc, mother_exten);
+			linkprio(exten, for_loop, mother_exten);
+			linkprio(exten, for_end, mother_exten);
 			
 			
 			exten->loop_break = loop_break_save;
@@ -3279,7 +3308,7 @@
 			while_end->app = strdup("NoOp");
 			while_end->appargs = strdup(buf1);
 
-			linkprio(exten, while_test);
+			linkprio(exten, while_test, mother_exten);
 			
 			/* now, put the body of the for loop here */
 			exten->loop_break = while_end;
@@ -3287,8 +3316,8 @@
 			
 			gen_prios(exten, new_label, p->u2.statements, mother_exten, this_context); /* this will link in all the while body statements here */
 
-			linkprio(exten, while_loop);
-			linkprio(exten, while_end);
+			linkprio(exten, while_loop, mother_exten);
+			linkprio(exten, while_end, mother_exten);
 			
 			
 			exten->loop_break = loop_break_save;
@@ -3302,7 +3331,21 @@
 			loop_break_save = exten->loop_break; /* save them, then restore before leaving */
 			loop_continue_save = exten->loop_continue;
 			snprintf(new_label,sizeof(new_label),"sw-%s-%d", label, control_statement_count);
-
+			if ((mother_exten && !mother_exten->has_switch)) {
+				switch_set = new_prio();
+				switch_set->type = AEL_APPCALL;
+				switch_set->app = strdup("Set");
+				switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
+				linkprio(exten, switch_set, mother_exten);
+				mother_exten->has_switch = 1;
+			} else if ((exten && !exten->has_switch)) {
+				switch_set = new_prio();
+				switch_set->type = AEL_APPCALL;
+				switch_set->app = strdup("Set");
+				switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
+				linkprio(exten, switch_set, exten);
+				exten->has_switch = 1;
+			}
 			switch_test = new_prio();
 			switch_end = new_prio();
 			switch_test->type = AEL_APPCALL;
@@ -3316,8 +3359,8 @@
 			switch_end->origin = p;
 			switch_end->exten = exten;
 
-			linkprio(exten, switch_test);
-			linkprio(exten, switch_end);
+			linkprio(exten, switch_test, mother_exten);
+			linkprio(exten, switch_end, mother_exten);
 			
 			exten->loop_break = switch_end;
 			exten->loop_continue = 0;
@@ -3355,7 +3398,7 @@
 							fall_thru->app = strdup("Goto");
 							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (p2->next && p2->next->type == PV_PATTERN) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
@@ -3363,20 +3406,20 @@
 							gen_match_to_pattern(p2->next->u1.str, buf2);
 							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10", local_control_statement_count, buf2);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (p2->next && p2->next->type == PV_DEFAULT) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
 							snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (!p2->next) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_CONTROL1;
 							fall_thru->goto_true = switch_end;
 							fall_thru->app = strdup("Goto");
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						}
 					}
 					if (switch_case->return_needed) { /* returns don't generate a goto eoe (end of extension) any more, just a Return() app call) */
@@ -3386,7 +3429,7 @@
 						np2->app = strdup("NoOp");
 						snprintf(buf,sizeof(buf),"End of Extension %s", switch_case->name);
 						np2->appargs = strdup(buf);
-						linkprio(switch_case, np2);
+						linkprio(switch_case, np2, mother_exten);
 						switch_case-> return_target = np2;
 					}
 				} else if (p2->type == PV_PATTERN) {
@@ -3418,7 +3461,7 @@
 							fall_thru->app = strdup("Goto");
 							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (p2->next && p2->next->type == PV_PATTERN) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
@@ -3426,20 +3469,20 @@
 							gen_match_to_pattern(p2->next->u1.str, buf2);
 							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, buf2);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (p2->next && p2->next->type == PV_DEFAULT) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
 							snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (!p2->next) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_CONTROL1;
 							fall_thru->goto_true = switch_end;
 							fall_thru->app = strdup("Goto");
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						}
 					}
 					if (switch_case->return_needed) { /* returns don't generate a goto eoe (end of extension) any more, just a Return() app call) */
@@ -3449,7 +3492,7 @@
 						np2->app = strdup("NoOp");
 						snprintf(buf,sizeof(buf),"End of Extension %s", switch_case->name);
 						np2->appargs = strdup(buf);
-						linkprio(switch_case, np2);
+						linkprio(switch_case, np2, mother_exten);
 						switch_case-> return_target = np2;
 					}
 				} else if (p2->type == PV_DEFAULT) {
@@ -3470,7 +3513,7 @@
 					snprintf(buf1,sizeof(buf1),"sw-%d-.|10",local_control_statement_count);
 					switch_empty->app = strdup("Goto");
 					switch_empty->appargs = strdup(buf1);
-					linkprio(switch_null, switch_empty);
+					linkprio(switch_null, switch_empty, mother_exten);
 					snprintf(buf1,sizeof(buf1),"sw-%d-", local_control_statement_count);
 					switch_null->name = strdup(buf1);
 					switch_null->loop_break = exten->loop_break;
@@ -3502,7 +3545,7 @@
 							fall_thru->app = strdup("Goto");
 							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (p2->next && p2->next->type == PV_PATTERN) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
@@ -3510,20 +3553,20 @@
 							gen_match_to_pattern(p2->next->u1.str, buf2);
 							snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, buf2);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (p2->next && p2->next->type == PV_DEFAULT) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_APPCALL;
 							fall_thru->app = strdup("Goto");
 							snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
 							fall_thru->appargs = strdup(buf1);
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						} else if (!p2->next) {
 							fall_thru = new_prio();
 							fall_thru->type = AEL_CONTROL1;
 							fall_thru->goto_true = switch_end;
 							fall_thru->app = strdup("Goto");
-							linkprio(switch_case, fall_thru);
+							linkprio(switch_case, fall_thru, mother_exten);
 						}
 					}
 					if (switch_case->return_needed) { /* returns don't generate a goto eoe (end of extension) any more, just a Return() app call) */
@@ -3533,7 +3576,7 @@
 						np2->app = strdup("NoOp");
 						snprintf(buf,sizeof(buf),"End of Extension %s", switch_case->name);
 						np2->appargs = strdup(buf);
-						linkprio(switch_case, np2);

[... 143 lines stripped ...]



More information about the asterisk-commits mailing list