[svn-commits] pabelanger: branch pabelanger/non-root r278572 - in /team/pabelanger/non-root...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 21 15:20:25 CDT 2010


Author: pabelanger
Date: Wed Jul 21 15:20:19 2010
New Revision: 278572

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=278572
Log:
Merged revisions 278425-278426,278461-278463,278465,278501,278536,278538-278539 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r278425 | russell | 2010-07-21 09:02:46 -0400 (Wed, 21 Jul 2010) | 6 lines
  
  Update documentation for 'comebacktoorigin' in featuers.conf.
  
  The documentation for this option did not match the code.  Fix that along with
  some minor cleanups to the code along the way.  Document a slight change in
  behavior (to something that was previously undocumented) in UPGRADE.txt.
........
  r278426 | mnicholson | 2010-07-21 09:03:01 -0400 (Wed, 21 Jul 2010) | 2 lines
  
  Don't print failure status when the remote end hangs up, it may not be an actual failure.
........
  r278461 | mnicholson | 2010-07-21 11:51:24 -0400 (Wed, 21 Jul 2010) | 2 lines
  
  Properly set the port number for UDPTL media sessions.
........
  r278462 | mnicholson | 2010-07-21 11:54:29 -0400 (Wed, 21 Jul 2010) | 2 lines
  
  Properly show the current page being transfered for 'fax show session'
........
  r278463 | tilghman | 2010-07-21 11:56:05 -0400 (Wed, 21 Jul 2010) | 11 lines
  
  Ensure realtime conferences are treated the same as static conferences when trying to find an empty one.
  
  Also, parse the useropts properly, when retrieving from realtime, and add them
  to the existing flags.
  
  (closes issue #17502)
   Reported by: kenji
   Patches: 
         20100720__issue17502.diff.txt uploaded by tilghman (license 14)
   Tested by: kenji
........
  r278465 | russell | 2010-07-21 12:15:00 -0400 (Wed, 21 Jul 2010) | 41 lines
  
  Use poll() instead of select() in res_timing_pthread to avoid stack corruption.
  
  This code did not properly check FD_SETSIZE to ensure that it did not try to
  select() on fds that were too large.  Switching to poll() removes the limitation
  on the maximum fd value.
  
  (closes issue #15915)
  Reported by: keiron
  
  (closes issue #17187)
  Reported by: Eddie Edwards
  
  (closes issue #16494)
  Reported by: Hubguru
  
  (closes issue #15731)
  Reported by: flop
  
  (closes issue #12917)
  Reported by: falves11
  
  (closes issue #14920)
  Reported by: vrban
  
  (closes issue #17199)
  Reported by: aleksey2000
  
  (closes issue #15406)
  Reported by: kowalma
  
  (closes issue #17438)
  Reported by: dcabot
  
  (closes issue #17325)
  Reported by: glwgoes
  
  (closes issue #17118)
  Reported by: erikje
  
  possibly other issues, too ...
........
  r278501 | tzafrir | 2010-07-21 13:44:20 -0400 (Wed, 21 Jul 2010) | 19 lines
  
  Fix invalid test for rxisoffhook in FXO channels
  
  This fixes some cases of no outgoing calls on FXO before an incoming call.
  
  Remove an unnecessary testing of an "off-hook" bit from DAHDI for FXO
  (KS/GS) channels.In some cases the bit would not be initialized properly
  before the first inbound call and thus prevent an outgoing call.
  
  If those tests are actually required by anybody, they should define
  DAHDI_CHECK_HOOKSTATE in channels/sig_analog.c .
  
  (closes issue #14577)
  Reported by: jkroon
  Patches:
        asterisk_chan_dahdi_hookstate_fix_trunk_new.diff uploaded by frawd (license 610)
  Tested by: frawd
  
  Review: https://reviewboard.asterisk.org/r/699/
........
  r278536 | dvossel | 2010-07-21 14:52:14 -0400 (Wed, 21 Jul 2010) | 12 lines
  
  send "423 Interval too small" Response to Subscribe with Expires less that min allowed
  
  [RFC3265]3.1.6.1....
     The notifier MAY also check that the duration in the "Expires" header
     is not too small.  If and only if the expiration interval is greater
     than zero AND smaller than one hour AND less than a notifier-
     configured minimum, the notifier MAY return a "423 Interval too
     small" error which contains a "Min-Expires" header field.  The "Min-
     Expires" header field is described in SIP [1].
........
  r278538 | twilson | 2010-07-21 15:11:32 -0400 (Wed, 21 Jul 2010) | 4 lines
  
  Remove built-in AES code and use optional_api instead
  
  Review: https://reviewboard.asterisk.org/r/793/
........
  r278539 | dvossel | 2010-07-21 15:16:12 -0400 (Wed, 21 Jul 2010) | 2 lines
  
  make func_file unit test's category consistent with other tests
........

Removed:
    team/pabelanger/non-root/include/asterisk/aes.h
    team/pabelanger/non-root/include/asterisk/aes_internal.h
    team/pabelanger/non-root/main/aescrypt.c
    team/pabelanger/non-root/main/aeskey.c
    team/pabelanger/non-root/main/aesopt.h
    team/pabelanger/non-root/main/aestab.c
Modified:
    team/pabelanger/non-root/   (props changed)
    team/pabelanger/non-root/UPGRADE.txt
    team/pabelanger/non-root/apps/app_meetme.c
    team/pabelanger/non-root/channels/chan_dahdi.c
    team/pabelanger/non-root/channels/chan_iax2.c
    team/pabelanger/non-root/channels/chan_sip.c
    team/pabelanger/non-root/channels/iax2-parser.h
    team/pabelanger/non-root/channels/sig_analog.c
    team/pabelanger/non-root/configs/features.conf.sample
    team/pabelanger/non-root/funcs/func_aes.c
    team/pabelanger/non-root/include/asterisk/crypto.h
    team/pabelanger/non-root/main/features.c
    team/pabelanger/non-root/pbx/dundi-parser.h
    team/pabelanger/non-root/pbx/pbx_dundi.c
    team/pabelanger/non-root/res/res_crypto.c
    team/pabelanger/non-root/res/res_crypto.exports.in
    team/pabelanger/non-root/res/res_fax.c
    team/pabelanger/non-root/res/res_fax_spandsp.c
    team/pabelanger/non-root/res/res_timing_pthread.c
    team/pabelanger/non-root/tests/test_func_file.c

Propchange: team/pabelanger/non-root/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul 21 15:20:19 2010
@@ -1,1 +1,1 @@
-/trunk:1-278415
+/trunk:1-278415,278425-278539

Modified: team/pabelanger/non-root/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/UPGRADE.txt?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/UPGRADE.txt (original)
+++ team/pabelanger/non-root/UPGRADE.txt Wed Jul 21 15:20:19 2010
@@ -30,6 +30,13 @@
   By default, Asterisk will look for both the 'asterisk' user and group on the
   system. If they do not exist you will be required to create the appropriate
   user/group or use the --enable-root flag.
+
+* The behavior of the 'parkedcallstimeout' has changed slightly.  The formulation
+  of the extension name that a timed out parked call is delivered to when this
+  option is set to 'no' was modified such that instead of converting '/' to '0',
+  the '/' is converted to an underscore '_'.  See the updated documentation in
+  features.conf.sample for more information on the behavior of the
+  'parkedcallstimeout' option.
 
 * Asterisk-addons no longer exists as an independent package.  Those modules
   now live in the addons directory of the main Asterisk source tree.  They

Modified: team/pabelanger/non-root/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/apps/app_meetme.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/apps/app_meetme.c (original)
+++ team/pabelanger/non-root/apps/app_meetme.c Wed Jul 21 15:20:19 2010
@@ -3749,7 +3749,7 @@
 }
 
 static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char *confno, int make, int dynamic,
-				char *dynamic_pin, size_t pin_buf_len, int refcount, struct ast_flags64 *confflags, int *too_early)
+				char *dynamic_pin, size_t pin_buf_len, int refcount, struct ast_flags64 *confflags, int *too_early, char **optargs)
 {
 	struct ast_variable *var, *origvar;
 	struct ast_conference *cnf;
@@ -3759,8 +3759,9 @@
 	/* Check first in the conference list */
 	AST_LIST_LOCK(&confs);
 	AST_LIST_TRAVERSE(&confs, cnf, list) {
-		if (!strcmp(confno, cnf->confno)) 
+		if (!strcmp(confno, cnf->confno)) {
 			break;
+		}
 	}
 	if (cnf) {
 		cnf->refcount += refcount;
@@ -3823,13 +3824,15 @@
 			 var = ast_load_realtime("meetme", "confno", confno, NULL);
 		}
 
-		if (!var)
+		if (!var) {
 			return NULL;
+		}
 
 		if (rt_schedule && *too_early) {
 			/* Announce that the caller is early and exit */
-			if (!ast_streamfile(chan, "conf-has-not-started", chan->language))
+			if (!ast_streamfile(chan, "conf-has-not-started", chan->language)) {
 				ast_waitstream(chan, "");
+			}
 			ast_variables_destroy(var);
 			return NULL;
 		}
@@ -3863,6 +3866,8 @@
 		cnf = build_conf(confno, pin ? pin : "", pinadmin ? pinadmin : "", make, dynamic, refcount, chan, NULL);
 
 		if (cnf) {
+			struct ast_flags64 tmp_flags;
+
 			cnf->maxusers = maxusers;
 			cnf->endalert = endalert;
 			cnf->endtime = endtime.tv_sec;
@@ -3871,6 +3876,11 @@
 			cnf->bookid = ast_strdup(bookid);
 			cnf->recordingfilename = ast_strdup(recordingfilename);
 			cnf->recordingformat = ast_strdup(recordingformat);
+
+			/* Parse the other options into confflags -- need to do this in two
+			 * steps, because the parse_options routine zeroes the buffer. */
+			ast_app_parse_options64(meetme_opts, &tmp_flags, optargs, useropts);
+			ast_copy_flags64(confflags, &tmp_flags, tmp_flags.flags);
 
 			if (strchr(cnf->useropts, 'r')) {
 				if (ast_strlen_zero(recordingfilename)) { /* If the recordingfilename in the database is empty, use the channel definition or use the default. */
@@ -3910,7 +3920,7 @@
 			ast_log(LOG_WARNING, "No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n");
 			ast_clear_flag64(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW);
 		}
-		
+
 		if (confflags && !cnf->chan &&
 		    ast_test_flag64(confflags, CONFFLAG_RECORDCONF)) {
 			ast_log(LOG_WARNING, "No DAHDI channel available for conference, conference recording disabled (is chan_dahdi loaded?)\n");
@@ -4168,12 +4178,47 @@
 										 */
 										ast_copy_string(confno, confno_tmp, sizeof(confno));
 										break;
-										/* XXX the map is not complete (but we do have a confno) */
 									}
 								}
 							}
 						}
 						var = var->next;
+					}
+					ast_config_destroy(cfg);
+				}
+
+				if (ast_strlen_zero(confno) && (cfg = ast_load_realtime_multientry("meetme", "confno LIKE", "%", SENTINEL))) {
+					const char *catg;
+					for (catg = ast_category_browse(cfg, NULL); catg; catg = ast_category_browse(cfg, catg)) {
+						const char *confno_tmp = ast_variable_retrieve(cfg, catg, "confno");
+						const char *pin_tmp = ast_variable_retrieve(cfg, catg, "pin");
+						if (ast_strlen_zero(confno_tmp)) {
+							continue;
+						}
+						if (!dynamic) {
+							int found = 0;
+							/* For static:  run through the list and see if this conference is empty */
+							AST_LIST_LOCK(&confs);
+							AST_LIST_TRAVERSE(&confs, cnf, list) {
+								if (!strcmp(confno_tmp, cnf->confno)) {
+									/* The conference exists, therefore it's not empty */
+									found = 1;
+									break;
+								}
+							}
+							AST_LIST_UNLOCK(&confs);
+							if (!found) {
+								/* At this point, we have a confno_tmp (realtime conference) that is empty */
+								if ((empty_no_pin && ast_strlen_zero(pin_tmp)) || (!empty_no_pin)) {
+									/* Case 1:  empty_no_pin and pin is nonexistent (NULL)
+									 * Case 2:  empty_no_pin and pin is blank (but not NULL)
+									 * Case 3:  not empty_no_pin
+									 */
+									ast_copy_string(confno, confno_tmp, sizeof(confno));
+									break;
+								}
+							}
+						}
 					}
 					ast_config_destroy(cfg);
 				}
@@ -4230,7 +4275,7 @@
 				int too_early = 0;
 
 				cnf = find_conf_realtime(chan, confno, 1, dynamic, 
-					the_pin, sizeof(the_pin), 1, &confflags,&too_early);
+					the_pin, sizeof(the_pin), 1, &confflags, &too_early, optargs);
 				if (rt_schedule && too_early)
 					allowretry = 0;
 			}

Modified: team/pabelanger/non-root/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/channels/chan_dahdi.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/channels/chan_dahdi.c (original)
+++ team/pabelanger/non-root/channels/chan_dahdi.c Wed Jul 21 15:20:19 2010
@@ -285,13 +285,6 @@
  * even though their web site says they support their products for life.
  */
 /* #define ZHONE_HACK */
-
-/*! \note
- * Define if you want to check the hook state for an FXO (FXS signalled) interface
- * before dialing on it.  Certain FXO interfaces always think they're out of
- * service with this method however.
- */
-/* #define DAHDI_CHECK_HOOKSTATE */
 
 /*! \brief Typically, how many rings before we should send Caller*ID */
 #define DEFAULT_CIDRINGS 1

Modified: team/pabelanger/non-root/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/channels/chan_iax2.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/channels/chan_iax2.c (original)
+++ team/pabelanger/non-root/channels/chan_iax2.c Wed Jul 21 15:20:19 2010
@@ -80,7 +80,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/causes.h"
 #include "asterisk/localtime.h"
-#include "asterisk/aes.h"
 #include "asterisk/dnsmgr.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/netsock.h"
@@ -6035,7 +6034,7 @@
 static void build_encryption_keys(const unsigned char *digest, struct chan_iax2_pvt *pvt)
 {
 	build_ecx_key(digest, pvt);
-	ast_aes_decrypt_key(digest, &pvt->dcx);
+	ast_aes_set_decrypt_key(digest, &pvt->dcx);
 }
 
 static void build_ecx_key(const unsigned char *digest, struct chan_iax2_pvt *pvt)
@@ -6044,8 +6043,8 @@
 	 * in the pvt struct because queued frames occasionally need to be decrypted and
 	 * re-encrypted when updated for a retransmission */
 	build_rand_pad(pvt->semirand, sizeof(pvt->semirand));
-	ast_aes_encrypt_key(digest, &pvt->ecx);
-	ast_aes_decrypt_key(digest, &pvt->mydcx);
+	ast_aes_set_encrypt_key(digest, &pvt->ecx);
+	ast_aes_set_decrypt_key(digest, &pvt->mydcx);
 }
 
 static void memcpy_decrypt(unsigned char *dst, const unsigned char *src, int len, ast_aes_decrypt_key *dcx)
@@ -11214,7 +11213,7 @@
 
 				IAX_DEBUGDIGEST("Receiving", ies.challenge);
 
-				ast_aes_decrypt_key((unsigned char *) ies.challenge, &iaxs[fr->callno]->dcx);
+				ast_aes_set_decrypt_key((unsigned char *) ies.challenge, &iaxs[fr->callno]->dcx);
 				break;
 			case IAX_COMMAND_DPREP:
 				complete_dpreply(iaxs[fr->callno], &ies);

Modified: team/pabelanger/non-root/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/channels/chan_sip.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/channels/chan_sip.c (original)
+++ team/pabelanger/non-root/channels/chan_sip.c Wed Jul 21 15:20:19 2010
@@ -8266,8 +8266,7 @@
 	/* Setup image address and port */
 	if (p->udptl) {
 		if (udptlportno > 0) {
-			isin.sin_family = AF_INET;
-			isin.sin_port = htons(udptlportno);
+			ast_sockaddr_set_port(isa, udptlportno);
 			if (ast_test_flag(&p->flags[1], SIP_PAGE2_SYMMETRICRTP) && ast_test_flag(&p->flags[1], SIP_PAGE2_UDPTL_DESTINATION)) {
 				struct sockaddr_in remote_address = { 0, };
 				struct ast_sockaddr remote_address_tmp;
@@ -9618,6 +9617,18 @@
 	respprep(&resp, p, msg, req);
 	add_header(&resp, "Accept", "application/sdp");
 	return send_response(p, &resp, reliable, 0);
+}
+
+/*! \brief Append Min-Expires header, content length before transmitting response */
+static int transmit_response_with_minexpires(struct sip_pvt *p, const char *msg, const struct sip_request *req)
+{
+	struct sip_request resp;
+	char tmp[32];
+
+	snprintf(tmp, sizeof(tmp), "%d", min_expiry);
+	respprep(&resp, p, msg, req);
+	add_header(&resp, "Min-Expires", tmp);
+	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
 }
 
 /*! \brief Respond with authorization request */
@@ -23146,10 +23157,15 @@
 		p->expiry = atoi(get_header(req, "Expires"));
 
 		/* check if the requested expiry-time is within the approved limits from sip.conf */
-		if (p->expiry > max_expiry)
+		if (p->expiry > max_expiry) {
 			p->expiry = max_expiry;
-		if (p->expiry < min_expiry && p->expiry > 0)
+		} else if (p->expiry < min_expiry && p->expiry > 0) {
 			p->expiry = min_expiry;
+			transmit_response_with_minexpires(p, "423 Interval too small", req);
+			ast_debug(2, "Received SIP subscribe with Expire header less that our minexpires limit.\n");
+			pvt_set_needdestroy(p, "Expires is less that the min expires allowed. ");
+			return 0;
+		}
 
 		if (sipdebug) {
 			if (p->subscribed == MWI_NOTIFICATION && p->relatedpeer) {

Modified: team/pabelanger/non-root/channels/iax2-parser.h
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/channels/iax2-parser.h?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/channels/iax2-parser.h (original)
+++ team/pabelanger/non-root/channels/iax2-parser.h Wed Jul 21 15:20:19 2010
@@ -19,7 +19,7 @@
 #define _IAX2_PARSER_H
 
 #include "asterisk/linkedlists.h"
-#include "asterisk/aes.h"
+#include "asterisk/crypto.h"
 #include "asterisk/frame_defs.h"
 
 struct iax_ies {

Modified: team/pabelanger/non-root/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/channels/sig_analog.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/channels/sig_analog.c (original)
+++ team/pabelanger/non-root/channels/sig_analog.c Wed Jul 21 15:20:19 2010
@@ -41,6 +41,13 @@
 #include "asterisk/causes.h"
 
 #include "sig_analog.h"
+
+/*! \note
+ * Define if you want to check the hook state for an FXO (FXS signalled) interface
+ * before dialing on it.  Certain FXO interfaces always think they're out of
+ * service with this method however.
+ */
+/* #define DAHDI_CHECK_HOOKSTATE */
 
 #define POLARITY_IDLE 0
 #define POLARITY_REV    1
@@ -684,23 +691,19 @@
 
 	/* If no owner definitely available */
 	if (!p->owner) {
-		if (p->sig == ANALOG_SIG_FXSLS) {
-			return 1;
-		}
-
 		offhook = analog_is_off_hook(p);
 
-		if ((p->sig == ANALOG_SIG_FXSKS) || (p->sig == ANALOG_SIG_FXSGS)) {
-			/* When "onhook" that means no battery on the line, and thus
-			  it is out of service..., if it's on a TDM card... If it's a channel
-			  bank, there is no telling... */
+		/* TDM FXO card, "onhook" means out of service (no battery on the line) */
+		if ((p->sig == ANALOG_SIG_FXSLS) || (p->sig == ANALOG_SIG_FXSKS) || (p->sig == ANALOG_SIG_FXSGS)) {
+#ifdef DAHDI_CHECK_HOOKSTATE
 			if (offhook) {
 				return 1;
 			}
 			return 0;
+#endif
+		/* TDM FXS card, "offhook" means someone took the hook off so it's unavailable! */
 		} else if (offhook) {
 			ast_debug(1, "Channel %d off hook, can't use\n", p->channel);
-			/* Not available when the other end is off hook */
 			return 0;
 		}
 		return 1;

Modified: team/pabelanger/non-root/configs/features.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/configs/features.conf.sample?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/configs/features.conf.sample (original)
+++ team/pabelanger/non-root/configs/features.conf.sample Wed Jul 21 15:20:19 2010
@@ -11,9 +11,33 @@
 ;parkinghints = no		; Add hints priorities automatically for parking slots (default is no).
 ;parkingtime => 45		; Number of seconds a call can be parked for
 				; (default is 45 seconds)
-;comebacktoorigin = yes	; Whether to return to the original calling extension upon parking
-				; timeout or to send the call to context 'parkedcallstimeout' at
-				; extension 's', priority '1' (default is yes).
+
+;comebacktoorigin = yes         ; Setting this option configures the behavior of call parking when the
+                                ; parked call times out (See the parkingtime option).  The default value is 'yes'.
+                                ;
+                                ; 'yes' - When the parked call times out, attempt to send the call back to the peer
+                                ;         that parked this call.  This is done by saving off the name of the channel
+                                ;         that parked the call.
+                                ;
+                                ; 'no'  - This option is useful for performing custom dialplan functionality prior to
+                                ;         sending the call back to the extension that initially parked the call, or to
+                                ;         an entirely different destination.
+                                ;
+                                ;         When the parked call times out, send it back to the dialplan.  The location
+                                ;         will be the 'parkedcallstimeout' context.  The extension will be built from
+                                ;         the saved channel name that parked the call.  For example, if a SIP peer named
+                                ;         '0004F2040001' parked this call, the extension will be 'SIP_0004F2040001'.
+                                ;         (Note that an underscore is used here because the '/' character has a special
+                                ;         meaning in extension names for CallerID matching.)  If this extension does not
+                                ;         exist, the call will be sent to the 's' extension, instead.  Finally, if the 's'
+                                ;         extension of 'parkedcallstimeout' does not exist, the call will fall back to the
+                                ;         's' extension of the 'default' context.
+                                ;
+                                ;         Additionally, in this example an extension of 'SIP_0004F2040001' will be
+                                ;         created in the 'park-dial' context.  This extension will be set up to do a
+                                ;         Dial() to 'SIP/0004F2040001'.
+                                ;
+
 ;courtesytone = beep		; Sound file to play to the parked caller
 				; when someone dials a parked call
 				; or the Touch Monitor is activated/deactivated.

Modified: team/pabelanger/non-root/funcs/func_aes.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/funcs/func_aes.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/funcs/func_aes.c (original)
+++ team/pabelanger/non-root/funcs/func_aes.c Wed Jul 21 15:20:19 2010
@@ -22,6 +22,9 @@
  * \ingroup functions
  */
 
+/*** MODULEINFO
+	<use>crypto</use>
+ ***/
 
 #include "asterisk.h"
 
@@ -30,7 +33,7 @@
 #include "asterisk/module.h"
 #include "asterisk/pbx.h"
 #include "asterisk/app.h"
-#include "asterisk/aes.h"
+#include "asterisk/crypto.h"
 
 #define AES_BLOCK_SIZE 16
 
@@ -97,8 +100,8 @@
 		return -1;
 	}
 
-	ast_aes_encrypt_key((unsigned char *) args.key, &ecx);   /* encryption:  plaintext -> encryptedtext -> base64 */
-	ast_aes_decrypt_key((unsigned char *) args.key, &dcx);   /* decryption:  base64 -> encryptedtext -> plaintext */
+	ast_aes_set_encrypt_key((unsigned char *) args.key, &ecx);   /* encryption:  plaintext -> encryptedtext -> base64 */
+	ast_aes_set_decrypt_key((unsigned char *) args.key, &dcx);   /* decryption:  base64 -> encryptedtext -> plaintext */
 	tmp = ast_calloc(1, len);                     /* requires a tmp buffer for the base64 decode */
 	tmpP = tmp;
 	encrypt = strcmp("AES_DECRYPT", cmd);           /* -1 if encrypting, 0 if decrypting */

Modified: team/pabelanger/non-root/include/asterisk/crypto.h
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/include/asterisk/crypto.h?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/include/asterisk/crypto.h (original)
+++ team/pabelanger/non-root/include/asterisk/crypto.h Wed Jul 21 15:20:19 2010
@@ -28,6 +28,16 @@
 #endif
 
 #include "asterisk/optional_api.h"
+#include "asterisk/logger.h"
+
+#ifdef HAVE_CRYPTO
+#include "openssl/aes.h"
+typedef AES_KEY ast_aes_encrypt_key;
+typedef AES_KEY ast_aes_decrypt_key;
+#else /* !HAVE_CRYPTO */
+typedef char ast_aes_encrypt_key;
+typedef char ast_aes_decrypt_key;
+#endif /* HAVE_CRYPTO */
 
 #define AST_KEY_PUBLIC	(1 << 0)
 #define AST_KEY_PRIVATE	(1 << 1)
@@ -122,6 +132,50 @@
  */
 AST_OPTIONAL_API(int, ast_decrypt_bin, (unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key), { return -1; });
 
+/*!
+ * \brief Set an encryption key
+ * \param key a 16 char key
+ * \param ctx address of an aes encryption context
+ *
+ * \retval 0 success
+ * \retval nonzero failure
+ */
+AST_OPTIONAL_API(int, ast_aes_set_encrypt_key,
+	(const unsigned char *key, ast_aes_encrypt_key *ctx),
+	{ ast_log(LOG_WARNING, "AES encryption disabled. Install OpenSSL.\n"); return -1; });
+
+/*!
+ * \brief Set a decryption key
+ * \param key a 16 char key
+ * \param ctx address of an aes encryption context
+ *
+ * \retval 0 success
+ * \retval nonzero failure
+ */
+AST_OPTIONAL_API(int, ast_aes_set_decrypt_key,
+	(const unsigned char *key, ast_aes_decrypt_key *ctx),
+	{ ast_log(LOG_WARNING, "AES encryption disabled. Install OpenSSL.\n"); return -1; });
+
+/*!
+ * \brief AES encrypt data
+ * \param in data to be encrypted
+ * \param out pointer to a buffer to hold the encrypted output
+ * \param ctx address of an aes encryption context filled in with ast_aes_set_encrypt_key
+ */
+AST_OPTIONAL_API(void, ast_aes_encrypt,
+	(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *ctx),
+	{ ast_log(LOG_WARNING, "AES encryption disabled. Install OpenSSL.\n");return; });
+
+/*!
+ * \brief AES decrypt data
+ * \param in encrypted data
+ * \param out pointer to a buffer to hold the decrypted output
+ * \param ctx address of an aes encryption context filled in with ast_aes_set_decrypt_key
+ */
+AST_OPTIONAL_API(void, ast_aes_decrypt,
+	(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *ctx),
+	{ ast_log(LOG_WARNING, "AES encryption disabled. Install OpenSSL.\n");return; });
+
 AST_OPTIONAL_API(int, ast_crypto_loaded, (void), { return 0; });
 
 #if defined(__cplusplus) || defined(c_plusplus)

Modified: team/pabelanger/non-root/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/main/features.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/main/features.c (original)
+++ team/pabelanger/non-root/main/features.c Wed Jul 21 15:20:19 2010
@@ -3629,21 +3629,24 @@
 			if (pu->peername[0]) {
 				char *peername = ast_strdupa(pu->peername);
 				char *cp = strrchr(peername, '-');
-				char peername_flat[AST_MAX_EXTENSION]; /* using something like DAHDI/52 for an extension name is NOT a good idea */
+				char *peername_flat; /* using something like DAHDI/52 for an extension name is NOT a good idea */
 				int i;
 
-				if (cp) 
+				if (cp) {
 					*cp = 0;
-				ast_copy_string(peername_flat,peername,sizeof(peername_flat));
-				for(i=0; peername_flat[i] && i < AST_MAX_EXTENSION; i++) {
-					if (peername_flat[i] == '/') 
-						peername_flat[i]= '0';
 				}
+
+				peername_flat = ast_strdupa(peername);
+				for (i = 0; peername_flat[i]; i++) {
+					if (peername_flat[i] == '/') {
+						peername_flat[i]= '_';
+					}
+				}
+
 				con = ast_context_find_or_create(NULL, NULL, pu->parkinglot->parking_con_dial, registrar);
 				if (!con) {
 					ast_log(LOG_ERROR, "Parking dial context '%s' does not exist and unable to create\n", pu->parkinglot->parking_con_dial);
-				}
-				if (con) {
+				} else {
 					char returnexten[AST_MAX_EXTENSION];
 					struct ast_datastore *features_datastore;
 					struct ast_dial_features *dialfeatures = NULL;
@@ -3663,7 +3666,7 @@
 						char buf[MAX_DIAL_FEATURE_OPTIONS] = {0,};
 						snprintf(returnexten, sizeof(returnexten), "%s,30,%s", peername, callback_dialoptions(&(dialfeatures->features_callee), &(dialfeatures->features_caller), buf, sizeof(buf)));
 					} else { /* Existing default */
-						ast_log(LOG_WARNING, "Dialfeatures not found on %s, using default!\n", chan->name);
+						ast_log(LOG_NOTICE, "Dial features not found on %s, using default!\n", chan->name);
 						snprintf(returnexten, sizeof(returnexten), "%s,30,t", peername);
 					}
 
@@ -3676,7 +3679,6 @@
 					if (comebacktoorigin) {
 						set_c_e_p(chan, pu->parkinglot->parking_con_dial, peername_flat, 1);
 					} else {
-						ast_log(LOG_WARNING, "now going to parkedcallstimeout,s,1 | ps is %d\n",pu->parkingnum);
 						snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
 						pbx_builtin_setvar_helper(chan, "PARKINGSLOT", parkingslot);
 						set_c_e_p(chan, "parkedcallstimeout", peername_flat, 1);

Modified: team/pabelanger/non-root/pbx/dundi-parser.h
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/pbx/dundi-parser.h?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/pbx/dundi-parser.h (original)
+++ team/pabelanger/non-root/pbx/dundi-parser.h Wed Jul 21 15:20:19 2010
@@ -13,7 +13,7 @@
 #define _DUNDI_PARSER_H
 
 #include "asterisk/dundi.h"
-#include "asterisk/aes.h"
+#include "asterisk/crypto.h"
 
 #define DUNDI_MAX_STACK 512
 #define DUNDI_MAX_ANSWERS	100

Modified: team/pabelanger/non-root/pbx/pbx_dundi.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/pbx/pbx_dundi.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/pbx/pbx_dundi.c (original)
+++ team/pabelanger/non-root/pbx/pbx_dundi.c Wed Jul 21 15:20:19 2010
@@ -61,7 +61,6 @@
 #include "asterisk/crypto.h"
 #include "asterisk/astdb.h"
 #include "asterisk/acl.h"
-#include "asterisk/aes.h"
 #include "asterisk/app.h"
 
 #include "dundi-parser.h"
@@ -1313,8 +1312,8 @@
 	int res;
 	if (!peer->keyexpire || (peer->keyexpire < time(NULL))) {
 		build_iv(key);
-		ast_aes_encrypt_key(key, &peer->us_ecx);
-		ast_aes_decrypt_key(key, &peer->us_dcx);
+		ast_aes_set_encrypt_key(key, &peer->us_ecx);
+		ast_aes_set_decrypt_key(key, &peer->us_dcx);
 		ekey = ast_key_get(peer->inkey, AST_KEY_PUBLIC);
 		if (!ekey) {
 			ast_log(LOG_NOTICE, "No such key '%s' for creating RSA encrypted shared key for '%s'!\n",
@@ -1516,8 +1515,8 @@
 	memcpy(peer->rxenckey, newkey, 128);
 	memcpy(peer->rxenckey + 128, newsig, 128);
 	peer->them_keycrc32 = crc32(0L, peer->rxenckey, 128);
-	ast_aes_decrypt_key(dst, &peer->them_dcx);
-	ast_aes_encrypt_key(dst, &peer->them_ecx);
+	ast_aes_set_decrypt_key(dst, &peer->them_dcx);
+	ast_aes_set_encrypt_key(dst, &peer->them_ecx);
 	return 1;
 }
 

Modified: team/pabelanger/non-root/res/res_crypto.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/res/res_crypto.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/res/res_crypto.c (original)
+++ team/pabelanger/non-root/res/res_crypto.c Wed Jul 21 15:20:19 2010
@@ -37,6 +37,7 @@
 #include "asterisk/paths.h"	/* use ast_config_AST_KEY_DIR */
 #include <openssl/ssl.h>
 #include <openssl/err.h>
+#include <openssl/aes.h>
 #include <dirent.h>
 
 #include "asterisk/module.h"
@@ -453,6 +454,26 @@
 	return 1;
 }
 
+int AST_OPTIONAL_API_NAME(ast_aes_set_encrypt_key)(const unsigned char *key, ast_aes_encrypt_key *ctx)
+{
+	return AES_set_encrypt_key(key, 128, ctx);
+}
+
+int AST_OPTIONAL_API_NAME(ast_aes_set_decrypt_key)(const unsigned char *key, ast_aes_decrypt_key *ctx)
+{
+	return AES_set_decrypt_key(key, 128, ctx);
+}
+
+void AST_OPTIONAL_API_NAME(ast_aes_encrypt)(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *ctx)
+{
+	return AES_encrypt(in, out, ctx);
+}
+
+void AST_OPTIONAL_API_NAME(ast_aes_decrypt)(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *ctx)
+{
+	return AES_decrypt(in, out, ctx);
+}
+
 /*!
  * \brief refresh RSA keys from file
  * \param ifd file descriptor

Modified: team/pabelanger/non-root/res/res_crypto.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/res/res_crypto.exports.in?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/res/res_crypto.exports.in (original)
+++ team/pabelanger/non-root/res/res_crypto.exports.in Wed Jul 21 15:20:19 2010
@@ -8,6 +8,10 @@
 		LINKER_SYMBOL_PREFIX*ast_key_get;
 		LINKER_SYMBOL_PREFIX*ast_sign;
 		LINKER_SYMBOL_PREFIX*ast_sign_bin;
+		LINKER_SYMBOL_PREFIX*ast_aes_encrypt;
+		LINKER_SYMBOL_PREFIX*ast_aes_decrypt;
+		LINKER_SYMBOL_PREFIX*ast_aes_set_encrypt_key;
+		LINKER_SYMBOL_PREFIX*ast_aes_set_decrypt_key;
 	local:
 		*;
 };

Modified: team/pabelanger/non-root/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/res/res_fax.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/res/res_fax.c (original)
+++ team/pabelanger/non-root/res/res_fax.c Wed Jul 21 15:20:19 2010
@@ -811,14 +811,19 @@
 	pbx_builtin_setvar_helper(chan, "FAXPAGES", buf);
 }
 
-#define GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason)	\
+#define GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, errorstr, reason) \
 	do {	\
-		ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s' (%s)\n", chan->name, fax->id, reason, errorstr); \
 		ast_string_field_set(fax->details, result, S_OR(fax->details->result, "FAILED")); \
 		ast_string_field_set(fax->details, resultstr, S_OR(fax->details->resultstr, reason)); \
 		ast_string_field_set(fax->details, error, S_OR(fax->details->error, errorstr)); \
 		set_channel_variables(chan, fax->details); \
 		res = ms = -1; \
+	} while (0)
+
+#define GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason)	\
+	do {	\
+		ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s' (%s)\n", chan->name, fax->id, reason, errorstr); \
+		GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, errorstr, reason); \
 	} while (0)
 
 static void t38_parameters_ast_to_fax(struct ast_fax_t38_parameters *dst, const struct ast_control_t38_parameters *src)
@@ -1048,7 +1053,7 @@
  				 * send the FAX stack silence so the modems can finish their session without
  				 * any problems */
 				ast_log(LOG_NOTICE, "Channel '%s' did not return a frame; probably hung up.\n", chan->name);
-				GENERIC_FAX_EXEC_ERROR(fax, chan, "HANGUP", "remote end hungup");
+				GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, "HANGUP", "remote end hungup");
 				c = NULL;
 				chancount = 0;
 				timeout -= (1000 - ms);

Modified: team/pabelanger/non-root/res/res_fax_spandsp.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/res/res_fax_spandsp.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/res/res_fax_spandsp.c (original)
+++ team/pabelanger/non-root/res/res_fax_spandsp.c Wed Jul 21 15:20:19 2010
@@ -675,9 +675,9 @@
 		ast_cli(fd, "%-22s : %d\n", "Data Rate", stats.bit_rate);
 		ast_cli(fd, "%-22s : %dx%d\n", "Image Resolution", stats.x_resolution, stats.y_resolution);
 #if SPANDSP_RELEASE_DATE >= 20090220
-		ast_cli(fd, "%-22s : %d\n", "Page Number", (s->details->caps & AST_FAX_TECH_RECEIVE) ? stats.pages_rx : stats.pages_tx);
+		ast_cli(fd, "%-22s : %d\n", "Page Number", ((s->details->caps & AST_FAX_TECH_RECEIVE) ? stats.pages_rx : stats.pages_tx) + 1);
 #else
-		ast_cli(fd, "%-22s : %d\n", "Page Number", stats.pages_transferred);
+		ast_cli(fd, "%-22s : %d\n", "Page Number", stats.pages_transferred + 1);
 #endif
 		ast_cli(fd, "%-22s : %s\n", "File Name", s->details->caps & AST_FAX_TECH_RECEIVE ? p->t30_state->rx_file : p->t30_state->tx_file);
 

Modified: team/pabelanger/non-root/res/res_timing_pthread.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/res/res_timing_pthread.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/res/res_timing_pthread.c (original)
+++ team/pabelanger/non-root/res/res_timing_pthread.c Wed Jul 21 15:20:19 2010
@@ -36,6 +36,7 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/time.h"
 #include "asterisk/lock.h"
+#include "asterisk/poll-compat.h"
 
 static void *timing_funcs_handle;
 
@@ -376,16 +377,12 @@
 	do {
 		unsigned char buf[1024];
 		ssize_t res;
-		fd_set rfds;
-		struct timeval timeout = {
-			.tv_sec = 0,
+		struct pollfd pfd = {
+			.fd = rd_fd,
+			.events = POLLIN,
 		};
 
-		/* Make sure there is data to read */
-		FD_ZERO(&rfds);
-		FD_SET(rd_fd, &rfds);
-
-		if (select(rd_fd + 1, &rfds, NULL, NULL, &timeout) != 1) {
+		if (ast_poll(&pfd, 1, 0) != 1) {
 			ast_debug(1, "Reading not available on timing pipe, "
 					"quantity: %u\n", quantity);
 			break;

Modified: team/pabelanger/non-root/tests/test_func_file.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/tests/test_func_file.c?view=diff&rev=278572&r1=278571&r2=278572
==============================================================================
--- team/pabelanger/non-root/tests/test_func_file.c (original)
+++ team/pabelanger/non-root/tests/test_func_file.c Wed Jul 21 15:20:19 2010
@@ -253,7 +253,7 @@
 	switch (cmd) {
 	case TEST_INIT:
 		info->name = "func_file";
-		info->category = "funcs/func_env";
+		info->category = "/funcs/func_env";
 		info->summary = "Verify behavior of the FILE() dialplan function";
 		info->description =
 			"Verifies that the examples of the FILE() dialplan function documentation work as described.";




More information about the svn-commits mailing list