[asterisk-commits] branch oej/sipregister - r7937 in
/team/oej/sipregister: ./ apps/ cdr/ channe...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Jan 10 02:38:48 CST 2006
Author: oej
Date: Tue Jan 10 02:38:33 2006
New Revision: 7937
URL: http://svn.digium.com/view/asterisk?rev=7937&view=rev
Log:
Merged revisions 7897,7901-7902,7907,7909,7911-7913,7916,7918-7921,7929,7936 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r7897 | kpfleming | 2006-01-09 19:03:18 +0100 (Mon, 09 Jan 2006) | 2 lines
fix breakage introduced in revision 7863
................
r7901 | russell | 2006-01-09 19:29:03 +0100 (Mon, 09 Jan 2006) | 2 lines
remove unnecessary check before ast_strlen_zero (issue #6179)
................
r7902 | kpfleming | 2006-01-09 19:34:09 +0100 (Mon, 09 Jan 2006) | 2 lines
restore proper svn:ignore properties that were somehow lost...
................
r7907 | tilghman | 2006-01-09 20:33:47 +0100 (Mon, 09 Jan 2006) | 3 lines
Merged revisions 7904 via svnmerge from
/branches/1.2
................
r7909 | tilghman | 2006-01-09 21:12:07 +0100 (Mon, 09 Jan 2006) | 3 lines
Merged revisions 7908 via svnmerge from
/branches/1.2
................
r7911 | tilghman | 2006-01-09 22:22:36 +0100 (Mon, 09 Jan 2006) | 2 lines
Bug 6099 - cleanup of parse_variable_name and pbx_retrieve_variable
................
r7912 | oej | 2006-01-09 22:30:46 +0100 (Mon, 09 Jan 2006) | 2 lines
Bug 6112: file.c list macro conversion (drumkilla)
................
r7913 | mogorman | 2006-01-09 22:50:20 +0100 (Mon, 09 Jan 2006) | 4 lines
Changed say.c aliased zh to the tw say.c output.
Done in relation to bug 6135.
................
r7916 | russell | 2006-01-09 23:09:15 +0100 (Mon, 09 Jan 2006) | 3 lines
block rev 7915 from being merged into the trunk, since the patch is
not compatible
................
r7918 | kpfleming | 2006-01-10 00:06:28 +0100 (Tue, 10 Jan 2006) | 10 lines
Merged revisions 7917 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7917 | kpfleming | 2006-01-09 16:48:48 -0600 (Mon, 09 Jan 2006) | 2 lines
re-initialize _all_ sequence numbers when transfer completes
........
................
r7919 | tilghman | 2006-01-10 00:20:50 +0100 (Tue, 10 Jan 2006) | 2 lines
Bug 6106 - SuSE startup script
................
r7920 | tilghman | 2006-01-10 01:55:45 +0100 (Tue, 10 Jan 2006) | 2 lines
Bug 5961 - new RAND() function
................
r7921 | mogorman | 2006-01-10 02:52:34 +0100 (Tue, 10 Jan 2006) | 3 lines
committing 5924 with minor white space changes
and adding it to the Makefile for functions.
................
r7929 | tilghman | 2006-01-10 04:23:38 +0100 (Tue, 10 Jan 2006) | 2 lines
Fix indentation
................
r7936 | oej | 2006-01-10 09:33:52 +0100 (Tue, 10 Jan 2006) | 2 lines
Declare missing randomlock
................
Added:
team/oej/sipregister/contrib/init.d/rc.suse.asterisk
- copied unchanged from r7936, trunk/contrib/init.d/rc.suse.asterisk
team/oej/sipregister/funcs/func_base64.c
- copied unchanged from r7936, trunk/funcs/func_base64.c
team/oej/sipregister/funcs/func_rand.c
- copied unchanged from r7936, trunk/funcs/func_rand.c
Modified:
team/oej/sipregister/ (props changed)
team/oej/sipregister/apps/ (props changed)
team/oej/sipregister/apps/app_voicemail.c
team/oej/sipregister/asterisk.c
team/oej/sipregister/cdr/ (props changed)
team/oej/sipregister/channels/ (props changed)
team/oej/sipregister/channels/chan_iax2.c
team/oej/sipregister/codecs/ (props changed)
team/oej/sipregister/codecs/ilbc/ (props changed)
team/oej/sipregister/codecs/lpc10/ (props changed)
team/oej/sipregister/db1-ast/ (props changed)
team/oej/sipregister/doc/README.variables
team/oej/sipregister/editline/ (props changed)
team/oej/sipregister/file.c
team/oej/sipregister/formats/ (props changed)
team/oej/sipregister/funcs/ (props changed)
team/oej/sipregister/funcs/Makefile
team/oej/sipregister/funcs/func_md5.c
team/oej/sipregister/include/asterisk/utils.h
team/oej/sipregister/pbx/ (props changed)
team/oej/sipregister/pbx.c
team/oej/sipregister/pbx/pbx_spool.c
team/oej/sipregister/res/ (props changed)
team/oej/sipregister/say.c
team/oej/sipregister/stdtime/ (props changed)
team/oej/sipregister/utils.c
Propchange: team/oej/sipregister/
------------------------------------------------------------------------------
--- svnmerge-blocked (original)
+++ svnmerge-blocked Tue Jan 10 02:38:33 2006
@@ -1,1 +1,1 @@
-/branches/1.2:7497
+/branches/1.2:7497,7915
Propchange: team/oej/sipregister/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan 10 02:38:33 2006
@@ -1,1 +1,1 @@
-/trunk:1-7894
+/trunk:1-7936
Propchange: team/oej/sipregister/apps/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,1 +1,3 @@
.depend
+*.a
+*.so
Modified: team/oej/sipregister/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/apps/app_voicemail.c?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/apps/app_voicemail.c (original)
+++ team/oej/sipregister/apps/app_voicemail.c Tue Jan 10 02:38:33 2006
@@ -3899,8 +3899,8 @@
{
int cmd;
char *buf;
+
buf = alloca(strlen(mbox)+2);
- memset(buf, '\0', sizeof(char)*(sizeof(buf)));
strcpy(buf, mbox);
strcat(buf,"s");
Modified: team/oej/sipregister/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/asterisk.c?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/asterisk.c (original)
+++ team/oej/sipregister/asterisk.c Tue Jan 10 02:38:33 2006
@@ -210,6 +210,8 @@
static int shuttingdown = 0;
static int restartnow = 0;
static pthread_t consolethread = AST_PTHREADT_NULL;
+
+static char randompool[256];
#if !defined(LOW_MEMORY)
struct file_version {
@@ -2288,7 +2290,7 @@
Asterisk is started
*/
srand((unsigned int) getpid() + (unsigned int) time(NULL));
- srandom((unsigned int) getpid() + (unsigned int) time(NULL));
+ initstate((unsigned int) getpid() * 65536 + (unsigned int) time(NULL), randompool, sizeof(randompool));
if (init_logger()) {
printf(term_quit());
Propchange: team/oej/sipregister/cdr/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,1 +1,3 @@
.depend
+*.a
+*.so
Propchange: team/oej/sipregister/channels/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,4 +1,6 @@
+.depend
+*.a
+*.so
+gentone
busy.h
-gentone
ringtone.h
-.depend
Modified: team/oej/sipregister/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channels/chan_iax2.c?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/channels/chan_iax2.c (original)
+++ team/oej/sipregister/channels/chan_iax2.c Tue Jan 10 02:38:33 2006
@@ -5372,6 +5372,7 @@
memset(&pvt->transfer, 0, sizeof(pvt->transfer));
/* Reset sequence numbers */
pvt->oseqno = 0;
+ pvt->rseqno = 0;
pvt->iseqno = 0;
pvt->aseqno = 0;
pvt->peercallno = peercallno;
@@ -6582,8 +6583,8 @@
/* Handle implicit ACKing unless this is an INVAL, and only if this is
from the real peer, not the transfer peer */
if (!inaddrcmp(&sin, &iaxs[fr.callno]->addr) &&
- (((f.subclass != IAX_COMMAND_INVAL)) ||
- (f.frametype != AST_FRAME_IAX))) {
+ ((f.subclass != IAX_COMMAND_INVAL) ||
+ (f.frametype != AST_FRAME_IAX))) {
unsigned char x;
/* XXX This code is not very efficient. Surely there is a better way which still
properly handles boundary conditions? XXX */
Propchange: team/oej/sipregister/codecs/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,3 +1,3 @@
-g723.1
-g723.1b
.depend
+*.a
+*.so
Propchange: team/oej/sipregister/codecs/ilbc/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,0 +1,3 @@
+.depend
+*.a
+*.so
Propchange: team/oej/sipregister/codecs/lpc10/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,0 +1,3 @@
+.depend
+*.a
+*.so
Propchange: team/oej/sipregister/db1-ast/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,0 +1,3 @@
+.depend
+*.a
+*.so
Modified: team/oej/sipregister/doc/README.variables
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/doc/README.variables?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/doc/README.variables (original)
+++ team/oej/sipregister/doc/README.variables Tue Jan 10 02:38:33 2006
@@ -558,25 +558,25 @@
only read in the dialplan. Writes to such variables are silently
ignored.
-${ACCOUNTCODE} * Account code (if specified)
+${ACCOUNTCODE} * Account code (if specified) (Deprecated; use ${CDR(accountcode)})
${BLINDTRANSFER} The name of the channel on the other side of a blind transfer
${BRIDGEPEER} Bridged peer
-${CALLERANI} * Caller ANI (PRI channels)
-${CALLERID} * Caller ID
-${CALLERIDNAME} * Caller ID Name only
-${CALLERIDNUM} * Caller ID Number only
+${CALLERANI} * Caller ANI (PRI channels) (Deprecated; use ${CALLERID(ani)})
+${CALLERID} * Caller ID (Deprecated; use ${CALLERID(all)})
+${CALLERIDNAME} * Caller ID Name only (Deprecated; use ${CALLERID(name)})
+${CALLERIDNUM} * Caller ID Number only (Deprecated; use ${CALLERID(num)})
${CALLINGANI2} * Caller ANI2 (PRI channels)
${CALLINGPRES} * Caller ID presentation for incoming calls (PRI channels)
${CALLINGTNS} * Transit Network Selector (PRI channels)
${CALLINGTON} * Caller Type of Number (PRI channels)
${CHANNEL} * Current channel name
${CONTEXT} * Current context
-${DATETIME} * Current date time in the format: DDMMYYYY-HH:MM:SS
+${DATETIME} * Current date time in the format: DDMMYYYY-HH:MM:SS (Deprecated; use ${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
${DB_RESULT} Result value of DB_EXISTS() dial plan function
-${DNID} * Dialed Number Identifier
+${DNID} * Dialed Number Identifier (Deprecated; use ${CALLERID(dnid)})
${EPOCH} * Current unix style epoch
${EXTEN} * Current extension
-${ENV(VAR)} * Environmental variable VAR
+${ENV(VAR)} Environmental variable VAR
${GOTO_ON_BLINDXFR} Transfer to the specified context/extension/priority
after a blind transfer (use ^ characters in place of
| to separate context/extension/priority when setting
@@ -585,12 +585,12 @@
${HINT} * Channel hints for this extension
${HINTNAME} * Suggested Caller*ID name for this extension
${INVALID_EXTEN} The invalid called extension (used in the "i" extension)
-${LANGUAGE} * Current language
+${LANGUAGE} * Current language (Deprecated; use ${LANGUAGE()})
${LEN(VAR)} * String length of VAR (integer)
${PRIORITY} * Current priority in the dialplan
${PRIREDIRECTREASON} Reason for redirect on PRI, if a call was directed
-${RDNIS} * Redirected Dial Number ID Service
-${TIMESTAMP} * Current date time in the format: YYYYMMDD-HHMMSS
+${RDNIS} * Redirected Dial Number ID Service (Deprecated; use ${CALLERID(rdnis)})
+${TIMESTAMP} * Current date time in the format: YYYYMMDD-HHMMSS (Deprecated; use ${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
${TRANSFER_CONTEXT} Context for transferred calls
${UNIQUEID} * Current call unique identifier
@@ -787,8 +787,8 @@
In addition, you can set your own extra variables with a traditional
-SetVAR(CDR(var)=val) to anything you want.
-
-Certain functional variables may be accessed with $(foo <args>). A list
+Set(CDR(var)=val) to anything you want.
+
+Certain functional variables may be accessed with ${foo(<args>)}. A list
of these functional variables may be found by typing "show functions"
at the Asterisk CLI.
Propchange: team/oej/sipregister/editline/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -21,3 +21,5 @@
config.cache
Makefile
cygdef.h
+*.a
+*.so
Modified: team/oej/sipregister/file.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/file.c?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/file.c (original)
+++ team/oej/sipregister/file.c Tue Jan 10 02:38:33 2006
@@ -50,6 +50,7 @@
#include "asterisk/lock.h"
#include "asterisk/app.h"
#include "asterisk/pbx.h"
+#include "asterisk/linkedlists.h"
struct ast_format {
/*! Name of format */
@@ -79,7 +80,7 @@
/*! Retrieve file comment */
char * (*getcomment)(struct ast_filestream *);
/*! Link */
- struct ast_format *next;
+ AST_LIST_ENTRY(ast_format) list;
};
struct ast_filestream {
@@ -99,9 +100,7 @@
struct ast_channel *owner;
};
-AST_MUTEX_DEFINE_STATIC(formatlock);
-
-static struct ast_format *formats = NULL;
+static AST_LIST_HEAD_STATIC(formats, ast_format);
int ast_format_register(const char *name, const char *exts, int format,
struct ast_filestream * (*open)(FILE *f),
@@ -115,23 +114,21 @@
char * (*getcomment)(struct ast_filestream *))
{
struct ast_format *tmp;
- if (ast_mutex_lock(&formatlock)) {
+ if (AST_LIST_LOCK(&formats)) {
ast_log(LOG_WARNING, "Unable to lock format list\n");
return -1;
}
- tmp = formats;
- while(tmp) {
+ AST_LIST_TRAVERSE(&formats, tmp, list) {
if (!strcasecmp(name, tmp->name)) {
- ast_mutex_unlock(&formatlock);
+ AST_LIST_UNLOCK(&formats);
ast_log(LOG_WARNING, "Tried to register '%s' format, already registered\n", name);
return -1;
}
- tmp = tmp->next;
}
tmp = malloc(sizeof(struct ast_format));
if (!tmp) {
ast_log(LOG_WARNING, "Out of memory\n");
- ast_mutex_unlock(&formatlock);
+ AST_LIST_UNLOCK(&formats);
return -1;
}
ast_copy_string(tmp->name, name, sizeof(tmp->name));
@@ -146,9 +143,8 @@
tmp->close = close;
tmp->format = format;
tmp->getcomment = getcomment;
- tmp->next = formats;
- formats = tmp;
- ast_mutex_unlock(&formatlock);
+ AST_LIST_INSERT_HEAD(&formats, tmp, list);
+ AST_LIST_UNLOCK(&formats);
if (option_verbose > 1)
ast_verbose( VERBOSE_PREFIX_2 "Registered file format %s, extension(s) %s\n", name, exts);
return 0;
@@ -156,29 +152,30 @@
int ast_format_unregister(const char *name)
{
- struct ast_format *tmp, *tmpl = NULL;
- if (ast_mutex_lock(&formatlock)) {
+ struct ast_format *tmp;
+ int res = -1;
+
+ if (AST_LIST_LOCK(&formats)) {
ast_log(LOG_WARNING, "Unable to lock format list\n");
return -1;
}
- tmp = formats;
- while(tmp) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&formats, tmp, list) {
if (!strcasecmp(name, tmp->name)) {
- if (tmpl)
- tmpl->next = tmp->next;
- else
- formats = tmp->next;
+ AST_LIST_REMOVE_CURRENT(&formats, list);
free(tmp);
- ast_mutex_unlock(&formatlock);
- if (option_verbose > 1)
+ res = 0;
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END
+ AST_LIST_UNLOCK(&formats);
+
+ if (tmp) {
+ if (option_verbose > 1)
ast_verbose( VERBOSE_PREFIX_2 "Unregistered format %s\n", name);
- return 0;
- }
- tmpl = tmp;
- tmp = tmp->next;
- }
- ast_log(LOG_WARNING, "Tried to unregister format %s, already unregistered\n", name);
- return -1;
+ } else
+ ast_log(LOG_WARNING, "Tried to unregister format %s, already unregistered\n", name);
+
+ return res;
}
int ast_stopstream(struct ast_channel *tmp)
@@ -360,11 +357,11 @@
if (action == ACTION_OPEN)
ret = -1;
/* Check for a specific format */
- if (ast_mutex_lock(&formatlock)) {
+ if (AST_LIST_LOCK(&formats)) {
ast_log(LOG_WARNING, "Unable to lock format list\n");
return res;
}
- for (f = formats; f; f = f->next) {
+ AST_LIST_TRAVERSE(&formats, f, list) {
if (!fmt || exts_compare(f->exts, fmt)) {
char *stringp=NULL;
exts = ast_strdupa(f->exts);
@@ -446,7 +443,7 @@
}
}
- ast_mutex_unlock(&formatlock);
+ AST_LIST_UNLOCK(&formats);
if ((action == ACTION_EXISTS) || (action == ACTION_OPEN))
res = ret ? ret : -1;
return res;
@@ -836,12 +833,15 @@
struct ast_filestream *fs = NULL;
char *fn;
- if (ast_mutex_lock(&formatlock)) {
+ if (AST_LIST_LOCK(&formats)) {
ast_log(LOG_WARNING, "Unable to lock format list\n");
return NULL;
}
- for (f = formats; f && !fs; f = f->next) {
+ AST_LIST_TRAVERSE(&formats, f, list) {
+ if (fs)
+ break;
+
if (!exts_compare(f->exts, type))
continue;
@@ -868,7 +868,7 @@
free(fn);
}
- ast_mutex_unlock(&formatlock);
+ AST_LIST_UNLOCK(&formats);
if (!fs)
ast_log(LOG_WARNING, "No such format '%s'\n", type);
@@ -886,7 +886,7 @@
char *buf = NULL;
size_t size = 0;
- if (ast_mutex_lock(&formatlock)) {
+ if (AST_LIST_LOCK(&formats)) {
ast_log(LOG_WARNING, "Unable to lock format list\n");
return NULL;
}
@@ -901,7 +901,10 @@
myflags |= O_WRONLY | O_CREAT;
- for (f = formats; f && !fs; f = f->next) {
+ AST_LIST_TRAVERSE(&formats, f, list) {
+ if (fs)
+ break;
+
if (!exts_compare(f->exts, type))
continue;
@@ -983,7 +986,7 @@
free(fn);
}
- ast_mutex_unlock(&formatlock);
+ AST_LIST_UNLOCK(&formats);
if (!fs)
ast_log(LOG_WARNING, "No such format '%s'\n", type);
@@ -1259,18 +1262,16 @@
return RESULT_SHOWUSAGE;
ast_cli(fd, FORMAT, "Format", "Name", "Extensions");
- if (ast_mutex_lock(&formatlock)) {
+ if (AST_LIST_LOCK(&formats)) {
ast_log(LOG_WARNING, "Unable to lock format list\n");
return -1;
}
- f = formats;
- while(f) {
+ AST_LIST_TRAVERSE(&formats, f, list) {
ast_cli(fd, FORMAT2, ast_getformatname(f->format), f->name, f->exts);
- f = f->next;
count_fmt++;
- };
- ast_mutex_unlock(&formatlock);
+ }
+ AST_LIST_UNLOCK(&formats);
ast_cli(fd, "%d file formats registered.\n", count_fmt);
return RESULT_SUCCESS;
#undef FORMAT
Propchange: team/oej/sipregister/formats/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,1 +1,3 @@
.depend
+*.a
+*.so
Propchange: team/oej/sipregister/funcs/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,2 +1,4 @@
+.depend
+*.a
+*.so
pbx_functions.h
-.depend
Modified: team/oej/sipregister/funcs/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/funcs/Makefile?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/funcs/Makefile (original)
+++ team/oej/sipregister/funcs/Makefile Tue Jan 10 02:38:33 2006
@@ -23,7 +23,8 @@
func_db.o \
func_timeout.o \
func_language.o \
- func_moh.o
+ func_moh.o \
+ func_base64.o
AVAILABLE_FUNCS=$(filter-out $(BUILTINS),$(patsubst %.c,%.o,$(wildcard func*.c)))
Modified: team/oej/sipregister/funcs/func_md5.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/funcs/func_md5.c?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/funcs/func_md5.c (original)
+++ team/oej/sipregister/funcs/func_md5.c Tue Jan 10 02:38:33 2006
@@ -60,7 +60,7 @@
char *args;
char newmd5[33];
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n");
return NULL;
}
Modified: team/oej/sipregister/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/include/asterisk/utils.h?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/include/asterisk/utils.h (original)
+++ team/oej/sipregister/include/asterisk/utils.h Tue Jan 10 02:38:33 2006
@@ -235,4 +235,10 @@
int getloadavg(double *list, int nelem);
#endif
+#ifdef linux
+#define ast_random random
+#else
+long int ast_random(void);
+#endif
+
#endif /* _ASTERISK_UTILS_H */
Propchange: team/oej/sipregister/pbx/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,2 +1,3 @@
-pbx_kdeconsole.moc
.depend
+*.a
+*.so
Modified: team/oej/sipregister/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/pbx.c?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/pbx.c (original)
+++ team/oej/sipregister/pbx.c Tue Jan 10 02:38:33 2006
@@ -821,40 +821,33 @@
/* Note that it's negative -- that's important later. */
#define DONT_HAVE_LENGTH 0x80000000
+/*! \brief extract offset:length from variable name.
+ * Returns 1 if there is a offset:length part, which is
+ * trimmed off (values go into variables)
+ */
static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
{
- char *varchar, *offsetchar = NULL;
int parens=0;
*offset = 0;
*length = DONT_HAVE_LENGTH;
*isfunc = 0;
- for (varchar = var; *varchar; varchar++) {
- switch (*varchar) {
- case '(':
+ for (; *var; var++) {
+ if (*var == '(') {
(*isfunc)++;
parens++;
- break;
- case ')':
+ } else if (*var == ')') {
parens--;
- break;
- case ':':
- if (parens == 0) {
- offsetchar = varchar + 1;
- *varchar = '\0';
- goto pvn_endfor;
- }
- }
- }
-pvn_endfor:
- if (offsetchar) {
- sscanf(offsetchar, "%d:%d", offset, length);
- return 1;
- } else {
- return 0;
- }
-}
-
+ } else if (*var == ':' && parens == 0) {
+ *var++ = '\0';
+ sscanf(var, "%d:%d", offset, length);
+ return 1; /* offset:length valid */
+ }
+ }
+ return 0;
+}
+
+/*! \brief takes a substring. It is ok to call with value == workspace. */
static char *substring(char *value, int offset, int length, char *workspace, size_t workspace_len)
{
char *ret = workspace;
@@ -899,204 +892,171 @@
---*/
void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
{
- char tmpvar[80];
- time_t thistime;
- struct tm brokentime;
- int offset, offset2, isfunc;
- struct ast_var_t *variables;
- char *deprecated = NULL;
-
- if (c)
- headp=&c->varshead;
- *ret=NULL;
- ast_copy_string(tmpvar, var, sizeof(tmpvar));
- if (parse_variable_name(tmpvar, &offset, &offset2, &isfunc)) {
- pbx_retrieve_variable(c, tmpvar, ret, workspace, workspacelen, headp);
- if (!(*ret))
- return;
- *ret = substring(*ret, offset, offset2, workspace, workspacelen);
- } else if (c && !strncmp(var, "CALL", 4)) {
- if (!strncmp(var + 4, "ER", 2)) {
- if (!strncmp(var + 6, "ID", 2)) {
- if (!var[8]) { /* CALLERID */
- if (c->cid.cid_num) {
- if (c->cid.cid_name) {
- snprintf(workspace, workspacelen, "\"%s\" <%s>", c->cid.cid_name, c->cid.cid_num);
- } else {
- ast_copy_string(workspace, c->cid.cid_num, workspacelen);
- }
- *ret = workspace;
- } else if (c->cid.cid_name) {
- ast_copy_string(workspace, c->cid.cid_name, workspacelen);
- *ret = workspace;
- } else
- *ret = NULL;
- deprecated = "CALLERID(all)";
- } else if (!strcmp(var + 8, "NUM")) {
- /* CALLERIDNUM */
- if (c->cid.cid_num) {
- ast_copy_string(workspace, c->cid.cid_num, workspacelen);
- *ret = workspace;
- } else
- *ret = NULL;
- deprecated = "CALLERID(num)";
- } else if (!strcmp(var + 8, "NAME")) {
- /* CALLERIDNAME */
- if (c->cid.cid_name) {
- ast_copy_string(workspace, c->cid.cid_name, workspacelen);
- *ret = workspace;
- } else
- *ret = NULL;
- deprecated = "CALLERID(name)";
- } else
- goto icky;
- } else if (!strcmp(var + 6, "ANI")) {
- /* CALLERANI */
- if (c->cid.cid_ani) {
- ast_copy_string(workspace, c->cid.cid_ani, workspacelen);
- *ret = workspace;
- } else
- *ret = NULL;
- deprecated = "CALLERID(ANI)";
- } else
- goto icky;
- } else if (!strncmp(var + 4, "ING", 3)) {
- if (!strcmp(var + 7, "PRES")) {
- /* CALLINGPRES */
- snprintf(workspace, workspacelen, "%d", c->cid.cid_pres);
- *ret = workspace;
- } else if (!strcmp(var + 7, "ANI2")) {
- /* CALLINGANI2 */
- snprintf(workspace, workspacelen, "%d", c->cid.cid_ani2);
- *ret = workspace;
- } else if (!strcmp(var + 7, "TON")) {
- /* CALLINGTON */
- snprintf(workspace, workspacelen, "%d", c->cid.cid_ton);
- *ret = workspace;
- } else if (!strcmp(var + 7, "TNS")) {
- /* CALLINGTNS */
- snprintf(workspace, workspacelen, "%d", c->cid.cid_tns);
- *ret = workspace;
- } else
- goto icky;
- } else
- goto icky;
- } else if (c && !strcmp(var, "DNID")) {
- if (c->cid.cid_dnid) {
- ast_copy_string(workspace, c->cid.cid_dnid, workspacelen);
- *ret = workspace;
- } else
- *ret = NULL;
- deprecated = "CALLERID(DNID)";
- } else if (c && !strcmp(var, "HINT")) {
- if (!ast_get_hint(workspace, workspacelen, NULL, 0, c, c->context, c->exten))
- *ret = NULL;
- else
- *ret = workspace;
- } else if (c && !strcmp(var, "HINTNAME")) {
- if (!ast_get_hint(NULL, 0, workspace, workspacelen, c, c->context, c->exten))
- *ret = NULL;
- else
- *ret = workspace;
- } else if (c && !strcmp(var, "EXTEN")) {
- ast_copy_string(workspace, c->exten, workspacelen);
- *ret = workspace;
- } else if (c && !strcmp(var, "RDNIS")) {
- if (c->cid.cid_rdnis) {
- ast_copy_string(workspace, c->cid.cid_rdnis, workspacelen);
- *ret = workspace;
- } else
- *ret = NULL;
- deprecated = "CALLERID(RDNIS)";
- } else if (c && !strcmp(var, "CONTEXT")) {
- ast_copy_string(workspace, c->context, workspacelen);
- *ret = workspace;
- } else if (c && !strcmp(var, "PRIORITY")) {
- snprintf(workspace, workspacelen, "%d", c->priority);
- *ret = workspace;
- } else if (c && !strcmp(var, "CHANNEL")) {
- ast_copy_string(workspace, c->name, workspacelen);
- *ret = workspace;
- } else if (!strcmp(var, "EPOCH")) {
- snprintf(workspace, workspacelen, "%u",(int)time(NULL));
- *ret = workspace;
- } else if (!strcmp(var, "DATETIME")) {
- thistime=time(NULL);
- localtime_r(&thistime, &brokentime);
- snprintf(workspace, workspacelen, "%02d%02d%04d-%02d:%02d:%02d",
- brokentime.tm_mday,
- brokentime.tm_mon+1,
- brokentime.tm_year+1900,
- brokentime.tm_hour,
- brokentime.tm_min,
- brokentime.tm_sec
- );
- *ret = workspace;
- deprecated = "STRFTIME(${EPOCH},,\%m\%d\%Y-\%H:\%M:\%S)";
- } else if (!strcmp(var, "TIMESTAMP")) {
- thistime=time(NULL);
- localtime_r(&thistime, &brokentime);
- /* 20031130-150612 */
- snprintf(workspace, workspacelen, "%04d%02d%02d-%02d%02d%02d",
- brokentime.tm_year+1900,
- brokentime.tm_mon+1,
- brokentime.tm_mday,
- brokentime.tm_hour,
- brokentime.tm_min,
- brokentime.tm_sec
- );
- *ret = workspace;
- deprecated = "STRFTIME(${EPOCH},,\%Y\%m\%d-\%H\%M\%S)";
- } else if (c && !strcmp(var, "UNIQUEID")) {
- snprintf(workspace, workspacelen, "%s", c->uniqueid);
- *ret = workspace;
- } else if (c && !strcmp(var, "HANGUPCAUSE")) {
- snprintf(workspace, workspacelen, "%d", c->hangupcause);
- *ret = workspace;
- } else if (c && !strcmp(var, "ACCOUNTCODE")) {
- ast_copy_string(workspace, c->accountcode, workspacelen);
- *ret = workspace;
- deprecated = "CDR(accountcode)";
- } else if (c && !strcmp(var, "LANGUAGE")) {
- ast_copy_string(workspace, c->language, workspacelen);
- *ret = workspace;
- deprecated = "LANGUAGE()";
- } else {
-icky:
- if (headp) {
- AST_LIST_TRAVERSE(headp,variables,entries) {
-#if 0
- ast_log(LOG_WARNING,"Comparing variable '%s' with '%s'\n",var,ast_var_name(variables));
-#endif
- if (strcasecmp(ast_var_name(variables),var)==0) {
- const char *s = ast_var_value(variables);
- if (s) {
- ast_copy_string(workspace, s, workspacelen);
- *ret = workspace;
+ const char not_found = '\0';
+ char tmpvar[80], *deprecated = NULL;
+ const char *s; /* the result */
+ int offset, length;
+ int i, need_substring;
+ struct varshead *places[2] = { headp, &globals }; /* list of places where we may look */
+
+ if (c) {
+ places[0] = &c->varshead;
+ }
+ /*
+ * Make a copy of var because parse_variable_name() modifies the string.
+ * Then if called directly, we might need to run substring() on the result;
+ * remember this for later in 'need_substring', 'offset' and 'length'
+ */
+ ast_copy_string(tmpvar, var, sizeof(tmpvar)); /* parse_variable_name modifies the string */
+ need_substring = parse_variable_name(tmpvar, &offset, &length, &i /* ignored */);
+
+ /*
+ * Look first into predefined variables, then into variable lists.
+ * s == ¬_found (set at the beginning) means that we did not find a
+ * matching variable and need to look into more places.
+ * If s != ¬_found, s is a valid result string as follows:
+ * s = NULL if the variable does not have a value;
+ * s = workspace if the result has been assembled there;
+ * s != workspace in case we have a string, that needs to be copied
+ * (the ast_copy_string is done once for all at the end).
+ * Deprecated variables have the replacement indicated in 'deprecated'.
+ */
+ s = ¬_found; /* default value */
+ if (c) { /* This group requires a valid channel */
+ /* Names with common parts are looked up a piece at a time using strncmp. */
+ if (!strncmp(var, "CALL", 4)) {
+ if (!strncmp(var + 4, "ER", 2)) {
+ if (!strncmp(var + 6, "ID", 2)) {
+ if (!var[8]) { /* CALLERID */
+ if (c->cid.cid_num) {
+ if (c->cid.cid_name) {
+ snprintf(workspace, workspacelen, "\"%s\" <%s>",
+ c->cid.cid_name, c->cid.cid_num);
+ s = workspace;
+ } else {
+ s = c->cid.cid_num;
+ }
+ } else
+ s = c->cid.cid_name; /* possibly empty */
+ deprecated = "CALLERID(all)";
+ } else if (!strcmp(var + 8, "NUM")) { /* CALLERIDNUM */
+ s = c->cid.cid_num;
+ deprecated = "CALLERID(num)";
+ } else if (!strcmp(var + 8, "NAME")) { /* CALLERIDNAME */
+ s = c->cid.cid_name;
+ deprecated = "CALLERID(name)";
}
- break;
+ } else if (!strcmp(var + 6, "ANI")) { /* CALLERANI */
+ s = c->cid.cid_ani;
+ deprecated = "CALLERID(ANI)";
+ }
+ } else if (!strncmp(var + 4, "ING", 3)) {
+ if (!strcmp(var + 7, "PRES")) { /* CALLINGPRES */
+ snprintf(workspace, workspacelen, "%d", c->cid.cid_pres);
+ s = workspace;
+ } else if (!strcmp(var + 7, "ANI2")) { /* CALLINGANI2 */
+ snprintf(workspace, workspacelen, "%d", c->cid.cid_ani2);
+ s = workspace;
+ } else if (!strcmp(var + 7, "TON")) { /* CALLINGTON */
+ snprintf(workspace, workspacelen, "%d", c->cid.cid_ton);
+ s = workspace;
+ } else if (!strcmp(var + 7, "TNS")) { /* CALLINGTNS */
+ snprintf(workspace, workspacelen, "%d", c->cid.cid_tns);
+ s = workspace;
}
}
- }
- if (!(*ret)) {
- /* Try globals */
- AST_LIST_TRAVERSE(&globals,variables,entries) {
-#if 0
- ast_log(LOG_WARNING,"Comparing variable '%s' with '%s'\n",var,ast_var_name(variables));
-#endif
- if (strcasecmp(ast_var_name(variables),var)==0) {
- const char *s = ast_var_value(variables);
- if (s) {
- ast_copy_string(workspace, s, workspacelen);
- *ret = workspace;
- }
- }
+ } else if (!strcmp(var, "DNID")) {
+ s = c->cid.cid_dnid;
+ deprecated = "CALLERID(DNID)";
+ } else if (!strcmp(var, "HINT")) {
+ s = ast_get_hint(workspace, workspacelen, NULL, 0, c, c->context, c->exten) ? workspace : NULL;
+ } else if (!strcmp(var, "HINTNAME")) {
+ s = ast_get_hint(NULL, 0, workspace, workspacelen, c, c->context, c->exten) ? workspace : NULL;
+ } else if (!strcmp(var, "EXTEN")) {
+ s = c->exten;
+ } else if (!strcmp(var, "RDNIS")) {
+ s = c->cid.cid_rdnis;
+ deprecated = "CALLERID(RDNIS)";
+ } else if (!strcmp(var, "CONTEXT")) {
+ s = c->context;
+ } else if (!strcmp(var, "PRIORITY")) {
+ snprintf(workspace, workspacelen, "%d", c->priority);
+ s = workspace;
+ } else if (!strcmp(var, "CHANNEL")) {
+ s = c->name;
+ } else if (!strcmp(var, "UNIQUEID")) {
+ s = c->uniqueid;
+ } else if (!strcmp(var, "HANGUPCAUSE")) {
+ snprintf(workspace, workspacelen, "%d", c->hangupcause);
+ s = workspace;
+ } else if (!strcmp(var, "ACCOUNTCODE")) {
+ s = c->accountcode;
+ deprecated = "CDR(accountcode)";
+ } else if (!strcmp(var, "LANGUAGE")) {
+ s = c->language;
+ deprecated = "LANGUAGE()";
+ }
+ }
+ if (s == ¬_found) { /* look for more */
+ time_t thistime;
+ struct tm brokentime;
+
+ if (!strcmp(var, "EPOCH")) {
+ snprintf(workspace, workspacelen, "%u",(int)time(NULL));
+ s = workspace;
+ } else if (!strcmp(var, "DATETIME")) {
+ thistime=time(NULL);
+ localtime_r(&thistime, &brokentime);
+ snprintf(workspace, workspacelen, "%02d%02d%04d-%02d:%02d:%02d",
+ brokentime.tm_mday,
+ brokentime.tm_mon+1,
+ brokentime.tm_year+1900,
+ brokentime.tm_hour,
+ brokentime.tm_min,
+ brokentime.tm_sec
+ );
+ s = workspace;
+ deprecated = "STRFTIME(${EPOCH},,\%d\%m\%Y-\%H:\%M:\%S)";
+ } else if (!strcmp(var, "TIMESTAMP")) {
+ thistime=time(NULL);
+ localtime_r(&thistime, &brokentime);
+ /* 20031130-150612 */
+ snprintf(workspace, workspacelen, "%04d%02d%02d-%02d%02d%02d",
+ brokentime.tm_year+1900,
+ brokentime.tm_mon+1,
+ brokentime.tm_mday,
+ brokentime.tm_hour,
+ brokentime.tm_min,
+ brokentime.tm_sec
+ );
+ s = workspace;
+ deprecated = "STRFTIME(${EPOCH},,\%Y\%m\%d-\%H\%M\%S)";
+ }
+ }
+ /* if not found, look into chanvars or global vars */
+ for (i = 0; s == ¬_found && i < (sizeof(places) / sizeof(places[0])); i++) {
+ struct ast_var_t *variables;
+ if (!places[i])
+ continue;
+ AST_LIST_TRAVERSE(places[i], variables, entries) {
+ if (strcasecmp(ast_var_name(variables), var)==0) {
+ s = ast_var_value(variables);
+ break;
}
}
}
- if (deprecated) {
+ if (s == ¬_found || s == NULL)
+ *ret = NULL;
+ else {
+ if (s != workspace)
+ ast_copy_string(workspace, s, workspacelen);
+ *ret = workspace;
+ if (need_substring)
+ *ret = substring(*ret, offset, length, workspace, workspacelen);
+ }
+
+ if (deprecated)
ast_log(LOG_WARNING, "${%s} is deprecated. Please use ${%s} instead.\n", var, deprecated);
- }
}
/*! \brief CLI function to show installed custom functions
Modified: team/oej/sipregister/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/pbx/pbx_spool.c?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/pbx/pbx_spool.c (original)
+++ team/oej/sipregister/pbx/pbx_spool.c Tue Jan 10 02:38:33 2006
@@ -312,8 +312,10 @@
#endif
fclose(f);
if (o->retries <= o->maxretries) {
+ now += o->retrytime;
if (o->callingpid && (o->callingpid == ast_mainpid)) {
safe_append(o, time(NULL), "DelayedRetry");
+ free_outgoing(o);
ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
} else {
/* Increment retries */
@@ -326,7 +328,6 @@
safe_append(o, now, "StartRetry");
launch_service(o);
}
- now += o->retrytime;
return now;
} else {
ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
Propchange: team/oej/sipregister/res/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jan 10 02:38:33 2006
@@ -1,1 +1,3 @@
.depend
+*.a
+*.so
Modified: team/oej/sipregister/say.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/say.c?rev=7937&r1=7936&r2=7937&view=diff
==============================================================================
--- team/oej/sipregister/say.c (original)
+++ team/oej/sipregister/say.c Tue Jan 10 02:38:33 2006
@@ -298,7 +298,7 @@
\arg \b pl - Polish
\arg \b pt - Portuguese
\arg \b se - Swedish
- \arg \b tw - Taiwanese
+ \arg \b tw - Taiwanese / Chinese
\arg \b ru - Russian
\par Gender:
@@ -443,7 +443,7 @@
return(ast_say_number_full_pt(chan, num, ints, language, options, audiofd, ctrlfd));
} else if (!strcasecmp(language, "se") ) { /* Swedish syntax */
return(ast_say_number_full_se(chan, num, ints, language, options, audiofd, ctrlfd));
- } else if (!strcasecmp(language, "tw")) { /* Taiwanese syntax */
+ } else if (!strcasecmp(language, "tw") || !strcasecmp(language, "zh") ) { /* Taiwanese / Chinese syntax */
return(ast_say_number_full_tw(chan, num, ints, language, audiofd, ctrlfd));
} else if (!strcasecmp(language, "gr") ) { /* Greek syntax */
return(ast_say_number_full_gr(chan, num, ints, language, audiofd, ctrlfd));
@@ -2099,7 +2099,7 @@
return res;
}
-/*! \brief ast_say_number_full_tw: Taiwanese syntax */
+/*! \brief ast_say_number_full_tw: Taiwanese / Chinese syntax */
static int ast_say_number_full_tw(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)
{
int res = 0;
@@ -2967,7 +2967,7 @@
return(ast_say_date_with_format_nl(chan, time, ints, lang, format, timezone));
} else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */
return(ast_say_date_with_format_pt(chan, time, ints, lang, format, timezone));
- } else if (!strcasecmp(lang, "tw") ) { /* Taiwanese syntax */
+ } else if (!strcasecmp(lang, "tw") || !strcasecmp(lang, "zh") ) { /* Taiwanese / Chinese syntax */
return(ast_say_date_with_format_tw(chan, time, ints, lang, format, timezone));
} else if (!strcasecmp(lang, "gr") ) { /* Greek syntax */
return(ast_say_date_with_format_gr(chan, time, ints, lang, format, timezone));
@@ -4874,7 +4874,7 @@
return res;
}
-/* Taiwanese syntax */
+/* Taiwanese / Chinese syntax */
int ast_say_date_with_format_tw(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone)
{
struct tm tm;
@@ -5153,7 +5153,7 @@
return(ast_say_time_nl(chan, t, ints, lang));
} else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */
return(ast_say_time_pt(chan, t, ints, lang));
- } else if (!strcasecmp(lang, "tw") ) { /* Taiwanese syntax */
+ } else if (!strcasecmp(lang, "tw") || !strcasecmp(lang, "zh") ) { /* Taiwanese / Chinese syntax */
return(ast_say_time_tw(chan, t, ints, lang));
} else if (!strcasecmp(lang, "gr") ) { /* Greek syntax */
return(ast_say_time_gr(chan, t, ints, lang));
@@ -5290,7 +5290,7 @@
return res;
}
-/* Taiwanese syntax */
+/* Taiwanese / Chinese syntax */
int ast_say_time_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang)
{
struct tm tm;
@@ -5342,7 +5342,7 @@
return(ast_say_datetime_nl(chan, t, ints, lang));
} else if (!strcasecmp(lang, "pt") ) { /* Portuguese syntax */
return(ast_say_datetime_pt(chan, t, ints, lang));
- } else if (!strcasecmp(lang, "tw") ) { /* Taiwanese syntax */
+ } else if (!strcasecmp(lang, "tw") || !strcasecmp(lang, "zh") ) { /* Taiwanese / Chinese syntax */
return(ast_say_datetime_tw(chan, t, ints, lang));
[... 50 lines stripped ...]
More information about the asterisk-commits
mailing list