[svn-commits] branch bweschke/bug_6047 - r8026 in
/team/bweschke/bug_6047: ./ apps/ cdr/ ch...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Thu Jan 12 13:38:21 CST 2006
Author: bweschke
Date: Thu Jan 12 13:37:52 2006
New Revision: 8026
URL: http://svn.digium.com/view/asterisk?rev=8026&view=rev
Log:
SVNMerge: Bringing in latest changes from /trunk
Added:
team/bweschke/bug_6047/apps/app_morsecode.c
- copied unchanged from r8025, trunk/apps/app_morsecode.c
team/bweschke/bug_6047/contrib/init.d/rc.suse.asterisk
- copied unchanged from r8025, trunk/contrib/init.d/rc.suse.asterisk
team/bweschke/bug_6047/formats/format_h264.c
- copied unchanged from r8025, trunk/formats/format_h264.c
team/bweschke/bug_6047/funcs/func_base64.c
- copied unchanged from r8025, trunk/funcs/func_base64.c
team/bweschke/bug_6047/funcs/func_rand.c
- copied unchanged from r8025, trunk/funcs/func_rand.c
team/bweschke/bug_6047/include/asterisk/stringfields.h
- copied unchanged from r8025, trunk/include/asterisk/stringfields.h
team/bweschke/bug_6047/include/asterisk/udptl.h
- copied unchanged from r8025, trunk/include/asterisk/udptl.h
team/bweschke/bug_6047/udptl.c
- copied unchanged from r8025, trunk/udptl.c
Removed:
team/bweschke/bug_6047/channels/chan_modem.c
team/bweschke/bug_6047/channels/chan_modem_aopen.c
team/bweschke/bug_6047/channels/chan_modem_bestdata.c
team/bweschke/bug_6047/channels/chan_modem_i4l.c
team/bweschke/bug_6047/include/asterisk/vmodem.h
Modified:
team/bweschke/bug_6047/ (props changed)
team/bweschke/bug_6047/Makefile
team/bweschke/bug_6047/UPGRADE.txt
team/bweschke/bug_6047/app.c
team/bweschke/bug_6047/apps/ (props changed)
team/bweschke/bug_6047/apps/Makefile
team/bweschke/bug_6047/apps/app_adsiprog.c
team/bweschke/bug_6047/apps/app_alarmreceiver.c
team/bweschke/bug_6047/apps/app_authenticate.c
team/bweschke/bug_6047/apps/app_chanspy.c
team/bweschke/bug_6047/apps/app_curl.c
team/bweschke/bug_6047/apps/app_dial.c
team/bweschke/bug_6047/apps/app_dictate.c
team/bweschke/bug_6047/apps/app_directory.c
team/bweschke/bug_6047/apps/app_disa.c
team/bweschke/bug_6047/apps/app_externalivr.c
team/bweschke/bug_6047/apps/app_meetme.c
team/bweschke/bug_6047/apps/app_milliwatt.c
team/bweschke/bug_6047/apps/app_mixmonitor.c
team/bweschke/bug_6047/apps/app_page.c
team/bweschke/bug_6047/apps/app_playback.c
team/bweschke/bug_6047/apps/app_privacy.c
team/bweschke/bug_6047/apps/app_queue.c
team/bweschke/bug_6047/apps/app_read.c
team/bweschke/bug_6047/apps/app_rpt.c
team/bweschke/bug_6047/apps/app_stack.c
team/bweschke/bug_6047/apps/app_voicemail.c
team/bweschke/bug_6047/ast_expr2.fl
team/bweschke/bug_6047/asterisk.c
team/bweschke/bug_6047/astmm.c
team/bweschke/bug_6047/autoservice.c
team/bweschke/bug_6047/callerid.c
team/bweschke/bug_6047/cdr/ (props changed)
team/bweschke/bug_6047/cdr.c
team/bweschke/bug_6047/channel.c
team/bweschke/bug_6047/channels/ (props changed)
team/bweschke/bug_6047/channels/Makefile
team/bweschke/bug_6047/channels/chan_agent.c
team/bweschke/bug_6047/channels/chan_alsa.c
team/bweschke/bug_6047/channels/chan_iax2.c
team/bweschke/bug_6047/channels/chan_local.c
team/bweschke/bug_6047/channels/chan_oss.c
team/bweschke/bug_6047/channels/chan_phone.c
team/bweschke/bug_6047/channels/chan_sip.c
team/bweschke/bug_6047/channels/chan_zap.c
team/bweschke/bug_6047/cli.c
team/bweschke/bug_6047/codecs/ (props changed)
team/bweschke/bug_6047/codecs/ilbc/ (props changed)
team/bweschke/bug_6047/codecs/lpc10/ (props changed)
team/bweschke/bug_6047/config.c
team/bweschke/bug_6047/configs/agents.conf.sample
team/bweschke/bug_6047/configs/extensions.conf.sample
team/bweschke/bug_6047/configs/features.conf.sample
team/bweschke/bug_6047/configs/manager.conf.sample
team/bweschke/bug_6047/configs/sip.conf.sample
team/bweschke/bug_6047/configs/voicemail.conf.sample
team/bweschke/bug_6047/configs/zapata.conf.sample
team/bweschke/bug_6047/contrib/scripts/managerproxy.pl
team/bweschke/bug_6047/db.c
team/bweschke/bug_6047/db1-ast/ (props changed)
team/bweschke/bug_6047/dns.c
team/bweschke/bug_6047/doc/CODING-GUIDELINES
team/bweschke/bug_6047/doc/README.cdr
team/bweschke/bug_6047/doc/README.variables
team/bweschke/bug_6047/editline/ (props changed)
team/bweschke/bug_6047/file.c
team/bweschke/bug_6047/formats/ (props changed)
team/bweschke/bug_6047/formats/Makefile
team/bweschke/bug_6047/formats/format_pcm.c
team/bweschke/bug_6047/formats/format_pcm_alaw.c
team/bweschke/bug_6047/frame.c
team/bweschke/bug_6047/funcs/ (props changed)
team/bweschke/bug_6047/funcs/Makefile
team/bweschke/bug_6047/funcs/func_cdr.c
team/bweschke/bug_6047/funcs/func_cut.c
team/bweschke/bug_6047/funcs/func_math.c
team/bweschke/bug_6047/funcs/func_md5.c
team/bweschke/bug_6047/funcs/func_moh.c
team/bweschke/bug_6047/image.c
team/bweschke/bug_6047/include/asterisk/app.h
team/bweschke/bug_6047/include/asterisk/astmm.h
team/bweschke/bug_6047/include/asterisk/astobj.h
team/bweschke/bug_6047/include/asterisk/callerid.h
team/bweschke/bug_6047/include/asterisk/channel.h
team/bweschke/bug_6047/include/asterisk/chanspy.h
team/bweschke/bug_6047/include/asterisk/dns.h
team/bweschke/bug_6047/include/asterisk/frame.h
team/bweschke/bug_6047/include/asterisk/image.h
team/bweschke/bug_6047/include/asterisk/linkedlists.h
team/bweschke/bug_6047/include/asterisk/manager.h
team/bweschke/bug_6047/include/asterisk/pbx.h
team/bweschke/bug_6047/include/asterisk/rtp.h
team/bweschke/bug_6047/include/asterisk/strings.h
team/bweschke/bug_6047/include/asterisk/translate.h
team/bweschke/bug_6047/include/asterisk/utils.h
team/bweschke/bug_6047/manager.c
team/bweschke/bug_6047/pbx/ (props changed)
team/bweschke/bug_6047/pbx.c
team/bweschke/bug_6047/pbx/pbx_config.c
team/bweschke/bug_6047/pbx/pbx_spool.c
team/bweschke/bug_6047/res/ (props changed)
team/bweschke/bug_6047/res/res_features.c
team/bweschke/bug_6047/res/res_osp.c
team/bweschke/bug_6047/rtp.c
team/bweschke/bug_6047/say.c
team/bweschke/bug_6047/stdtime/ (props changed)
team/bweschke/bug_6047/translate.c
team/bweschke/bug_6047/utils.c
Propchange: team/bweschke/bug_6047/
------------------------------------------------------------------------------
--- svnmerge-blocked (original)
+++ svnmerge-blocked Thu Jan 12 13:37:52 2006
@@ -1,1 +1,1 @@
-/branches/1.2:7497
+/branches/1.2:7497,7915,7960,7965,7970,7976
Propchange: team/bweschke/bug_6047/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 12 13:37:52 2006
@@ -1,1 +1,1 @@
-/trunk:1-7748
+/trunk:1-8025
Modified: team/bweschke/bug_6047/Makefile
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/Makefile?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/Makefile (original)
+++ team/bweschke/bug_6047/Makefile Thu Jan 12 13:37:52 2006
@@ -346,7 +346,7 @@
OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
translate.o file.o say.o pbx.o cli.o md5.o term.o \
ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
- cdr.o tdd.o acl.o rtp.o manager.o asterisk.o \
+ cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
@@ -416,6 +416,8 @@
LIBS+=-lssl
INSTALL=install
+
+CFLAGS+=-DT38_SUPPORT
_all: all
@echo " +--------- Asterisk Build Complete ---------+"
Modified: team/bweschke/bug_6047/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/UPGRADE.txt?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/UPGRADE.txt (original)
+++ team/bweschke/bug_6047/UPGRADE.txt Thu Jan 12 13:37:52 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},
@@ -26,3 +29,6 @@
functions. You are encouraged to move towards the associated dialplan
function, as these variables will be removed in a future release.
+The SIP channel:
+
+* The "incominglimit" setting is replaced by the "call-limit" setting in sip.conf.
Modified: team/bweschke/bug_6047/app.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/app.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/app.c (original)
+++ team/bweschke/bug_6047/app.c Thu Jan 12 13:37:52 2006
@@ -279,47 +279,57 @@
return 0;
}
-int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between)
-{
- char *ptr;
+int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between)
+{
+ const char *ptr;
int res = 0;
- struct ast_frame f;
+ struct ast_frame f = {
+ .frametype = AST_FRAME_DTMF,
+ .src = "ast_dtmf_stream"
+ };
+
if (!between)
between = 100;
if (peer)
res = ast_autoservice_start(peer);
- if (!res) {
- res = ast_waitfor(chan,100);
- if (res > -1) {
- for (ptr=digits; *ptr; ptr++) {
- if (*ptr == 'w') {
- res = ast_safe_sleep(chan, 500);
- if (res)
- break;
- continue;
- }
- memset(&f, 0, sizeof(f));
- f.frametype = AST_FRAME_DTMF;
+ if (!res)
+ res = ast_waitfor(chan, 100);
+
+ /* ast_waitfor will return the number of remaining ms on success */
+ if (res < 0)
+ return res;
+
+ for (ptr = digits; *ptr; ptr++) {
+ if (*ptr == 'w') {
+ /* 'w' -- wait half a second */
+ if ((res = ast_safe_sleep(chan, 500)))
+ break;
+ } else if (strchr("0123456789*#abcdfABCDF", *ptr)) {
+ /* Character represents valid DTMF */
+ if (*ptr == 'f' || *ptr == 'F') {
+ /* ignore return values if not supported by channel */
+ ast_indicate(chan, AST_CONTROL_FLASH);
+ } else {
f.subclass = *ptr;
- f.src = "ast_dtmf_stream";
- if (strchr("0123456789*#abcdABCD",*ptr)==NULL) {
- ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
- } else {
- res = ast_write(chan, &f);
- if (res)
- break;
- /* pause between digits */
- res = ast_safe_sleep(chan,between);
- if (res)
- break;
- }
- }
- }
- if (peer)
- res = ast_autoservice_stop(peer);
- }
+ if ((res = ast_write(chan, &f)))
+ break;
+ }
+ /* pause between digits */
+ if ((res = ast_safe_sleep(chan, between)))
+ break;
+ } else
+ ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
+ }
+
+ if (peer) {
+ /* Stop autoservice on the peer channel, but don't overwrite any error condition
+ that has occurred previously while acting on the primary channel */
+ if (ast_autoservice_stop(peer) && !res)
+ res = -1;
+ }
+
return res;
}
Propchange: team/bweschke/bug_6047/apps/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jan 12 13:37:52 2006
@@ -1,1 +1,3 @@
.depend
+*.a
+*.so
Modified: team/bweschke/bug_6047/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/Makefile?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/Makefile (original)
+++ team/bweschke/bug_6047/apps/Makefile Thu Jan 12 13:37:52 2006
@@ -24,7 +24,8 @@
app_setcdruserfield.so app_settransfercapability.so app_softhangup.so \
app_stack.so app_system.so app_talkdetect.so app_test.so app_transfer.so \
app_userevent.so app_url.so app_verbose.so app_voicemail.so \
- app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so
+ app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so \
+ app_morsecode.so
#
# Obsolete things...
Modified: team/bweschke/bug_6047/apps/app_adsiprog.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_adsiprog.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_adsiprog.c (original)
+++ team/bweschke/bug_6047/apps/app_adsiprog.c Thu Jan 12 13:37:52 2006
@@ -1359,13 +1359,10 @@
ast_log(LOG_WARNING, "Can't open file '%s'\n", fn);
return NULL;
}
- scr = malloc(sizeof(struct adsi_script));
- if (!scr) {
+ if (!(scr = ast_calloc(1, sizeof(*scr)))) {
fclose(f);
- ast_log(LOG_WARNING, "Out of memory loading script '%s'\n", fn);
return NULL;
}
- memset(scr, 0, sizeof(struct adsi_script));
/* Create "main" as first subroutine */
getsubbyname(scr, "main", NULL, 0);
while(!feof(f)) {
Modified: team/bweschke/bug_6047/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_alarmreceiver.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_alarmreceiver.c (original)
+++ team/bweschke/bug_6047/apps/app_alarmreceiver.c Thu Jan 12 13:37:52 2006
@@ -56,6 +56,7 @@
#include "asterisk/localtime.h"
#include "asterisk/callerid.h"
#include "asterisk/astdb.h"
+#include "asterisk/utils.h"
#define ALMRCV_CONFIG "alarmreceiver.conf"
#define ADEMCO_CONTACT_ID "ADEMCO_CONTACT_ID"
@@ -579,17 +580,11 @@
events_received++;
- /* Queue the Event */
-
- if((enew = malloc(sizeof(event_node_t))) == NULL){
- if(option_verbose >= 1)
- ast_verbose(VERBOSE_PREFIX_1 "AlarmReceiver: Failed to allocate memory\n");
- ast_log(LOG_WARNING, "AlarmReceiver Failed to allocate memory\n");
+ /* Queue the Event */
+ if (!(enew = ast_calloc(1, sizeof(*enew)))) {
res = -1;
- break;
- }
-
- memset(enew, 0, sizeof(event_node_t));
+ break;
+ }
enew->next = NULL;
ast_copy_string(enew->data, event, sizeof(enew->data));
Modified: team/bweschke/bug_6047/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_authenticate.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_authenticate.c (original)
+++ team/bweschke/bug_6047/apps/app_authenticate.c Thu Jan 12 13:37:52 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/bweschke/bug_6047/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_chanspy.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_chanspy.c (original)
+++ team/bweschke/bug_6047/apps/app_chanspy.c Thu Jan 12 13:37:52 2006
@@ -2,6 +2,7 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2005 Anthony Minessale II (anthmct at yahoo.com)
+ * Copyright (C) 2005 - 2006, Digium, Inc.
*
* Disclaimed to Digium
*
Modified: team/bweschke/bug_6047/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_curl.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_curl.c (original)
+++ team/bweschke/bug_6047/apps/app_curl.c Thu Jan 12 13:37:52 2006
@@ -46,6 +46,7 @@
#include "asterisk/options.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
+#include "asterisk/utils.h"
static char *tdesc = "Load external URL";
@@ -63,9 +64,9 @@
/* There might be a realloc() out there that doesn't like reallocing
NULL pointers, so we take care of it here */
if (ptr)
- return realloc(ptr, size);
+ return ast_realloc(ptr, size);
else
- return malloc(size);
+ return ast_malloc(size);
}
static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
Modified: team/bweschke/bug_6047/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_dial.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_dial.c (original)
+++ team/bweschke/bug_6047/apps/app_dial.c Thu Jan 12 13:37:52 2006
@@ -164,7 +164,7 @@
" S(x) - Hang up the call after 'x' seconds *after* the called party has\n"
" answered the call.\n"
" t - Allow the called party to transfer the calling party by sending the\n"
-" DTMF sequence defiend in features.conf.\n"
+" DTMF sequence defined in features.conf.\n"
" T - Allow the calling party to transfer the called party by sending the\n"
" DTMF sequence defined in features.conf.\n"
" w - Allow the called party to enable recording of the call by sending\n"
@@ -984,13 +984,10 @@
goto out;
}
*number = '\0';
- number++;
- tmp = malloc(sizeof(struct localuser));
- if (!tmp) {
- ast_log(LOG_WARNING, "Out of memory\n");
+ number++;
+ if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
goto out;
}
- memset(tmp, 0, sizeof(struct localuser));
if (opts.flags) {
ast_copy_flags(tmp, &opts,
OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
Modified: team/bweschke/bug_6047/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_dictate.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_dictate.c (original)
+++ team/bweschke/bug_6047/apps/app_dictate.c Thu Jan 12 13:37:52 2006
@@ -82,7 +82,12 @@
static int dictate_exec(struct ast_channel *chan, void *data)
{
- char *mydata, *argv[3], *path = NULL, filein[256], *filename = "";
+ char *path = NULL, filein[256], *filename = "";
+ char *parse;
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(base);
+ AST_APP_ARG(filename);
+ );
char dftbase[256];
char *base;
struct ast_flags flags = {0};
@@ -91,7 +96,6 @@
struct localuser *u;
int ffactor = 320 * 80,
res = 0,
- argc = 0,
done = 0,
oldr = 0,
lastop = 0,
@@ -105,17 +109,23 @@
LOCAL_USER_ADD(u);
snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
- if (!ast_strlen_zero(data) && (mydata = ast_strdupa(data))) {
- argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
- }
+ if (!ast_strlen_zero(data)) {
+ parse = ast_strdupa(data);
+ if (!parse) {
+ ast_log(LOG_ERROR, "Out of memory!\n");
+ return -1;
+ }
+ AST_STANDARD_APP_ARGS(args, parse);
+ } else
+ args.argc = 0;
- if (argc) {
- base = argv[0];
+ if (args.argc && !ast_strlen_zero(args.base)) {
+ base = args.base;
} else {
base = dftbase;
}
- if (argc && argv[1]) {
- filename = argv[1];
+ if (args.argc > 1 && args.filename) {
+ filename = args.filename;
}
oldr = chan->readformat;
if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR)) < 0) {
Modified: team/bweschke/bug_6047/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_directory.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_directory.c (original)
+++ team/bweschke/bug_6047/apps/app_directory.c Thu Jan 12 13:37:52 2006
@@ -84,7 +84,7 @@
{
char *tmp;
int lcount = 0;
- tmp = malloc(NUMDIGITS + 1);
+ tmp = ast_malloc(NUMDIGITS + 1);
if (tmp) {
while((*lastname > 32) && lcount < NUMDIGITS) {
switch(toupper(*lastname)) {
Modified: team/bweschke/bug_6047/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_disa.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_disa.c (original)
+++ team/bweschke/bug_6047/apps/app_disa.c Thu Jan 12 13:37:52 2006
@@ -146,12 +146,12 @@
}
if (ast_set_write_format(chan,AST_FORMAT_ULAW)) {
- ast_log(LOG_WARNING, "Unable to set write format to Mu-law on %s\n",chan->name);
+ ast_log(LOG_WARNING, "Unable to set write format to Mu-law on %s\n", chan->name);
LOCAL_USER_REMOVE(u);
return -1;
}
if (ast_set_read_format(chan,AST_FORMAT_ULAW)) {
- ast_log(LOG_WARNING, "Unable to set read format to Mu-law on %s\n",chan->name);
+ ast_log(LOG_WARNING, "Unable to set read format to Mu-law on %s\n", chan->name);
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -198,8 +198,7 @@
for (;;) {
/* if outa time, give em reorder */
if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) >
- ((k&2) ? digittimeout : firstdigittimeout))
- {
+ ((k&2) ? digittimeout : firstdigittimeout)) {
ast_log(LOG_DEBUG,"DISA %s entry timeout on chan %s\n",
((k&1) ? "extension" : "password"),chan->name);
break;
@@ -210,14 +209,12 @@
}
f = ast_read(chan);
- if (f == NULL)
- {
+ if (f == NULL) {
LOCAL_USER_REMOVE(u);
return -1;
}
if ((f->frametype == AST_FRAME_CONTROL) &&
- (f->subclass == AST_CONTROL_HANGUP))
- {
+ (f->subclass == AST_CONTROL_HANGUP)) {
ast_frfree(f);
LOCAL_USER_REMOVE(u);
return -1;
@@ -226,56 +223,54 @@
ast_frfree(f);
continue;
}
- /* if not DTMF, just do it again */
- if (f->frametype != AST_FRAME_DTMF)
- {
+
+ /* if not DTMF, just do it again */
+ if (f->frametype != AST_FRAME_DTMF) {
ast_frfree(f);
continue;
}
j = f->subclass; /* save digit */
ast_frfree(f);
- if (i == 0)
- {
+ if (i == 0) {
k|=2; /* We have the first digit */
ast_playtones_stop(chan);
}
lastdigittime = ast_tvnow();
/* got a DTMF tone */
- if (i < AST_MAX_EXTENSION) /* if still valid number of digits */
- {
- if (!(k&1)) /* if in password state */
- {
- if (j == '#') /* end of password */
- {
+ if (i < AST_MAX_EXTENSION) { /* if still valid number of digits */
+ if (!(k&1)) { /* if in password state */
+ if (j == '#') { /* end of password */
/* see if this is an integer */
- if (sscanf(args.passcode,"%d",&j) < 1)
- { /* nope, it must be a filename */
+ if (sscanf(args.passcode,"%d",&j) < 1) { /* nope, it must be a filename */
fp = fopen(args.passcode,"r");
- if (!fp)
- {
+ if (!fp) {
ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,chan->name);
LOCAL_USER_REMOVE(u);
return -1;
- }
+ }
pwline[0] = 0;
- while(fgets(pwline,sizeof(pwline) - 1,fp))
- {
- if (!pwline[0]) continue;
+ while(fgets(pwline,sizeof(pwline) - 1,fp)) {
+ if (!pwline[0])
+ continue;
if (pwline[strlen(pwline) - 1] == '\n')
pwline[strlen(pwline) - 1] = 0;
- if (!pwline[0]) continue;
- /* skip comments */
- if (pwline[0] == '#') continue;
- if (pwline[0] == ';') continue;
+ if (!pwline[0])
+ continue;
+ /* skip comments */
+ if (pwline[0] == '#')
+ continue;
+ if (pwline[0] == ';')
+ continue;
AST_STANDARD_APP_ARGS(args, pwline);
ast_log(LOG_DEBUG, "Mailbox: %s\n",args.mailbox);
- /* password must be in valid format (numeric) */
- if (sscanf(args.passcode,"%d",&j) < 1) continue;
- /* if we got it */
+ /* password must be in valid format (numeric) */
+ if (sscanf(args.passcode,"%d", &j) < 1)
+ continue;
+ /* if we got it */
if (!strcmp(exten,args.passcode)) {
if (ast_strlen_zero(args.context))
args.context = "disa";
@@ -283,12 +278,11 @@
args.mailbox = "";
break;
}
- }
+ }
fclose(fp);
- }
- /* compare the two */
- if (strcmp(exten,args.passcode))
- {
+ }
+ /* compare the two */
+ if (strcmp(exten,args.passcode)) {
ast_log(LOG_WARNING,"DISA on chan %s got bad password %s\n",chan->name,exten);
goto reorder;
@@ -302,15 +296,16 @@
exten[sizeof(acctcode)] = 0;
ast_copy_string(acctcode, exten, sizeof(acctcode));
exten[0] = 0;
- ast_log(LOG_DEBUG,"Successful DISA log-in on chan %s\n",chan->name);
+ ast_log(LOG_DEBUG,"Successful DISA log-in on chan %s\n", chan->name);
continue;
}
}
exten[i++] = j; /* save digit */
exten[i] = 0;
- if (!(k&1)) continue; /* if getting password, continue doing it */
- /* if this exists */
+ if (!(k&1))
+ continue; /* if getting password, continue doing it */
+ /* if this exists */
if (ast_ignore_pattern(args.context, exten)) {
play_dialtone(chan, "");
@@ -321,7 +316,7 @@
did_ignore = 0;
}
- /* if can do some more, do it */
+ /* if can do some more, do it */
if (!ast_matchmore_extension(chan,args.context,exten,1, chan->cid.cid_num)) {
break;
}
@@ -341,8 +336,7 @@
if (!recheck || ast_exists_extension(chan, args.context, exten, 1, chan->cid.cid_num)) {
ast_playtones_stop(chan);
/* We're authenticated and have a target extension */
- if (!ast_strlen_zero(args.cid))
- {
+ if (!ast_strlen_zero(args.cid)) {
ast_callerid_split(args.cid, ourcidname, sizeof(ourcidname), ourcidnum, sizeof(ourcidnum));
ast_set_callerid(chan, ourcidnum, ourcidname, ourcidnum);
}
@@ -364,8 +358,7 @@
ast_indicate(chan,AST_CONTROL_CONGESTION);
/* something is invalid, give em reorder for several seconds */
time(&rstart);
- while(time(NULL) < rstart + 10)
- {
+ while(time(NULL) < rstart + 10) {
if (ast_waitfor(chan, -1) < 0)
break;
f = ast_read(chan);
Modified: team/bweschke/bug_6047/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_externalivr.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_externalivr.c (original)
+++ team/bweschke/bug_6047/apps/app_externalivr.c Thu Jan 12 13:37:52 2006
@@ -49,6 +49,7 @@
#include "asterisk/module.h"
#include "asterisk/linkedlists.h"
#include "asterisk/app.h"
+#include "asterisk/utils.h"
static const char *tdesc = "External IVR Interface Application";
@@ -112,10 +113,8 @@
{
struct localuser *u = params;
struct gen_state *state;
-
- state = calloc(1, sizeof(*state));
-
- if (!state)
+
+ if (!(state = ast_calloc(1, sizeof(*state))))
return NULL;
state->u = u;
@@ -234,10 +233,8 @@
static struct playlist_entry *make_entry(const char *filename)
{
struct playlist_entry *entry;
-
- entry = calloc(1, sizeof(*entry) + strlen(filename) + 10);
-
- if (!entry)
+
+ if (!(entry = ast_calloc(1, sizeof(*entry) + strlen(filename) + 10)))
return NULL;
strcpy(entry->filename, filename);
Modified: team/bweschke/bug_6047/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_meetme.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_meetme.c (original)
+++ team/bweschke/bug_6047/apps/app_meetme.c Thu Jan 12 13:37:52 2006
@@ -662,8 +662,14 @@
}
}
/* Show all the users */
- for (user = cnf->firstuser; user; user = user->nextuser)
- ast_cli(fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s\n",
+ for (user = cnf->firstuser; user; user = user->nextuser){
+ now = time(NULL);
+ hr = (now - user->jointime) / 3600;
+ min = ((now - user->jointime) % 3600) / 60;
+ sec = (now - user->jointime) % 60;
+
+
+ ast_cli(fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %02d:%02d:%02d\n",
user->user_no,
user->chan->cid.cid_num ? user->chan->cid.cid_num : "<unknown>",
user->chan->cid.cid_name ? user->chan->cid.cid_name : "<no name>",
@@ -671,7 +677,8 @@
user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
user->adminflags & ADMINFLAG_MUTED ? "(Admn Muted)" : "",
- istalking(user->talking));
+ istalking(user->talking), hr, min, sec);
+ }
ast_cli(fd,"%d users in that conference.\n",cnf->users);
return RESULT_SUCCESS;
@@ -867,6 +874,8 @@
int menu_active = 0;
int using_pseudo = 0;
int duration=20;
+ int hr, min, sec;
+ time_t now;
struct ast_dsp *dsp=NULL;
struct ast_app *app;
const char *agifile;
@@ -1661,12 +1670,26 @@
ast_dsp_free(dsp);
if (user->user_no) { /* Only cleanup users who really joined! */
- manager_event(EVENT_FLAG_CALL, "MeetmeLeave",
- "Channel: %s\r\n"
- "Uniqueid: %s\r\n"
- "Meetme: %s\r\n"
- "Usernum: %d\r\n",
- chan->name, chan->uniqueid, conf->confno, user->user_no);
+ now = time(NULL);
+ hr = (now - user->jointime) / 3600;
+ min = ((now - user->jointime) % 3600) / 60;
+ sec = (now - user->jointime) % 60;
+
+ manager_event(EVENT_FLAG_CALL, "MeetmeLeave",
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "Meetme: %s\r\n"
+ "Usernum: %d\r\n"
+ "CIDnum: %s\r\n"
+ "CIDname: %s\r\n"
+ "Duration: %02d:%02d:%02d\r\n",
+ chan->name, chan->uniqueid, conf->confno,
+ user->user_no,
+ user->chan->cid.cid_num ? user->chan->cid.cid_num :
+ "<unknown>",
+ user->chan->cid.cid_name ? user->chan->cid.cid_name :
+ "<no name>", hr, min, sec);
+
conf->users--;
if (confflags & CONFFLAG_MARKEDUSER)
conf->markedusers--;
Modified: team/bweschke/bug_6047/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_milliwatt.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_milliwatt.c (original)
+++ team/bweschke/bug_6047/apps/app_milliwatt.c Thu Jan 12 13:37:52 2006
@@ -60,7 +60,7 @@
static void *milliwatt_alloc(struct ast_channel *chan, void *params)
{
int *indexp;
- indexp = malloc(sizeof(int));
+ indexp = ast_malloc(sizeof(*indexp));
if (indexp == NULL) return(NULL);
*indexp = 0;
return(indexp);
Modified: team/bweschke/bug_6047/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_mixmonitor.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_mixmonitor.c (original)
+++ team/bweschke/bug_6047/apps/app_mixmonitor.c Thu Jan 12 13:37:52 2006
@@ -2,7 +2,7 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2005, Anthony Minessale II
- * Copyright (C) 2005, Digium, Inc.
+ * Copyright (C) 2005 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
* Kevin P. Fleming <kpfleming at digium.com>
Modified: team/bweschke/bug_6047/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_page.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_page.c (original)
+++ team/bweschke/bug_6047/apps/app_page.c Thu Jan 12 13:37:52 2006
@@ -100,9 +100,8 @@
struct ast_var_t *varptr;
pthread_t t;
pthread_attr_t attr;
- cd = malloc(sizeof(struct calloutdata));
+ cd = ast_calloc(1, sizeof(*cd));
if (cd) {
- memset(cd, 0, sizeof(struct calloutdata));
ast_copy_string(cd->cidnum, chan->cid.cid_num ? chan->cid.cid_num : "", sizeof(cd->cidnum));
ast_copy_string(cd->cidname, chan->cid.cid_name ? chan->cid.cid_name : "", sizeof(cd->cidname));
ast_copy_string(cd->tech, tech, sizeof(cd->tech));
Modified: team/bweschke/bug_6047/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/apps/app_playback.c?rev=8026&r1=8025&r2=8026&view=diff
==============================================================================
--- team/bweschke/bug_6047/apps/app_playback.c (original)
+++ team/bweschke/bug_6047/apps/app_playback.c Thu Jan 12 13:37:52 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) {
[... 9402 lines stripped ...]
More information about the svn-commits
mailing list