[asterisk-commits] tilghman: branch 1.6.0 r245946 - in /branches/1.6.0: ./ configs/ funcs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Feb 10 08:09:32 CST 2010
Author: tilghman
Date: Wed Feb 10 08:09:28 2010
New Revision: 245946
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=245946
Log:
Merged revisions 245945 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r245945 | tilghman | 2010-02-10 08:06:12 -0600 (Wed, 10 Feb 2010) | 9 lines
Merged revisions 245944 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r245944 | tilghman | 2010-02-10 07:37:13 -0600 (Wed, 10 Feb 2010) | 2 lines
Include examples of FILTER usage in extension patterns where a "." may be a risk.
........
................
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/configs/extensions.conf.sample
branches/1.6.0/funcs/func_strings.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/configs/extensions.conf.sample
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/configs/extensions.conf.sample?view=diff&rev=245946&r1=245945&r2=245946
==============================================================================
--- branches/1.6.0/configs/extensions.conf.sample (original)
+++ branches/1.6.0/configs/extensions.conf.sample Wed Feb 10 08:09:28 2010
@@ -316,7 +316,7 @@
; International long distance through trunk
;
exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
-exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
+exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
[trunkld]
;
@@ -624,7 +624,7 @@
; An extension like the one below can be used for FWD, Nikotel, sipgate etc.
; Note that you must have a [sipprovider] section in sip.conf
;
-;exten => _41X.,1,Dial(SIP/${EXTEN:2}@sipprovider,,r)
+;exten => _41X.,1,Dial(SIP/${FILTER(0-9,${EXTEN:2})}@sipprovider,,r)
; Real extensions would go here. Generally you want real extensions to be
; 4 or 5 digits long (although there is no such requirement) and start with a
Modified: branches/1.6.0/funcs/func_strings.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/funcs/func_strings.c?view=diff&rev=245946&r1=245945&r2=245946
==============================================================================
--- branches/1.6.0/funcs/func_strings.c (original)
+++ branches/1.6.0/funcs/func_strings.c Wed Feb 10 08:09:28 2010
@@ -90,8 +90,9 @@
char *outbuf = buf, ac;
char allowed[256] = "";
size_t allowedlen = 0;
-
- AST_STANDARD_APP_ARGS(args, parse);
+ int32_t bitfield[8] = { 0, }; /* 256 bits */
+
+ AST_STANDARD_RAW_ARGS(args, parse);
if (!args.string) {
ast_log(LOG_ERROR, "Usage: FILTER(<allowed-chars>,<string>)\n");
@@ -116,16 +117,23 @@
* Looks a little strange, until you realize that we can overflow
* the size of a char.
*/
- for (ac = c1; ac != c2 && allowedlen < sizeof(allowed) - 1; ac++)
- allowed[allowedlen++] = ac;
- allowed[allowedlen++] = ac;
+ for (ac = c1; ac != c2; ac++) {
+ bitfield[ac / 32] |= 1 << (ac % 32);
+ }
ast_debug(4, "c1=%d, c2=%d\n", c1, c2);
/* Decrement before the loop increment */
(args.allowed)--;
- } else
- allowed[allowedlen++] = c1;
+ } else {
+ bitfield[c1 / 32] |= 1 << (c1 % 32);
+ }
+ }
+
+ for (ac = 1; ac != 0; ac++) {
+ if (bitfield[ac / 32] & (1 << (ac % 32))) {
+ allowed[allowedlen++] = ac;
+ }
}
ast_debug(1, "Allowed: %s\n", allowed);
More information about the asterisk-commits
mailing list