[asterisk-commits] murf: branch group/newcdr r178571 - in /team/group/newcdr: ./ apps/ channels/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 25 10:21:12 CST 2009


Author: murf
Date: Wed Feb 25 10:21:12 2009
New Revision: 178571

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=178571
Log:
Merged revisions 178022,178027,178030,178061,178107,178142,178213,178300,178303,178342,178374-178375,178381,178446,178509 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r178022 | russell | 2009-02-23 10:29:16 -0700 (Mon, 23 Feb 2009) | 6 lines
  
  Fix a regression in scheduler entry ordering, and add a regression test for it.
  
  (closes issue #14522)
  Reported by: pj
  Tested by: russell
................
  r178027 | mvanbaak | 2009-02-23 10:48:32 -0700 (Mon, 23 Feb 2009) | 2 lines
  
  list the addition of the SKINNY manager actions in the CHANGES file.
................
  r178030 | dvossel | 2009-02-23 10:59:55 -0700 (Mon, 23 Feb 2009) | 7 lines
  
  Changes the way keyrotation is enabled by default
  
  Key rotation was enabled by default by setting the global encryption method to IAX_ENCRYPT_KEYROTATE.  the problem with this is that if encryption is not enabled, and the encryption method is set to anything except 0, the peer appears to have encryption enabled when issuing a "iax2 show peers".  Rather than have the key rotation bit always set by default, it is now only set when an encryption method is enabled. 
  
  (closes issue #14523)
  Reported by: mvanbaak
................
  r178061 | mvanbaak | 2009-02-23 11:23:38 -0700 (Mon, 23 Feb 2009) | 3 lines
  
  update the new manager commands in chan_skinny to match
  chan_sip's headers. requested by oej.
................
  r178107 | tilghman | 2009-02-23 14:02:18 -0700 (Mon, 23 Feb 2009) | 7 lines
  
  Permit emailsubject and emailbody to be set per mailbox.
  (closes issue #14372)
   Reported by: fhackenberger
   Patches: 
         voicemail_individual_subject_and_body_1.6.1 uploaded by fhackenberger (license 592)
         with additional fixes by Corydon76 (license 14)
................
  r178142 | russell | 2009-02-23 16:11:37 -0700 (Mon, 23 Feb 2009) | 22 lines
  
  Merged revisions 178141 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r178141 | russell | 2009-02-23 17:09:01 -0600 (Mon, 23 Feb 2009) | 14 lines
  
  Fix infinite DTMF when a BEGIN is received without an END.
  
  This commit is related to rev 175124 of 1.4 where a previous attempt was made
  to fix this problem.  The problem with the previous patch was that the inserted
  code needed to go _before_ setting the lastrxts to the current timestamp.
  Because those were the same, the dtmfcount variable was never decremented, and
  so the END was never sent.
  
  In passing, I removed the dtmfsamples variable which was completed unused.  I
  also removed a redundant setting of the lastrxts variable.
  
  (closes issue #14460)
  Reported by: moliveras
  
  ........
................
  r178213 | file | 2009-02-24 08:18:38 -0700 (Tue, 24 Feb 2009) | 16 lines
  
  Merged revisions 178205 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r178205 | file | 2009-02-24 11:16:07 -0400 (Tue, 24 Feb 2009) | 9 lines
    
    Skip check for extension when subscribing for MWI.
    
    Since the remote side is not actually subscribing to a specific extension when
    subscribing for MWI just skip the check to see if the extension exists. They can't use it
    to specify the mailbox either since we require configuration of that in sip.conf
    
    (closes issue #14531)
    Reported by: festr
  ........
................
  r178300 | dvossel | 2009-02-24 10:42:37 -0700 (Tue, 24 Feb 2009) | 12 lines
  
  Allows manager command to see if IAX link is trunked and encrypted. Displays what kind of encryption is enabled as well. 
  
  Manager command "iaxpeers" now shows if a link is trunked and encrypted.  Instead of encryption saying simply "yes" or "no", it now displays what type of encryption is enabled and if keyrotation is on or not.  
  
  (closes issue #14427)
  Reported by: snuffy
  Patches:
  	iax_show_trunks.diff uploaded by snuffy (license 35)
  	2009022200_iax2_show_trunkencryption.diff.txt uploaded by mvanbaak (license 7)
  Tested by: mvanbaak, dvossel, snuffy
  Review: http://reviewboard.digium.com/r/173/
................
  r178303 | tilghman | 2009-02-24 10:51:36 -0700 (Tue, 24 Feb 2009) | 7 lines
  
  Cause astcanary to exit if Asterisk exits abnormally and doesn't kill astcanary.
  Also, add some documentation supporting the use of astcanary.
  (closes issue #14538)
   Reported by: KNK
   Patches: 
         asterisk-1.6.x-astcanary.diff uploaded by KNK (license 545)
................
  r178342 | tilghman | 2009-02-24 13:06:48 -0700 (Tue, 24 Feb 2009) | 2 lines
  
  Use a SIGPIPE to kill the process, instead of depending upon the astcanary process being inherited by init.
................
  r178374 | russell | 2009-02-24 13:39:57 -0700 (Tue, 24 Feb 2009) | 14 lines
  
  Merged revisions 178373 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r178373 | russell | 2009-02-24 14:36:19 -0600 (Tue, 24 Feb 2009) | 6 lines
  
  Only set dtmfcount on BEGIN, and ensure it gets reset to 0 properly.
  
  (issue #14460)
  Reported by: moliveras
  Tested by: russell
  
  ........
................
  r178375 | tilghman | 2009-02-24 13:40:02 -0700 (Tue, 24 Feb 2009) | 2 lines
  
  The 3 possible errors with pipe(2) are all impossible in this situation.
................
  r178381 | tilghman | 2009-02-24 13:52:44 -0700 (Tue, 24 Feb 2009) | 2 lines
  
  Apparently, a void cast doesn't override warn_unused_result.
................
  r178446 | tilghman | 2009-02-24 16:27:23 -0700 (Tue, 24 Feb 2009) | 12 lines
  
  Merged revisions 178445 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r178445 | tilghman | 2009-02-24 17:25:24 -0600 (Tue, 24 Feb 2009) | 5 lines
    
    Add section about the #exec command in configuration files.
    (closes issue #14540)
     Reported by: jtodd
     Patch by: jtodd, with additional notes by tilghman (license 14) 
  ........
................
  r178509 | russell | 2009-02-25 05:45:30 -0700 (Wed, 25 Feb 2009) | 10 lines
  
  Merged revisions 178508 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
  r178508 | russell | 2009-02-25 06:43:36 -0600 (Wed, 25 Feb 2009) | 2 lines
  
  Update the copyright year for the main page of the doxygen documentation.
  
  ........
................

Modified:
    team/group/newcdr/   (props changed)
    team/group/newcdr/CHANGES
    team/group/newcdr/apps/app_voicemail.c
    team/group/newcdr/channels/chan_iax2.c
    team/group/newcdr/channels/chan_sip.c
    team/group/newcdr/channels/chan_skinny.c
    team/group/newcdr/configs/extensions.conf.sample
    team/group/newcdr/configs/voicemail.conf.sample
    team/group/newcdr/doc/manager_1_1.txt
    team/group/newcdr/main/asterisk.c
    team/group/newcdr/main/rtp.c
    team/group/newcdr/main/sched.c
    team/group/newcdr/tests/test_sched.c
    team/group/newcdr/utils/astcanary.c

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

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 25 10:21:12 2009
@@ -1,1 +1,1 @@
-/trunk:1-177999
+/trunk:1-178570

Modified: team/group/newcdr/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/CHANGES?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/CHANGES (original)
+++ team/group/newcdr/CHANGES Wed Feb 25 10:21:12 2009
@@ -52,6 +52,12 @@
    set both for inbound and outbound calls.
  * Added support for ITU G.722.1 and G.722.1C (Siren7 and Siren14) media streams.
 
+IAX2 changes
+------------
+  * Added immediate option to iax.conf
+  * Added forceencryption option to iax.conf
+  * Added Encryption and Trunk status to manager command "iaxpeers"
+
 Skinny Changes
 --------------
  * The configuration file now holds separate sections for devices and lines.
@@ -109,6 +115,8 @@
    specified in the initial argument.
  * A new application, Originate, has been introduced, that allows asynchronous
    call origination from the dialplan.
+ * Voicemail now permits setting the emailsubject and emailbody per mailbox,
+   in addition to the setting in the "general" context.
 
 Miscellaneous
 -------------
@@ -156,6 +164,12 @@
    Pragma: SuppressEvents
 
    If this is included, the server supports event suppression.
+
+ * Added 4 new Actions to list skinny device(s) and line(s)
+   SKINNYdevices
+   SKINNYshowdevice
+   SKINNYlines
+   SKINNYshowline
 
 Channel Event Logging
 ---------------------
@@ -575,8 +589,6 @@
   * Added the srvlookup option to iax.conf
   * Added support for OSP.  The token is set and retrieved through the CHANNEL()
      dialplan function.
-  * Added immediate option to iax.conf
-  * Added forceencryption option to iax.conf
 
 XMPP Google Talk/Jingle changes
 -------------------------------

Modified: team/group/newcdr/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/apps/app_voicemail.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/apps/app_voicemail.c (original)
+++ team/group/newcdr/apps/app_voicemail.c Wed Feb 25 10:21:12 2009
@@ -562,6 +562,8 @@
 	char password[80];               /*!< Secret pin code, numbers only */
 	char fullname[80];               /*!< Full name, for directory app */
 	char email[80];                  /*!< E-mail address */
+	char *emailsubject;              /*!< E-mail subject */
+	char *emailbody;                 /*!< E-mail body */
 	char pager[80];                  /*!< E-mail address to pager (no attachment) */
 	char serveremail[80];            /*!< From: Mail address */
 	char mailcmd[160];               /*!< Configurable mail command */
@@ -861,6 +863,8 @@
 	if (maxdeletedmsg)
 		vmu->maxdeletedmsg = maxdeletedmsg;
 	vmu->volgain = volgain;
+	vmu->emailsubject = NULL;
+	vmu->emailbody = NULL;
 }
 
 /*!
@@ -1118,6 +1122,10 @@
 			ast_copy_string(retval->fullname, var->value, sizeof(retval->fullname));
 		} else if (!strcasecmp(var->name, "context")) {
 			ast_copy_string(retval->context, var->value, sizeof(retval->context));
+		} else if (!strcasecmp(var->name, "emailsubject")) {
+			retval->emailsubject = ast_strdup(var->value);
+		} else if (!strcasecmp(var->name, "emailbody")) {
+			retval->emailbody = ast_strdup(var->value);
 #ifdef IMAP_STORAGE
 		} else if (!strcasecmp(var->name, "imapuser")) {
 			ast_copy_string(retval->imapuser, var->value, sizeof(retval->imapuser));
@@ -1437,8 +1445,17 @@
 
 static void free_user(struct ast_vm_user *vmu)
 {
-	if (ast_test_flag(vmu, VM_ALLOCED))
+	if (ast_test_flag(vmu, VM_ALLOCED)) {
+		if (vmu->emailbody != NULL) {
+			ast_free(vmu->emailbody);
+			vmu->emailbody = NULL;
+		}
+		if (vmu->emailsubject != NULL) {
+			ast_free(vmu->emailsubject);
+			vmu->emailsubject = NULL;
+		}
 		ast_free(vmu);
+	}
 }
 
 /* All IMAP-specific functions should go in this block. This
@@ -4086,10 +4103,11 @@
 	} else {
 		fprintf(p, "To: %s <%s>" ENDL, quote(vmu->fullname, passdata2, len_passdata2), vmu->email);
 	}
-	if (!ast_strlen_zero(emailsubject)) {
+	if (!ast_strlen_zero(emailsubject) || !ast_strlen_zero(vmu->emailsubject)) {
+		char *e_subj = !ast_strlen_zero(vmu->emailsubject) ? vmu->emailsubject : emailsubject;
 		struct ast_channel *ast;
 		if ((ast = ast_dummy_channel_alloc())) {
-			int vmlen = strlen(emailsubject) * 3 + 200;
+			int vmlen = strlen(e_subj) * 3 + 200;
 			/* Only allocate more space if the previous was not large enough */
 			if (vmlen > len_passdata) {
 				passdata = alloca(vmlen);
@@ -4098,7 +4116,7 @@
 
 			memset(passdata, 0, len_passdata);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, len_passdata, category, flag);
-			pbx_substitute_variables_helper(ast, emailsubject, passdata, len_passdata);
+			pbx_substitute_variables_helper(ast, e_subj, passdata, len_passdata);
 			if (check_mime(passdata)) {
 				int first_line = 1;
 				char *ptr;
@@ -4175,15 +4193,16 @@
 		fprintf(p, "--%s" ENDL, bound);
 	}
 	fprintf(p, "Content-Type: text/plain; charset=%s" ENDL "Content-Transfer-Encoding: 8bit" ENDL ENDL, charset);
-	if (emailbody) {
+	if (emailbody || vmu->emailbody) {
+		char* e_body = vmu->emailbody ? vmu->emailbody : emailbody;
 		struct ast_channel *ast;
 		if ((ast = ast_dummy_channel_alloc())) {
 			char *passdata;
-			int vmlen = strlen(emailbody)*3 + 200;
+			int vmlen = strlen(e_body) * 3 + 200;
 			passdata = alloca(vmlen);
 			memset(passdata, 0, vmlen);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category, flag);
-			pbx_substitute_variables_helper(ast, emailbody, passdata, vmlen);
+			pbx_substitute_variables_helper(ast, e_body, passdata, vmlen);
 			fprintf(p, "%s" ENDL, passdata);
 			ast_dummy_channel_free(ast);
 		} else

Modified: team/group/newcdr/channels/chan_iax2.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_iax2.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/channels/chan_iax2.c (original)
+++ team/group/newcdr/channels/chan_iax2.c Wed Feb 25 10:21:12 2009
@@ -1306,13 +1306,29 @@
 	return 0;
 }
 
+static void encmethods_to_str(int e, struct ast_str *buf)
+{
+	ast_str_set(&buf, 0, "(");
+	if (e & IAX_ENCRYPT_AES128) {
+		ast_str_append(&buf, 0, "aes128");
+	}
+	if (e & IAX_ENCRYPT_KEYROTATE) {
+		ast_str_append(&buf, 0, ",keyrotate");
+	}
+	if (ast_str_strlen(buf) > 1) {
+		ast_str_append(&buf, 0, ")");
+	} else {
+		ast_str_set(&buf, 0, "No");
+	}
+}
+
 static int get_encrypt_methods(const char *s)
 {
 	int e;
 	if (!strcasecmp(s, "aes128"))
-		e = IAX_ENCRYPT_AES128;
+		e = IAX_ENCRYPT_AES128 | IAX_ENCRYPT_KEYROTATE;
 	else if (ast_true(s))
-		e = IAX_ENCRYPT_AES128;
+		e = IAX_ENCRYPT_AES128 | IAX_ENCRYPT_KEYROTATE;
 	else
 		e = 0;
 	return e;
@@ -2762,6 +2778,7 @@
 	char cbuf[256];
 	struct iax2_peer *peer;
 	char codec_buf[512];
+	struct ast_str *encmethods = ast_str_alloca(256);
 	int x = 0, codec = 0, load_realtime = 0;
 
 	switch (cmd) {
@@ -2784,6 +2801,7 @@
 
 	peer = find_peer(a->argv[3], load_realtime);
 	if (peer) {
+		encmethods_to_str(peer->encmethods, encmethods);
 		ast_cli(a->fd, "\n\n");
 		ast_cli(a->fd, "  * Name       : %s\n", peer->name);
 		ast_cli(a->fd, "  Secret       : %s\n", ast_strlen_zero(peer->secret) ? "<Not set>" : "<Set>");
@@ -2791,6 +2809,8 @@
  		ast_cli(a->fd, "  Parking lot  : %s\n", peer->parkinglot);
 		ast_cli(a->fd, "  Mailbox      : %s\n", peer->mailbox);
 		ast_cli(a->fd, "  Dynamic      : %s\n", ast_test_flag(peer, IAX_DYNAMIC) ? "Yes" : "No");
+		ast_cli(a->fd, "  Trunk        : %s\n", ast_test_flag(peer, IAX_TRUNK) ? "Yes" : "No");
+		ast_cli(a->fd, "  Encryption   : %s\n", peer->encmethods ? ast_str_buffer(encmethods) : "No");
 		ast_cli(a->fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
 		ast_cli(a->fd, "  Expire       : %d\n", peer->expire);
 		ast_cli(a->fd, "  ACL          : %s\n", (peer->ha ? "Yes" : "No"));
@@ -5243,6 +5263,7 @@
 
 	struct iax2_peer *peer = NULL;
 	char name[256];
+	struct ast_str *encmethods = ast_str_alloca(256);
 	int registeredonly=0;
 	char *term = manager ? "\r\n" : "\n";
 	char idtext[256] = "";
@@ -5288,7 +5309,6 @@
 		peer_unref(peer), peer = ao2_iterator_next(&i)) {
 		char nm[20];
 		char status[20];
-		char srch[2000];
 		int retstatus;
 
 		if (registeredonly && !peer->addr.sin_addr.s_addr)
@@ -5300,7 +5320,8 @@
 			snprintf(name, sizeof(name), "%s/%s", peer->name, peer->username);
 		else
 			ast_copy_string(name, peer->name, sizeof(name));
-		
+
+		encmethods_to_str(peer->encmethods, encmethods);
 		retstatus = peer_status(peer, status, sizeof(status));
 		if (retstatus > 0)
 			online_peers++;
@@ -5308,18 +5329,11 @@
 			offline_peers++;
 		else
 			unmonitored_peers++;
-		
+
 		ast_copy_string(nm, ast_inet_ntoa(peer->mask), sizeof(nm));
-		
-		snprintf(srch, sizeof(srch), FORMAT, name, 
-			 peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "(Unspecified)",
-			 ast_test_flag(peer, IAX_DYNAMIC) ? "(D)" : "(S)",
-			 nm,
-			 ntohs(peer->addr.sin_port), ast_test_flag(peer, IAX_TRUNK) ? "(T)" : "   ",
-			 peer->encmethods ? "(E)" : "   ", status, term);
-		
-		if (s)
-			astman_append(s, 
+
+		if (s) {
+			astman_append(s,
 				"Event: PeerEntry\r\n%s"
 				"Channeltype: IAX2\r\n"
 				"ChanObjectType: peer\r\n"
@@ -5327,21 +5341,28 @@
 				"IPaddress: %s\r\n"
 				"IPport: %d\r\n"
 				"Dynamic: %s\r\n"
+				"Trunk: %s\r\n"
+				"Encryption: %s\r\n"
 				"Status: %s\r\n\r\n",
 				idtext,
 				name,
 				peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "-none-",
 				ntohs(peer->addr.sin_port),
 				ast_test_flag(peer, IAX_DYNAMIC) ? "yes" : "no",
+				ast_test_flag(peer, IAX_TRUNK) ? "yes" : "no",
+				peer->encmethods ? ast_str_buffer(encmethods) : "no",
 				status);
-		
-		else
-			ast_cli(fd, FORMAT, name, 
+		} else {
+			ast_cli(fd, FORMAT, name,
 				peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "(Unspecified)",
 				ast_test_flag(peer, IAX_DYNAMIC) ? "(D)" : "(S)",
 				nm,
-				ntohs(peer->addr.sin_port), ast_test_flag(peer, IAX_TRUNK) ? "(T)" : "   ",
-				peer->encmethods ? "(E)" : "   ", status, term);
+				ntohs(peer->addr.sin_port),
+				ast_test_flag(peer, IAX_TRUNK) ? "(T)" : "   ",
+				peer->encmethods ? "(E)" : "   ",
+				status,
+				term);
+		}
 		total_peers++;
 	}
 
@@ -5577,6 +5598,7 @@
 	char status[20];
 	const char *id = astman_get_header(m,"ActionID");
 	char idtext[256] = "";
+	struct ast_str *encmethods = ast_str_alloca(256);
 	struct ao2_iterator i;
 
 	if (!ast_strlen_zero(id))
@@ -5587,7 +5609,7 @@
 
 	i = ao2_iterator_init(peers, 0);
 	for (peer = ao2_iterator_next(&i); peer; peer_unref(peer), peer = ao2_iterator_next(&i)) {
-
+		encmethods_to_str(peer->encmethods, encmethods);
 		astman_append(s, "Event: PeerEntry\r\n%sChanneltype: IAX\r\n", idtext);
 		if (!ast_strlen_zero(peer->username)) {
 			astman_append(s, "ObjectName: %s\r\nObjectUsername: %s\r\n", peer->name, peer->username);
@@ -5600,6 +5622,8 @@
 		astman_append(s, "Mask: %s\r\n", nm);
 		astman_append(s, "Port: %d\r\n", ntohs(peer->addr.sin_port));
 		astman_append(s, "Dynamic: %s\r\n", ast_test_flag(peer, IAX_DYNAMIC) ? "Yes" : "No");
+		astman_append(s, "Trunk: %s\r\n", ast_test_flag(peer, IAX_TRUNK) ? "Yes" : "No");
+		astman_append(s, "Encryption: %s\r\n", peer->encmethods ? ast_str_buffer(encmethods) : "No");
 		peer_status(peer, status, sizeof(status));
 		astman_append(s, "Status: %s\r\n\r\n", status);
 		peer_count++;
@@ -11268,8 +11292,6 @@
 	memset(&globalflags, 0, sizeof(globalflags));
 	ast_set_flag(&globalflags, IAX_RTUPDATE);
 	
-	/* Turns on support for key rotation during encryption. */
-	iax2_encryption |= IAX_ENCRYPT_KEYROTATE;
 #ifdef SO_NO_CHECK
 	nochecksums = 0;
 #endif

Modified: team/group/newcdr/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_sip.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/channels/chan_sip.c (original)
+++ team/group/newcdr/channels/chan_sip.c Wed Feb 25 10:21:12 2009
@@ -20077,7 +20077,7 @@
 /*! \brief  Handle incoming SUBSCRIBE request */
 static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e)
 {
-	int gotdest;
+	int gotdest = 0;
 	int res = 0;
 	int firststate = AST_EXTENSION_REMOVED;
 	struct sip_peer *authpeer = NULL;
@@ -20184,8 +20184,10 @@
 		return 0;
 	}
 
-	/* Get destination right away */
-	gotdest = get_destination(p, NULL);
+	if (strcmp(event, "message-summary")) {
+		/* Get destination right away */
+		gotdest = get_destination(p, NULL);
+	}
 
 	/* Get full contact header - this needs to be used as a request URI in NOTIFY's */
 	parse_ok_contact(p, req);

Modified: team/group/newcdr/channels/chan_skinny.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/channels/chan_skinny.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/channels/chan_skinny.c (original)
+++ team/group/newcdr/channels/chan_skinny.c Wed Feb 25 10:21:12 2009
@@ -2964,14 +2964,14 @@
 				"DeviceId: %s\r\n"
 				"IPaddress: %s\r\n"
 				"Type: %s\r\n"
-				"Registered: %s\r\n"
+				"Devicestatus: %s\r\n"
 				"NumberOfLines: %d\r\n",
 				idtext,
 				d->name,
 				d->id,
 				d->session?ast_inet_ntoa(d->session->sin.sin_addr):"-none-",
 				device2str(d->type),
-				d->registered?"yes":"no",
+				d->registered?"registered":"unregistered",
 				numlines);
 		}
 	}
@@ -3108,7 +3108,7 @@
 				astman_append(s, "CodecOrder: ");
 				ast_getformatname_multiple(codec_buf, sizeof(codec_buf) -1, d->capability);
 				astman_append(s, "%s\r\n", codec_buf);
-				astman_append(s, "Registered: %s\r\n", (d->registered?"yes":"no"));
+				astman_append(s, "Devicestatus: %s\r\n", (d->registered?"registered":"unregistered"));
 				astman_append(s, "NumberOfLines: %d\r\n", numlines);
 				AST_LIST_TRAVERSE(&d->lines, l, list) {
 					astman_append(s, "Line: %s (%s)\r\n", l->name, l->label);
@@ -3392,7 +3392,7 @@
 				astman_append(s, "PickupGroup: %s\r\n", ast_print_group(group_buf, sizeof(group_buf), l->pickupgroup));
 				astman_append(s, "Language: %s\r\n", S_OR(l->language, "<not set>"));
 				astman_append(s, "Accountcode: %s\r\n", S_OR(l->accountcode, "<not set>"));
-				astman_append(s, "AmaFlag: %s\r\n", ast_cdr_flags2str(l->amaflags));
+				astman_append(s, "AMAflags: %s\r\n", ast_cdr_flags2str(l->amaflags));
 				astman_append(s, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), l->cid_name, l->cid_num, ""));
 				astman_append(s, "HideCallerId: %s\r\n", (l->hidecallerid ? "Yes" : "No"));
 				astman_append(s, "CFwdAll: %s\r\n", S_COR((l->cfwdtype & SKINNY_CFWD_ALL), l->call_forward_all, "<not set>"));
@@ -3401,7 +3401,7 @@
 				astman_append(s, "VoicemailBox: %s\r\n", S_OR(l->mailbox, "<not set>"));
 				astman_append(s, "VoicemailNumber: %s\r\n", S_OR(l->vmexten, "<not set>"));
 				astman_append(s, "MWIblink: %d\r\n", l->mwiblink);
-				astman_append(s, "Regextension: %s\r\n", S_OR(l->regexten, "<not set>"));
+				astman_append(s, "RegExtension: %s\r\n", S_OR(l->regexten, "<not set>"));
 				astman_append(s, "Regcontext: %s\r\n", S_OR(l->regcontext, "<not set>"));
 				astman_append(s, "MoHInterpret: %s\r\n", S_OR(l->mohinterpret, "<not set>"));
 				astman_append(s, "MoHSuggest: %s\r\n", S_OR(l->mohsuggest, "<not set>"));

Modified: team/group/newcdr/configs/extensions.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/configs/extensions.conf.sample?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/configs/extensions.conf.sample (original)
+++ team/group/newcdr/configs/extensions.conf.sample Wed Feb 25 10:21:12 2009
@@ -106,6 +106,14 @@
 ; that includes contexts within other contexts. The #include command works
 ; in all asterisk configuration files.
 ;#include "filename.conf"
+;
+; You can execute a program or script that produces config files, and they
+; will be inserted where you insert the #exec command. The #exec command 
+; works on all asterisk configuration files.  However, you will need to
+; activate them within asterisk.conf with the "execincludes" option.  They
+; are otherwise considered a security risk.
+;#exec /opt/bin/build-extra-contexts.sh
+;
 
 ; The "Globals" category contains global variables that can be referenced
 ; in the dialplan with the GLOBAL dialplan function:

Modified: team/group/newcdr/configs/voicemail.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/configs/voicemail.conf.sample?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/configs/voicemail.conf.sample (original)
+++ team/group/newcdr/configs/voicemail.conf.sample Wed Feb 25 10:21:12 2009
@@ -316,7 +316,7 @@
 ;4300 => 3456,Ben Rigas,ben at american-computer.net
 ;4310 => -5432,Sales,sales at marko.net
 ;4069 => 6522,Matt Brooks,matt at marko.net,,|tz=central|attach=yes|saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes|envelope=yes|moveheard=yes|sayduration=yes|saydurationm=1
-;4073 => 1099,Bianca Paige,bianca at biancapaige.com,,delete=1
+;4073 => 1099,Bianca Paige,bianca at biancapaige.com,,delete=1|emailsubject=You have a new voicemail.|emailbody=Click on the attachment to listen.
 ;4110 => 3443,Rob Flynn,rflynn at blueridge.net
 ;4235 => 1234,Jim Holmes,jim at astricon.ips,,Tz=european
 

Modified: team/group/newcdr/doc/manager_1_1.txt
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/doc/manager_1_1.txt?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/doc/manager_1_1.txt (original)
+++ team/group/newcdr/doc/manager_1_1.txt Wed Feb 25 10:21:12 2009
@@ -127,6 +127,12 @@
 
 - Event QueueEntry now also returns the Uniqueid field like other events from app_queue.
 
+- Action IAXpeerlist
+	Now includes if the IAX link is a trunk or not
+
+- Action IAXpeers
+	Now includes if the IAX link is a trunk or not
+
 * NEW ACTIONS
 -------------
 - Action: ModuleLoad

Modified: team/group/newcdr/main/asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/main/asterisk.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/main/asterisk.c (original)
+++ team/group/newcdr/main/asterisk.c Wed Feb 25 10:21:12 2009
@@ -37,7 +37,7 @@
  *
  * \section copyright Copyright and Author
  *
- * Copyright (C) 1999 - 2008, Digium, Inc.
+ * Copyright (C) 1999 - 2009, Digium, Inc.
  * Asterisk is a <a href="http://www.digium.com/en/company/view-policy.php?id=Trademark-Policy">registered trademark</a>
  * of <a href="http://www.digium.com">Digium, Inc</a>.
  *
@@ -275,6 +275,7 @@
 static pthread_t consolethread = AST_PTHREADT_NULL;
 static int canary_pid = 0;
 static char canary_filename[128];
+static int canary_pipe = -1;
 
 static char randompool[256];
 
@@ -3300,7 +3301,19 @@
 	if (isroot) {
 		ast_set_priority(ast_opt_high_priority);
 		if (ast_opt_high_priority) {
+			int cpipe[2];
+
+			/* PIPE signal ensures that astcanary dies when Asterisk dies */
+			if (pipe(cpipe)) {
+				fprintf(stderr, "Unable to open pipe for canary process: %s\n", strerror(errno));
+				exit(1);
+			}
+			canary_pipe = cpipe[0];
+
 			snprintf(canary_filename, sizeof(canary_filename), "%s/alt.asterisk.canary.tweet.tweet.tweet", ast_config_AST_RUN_DIR);
+
+			/* Don't let the canary child kill Asterisk, if it dies immediately */
+			signal(SIGPIPE, SIG_IGN);
 
 			canary_pid = fork();
 			if (canary_pid == 0) {
@@ -3309,9 +3322,14 @@
 
 				/* Reset signal handler */
 				signal(SIGCHLD, SIG_DFL);
-
-				for (fd = 0; fd < 100; fd++)
+				signal(SIGPIPE, SIG_DFL);
+
+				dup2(cpipe[1], 100);
+				close(cpipe[1]);
+
+				for (fd = 0; fd < 100; fd++) {
 					close(fd);
+				}
 
 				execlp("astcanary", "astcanary", canary_filename, (char *)NULL);
 
@@ -3326,6 +3344,7 @@
 				_exit(1);
 			} else if (canary_pid > 0) {
 				pthread_t dont_care;
+				close(cpipe[1]);
 				ast_pthread_create_detached(&dont_care, NULL, canary_thread, NULL);
 			}
 

Modified: team/group/newcdr/main/rtp.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/main/rtp.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/main/rtp.c (original)
+++ team/group/newcdr/main/rtp.c Wed Feb 25 10:21:12 2009
@@ -1038,10 +1038,11 @@
 		ast_log(LOG_DEBUG, "Ignoring RTP 2833 Event: %08x. Not a DTMF Digit.\n", event);
 		return &ast_null_frame;
 	}
-	
+
 	if (ast_test_flag(rtp, FLAG_DTMF_COMPENSATE)) {
 		if ((rtp->lastevent != timestamp) || (rtp->resp && rtp->resp != resp)) {
 			rtp->resp = resp;
+			rtp->dtmfcount = 0;
 			f = send_dtmf(rtp, AST_FRAME_DTMF_END);
 			f->len = 0;
 			rtp->lastevent = timestamp;
@@ -1050,15 +1051,16 @@
 		if ((!(rtp->resp) && (!(event_end & 0x80))) || (rtp->resp && rtp->resp != resp)) {
 			rtp->resp = resp;
 			f = send_dtmf(rtp, AST_FRAME_DTMF_BEGIN);
+			rtp->dtmfcount = dtmftimeout;
 		} else if ((event_end & 0x80) && (rtp->lastevent != seqno) && rtp->resp) {
 			f = send_dtmf(rtp, AST_FRAME_DTMF_END);
 			f->len = ast_tvdiff_ms(ast_samp2tv(samples, 8000), ast_tv(0, 0)); /* XXX hard coded 8kHz */
 			rtp->resp = 0;
+			rtp->dtmfcount = 0;
 			rtp->lastevent = seqno;
 		}
 	}
 
-	rtp->dtmfcount = dtmftimeout;
 	rtp->dtmfsamples = samples;
 
 	return f;
@@ -1735,13 +1737,7 @@
 	rtp->lastrxformat = rtp->f.subclass = rtpPT.code;
 	rtp->f.frametype = (rtp->f.subclass & AST_FORMAT_AUDIO_MASK) ? AST_FRAME_VOICE : (rtp->f.subclass & AST_FORMAT_VIDEO_MASK) ? AST_FRAME_VIDEO : AST_FRAME_TEXT;
 
-	if (!rtp->lastrxts)
-		rtp->lastrxts = timestamp;
-
 	rtp->rxseqno = seqno;
-
-	/* Record received timestamp as last received now */
-	rtp->lastrxts = timestamp;
 
 	if (rtp->dtmfcount) {
 		rtp->dtmfcount -= (timestamp - rtp->lastrxts);
@@ -1757,6 +1753,9 @@
 			return f;
 		}
 	}
+
+	/* Record received timestamp as last received now */
+	rtp->lastrxts = timestamp;
 
 	rtp->f.mallocd = 0;
 	rtp->f.datalen = res - hdrlen;

Modified: team/group/newcdr/main/sched.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/main/sched.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/main/sched.c (original)
+++ team/group/newcdr/main/sched.c Wed Feb 25 10:21:12 2009
@@ -233,7 +233,7 @@
 
 static int sched_time_cmp(void *a, void *b)
 {
-	return ast_tvcmp(((struct sched *) a)->when, ((struct sched *) b)->when);
+	return ast_tvcmp(((struct sched *) b)->when, ((struct sched *) a)->when);
 }
 
 struct sched_context *sched_context_create(void)

Modified: team/group/newcdr/tests/test_sched.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/tests/test_sched.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/tests/test_sched.c (original)
+++ team/group/newcdr/tests/test_sched.c Wed Feb 25 10:21:12 2009
@@ -42,13 +42,127 @@
 static char *handle_cli_sched_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct sched_context *con;
+	char *res = CLI_FAILURE;
+	int id1, id2, id3, wait;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "sched test";
+		e->usage = ""
+			"Usage: sched test\n"
+			"   Test scheduler entry ordering.\n"
+			"";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != e->args) {
+		return CLI_SHOWUSAGE;
+	}
+
+	ast_cli(a->fd, "Testing scheduler entry ordering ...\n");
+
+	if (!(con = sched_context_create())) {
+		ast_cli(a->fd, "Test failed - could not create scheduler context\n");
+		return CLI_FAILURE;
+	}
+
+	/* Add 3 scheduler entries, and then remove them, ensuring that the result
+	 * of ast_sched_wait() looks appropriate at each step along the way. */
+
+	if ((wait = ast_sched_wait(con)) != -1) {
+		ast_cli(a->fd, "ast_sched_wait() should have returned -1, returned '%d'\n",
+				wait);
+		goto return_cleanup;
+	}
+
+	if ((id1 = ast_sched_add(con, 100000, sched_cb, NULL)) == -1) {
+		ast_cli(a->fd, "Failed to add scheduler entry\n");
+		goto return_cleanup;
+	}
+
+	if ((wait = ast_sched_wait(con)) > 100000) {
+		ast_cli(a->fd, "ast_sched_wait() should have returned <= 100000, returned '%d'\n",
+				wait);
+		goto return_cleanup;
+	}
+
+	if ((id2 = ast_sched_add(con, 10000, sched_cb, NULL)) == -1) {
+		ast_cli(a->fd, "Failed to add scheduler entry\n");
+		goto return_cleanup;
+	}
+
+	if ((wait = ast_sched_wait(con)) > 10000) {
+		ast_cli(a->fd, "ast_sched_wait() should have returned <= 10000, returned '%d'\n",
+				wait);
+		goto return_cleanup;
+	}
+
+	if ((id3 = ast_sched_add(con, 1000, sched_cb, NULL)) == -1) {
+		ast_cli(a->fd, "Failed to add scheduler entry\n");
+		goto return_cleanup;
+	}
+
+	if ((wait = ast_sched_wait(con)) > 1000) {
+		ast_cli(a->fd, "ast_sched_wait() should have returned <= 1000, returned '%d'\n",
+				wait);
+		goto return_cleanup;
+	}
+
+	if (ast_sched_del(con, id3) == -1) {
+		ast_cli(a->fd, "Failed to remove scheduler entry\n");
+		goto return_cleanup;
+	}
+
+	if ((wait = ast_sched_wait(con)) <= 1000) {
+		ast_cli(a->fd, "ast_sched_wait() should have returned > 1000, returned '%d'\n",
+				wait);
+		goto return_cleanup;
+	}
+
+	if (ast_sched_del(con, id2) == -1) {
+		ast_cli(a->fd, "Failed to remove scheduler entry\n");
+		goto return_cleanup;
+	}
+
+	if ((wait = ast_sched_wait(con)) <= 10000) {
+		ast_cli(a->fd, "ast_sched_wait() should have returned > 10000, returned '%d'\n",
+				wait);
+		goto return_cleanup;
+	}
+
+	if (ast_sched_del(con, id1) == -1) {
+		ast_cli(a->fd, "Failed to remove scheduler entry\n");
+		goto return_cleanup;
+	}
+
+	if ((wait = ast_sched_wait(con)) != -1) {
+		ast_cli(a->fd, "ast_sched_wait() should have returned -1, returned '%d'\n",
+				wait);
+		goto return_cleanup;
+	}
+
+	res = CLI_SUCCESS;
+
+	ast_cli(a->fd, "Test passed!\n");
+
+return_cleanup:
+	sched_context_destroy(con);
+
+	return res;
+}
+
+static char *handle_cli_sched_bench(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct sched_context *con;
 	struct timeval start;
 	unsigned int num, i;
 	int *sched_ids = NULL;
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "sched test";
+		e->command = "sched benchmark";
 		e->usage = ""
 			"Usage: sched test <num>\n"
 			"";
@@ -114,7 +228,8 @@
 }
 
 static struct ast_cli_entry cli_sched[] = {
-	AST_CLI_DEFINE(handle_cli_sched_test, "Test ast_sched add/del performance"),
+	AST_CLI_DEFINE(handle_cli_sched_bench, "Benchmark ast_sched add/del performance"),
+	AST_CLI_DEFINE(handle_cli_sched_test, "Test scheduler entry ordering"),
 };
 
 static int unload_module(void)

Modified: team/group/newcdr/utils/astcanary.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/newcdr/utils/astcanary.c?view=diff&rev=178571&r1=178570&r2=178571
==============================================================================
--- team/group/newcdr/utils/astcanary.c (original)
+++ team/group/newcdr/utils/astcanary.c Wed Feb 25 10:21:12 2009
@@ -30,7 +30,7 @@
  * At one time, canaries were carried along with coal miners down
  * into a mine.  Their purpose was to alert the miners when they
  * had drilled into a pocket of methane gas or another noxious
- * substance.  The canary, being the most sensitive animal would
+ * substance.  The canary, being the most sensitive animal, would
  * immediately fall over.  Seeing this, the miners could take
  * action to escape the mine, seeing an imminent danger.
  *
@@ -57,6 +57,18 @@
  * the same time.  This is also why this canary must exist as a
  * completely separate process and not simply as a thread within
  * Asterisk itself.
+ *
+ * Quote:
+ * "The nice value set with setpriority() shall be applied to the
+ * process. If the process is multi-threaded, the nice value shall
+ * affect all system scope threads in the process."
+ *
+ * Source:
+ * http://www.opengroup.org/onlinepubs/000095399/functions/setpriority.html
+ *
+ * In answer to the question, what aren't system scope threads, the
+ * answer is, in Asterisk, nothing.  Process scope threads are the
+ * alternative, but they aren't supported in Linux.
  */
 
 static const char explanation[] =




More information about the asterisk-commits mailing list