[asterisk-commits] branch oej/multiparking - r7876 in
/team/oej/multiparking: ./ apps/ channels/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Jan 9 03:20:33 CST 2006
Author: oej
Date: Mon Jan 9 03:20:04 2006
New Revision: 7876
URL: http://svn.digium.com/view/asterisk?rev=7876&view=rev
Log:
- Update to current trunk.
- Remove comment about lack of configuration now that we do support configuration
in features.conf
------------------
Merged revisions 7796-7797,7801-7802,7804,7806,7808,7810-7811,7813-7814,7818,7820-7822,7824,7826,7828,7830,7832-7833,7841-7842,7849-7869,7872 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r7796 | oej | 2006-01-04 22:52:35 +0100 (Wed, 04 Jan 2006) | 10 lines
Merged revisions 7795 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7795 | oej | 2006-01-04 22:46:40 +0100 (Wed, 04 Jan 2006) | 2 lines
Issue #5980: Removing extra CR+LF in manager events - needs port to trunk
........
................
r7797 | kpfleming | 2006-01-04 22:54:09 +0100 (Wed, 04 Jan 2006) | 5 lines
add memory-pool based string field management for structures
convert chan_sip sip_pvt and sip_registry structures to use string fields
add 'const' qualifiers to a few API calls that don't modify their input strings
add an asprintf() wrapper to astmm
................
r7801 | kpfleming | 2006-01-05 00:29:37 +0100 (Thu, 05 Jan 2006) | 15 lines
Merged revisions 7799-7800 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7799 | kpfleming | 2006-01-04 17:02:38 -0600 (Wed, 04 Jan 2006) | 2 lines
make monitoring more tolerant of peers that deliver frames in bursts
........
r7800 | kpfleming | 2006-01-04 17:27:57 -0600 (Wed, 04 Jan 2006) | 2 lines
ensure that ulaw/alaw sound files are filled with silence when extended (not zeroes)
........
................
r7802 | kpfleming | 2006-01-05 00:33:59 +0100 (Thu, 05 Jan 2006) | 2 lines
remove deprecated chan_modem drivers
................
r7804 | kpfleming | 2006-01-05 00:45:58 +0100 (Thu, 05 Jan 2006) | 10 lines
Merged revisions 7803 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7803 | kpfleming | 2006-01-04 17:45:34 -0600 (Wed, 04 Jan 2006) | 2 lines
return properly after extending file
........
................
r7806 | kpfleming | 2006-01-05 00:51:23 +0100 (Thu, 05 Jan 2006) | 10 lines
Merged revisions 7805 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7805 | kpfleming | 2006-01-04 17:51:03 -0600 (Wed, 04 Jan 2006) | 2 lines
use proper fwrite() parameters and return value
........
................
r7808 | kpfleming | 2006-01-05 01:19:18 +0100 (Thu, 05 Jan 2006) | 10 lines
Merged revisions 7807 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7807 | kpfleming | 2006-01-04 18:18:46 -0600 (Wed, 04 Jan 2006) | 2 lines
doh... fseek() has no useful return value
........
................
r7810 | kpfleming | 2006-01-05 01:58:48 +0100 (Thu, 05 Jan 2006) | 10 lines
Merged revisions 7809 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7809 | kpfleming | 2006-01-04 18:58:29 -0600 (Wed, 04 Jan 2006) | 2 lines
send device state updates for auto-logoff of agents as well
........
................
r7811 | oej | 2006-01-05 10:12:33 +0100 (Thu, 05 Jan 2006) | 2 lines
Fix copyright for touched file
................
r7813 | oej | 2006-01-05 10:30:21 +0100 (Thu, 05 Jan 2006) | 2 lines
Copyright header update
................
r7814 | oej | 2006-01-05 10:40:22 +0100 (Thu, 05 Jan 2006) | 2 lines
Doxygen updates
................
r7818 | mogorman | 2006-01-05 20:55:03 +0100 (Thu, 05 Jan 2006) | 5 lines
Added feature from bug #5573 and updated app_read
to be able to use indication tones, and argument
parsing code. Documented possible problems this might
cause an older dialplans in UPGRADE.txt
................
r7820 | kpfleming | 2006-01-05 21:53:21 +0100 (Thu, 05 Jan 2006) | 10 lines
Merged revisions 7819 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7819 | kpfleming | 2006-01-05 14:52:38 -0600 (Thu, 05 Jan 2006) | 2 lines
ensure that variable is initialized
........
................
r7821 | mogorman | 2006-01-05 22:04:06 +0100 (Thu, 05 Jan 2006) | 3 lines
oops minor formatting fixes, and taking out
debug message.
................
r7822 | mogorman | 2006-01-05 22:47:44 +0100 (Thu, 05 Jan 2006) | 5 lines
Added feature from bug #5053, allowing for
app_authenticate to set a max number of digits
also implemented the new argument and option
parsing code.
................
r7824 | tilghman | 2006-01-06 00:08:55 +0100 (Fri, 06 Jan 2006) | 3 lines
Merged revisions 7823 via svnmerge from
/branches/1.2
................
r7826 | kpfleming | 2006-01-06 00:52:34 +0100 (Fri, 06 Jan 2006) | 11 lines
Merged revisions 7825 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7825 | kpfleming | 2006-01-05 17:49:50 -0600 (Thu, 05 Jan 2006) | 3 lines
eliminate rounding errors that caused call time limits to be inaccurate (issue #5913)
round 'time left' reported during call limit warnings up to sound more accurate
........
................
r7828 | tilghman | 2006-01-06 00:54:28 +0100 (Fri, 06 Jan 2006) | 3 lines
Merged revisions 7827 via svnmerge from
/branches/1.2
................
r7830 | kpfleming | 2006-01-06 01:23:19 +0100 (Fri, 06 Jan 2006) | 10 lines
Merged revisions 7829 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7829 | kpfleming | 2006-01-05 18:21:00 -0600 (Thu, 05 Jan 2006) | 2 lines
update agent persistence when an agent gets logged off by autologoff
........
................
r7832 | tilghman | 2006-01-06 01:36:12 +0100 (Fri, 06 Jan 2006) | 3 lines
Merged revisions 7831 via svnmerge from
/branches/1.2
................
r7833 | kpfleming | 2006-01-06 04:40:12 +0100 (Fri, 06 Jan 2006) | 2 lines
allow limiting of queue members who will be delivered a given caller's call by penalty setting
................
r7841 | kpfleming | 2006-01-06 20:19:17 +0100 (Fri, 06 Jan 2006) | 4 lines
ensure that string field 'build' operation only evaluates arguments one time
fix some minor documentation errors
return proper type from string field space allocator
................
r7842 | mattf | 2006-01-06 21:03:20 +0100 (Fri, 06 Jan 2006) | 2 lines
Changes to allow receiving japanese callerid (Bug #5928)
................
r7849 | tilghman | 2006-01-07 08:31:08 +0100 (Sat, 07 Jan 2006) | 3 lines
Merged revisions 7848 via svnmerge from
/branches/1.2
................
r7850 | tilghman | 2006-01-07 15:47:36 +0100 (Sat, 07 Jan 2006) | 2 lines
Bug 6161 - Remove duplicated code
................
r7851 | markster | 2006-01-07 16:17:10 +0100 (Sat, 07 Jan 2006) | 2 lines
Fix CLI breakage
................
r7852 | tilghman | 2006-01-07 16:18:23 +0100 (Sat, 07 Jan 2006) | 2 lines
Bug 6160 - Replace inlined code with ast_skip_blanks
................
r7853 | tilghman | 2006-01-07 16:23:38 +0100 (Sat, 07 Jan 2006) | 2 lines
Bug 6162 - Constify manager_event arguments
................
r7854 | tilghman | 2006-01-07 16:45:47 +0100 (Sat, 07 Jan 2006) | 2 lines
Bug 6164 - Allow ast_skip_blanks on const strings without spewing warning
................
r7855 | markster | 2006-01-07 18:54:22 +0100 (Sat, 07 Jan 2006) | 2 lines
Add support for H.264 with SIP and recording
................
r7856 | markster | 2006-01-07 20:30:44 +0100 (Sat, 07 Jan 2006) | 3 lines
Fix potential deadlock (bug #6169)
................
r7857 | markster | 2006-01-07 20:42:05 +0100 (Sat, 07 Jan 2006) | 2 lines
Initialize groups properly
................
r7858 | markster | 2006-01-07 21:08:51 +0100 (Sat, 07 Jan 2006) | 2 lines
Only set group for "runuser" if "rungroup" is not specified.
................
r7859 | markster | 2006-01-07 21:09:26 +0100 (Sat, 07 Jan 2006) | 2 lines
oops
................
r7860 | markster | 2006-01-07 21:38:40 +0100 (Sat, 07 Jan 2006) | 3 lines
Fix build if RINGBEGIN is not defined (bug #6166)
................
r7861 | markster | 2006-01-07 22:30:19 +0100 (Sat, 07 Jan 2006) | 2 lines
Handle swapout of "fromdomain" in callid properly (bug #6154)
................
r7862 | markster | 2006-01-07 22:35:40 +0100 (Sat, 07 Jan 2006) | 2 lines
Fix RPID with new string fields (bug #6145)
................
r7863 | markster | 2006-01-08 00:43:23 +0100 (Sun, 08 Jan 2006) | 2 lines
Fix segfault in greek syntax (bug #6142)
................
r7864 | markster | 2006-01-08 01:08:49 +0100 (Sun, 08 Jan 2006) | 2 lines
Merge playback cleanups (bug #6163)
................
r7865 | mogorman | 2006-01-08 01:25:31 +0100 (Sun, 08 Jan 2006) | 3 lines
added small feature from bug 5682 with one typo fix.
................
r7866 | markster | 2006-01-08 05:30:10 +0100 (Sun, 08 Jan 2006) | 2 lines
Minor video fixes
................
r7867 | mogorman | 2006-01-08 18:24:54 +0100 (Sun, 08 Jan 2006) | 5 lines
Commiting bugfix 5310. added functions to astobj
for queue like structure. astobj_container_link_end
astobj_container_link_start
astobj_conatiner_unlink_start
................
r7868 | markster | 2006-01-08 20:53:25 +0100 (Sun, 08 Jan 2006) | 3 lines
Remove unnecessary unlock (bug #6171)
................
r7869 | markster | 2006-01-08 21:27:22 +0100 (Sun, 08 Jan 2006) | 2 lines
you need to setgid in addition to initgroups...
................
r7872 | tilghman | 2006-01-09 07:42:28 +0100 (Mon, 09 Jan 2006) | 2 lines
Bug 6150 - do not modify strings after they have been submitted into a string pool
................
Added:
team/oej/multiparking/formats/format_h264.c
- copied unchanged from r7872, trunk/formats/format_h264.c
team/oej/multiparking/include/asterisk/stringfields.h
- copied unchanged from r7872, trunk/include/asterisk/stringfields.h
Removed:
team/oej/multiparking/channels/chan_modem.c
team/oej/multiparking/channels/chan_modem_aopen.c
team/oej/multiparking/channels/chan_modem_bestdata.c
team/oej/multiparking/channels/chan_modem_i4l.c
Modified:
team/oej/multiparking/ (props changed)
team/oej/multiparking/UPGRADE.txt
team/oej/multiparking/apps/app_authenticate.c
team/oej/multiparking/apps/app_playback.c
team/oej/multiparking/apps/app_queue.c
team/oej/multiparking/apps/app_read.c
team/oej/multiparking/apps/app_voicemail.c
team/oej/multiparking/asterisk.c
team/oej/multiparking/astmm.c
team/oej/multiparking/autoservice.c
team/oej/multiparking/callerid.c
team/oej/multiparking/channel.c
team/oej/multiparking/channels/Makefile
team/oej/multiparking/channels/chan_agent.c
team/oej/multiparking/channels/chan_sip.c
team/oej/multiparking/channels/chan_zap.c
team/oej/multiparking/cli.c
team/oej/multiparking/config.c
team/oej/multiparking/configs/features.conf.sample
team/oej/multiparking/db.c
team/oej/multiparking/dns.c
team/oej/multiparking/doc/README.variables
team/oej/multiparking/file.c
team/oej/multiparking/formats/Makefile
team/oej/multiparking/formats/format_pcm.c
team/oej/multiparking/formats/format_pcm_alaw.c
team/oej/multiparking/frame.c
team/oej/multiparking/include/asterisk/astmm.h
team/oej/multiparking/include/asterisk/astobj.h
team/oej/multiparking/include/asterisk/callerid.h
team/oej/multiparking/include/asterisk/dns.h
team/oej/multiparking/include/asterisk/frame.h
team/oej/multiparking/include/asterisk/manager.h
team/oej/multiparking/include/asterisk/pbx.h
team/oej/multiparking/include/asterisk/strings.h
team/oej/multiparking/include/asterisk/utils.h
team/oej/multiparking/manager.c
team/oej/multiparking/pbx.c
team/oej/multiparking/pbx/pbx_config.c
team/oej/multiparking/pbx/pbx_spool.c
team/oej/multiparking/res/res_features.c
team/oej/multiparking/rtp.c
team/oej/multiparking/utils.c
Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan 9 03:20:04 2006
@@ -1,1 +1,1 @@
-/trunk:1-7786
+/trunk:1-7873
Modified: team/oej/multiparking/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/UPGRADE.txt?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/UPGRADE.txt (original)
+++ team/oej/multiparking/UPGRADE.txt Mon Jan 9 03:20:04 2006
@@ -18,6 +18,9 @@
* The application SetVar has been renamed to Set. The syntax SetVar was marked
deprecated in version 1.2 and is no longer recognized in this version.
+* app_read has been updated to use the newer options codes, using "skip" or
+ "noanswer" will not work. Use s or n. Also there is a new feature i, for
+ using indication tones, so typing in skip would give you unexpected results.
Variables:
* The builtin variables ${CALLERID}, ${CALLERIDNAME}, ${CALLERIDNUM},
Modified: team/oej/multiparking/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_authenticate.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_authenticate.c (original)
+++ team/oej/multiparking/apps/app_authenticate.c Mon Jan 9 03:20:04 2006
@@ -44,6 +44,23 @@
#include "asterisk/app.h"
#include "asterisk/astdb.h"
#include "asterisk/utils.h"
+#include "asterisk/options.h"
+
+enum {
+ OPT_ACCOUNT = (1 << 0),
+ OPT_DATABASE = (1 << 1),
+ OPT_JUMP = (1 << 2),
+ OPT_MULTIPLE = (1 << 3),
+ OPT_REMOVE = (1 << 4),
+} auth_option_flags;
+
+AST_APP_OPTIONS(auth_app_options, {
+ AST_APP_OPTION('a', OPT_ACCOUNT),
+ AST_APP_OPTION('d', OPT_DATABASE),
+ AST_APP_OPTION('j', OPT_JUMP),
+ AST_APP_OPTION('m', OPT_MULTIPLE),
+ AST_APP_OPTION('r', OPT_REMOVE),
+});
static char *tdesc = "Authentication Application";
@@ -52,9 +69,9 @@
static char *synopsis = "Authenticate a user";
static char *descrip =
-" Authenticate(password[|options]): This application asks the caller to enter a\n"
-"given password in order to continue dialplan execution. If the password begins\n"
-"with the '/' character, it is interpreted as a file which contains a list of\n"
+" Authenticate(password[|options[|maxdigits]]): This application asks the caller\n"
+"to enter a given password in order to continue dialplan execution. If the password\n"
+"begins with the '/' character, it is interpreted as a file which contains a list of\n"
"valid passwords, listed 1 password per line in the file.\n"
" When using a database key, the value associated with the key can be anything.\n"
"Users have three attempts to authenticate before the channel is hung up. If the\n"
@@ -69,6 +86,10 @@
" the file. When one of the passwords is matched, the channel will have\n"
" its account code set to the corresponding account code in the file.\n"
" r - Remove the database key upon successful entry (valid with 'd' only)\n"
+" maxdigits - maximum acceptable number of digits. Stops reading after\n"
+" maxdigits have been entered (without requiring the user to\n"
+" press the '#' key).\n"
+" Defaults to 0 - no limit - wait for the user press the '#' key.\n"
;
STANDARD_LOCAL_USER;
@@ -78,13 +99,19 @@
static int auth_exec(struct ast_channel *chan, void *data)
{
int res=0;
- int jump = 0;
int retries;
struct localuser *u;
- char password[256]="";
char passwd[256];
- char *opts;
char *prompt;
+ int maxdigits;
+ char *argcopy =NULL;
+ struct ast_flags flags = {0};
+
+ AST_DECLARE_APP_ARGS(arglist,
+ AST_APP_ARG(password);
+ AST_APP_ARG(options);
+ AST_APP_ARG(maxdigits);
+ );
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Authenticate requires an argument(password)\n");
@@ -101,37 +128,49 @@
}
}
- strncpy(password, data, sizeof(password) - 1);
- opts=strchr(password, '|');
- if (opts) {
- *opts = 0;
- opts++;
- } else
- opts = "";
- if (strchr(opts, 'j'))
- jump = 1;
+ argcopy = ast_strdupa(data);
+ if (!argcopy) {
+ ast_log(LOG_ERROR, "Out of memory!\n");
+ LOCAL_USER_REMOVE(u);
+ return -1;
+ }
+
+ AST_STANDARD_APP_ARGS(arglist,argcopy);
+
+ if (!ast_strlen_zero(arglist.options)) {
+ ast_app_parse_options(auth_app_options, &flags, NULL, arglist.options);
+ }
+
+ if (!ast_strlen_zero(arglist.maxdigits)) {
+ maxdigits = atoi(arglist.maxdigits);
+ if ((maxdigits<1) || (maxdigits>sizeof(passwd)-2))
+ maxdigits = sizeof(passwd) - 2;
+ } else {
+ maxdigits = sizeof(passwd) - 2;
+ }
+
/* Start asking for password */
prompt = "agent-pass";
for (retries = 0; retries < 3; retries++) {
- res = ast_app_getdata(chan, prompt, passwd, sizeof(passwd) - 2, 0);
+ res = ast_app_getdata(chan, prompt, passwd, maxdigits, 0);
if (res < 0)
break;
res = 0;
- if (password[0] == '/') {
- if (strchr(opts, 'd')) {
+ if (arglist.password[0] == '/') {
+ if (ast_test_flag(&flags,OPT_DATABASE)) {
char tmp[256];
/* Compare against a database key */
- if (!ast_db_get(password + 1, passwd, tmp, sizeof(tmp))) {
+ if (!ast_db_get(arglist.password + 1, passwd, tmp, sizeof(tmp))) {
/* It's a good password */
- if (strchr(opts, 'r')) {
- ast_db_del(password + 1, passwd);
+ if (ast_test_flag(&flags,OPT_REMOVE)) {
+ ast_db_del(arglist.password + 1, passwd);
}
break;
}
} else {
/* Compare against a file */
FILE *f;
- f = fopen(password, "r");
+ f = fopen(arglist.password, "r");
if (f) {
char buf[256] = "";
char md5passwd[33] = "";
@@ -141,7 +180,7 @@
fgets(buf, sizeof(buf), f);
if (!feof(f) && !ast_strlen_zero(buf)) {
buf[strlen(buf) - 1] = '\0';
- if (strchr(opts, 'm')) {
+ if (ast_test_flag(&flags,OPT_MULTIPLE)) {
md5secret = strchr(buf, ':');
if (md5secret == NULL)
continue;
@@ -149,13 +188,13 @@
md5secret++;
ast_md5_hash(md5passwd, passwd);
if (!strcmp(md5passwd, md5secret)) {
- if (strchr(opts, 'a'))
+ if (ast_test_flag(&flags,OPT_ACCOUNT))
ast_cdr_setaccount(chan, buf);
break;
}
} else {
if (!strcmp(passwd, buf)) {
- if (strchr(opts, 'a'))
+ if (ast_test_flag(&flags,OPT_ACCOUNT))
ast_cdr_setaccount(chan, buf);
break;
}
@@ -164,7 +203,7 @@
}
fclose(f);
if (!ast_strlen_zero(buf)) {
- if (strchr(opts, 'm')) {
+ if (ast_test_flag(&flags,OPT_MULTIPLE)) {
if (md5secret && !strcmp(md5passwd, md5secret))
break;
} else {
@@ -173,23 +212,23 @@
}
}
} else
- ast_log(LOG_WARNING, "Unable to open file '%s' for authentication: %s\n", password, strerror(errno));
+ ast_log(LOG_WARNING, "Unable to open file '%s' for authentication: %s\n", arglist.password, strerror(errno));
}
} else {
/* Compare against a fixed password */
- if (!strcmp(passwd, password))
+ if (!strcmp(passwd, arglist.password))
break;
}
prompt="auth-incorrect";
}
if ((retries < 3) && !res) {
- if (strchr(opts, 'a') && !strchr(opts, 'm'))
+ if (ast_test_flag(&flags,OPT_ACCOUNT) && !ast_test_flag(&flags,OPT_MULTIPLE))
ast_cdr_setaccount(chan, passwd);
res = ast_streamfile(chan, "auth-thankyou", chan->language);
if (!res)
res = ast_waitstream(chan, "");
} else {
- if (jump && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
+ if (ast_test_flag(&flags,OPT_JUMP) && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
res = 0;
} else {
if (!ast_streamfile(chan, "vm-goodbye", chan->language))
Modified: team/oej/multiparking/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_playback.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_playback.c (original)
+++ team/oej/multiparking/apps/app_playback.c Mon Jan 9 03:20:04 2006
@@ -72,13 +72,13 @@
static int playback_exec(struct ast_channel *chan, void *data)
{
- int res = 0, mres = 0;
+ int res = 0;
struct localuser *u;
- char *tmp = NULL;
+ char *tmp;
int option_skip=0;
int option_noanswer = 0;
- char *front = NULL, *back = NULL;
int priority_jump = 0;
+
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(filenames);
AST_APP_ARG(options);
@@ -89,15 +89,13 @@
return -1;
}
- LOCAL_USER_ADD(u);
-
tmp = ast_strdupa(data);
if (!tmp) {
ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
return -1;
}
+ LOCAL_USER_ADD(u);
AST_STANDARD_APP_ARGS(args, tmp);
if (args.options) {
@@ -119,13 +117,11 @@
res = ast_answer(chan);
}
if (!res) {
+ int mres = 0;
+ char *front;
+
ast_stopstream(chan);
- front = tmp;
- while (!res && front) {
- if ((back = strchr(front, '&'))) {
- *back = '\0';
- back++;
- }
+ while (!res && (front = strsep(&tmp, "&"))) {
res = ast_streamfile(chan, front, chan->language);
if (!res) {
res = ast_waitstream(chan, "");
@@ -137,12 +133,8 @@
res = 0;
mres = 1;
}
- front = back;
}
- if (mres)
- pbx_builtin_setvar_helper(chan, "PLAYBACKSTATUS", "FAILED");
- else
- pbx_builtin_setvar_helper(chan, "PLAYBACKSTATUS", "SUCCESS");
+ pbx_builtin_setvar_helper(chan, "PLAYBACKSTATUS", mres ? "FAILED" : "SUCCESS");
}
LOCAL_USER_REMOVE(u);
return res;
Modified: team/oej/multiparking/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_queue.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_queue.c (original)
+++ team/oej/multiparking/apps/app_queue.c Mon Jan 9 03:20:04 2006
@@ -286,6 +286,7 @@
time_t last_pos; /*!< Last time we told the user their position */
int opos; /*!< Where we started in the queue */
int handled; /*!< Whether our call was handled */
+ int max_penalty; /*!< Limit the members that can take this call to this penalty or lower */
time_t start; /*!< When we started holding */
time_t expire; /*!< When this entry should expire (time out of queue) */
struct ast_channel *chan; /*!< Our channel */
@@ -426,12 +427,15 @@
QUEUE_NORMAL
};
-static enum queue_member_status get_member_status(const struct ast_call_queue *q)
+static enum queue_member_status get_member_status(const struct ast_call_queue *q, int max_penalty)
{
struct member *member;
enum queue_member_status result = QUEUE_NO_MEMBERS;
for (member = q->members; member; member = member->next) {
+ if (max_penalty && (member->penalty > max_penalty))
+ continue;
+
switch (member->status) {
case AST_DEVICE_INVALID:
/* nothing to do */
@@ -929,7 +933,7 @@
}
/* This is our one */
- stat = get_member_status(q);
+ stat = get_member_status(q, qe->max_penalty);
if (!q->joinempty && (stat == QUEUE_NO_MEMBERS))
*reason = QUEUE_JOINEMPTY;
else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS))
@@ -1878,7 +1882,7 @@
break;
}
- stat = get_member_status(qe->parent);
+ stat = get_member_status(qe->parent, qe->max_penalty);
/* leave the queue if no agents, if enabled */
if (qe->parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
@@ -1935,6 +1939,9 @@
static int calc_metric(struct ast_call_queue *q, struct member *mem, int pos, struct queue_ent *qe, struct localuser *tmp)
{
+ if (mem->penalty > qe->max_penalty)
+ return -1;
+
switch (q->strategy) {
case QUEUE_STRATEGY_RINGALL:
/* Everyone equal, except for penalty */
@@ -2087,15 +2094,18 @@
}
/* Special case: If we ring everyone, go ahead and ring them, otherwise
just calculate their metric for the appropriate strategy */
- calc_metric(qe->parent, cur, x++, qe, tmp);
- /* Put them in the list of outgoing thingies... We're ready now.
- XXX If we're forcibly removed, these outgoing calls won't get
- hung up XXX */
- tmp->next = outgoing;
- outgoing = tmp;
- /* If this line is up, don't try anybody else */
- if (outgoing->chan && (outgoing->chan->_state == AST_STATE_UP))
- break;
+ if (!calc_metric(qe->parent, cur, x++, qe, tmp)) {
+ /* Put them in the list of outgoing thingies... We're ready now.
+ XXX If we're forcibly removed, these outgoing calls won't get
+ hung up XXX */
+ tmp->next = outgoing;
+ outgoing = tmp;
+ /* If this line is up, don't try anybody else */
+ if (outgoing->chan && (outgoing->chan->_state == AST_STATE_UP))
+ break;
+ } else {
+ free(tmp);
+ }
cur = cur->next;
}
@@ -2848,7 +2858,9 @@
char *url = NULL;
char *announceoverride = NULL;
const char *user_priority;
+ const char *max_penalty_str;
int prio;
+ int max_penalty;
char *queuetimeoutstr = NULL;
enum queue_result reason = QUEUE_UNKNOWN;
@@ -2901,15 +2913,31 @@
prio = 0;
}
+ /* Get the maximum penalty from the variable ${QUEUE_MAX_PENALTY} */
+ if ((max_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MAX_PENALTY"))) {
+ if (sscanf(max_penalty_str, "%d", &max_penalty) == 1) {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "%s: Got max penalty %d from ${QUEUE_MAX_PENALTY}.\n",
+ chan->name, max_penalty);
+ } else {
+ ast_log(LOG_WARNING, "${QUEUE_MAX_PENALTY}: Invalid value (%s), channel %s.\n",
+ max_penalty_str, chan->name);
+ max_penalty = 0;
+ }
+ } else {
+ max_penalty = 0;
+ }
+
if (options && (strchr(options, 'r')))
ringing = 1;
if (option_debug)
ast_log(LOG_DEBUG, "queue: %s, options: %s, url: %s, announce: %s, expires: %ld, priority: %d\n",
- queuename, options, url, announceoverride, (long)qe.expire, (int)prio);
+ queuename, options, url, announceoverride, (long)qe.expire, prio);
qe.chan = chan;
- qe.prio = (int)prio;
+ qe.prio = prio;
+ qe.max_penalty = max_penalty;
qe.last_pos_said = 0;
qe.last_pos = 0;
qe.last_periodic_announce_time = time(NULL);
@@ -2997,7 +3025,7 @@
break;
}
- stat = get_member_status(qe.parent);
+ stat = get_member_status(qe.parent, qe.max_penalty);
/* leave the queue if no agents, if enabled */
if (qe.parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
Modified: team/oej/multiparking/apps/app_read.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_read.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_read.c (original)
+++ team/oej/multiparking/apps/app_read.c Mon Jan 9 03:20:04 2006
@@ -43,6 +43,19 @@
#include "asterisk/translate.h"
#include "asterisk/options.h"
#include "asterisk/utils.h"
+#include "asterisk/indications.h"
+
+enum {
+ OPT_SKIP = (1 << 0),
+ OPT_INDICATION = (1 << 1),
+ OPT_NOANSWER = (1 << 2),
+} read_option_flags;
+
+AST_APP_OPTIONS(read_app_options, {
+ AST_APP_OPTION('s', OPT_SKIP),
+ AST_APP_OPTION('i', OPT_INDICATION),
+ AST_APP_OPTION('n', OPT_NOANSWER),
+});
static char *tdesc = "Read Variable Application";
@@ -54,14 +67,16 @@
" Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])\n\n"
"Reads a #-terminated string of digits a certain number of times from the\n"
"user in to the given variable.\n"
-" filename -- file to play before reading digits.\n"
+" filename -- file to play before reading digits or tone with option i\n"
" maxdigits -- maximum acceptable number of digits. Stops reading after\n"
" maxdigits have been entered (without requiring the user to\n"
" press the '#' key).\n"
" Defaults to 0 - no limit - wait for the user press the '#' key.\n"
" Any value below 0 means the same. Max accepted value is 255.\n"
-" option -- may be 'skip' to return immediately if the line is not up,\n"
-" or 'noanswer' to read digits even if the line is not up.\n"
+" option -- options are 's' , 'i', 'n'\n"
+" 's' to return immediately if the line is not up,\n"
+" 'i' to play filename as an indication tone from your indications.conf\n"
+" 'n' to read digits even if the line is not up.\n"
" attempts -- if greater than 1, that many attempts will be made in the \n"
" event no data is entered.\n"
" timeout -- if greater than 0, that value will override the default timeout.\n\n"
@@ -78,21 +93,23 @@
int res = 0;
struct localuser *u;
char tmp[256];
- char *timeout = NULL;
- char *varname = NULL;
- char *filename = NULL;
- char *loops;
- char *maxdigitstr=NULL;
- char *options=NULL;
- int option_skip = 0;
- int option_noanswer = 0;
int maxdigits=255;
int tries = 1;
int to = 0;
int x = 0;
char *argcopy = NULL;
- char *args[8];
-
+ struct tone_zone_sound *ts;
+ struct ast_flags flags = {0};
+
+ AST_DECLARE_APP_ARGS(arglist,
+ AST_APP_ARG(variable);
+ AST_APP_ARG(filename);
+ AST_APP_ARG(maxdigits);
+ AST_APP_ARG(options);
+ AST_APP_ARG(attempts);
+ AST_APP_ARG(timeout);
+ );
+
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Read requires an argument (variable)\n");
return -1;
@@ -102,83 +119,88 @@
argcopy = ast_strdupa(data);
if (!argcopy) {
- ast_log(LOG_ERROR, "Out of memory\n");
+ ast_log(LOG_ERROR, "Out of memory!\n");
LOCAL_USER_REMOVE(u);
return -1;
}
- if (ast_app_separate_args(argcopy, '|', args, sizeof(args) / sizeof(args[0])) < 1) {
- ast_log(LOG_WARNING, "Cannot Parse Arguments.\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
- varname = args[x++];
- filename = args[x++];
- maxdigitstr = args[x++];
- options = args[x++];
- loops = args[x++];
- timeout = args[x++];
-
- if (options) {
- if (!strcasecmp(options, "skip"))
- option_skip = 1;
- else if (!strcasecmp(options, "noanswer"))
- option_noanswer = 1;
- else {
- if (strchr(options, 's'))
- option_skip = 1;
- if (strchr(options, 'n'))
- option_noanswer = 1;
- }
- }
-
- if(loops) {
- tries = atoi(loops);
- if(tries <= 0)
+ AST_STANDARD_APP_ARGS(arglist, argcopy);
+
+ if (!ast_strlen_zero(arglist.options)) {
+ ast_app_parse_options(read_app_options, &flags, NULL, arglist.options);
+ }
+
+ if (!ast_strlen_zero(arglist.attempts)) {
+ tries = atoi(arglist.attempts);
+ if (tries <= 0)
tries = 1;
}
- if(timeout) {
- to = atoi(timeout);
+ if (!ast_strlen_zero(arglist.timeout)) {
+ to = atoi(arglist.timeout);
if (to <= 0)
to = 0;
else
to *= 1000;
}
- if (ast_strlen_zero(filename))
- filename = NULL;
- if (maxdigitstr) {
- maxdigits = atoi(maxdigitstr);
+ if (ast_strlen_zero(arglist.filename)) {
+ arglist.filename = NULL;
+ }
+ if (!ast_strlen_zero(arglist.maxdigits)) {
+ maxdigits = atoi(arglist.maxdigits);
if ((maxdigits<1) || (maxdigits>255)) {
maxdigits = 255;
} else if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Accepting a maximum of %d digits.\n", maxdigits);
}
- if (ast_strlen_zero(varname)) {
+ if (ast_strlen_zero(arglist.variable)) {
ast_log(LOG_WARNING, "Invalid! Usage: Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])\n\n");
LOCAL_USER_REMOVE(u);
return -1;
}
-
+ ts=NULL;
+ if (ast_test_flag(&flags,OPT_INDICATION)) {
+ if (!ast_strlen_zero(arglist.filename)) {
+ ts = ast_get_indication_tone(chan->zone,arglist.filename);
+ }
+ }
if (chan->_state != AST_STATE_UP) {
- if (option_skip) {
+ if (ast_test_flag(&flags,OPT_SKIP)) {
/* At the user's option, skip if the line is not up */
- pbx_builtin_setvar_helper(chan, varname, "\0");
+ pbx_builtin_setvar_helper(chan, arglist.variable, "\0");
LOCAL_USER_REMOVE(u);
return 0;
- } else if (!option_noanswer) {
+ } else if (!ast_test_flag(&flags,OPT_NOANSWER)) {
/* Otherwise answer unless we're supposed to read while on-hook */
res = ast_answer(chan);
}
}
if (!res) {
- while(tries && !res) {
+ while (tries && !res) {
ast_stopstream(chan);
- res = ast_app_getdata(chan, filename, tmp, maxdigits, to);
+ if (ts && ts->data[0]) {
+ if (!to)
+ to = chan->pbx ? chan->pbx->rtimeout * 1000 : 6000;
+ res = ast_playtones_start(chan, 0, ts->data, 0);
+ for (x = 0; x < maxdigits; ) {
+ res = ast_waitfordigit(chan, to);
+ ast_playtones_stop(chan);
+ if (res < 1) {
+ tmp[x]='\0';
+ break;
+ }
+ tmp[x++] = res;
+ if (tmp[x-1] == '#') {
+ tmp[x-1] = '\0';
+ break;
+ }
+ }
+ } else {
+ res = ast_app_getdata(chan, arglist.filename, tmp, maxdigits, to);
+ }
if (res > -1) {
- pbx_builtin_setvar_helper(chan, varname, tmp);
+ pbx_builtin_setvar_helper(chan, arglist.variable, tmp);
if (!ast_strlen_zero(tmp)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "User entered '%s'\n", tmp);
Modified: team/oej/multiparking/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_voicemail.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_voicemail.c (original)
+++ team/oej/multiparking/apps/app_voicemail.c Mon Jan 9 03:20:04 2006
@@ -3898,8 +3898,8 @@
static int vm_play_folder_name_gr(struct ast_channel *chan, char *mbox)
{
int cmd;
- char buf[sizeof(mbox)+1];
-
+ char *buf;
+ buf = alloca(strlen(mbox)+2);
memset(buf, '\0', sizeof(char)*(sizeof(buf)));
strcpy(buf, mbox);
strcat(buf,"s");
Modified: team/oej/multiparking/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/asterisk.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/asterisk.c (original)
+++ team/oej/multiparking/asterisk.c Mon Jan 9 03:20:04 2006
@@ -1511,7 +1511,7 @@
idx = 1;
- qsort(&matches[0], (size_t)(len + 1), sizeof(char *), ast_el_sort_compare);
+ qsort(&matches[0], (size_t)(len), sizeof(char *), ast_el_sort_compare);
for (; count > 0; count--) {
numoutputline = 0;
@@ -1603,12 +1603,14 @@
} else
matches = (char **) NULL;
} else {
- char **p;
- int count = 0;
+ char **p, *oldbuf=NULL;
+ nummatches = 0;
matches = ast_cli_completion_matches((char *)lf->buffer,ptr);
- for (p = matches; p && *p; p++)
- count++;
- nummatches = count - 1; /* XXX apparently there is one dup ? */
+ for (p = matches; p && *p; p++) {
+ if (!oldbuf || strcmp(*p,oldbuf))
+ nummatches++;
+ oldbuf = *p;
+ }
}
if (matches) {
@@ -2169,6 +2171,16 @@
ast_log(LOG_WARNING, "No such user '%s'!\n", runuser);
exit(1);
}
+ if (!rungroup) {
+ if (setgid(pw->pw_gid)) {
+ ast_log(LOG_WARNING, "Unable to setgid to %d!\n", pw->pw_gid);
+ exit(1);
+ }
+ if (initgroups(pw->pw_name, pw->pw_gid)) {
+ ast_log(LOG_WARNING, "Unable to init groups for '%s'\n", runuser);
+ exit(1);
+ }
+ }
if (setuid(pw->pw_uid)) {
ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", pw->pw_uid, runuser);
exit(1);
Modified: team/oej/multiparking/astmm.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/astmm.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/astmm.c (original)
+++ team/oej/multiparking/astmm.c Mon Jan 9 03:20:04 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -47,6 +47,7 @@
#define FUNC_STRDUP 4
#define FUNC_STRNDUP 5
#define FUNC_VASPRINTF 6
+#define FUNC_ASPRINTF 7
/* Undefine all our macros */
#undef malloc
@@ -56,6 +57,7 @@
#undef strndup
#undef free
#undef vasprintf
+#undef asprintf
#define FENCE_MAGIC 0xdeadbeef
@@ -253,6 +255,28 @@
return ptr;
}
+int __ast_asprintf(const char *file, int lineno, const char *func, char **strp, const char *fmt, ...)
+{
+ int size;
+ va_list ap, ap2;
+ char s;
+
+ *strp = NULL;
+ va_start(ap, fmt);
+ va_copy(ap2, ap);
+ size = vsnprintf(&s, 1, fmt, ap2);
+ va_end(ap2);
+ *strp = __ast_alloc_region(size + 1, FUNC_ASPRINTF, file, lineno, func);
+ if (!*strp) {
+ va_end(ap);
+ return -1;
+ }
+ vsnprintf(*strp, size + 1, fmt, ap);
+ va_end(ap);
+
+ return size;
+}
+
int __ast_vasprintf(char **strp, const char *fmt, va_list ap, const char *file, int lineno, const char *func)
{
int size;
@@ -264,8 +288,10 @@
size = vsnprintf(&s, 1, fmt, ap2);
va_end(ap2);
*strp = __ast_alloc_region(size + 1, FUNC_VASPRINTF, file, lineno, func);
- if (!*strp)
+ if (!*strp) {
+ va_end(ap);
return -1;
+ }
vsnprintf(*strp, size + 1, fmt, ap);
return size;
Modified: team/oej/multiparking/autoservice.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/autoservice.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/autoservice.c (original)
+++ team/oej/multiparking/autoservice.c Mon Jan 9 03:20:04 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
Modified: team/oej/multiparking/callerid.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/callerid.c?rev=7876&r1=7875&r2=7876&view=diff
==============================================================================
--- team/oej/multiparking/callerid.c (original)
+++ team/oej/multiparking/callerid.c Mon Jan 9 03:20:04 2006
@@ -57,6 +57,9 @@
int flags;
int sawflag;
int len;
+
+ int skipflag;
+ unsigned short crc;
};
@@ -251,6 +254,278 @@
gen_tones(outbuf + pos, len, codec, casdr1, casdi1, casdr2, casdi2, &cr1, &ci1, &cr2, &ci2);
return 0;
}
+
+static unsigned short calc_crc(unsigned short crc, unsigned char data)
+{
+ unsigned int i, j, org, dst;
+ org = data;
+ dst = 0;
+ for (i=0; i<CHAR_BIT; i++) {
+ org <<= 1;
+ dst >>= 1;
+ if (org & 0x100) {
+ dst |= 0x80;
+ }
+ }
+ data = (unsigned char)dst;
+ crc ^= (unsigned int)data << (16 - CHAR_BIT);
+ for ( j=0; j<CHAR_BIT; j++ ) {
+ if ( crc & 0x8000U ) crc = (crc << 1) ^ 0x1021U ;
+ else crc <<= 1 ;
+ }
+ return crc;
+}
+
+int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, int codec)
+{
+ int mylen = len;
+ int olen;
+ int b = 'X';
+ int b2 ;
+ int res;
+ int x;
+ short *buf = malloc(2 * len + cid->oldlen);
+ short *obuf = buf;
+
+ if (!buf) {
+ ast_log(LOG_WARNING, "Out of memory\n");
+ return -1;
+ }
+
+ memset(buf, 0, 2 * len + cid->oldlen);
+ memcpy(buf, cid->oldstuff, cid->oldlen);
+ mylen += cid->oldlen/2;
+
+ for (x=0;x<len;x++)
+ buf[x+cid->oldlen/2] = AST_XLAW(ubuf[x]);
+
+ while (mylen >= 160) {
+ b = b2 = 0 ;
+ olen = mylen;
+ res = fsk_serie(&cid->fskd, buf, &mylen, &b);
+
+ if (mylen < 0) {
+ ast_log(LOG_ERROR, "fsk_serie made mylen < 0 (%d)\n", mylen);
+ return -1;
+ }
+
+ buf += (olen - mylen);
+
+ if (res < 0) {
+ ast_log(LOG_NOTICE, "fsk_serie failed\n");
+ return -1;
+ }
+
+ if (res == 1) {
+
+ b2 = b ;
+ b = b & 0x7f ;
+
+ /* crc checksum calculation */
+ if ( cid->sawflag > 1 ) {
+ cid->crc = calc_crc(cid->crc, (unsigned char)b2);
+ }
+
+ /* Ignore invalid bytes */
+ if (b > 0xff) {
+ continue;
+ }
+
+ /* skip DLE if needed */
+ if ( cid->sawflag > 0 ) {
+ if ( cid->sawflag != 5 && cid->skipflag == 0 && b == 0x10 ) {
+ cid->skipflag = 1 ;
+ continue ;
+ }
+ }
+ if ( cid->skipflag == 1 ) {
+ cid->skipflag = 0 ;
+ }
+
+ /* caller id retrieval */
+ switch(cid->sawflag) {
+ case 0: /* DLE */
+ if (b == 0x10) {
+ cid->sawflag = 1;
[... 3362 lines stripped ...]
More information about the asterisk-commits
mailing list