add time of day routing attrs to condition tags in xml dialplan

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14137 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-07-06 18:31:23 +00:00
parent 1e8eb422f0
commit 835b6d31bb
3 changed files with 101 additions and 0 deletions

View File

@@ -1949,6 +1949,47 @@ SWITCH_DECLARE(int) switch_isxdigit(int c)
return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & (_N|_X)));
}
SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val)
{
char *p;
if ((p=strchr(exp, '-'))) {
int min;
int max;
min = atol(exp);
p++;
max = atol(p);
if (val >= min && val <= max) {
return 1;
}
} else if ((p=strchr(exp, ','))) {
const char *cur = exp;
p++;
while(cur) {
if (atol(cur) == val) {
return 1;
}
cur = p;
if (p && p+1) {
if ((p = strchr((p+1), ','))) {
p++;
}
}
}
} else {
if (atol(exp) == val) {
return 1;
}
}
return 0;
}
/* For Emacs:
* Local Variables:
* mode:c