[asterisk-commits] branch oej/multiparking - r7787 in
/team/oej/multiparking: ./ apps/ channels/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Jan 4 13:20:01 CST 2006
Author: oej
Date: Wed Jan 4 13:19:45 2006
New Revision: 7787
URL: http://svn.digium.com/view/asterisk?rev=7787&view=rev
Log:
Merged revisions 7725,7728-7734,7737,7739,7741,7744-7745,7747-7748,7750-7751,7770,7774-7779,7783-7786 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r7725 | russell | 2006-01-03 00:52:33 +0100 (Tue, 03 Jan 2006) | 2 lines
initialize sip_auth list
................
r7728 | oej | 2006-01-03 09:40:55 +0100 (Tue, 03 Jan 2006) | 2 lines
Bug #6118: Clean up list handling in image.c (drumkilla)
................
r7729 | oej | 2006-01-03 09:54:19 +0100 (Tue, 03 Jan 2006) | 2 lines
Bug #6116: Use list macros in autoservice.c (drumkilla)
................
r7730 | oej | 2006-01-03 10:30:19 +0100 (Tue, 03 Jan 2006) | 2 lines
Bug #6109: Fix unprotected list in RTP, implement AST_LIST macros, update doxygen docs
................
r7731 | oej | 2006-01-03 12:21:48 +0100 (Tue, 03 Jan 2006) | 2 lines
Bug 5345; Add configuration option for minimum registration time. (folsson)
................
r7732 | oej | 2006-01-03 12:31:56 +0100 (Tue, 03 Jan 2006) | 2 lines
Bug #5228: Add caller ID and CallerIDname to OriginateSuccess/Failure manager events (outtolunc)
................
r7733 | oej | 2006-01-03 12:58:10 +0100 (Tue, 03 Jan 2006) | 2 lines
Bug #6071: Broken rport match in check_via(). (rizzo)
................
r7734 | oej | 2006-01-03 13:25:32 +0100 (Tue, 03 Jan 2006) | 2 lines
Issue #5954: Implement printf-like append_history and implement AST_LIST for SIP history (rizzo)
................
r7737 | kpfleming | 2006-01-03 17:39:37 +0100 (Tue, 03 Jan 2006) | 10 lines
Merged revisions 7736 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7736 | kpfleming | 2006-01-03 10:34:12 -0600 (Tue, 03 Jan 2006) | 2 lines
don't leak memory for (most) expression evaluations
........
................
r7739 | kpfleming | 2006-01-03 18:08:35 +0100 (Tue, 03 Jan 2006) | 3 lines
fix breakage from rev 7730 (failure to unlock list in get_proto)
minor cleanups and simpler usage of list macros
................
r7741 | kpfleming | 2006-01-03 18:25:39 +0100 (Tue, 03 Jan 2006) | 12 lines
Merged revisions 7740 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7740 | kpfleming | 2006-01-03 11:24:56 -0600 (Tue, 03 Jan 2006) | 4 lines
revert incorrect fix for bug #6048 from revision 7709
put in correct (simpler) fix
add doxygen docs for channel spy 'state' values
........
................
r7744 | tilghman | 2006-01-03 19:17:42 +0100 (Tue, 03 Jan 2006) | 3 lines
Merged revisions 7743 via svnmerge from
/branches/1.2
................
r7745 | oej | 2006-01-03 20:12:50 +0100 (Tue, 03 Jan 2006) | 2 lines
Don't check user call limits for outbound calls.
................
r7747 | kpfleming | 2006-01-03 21:23:23 +0100 (Tue, 03 Jan 2006) | 10 lines
Merged revisions 7746 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7746 | kpfleming | 2006-01-03 14:22:18 -0600 (Tue, 03 Jan 2006) | 2 lines
remove unused 'old' expression parser
........
................
r7748 | kpfleming | 2006-01-03 21:33:28 +0100 (Tue, 03 Jan 2006) | 2 lines
add script for simple 'no-brainer' restarts of safe_asterisk (issue #5139)
................
r7750 | kpfleming | 2006-01-03 23:07:12 +0100 (Tue, 03 Jan 2006) | 2 lines
add optional timestamps to manager events (issue #5535, simplified)
................
r7751 | kpfleming | 2006-01-03 23:16:23 +0100 (Tue, 03 Jan 2006) | 2 lines
update copyright headers for files changed this year
................
r7770 | bweschke | 2006-01-04 06:26:03 +0100 (Wed, 04 Jan 2006) | 3 lines
Fix the 'if' clause to be true under the right conditions. Bug #6126
................
r7774 | russell | 2006-01-04 08:08:08 +0100 (Wed, 04 Jan 2006) | 10 lines
Merged revisions 7773 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r7773 | russell | 2006-01-04 02:06:50 -0500 (Wed, 04 Jan 2006) | 2 lines
use a more correct way of determining the size of the destination buffer
........
................
r7775 | oej | 2006-01-04 10:10:56 +0100 (Wed, 04 Jan 2006) | 6 lines
- Remove "incominglimit" as a configuration option in sip.conf
- Add documentation on call-limit, explaining that there's two counters
for a type="friend".
- Document the removval of "incominglimit" in UPGRADE.txt
................
r7776 | oej | 2006-01-04 10:22:45 +0100 (Wed, 04 Jan 2006) | 2 lines
Issue #6127: Count in show channeltypes (junky)
................
r7777 | oej | 2006-01-04 11:16:53 +0100 (Wed, 04 Jan 2006) | 2 lines
Missing ">" in XML. Thanks, fenlander, for reporting this on IRC.
................
r7778 | russell | 2006-01-04 13:11:11 +0100 (Wed, 04 Jan 2006) | 2 lines
doxygen tweak
................
r7779 | oej | 2006-01-04 13:16:30 +0100 (Wed, 04 Jan 2006) | 2 lines
Issue #5952: Add destination protocol information to res_osp (homesick)
................
r7783 | oej | 2006-01-04 14:07:34 +0100 (Wed, 04 Jan 2006) | 2 lines
Issue #5824: Adding more SIP to ISDN Cause code conversions. Thanks mguesdon!
................
r7784 | oej | 2006-01-04 14:49:25 +0100 (Wed, 04 Jan 2006) | 2 lines
Whitespace and formatting changes. /Housekeeping
................
r7785 | oej | 2006-01-04 14:56:11 +0100 (Wed, 04 Jan 2006) | 2 lines
Small typo fix
................
r7786 | mattf | 2006-01-04 15:46:41 +0100 (Wed, 04 Jan 2006) | 2 lines
Fixes for bug #6125
................
Added:
team/oej/multiparking/contrib/scripts/safe_asterisk_restart
- copied unchanged from r7786, trunk/contrib/scripts/safe_asterisk_restart
Removed:
team/oej/multiparking/ast_expr.y
Modified:
team/oej/multiparking/ (props changed)
team/oej/multiparking/UPGRADE.txt
team/oej/multiparking/apps/app_chanspy.c
team/oej/multiparking/apps/app_disa.c
team/oej/multiparking/apps/app_mixmonitor.c
team/oej/multiparking/apps/app_privacy.c
team/oej/multiparking/apps/app_stack.c
team/oej/multiparking/ast_expr2.fl
team/oej/multiparking/ast_expr2f.c
team/oej/multiparking/autoservice.c
team/oej/multiparking/cdr.c
team/oej/multiparking/channel.c
team/oej/multiparking/channels/chan_iax2.c
team/oej/multiparking/channels/chan_sip.c
team/oej/multiparking/channels/chan_zap.c
team/oej/multiparking/configs/manager.conf.sample
team/oej/multiparking/configs/sip.conf.sample
team/oej/multiparking/contrib/scripts/managerproxy.pl
team/oej/multiparking/file.c
team/oej/multiparking/funcs/func_moh.c
team/oej/multiparking/image.c
team/oej/multiparking/include/asterisk/chanspy.h
team/oej/multiparking/include/asterisk/image.h
team/oej/multiparking/include/asterisk/rtp.h
team/oej/multiparking/manager.c
team/oej/multiparking/pbx.c
team/oej/multiparking/res/res_osp.c
team/oej/multiparking/rtp.c
Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan 4 13:19:45 2006
@@ -1,1 +1,1 @@
-/trunk:1-7722
+/trunk:1-7786
Modified: team/oej/multiparking/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/UPGRADE.txt?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/UPGRADE.txt (original)
+++ team/oej/multiparking/UPGRADE.txt Wed Jan 4 13:19:45 2006
@@ -26,3 +26,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/oej/multiparking/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_chanspy.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_chanspy.c (original)
+++ team/oej/multiparking/apps/app_chanspy.c Wed Jan 4 13:19:45 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
*
@@ -211,9 +212,9 @@
static void stop_spying(struct ast_channel *chan, struct ast_channel_spy *spy)
{
- /* If our status has changed, then the channel we're spying on is gone....
+ /* If our status has changed to DONE, then the channel we're spying on is gone....
DON'T TOUCH IT!!! RUN AWAY!!! */
- if (spy->status != CHANSPY_RUNNING)
+ if (spy->status == CHANSPY_DONE)
return;
if (!chan)
Modified: team/oej/multiparking/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_disa.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_disa.c (original)
+++ team/oej/multiparking/apps/app_disa.c Wed Jan 4 13:19:45 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/oej/multiparking/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_mixmonitor.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_mixmonitor.c (original)
+++ team/oej/multiparking/apps/app_mixmonitor.c Wed Jan 4 13:19:45 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>
@@ -86,7 +86,6 @@
static const char *mixmonitor_spy_type = "MixMonitor";
struct mixmonitor {
- AST_LIST_ENTRY(mixmonitor) list;
struct ast_channel *chan;
char *filename;
char *post_process;
@@ -95,15 +94,12 @@
int writevol;
};
-AST_LIST_HEAD_STATIC(monitors, mixmonitor);
-
enum {
MUXFLAG_APPEND = (1 << 1),
MUXFLAG_BRIDGED = (1 << 2),
MUXFLAG_VOLUME = (1 << 3),
MUXFLAG_READVOLUME = (1 << 4),
MUXFLAG_WRITEVOLUME = (1 << 5),
- FLAG_STOP = (1 << 6),
} mixmonitor_flags;
enum {
@@ -123,9 +119,9 @@
static void stopmon(struct ast_channel *chan, struct ast_channel_spy *spy)
{
- /* If our status has changed, then the channel we're spying on is gone....
+ /* If our status has changed to DONE, then the channel we're spying on is gone....
DON'T TOUCH IT!!! RUN AWAY!!! */
- if (spy->status != CHANSPY_RUNNING)
+ if (spy->status == CHANSPY_DONE)
return;
if (!chan)
@@ -167,10 +163,6 @@
char post_process[1024] = "";
STANDARD_INCREMENT_USECOUNT;
-
- AST_LIST_LOCK(&monitors);
- AST_LIST_INSERT_HEAD(&monitors, mixmonitor, list);
- AST_LIST_UNLOCK(&monitors);
name = ast_strdupa(mixmonitor->chan->name);
@@ -226,7 +218,7 @@
ast_channel_spy_trigger_wait(&spy);
- if (ast_check_hangup(mixmonitor->chan) || spy.status != CHANSPY_RUNNING || ast_test_flag(mixmonitor, FLAG_STOP)) {
+ if (ast_check_hangup(mixmonitor->chan) || spy.status != CHANSPY_RUNNING) {
ast_mutex_unlock(&spy.lock);
break;
}
@@ -252,8 +244,6 @@
ast_mutex_unlock(&spy.lock);
}
- stopmon(mixmonitor->chan, &spy);
-
if (mixmonitor->post_process) {
char *p;
@@ -265,6 +255,8 @@
pbx_substitute_variables_helper(mixmonitor->chan, mixmonitor->post_process, post_process, sizeof(post_process) - 1);
}
+ stopmon(mixmonitor->chan, &spy);
+
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "End MixMonitor Recording %s\n", name);
@@ -281,10 +273,6 @@
ast_closestream(fs);
out:
- AST_LIST_LOCK(&monitors);
- AST_LIST_REMOVE(&monitors, mixmonitor, list);
- AST_LIST_UNLOCK(&monitors);
-
free(mixmonitor);
STANDARD_DECREMENT_USECOUNT;
@@ -415,7 +403,6 @@
static int mixmonitor_cli(int fd, int argc, char **argv)
{
struct ast_channel *chan;
- struct mixmonitor *mon;
if (argc < 3)
return RESULT_SHOWUSAGE;
@@ -427,13 +414,8 @@
if (!strcasecmp(argv[1], "start"))
mixmonitor_exec(chan, argv[3]);
- else if (!strcasecmp(argv[1], "stop")) {
- AST_LIST_TRAVERSE_SAFE_BEGIN(&monitors, mon, list) {
- if (chan == mon->chan)
- ast_set_flag(mon, FLAG_STOP);
- }
- AST_LIST_TRAVERSE_SAFE_END;
- }
+ else if (!strcasecmp(argv[1], "stop"))
+ ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
ast_mutex_unlock(&chan->lock);
Modified: team/oej/multiparking/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_privacy.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_privacy.c (original)
+++ team/oej/multiparking/apps/app_privacy.c Wed Jan 4 13:19:45 2006
@@ -195,7 +195,7 @@
}
/*Got a number, play sounds and send them on their way*/
- if ((retries < maxretries) && res == 1 ) {
+ if ((retries < maxretries) && !res ) {
res = ast_streamfile(chan, "privacy-thankyou", chan->language);
if (!res)
res = ast_waitstream(chan, "");
Modified: team/oej/multiparking/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_stack.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_stack.c (original)
+++ team/oej/multiparking/apps/app_stack.c Wed Jan 4 13:19:45 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (c) 2004-2005 Tilghman Lesher <app_stack_v002 at the-tilghman.com>.
+ * Copyright (c) 2004-2006 Tilghman Lesher <app_stack_v002 at the-tilghman.com>.
*
* This code is released by the author with no restrictions on usage.
*
@@ -54,22 +54,18 @@
static const char *gosub_descrip =
"Gosub([[context|]exten|]priority)\n"
-" Jumps to the label specified, saving the return address.\n"
-" Returns 0 if the label exists or -1 otherwise.\n";
+" Jumps to the label specified, saving the return address.\n";
static const char *gosubif_descrip =
-"Gosub(condition?labeliftrue[:labeliffalse])\n"
+"GosubIf(condition?labeliftrue[:labeliffalse])\n"
" If the condition is true, then jump to labeliftrue. If false, jumps to\n"
"labeliffalse, if specified. In either case, a jump saves the return point\n"
-"in the dialplan, to be returned to with a Return.\n"
-" Returns 0 if the label exists or -1 otherwise.\n";
+"in the dialplan, to be returned to with a Return.\n";
static const char *return_descrip =
"Return()\n"
-" Jumps to the last label in the stack, removing it.\n"
-" Returns 0 if there's a label in the stack or -1 otherwise.\n";
+" Jumps to the last label on the stack, removing it.\n";
static const char *pop_descrip =
"StackPop()\n"
-" Removes last label in the stack, discarding it.\n"
-" Always returns 0, even if the stack is empty.\n";
+" Removes last label on the stack, discarding it.\n";
STANDARD_LOCAL_USER;
Modified: team/oej/multiparking/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/ast_expr2.fl?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/ast_expr2.fl (original)
+++ team/oej/multiparking/ast_expr2.fl Wed Jan 4 13:19:45 2006
@@ -1,4 +1,27 @@
%{
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2006, Digium, Inc.
+ *
+ * Mark Spencer <markster at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Dialplan Expression Parser
+ */
+
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
@@ -98,42 +121,42 @@
int ast_expr(char *expr, char *buf, int length)
{
- struct parse_io *io;
-
- io = calloc(sizeof(struct parse_io),1);
- io->string = expr; /* to pass to the error routine */
-
- ast_yylex_init(&io->scanner);
-
- ast_yy_scan_string(expr, io->scanner);
-
- ast_yyparse ((void *) io);
-
- ast_yylex_destroy(io->scanner);
-
- if (io->val == NULL) {
+ struct parse_io io;
+ int return_value = 0;
+
+ memset(&io, 0, sizeof(io));
+ io.string = expr; /* to pass to the error routine */
+
+ ast_yylex_init(&io.scanner);
+
+ ast_yy_scan_string(expr, io.scanner);
+
+ ast_yyparse ((void *) &io);
+
+ ast_yylex_destroy(io.scanner);
+
+ if (!io.val) {
if (length > 1) {
strcpy(buf, "0");
- return 1;
+ return_value = 1;
}
} else {
- if (io->val->type == AST_EXPR_integer) {
+ if (io.val->type == AST_EXPR_integer) {
int res_length;
- res_length = snprintf(buf, length, "%ld", (long int) io->val->u.i);
- return res_length <= length ? res_length : length;
+ res_length = snprintf(buf, length, "%ld", (long int) io.val->u.i);
+ return_value = (res_length <= length) ? res_length : length;
} else {
#ifdef STANDALONE
- strncpy(buf, io->val->u.s, length - 1);
+ strncpy(buf, io.val->u.s, length - 1);
#else /* !STANDALONE */
- ast_copy_string(buf, io->val->u.s, length);
+ ast_copy_string(buf, io.val->u.s, length);
#endif /* STANDALONE */
- return strlen(buf);
+ return_value = strlen(buf);
}
- free(io->val);
+ free(io.val);
}
- free(io);
- return 0;
+ return return_value;
}
int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
Modified: team/oej/multiparking/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/ast_expr2f.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/ast_expr2f.c (original)
+++ team/oej/multiparking/ast_expr2f.c Wed Jan 4 13:19:45 2006
@@ -2562,42 +2562,42 @@
int ast_expr(char *expr, char *buf, int length)
{
- struct parse_io *io;
+ struct parse_io io;
+ int return_value = 0;
- io = calloc(sizeof(struct parse_io),1);
- io->string = expr; /* to pass to the error routine */
+ memset(&io, 0, sizeof(io));
+ io.string = expr; /* to pass to the error routine */
- ast_yylex_init(&io->scanner);
+ ast_yylex_init(&io.scanner);
- ast_yy_scan_string(expr, io->scanner);
+ ast_yy_scan_string(expr, io.scanner);
- ast_yyparse ((void *) io);
-
- ast_yylex_destroy(io->scanner);
-
- if (io->val == NULL) {
+ ast_yyparse ((void *) &io);
+
+ ast_yylex_destroy(io.scanner);
+
+ if (!io.val) {
if (length > 1) {
strcpy(buf, "0");
- return 1;
+ return_value = 1;
}
} else {
- if (io->val->type == AST_EXPR_integer) {
+ if (io.val->type == AST_EXPR_integer) {
int res_length;
- res_length = snprintf(buf, length, "%ld", (long int) io->val->u.i);
- return res_length <= length ? res_length : length;
+ res_length = snprintf(buf, length, "%ld", (long int) io.val->u.i);
+ return_value = (res_length <= length) ? res_length : length;
} else {
#ifdef STANDALONE
- strncpy(buf, io->val->u.s, length - 1);
+ strncpy(buf, io.val->u.s, length - 1);
#else /* !STANDALONE */
- ast_copy_string(buf, io->val->u.s, length);
+ ast_copy_string(buf, io.val->u.s, length);
#endif /* STANDALONE */
- return strlen(buf);
+ return_value = strlen(buf);
}
- free(io->val);
+ free(io.val);
}
- free(io);
- return 0;
+ return return_value;
}
int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
Modified: team/oej/multiparking/autoservice.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/autoservice.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/autoservice.c (original)
+++ team/oej/multiparking/autoservice.c Wed Jan 4 13:19:45 2006
@@ -53,14 +53,13 @@
#define MAX_AUTOMONS 256
-AST_MUTEX_DEFINE_STATIC(autolock);
-
struct asent {
struct ast_channel *chan;
- struct asent *next;
+ AST_LIST_ENTRY(asent) list;
};
-static struct asent *aslist = NULL;
+static AST_LIST_HEAD_STATIC(aslist, asent);
+
static pthread_t asthread = AST_PTHREADT_NULL;
static void *autoservice_run(void *ign)
@@ -71,23 +70,20 @@
struct ast_channel *chan;
struct asent *as;
struct ast_frame *f;
+
for(;;) {
x = 0;
- ast_mutex_lock(&autolock);
- as = aslist;
- while(as) {
+ AST_LIST_LOCK(&aslist);
+ AST_LIST_TRAVERSE(&aslist, as, list) {
if (!as->chan->_softhangup) {
if (x < MAX_AUTOMONS)
mons[x++] = as->chan;
else
ast_log(LOG_WARNING, "Exceeded maximum number of automatic monitoring events. Fix autoservice.c\n");
}
- as = as->next;
}
- ast_mutex_unlock(&autolock);
+ AST_LIST_UNLOCK(&aslist);
-/* if (!aslist)
- break; */
ms = 500;
chan = ast_waitfor_n(mons, x, &ms);
if (chan) {
@@ -106,62 +102,62 @@
int res = -1;
struct asent *as;
int needstart;
- ast_mutex_lock(&autolock);
- needstart = (asthread == AST_PTHREADT_NULL) ? 1 : 0 /* aslist ? 0 : 1 */;
- as = aslist;
- while(as) {
+ AST_LIST_LOCK(&aslist);
+
+ /* Check if autoservice thread is executing */
+ needstart = (asthread == AST_PTHREADT_NULL) ? 1 : 0 ;
+
+ /* Check if the channel already has autoservice */
+ AST_LIST_TRAVERSE(&aslist, as, list) {
if (as->chan == chan)
break;
- as = as->next;
}
+
+ /* If not, start autoservice on channel */
if (!as) {
- as = malloc(sizeof(struct asent));
+ as = calloc(1, sizeof(struct asent));
if (as) {
- memset(as, 0, sizeof(struct asent));
as->chan = chan;
- as->next = aslist;
- aslist = as;
+ AST_LIST_INSERT_HEAD(&aslist, as, list);
res = 0;
if (needstart) {
if (ast_pthread_create(&asthread, NULL, autoservice_run, NULL)) {
ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
- free(aslist);
- aslist = NULL;
+ /* There will only be a single member in the list at this point,
+ the one we just added. */
+ AST_LIST_REMOVE(&aslist, as, list);
+ free(as);
res = -1;
} else
pthread_kill(asthread, SIGURG);
}
}
}
- ast_mutex_unlock(&autolock);
+ AST_LIST_UNLOCK(&aslist);
return res;
}
int ast_autoservice_stop(struct ast_channel *chan)
{
int res = -1;
- struct asent *as, *prev;
- ast_mutex_lock(&autolock);
- as = aslist;
- prev = NULL;
- while(as) {
- if (as->chan == chan)
+ struct asent *as;
+
+ AST_LIST_LOCK(&aslist);
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) {
+ if (as->chan == chan) {
+ AST_LIST_REMOVE_CURRENT(&aslist, list);
+ free(as);
+ if (!chan->_softhangup)
+ res = 0;
break;
- prev = as;
- as = as->next;
+ }
}
- if (as) {
- if (prev)
- prev->next = as->next;
- else
- aslist = as->next;
- free(as);
- if (!chan->_softhangup)
- res = 0;
- }
+ AST_LIST_TRAVERSE_SAFE_END
+
if (asthread != AST_PTHREADT_NULL)
pthread_kill(asthread, SIGURG);
- ast_mutex_unlock(&autolock);
+ AST_LIST_UNLOCK(&aslist);
+
/* Wait for it to un-block */
while(ast_test_flag(chan, AST_FLAG_BLOCKING))
usleep(1000);
Modified: team/oej/multiparking/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/cdr.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/cdr.c (original)
+++ team/oej/multiparking/cdr.c Wed Jan 4 13:19:45 2006
@@ -22,7 +22,7 @@
*
* \author Mark Spencer <markster at digium.com>
*
- * Includes code and algorithms from the Zapata library.
+ * \note Includes code and algorithms from the Zapata library.
*
* \note We do a lot of checking here in the CDR code to try to be sure we don't ever let a CDR slip
* through our fingers somehow. If someone allocates a CDR, it must be completely handled normally
Modified: team/oej/multiparking/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channel.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/channel.c (original)
+++ team/oej/multiparking/channel.c Wed Jan 4 13:19:45 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>
*
@@ -168,8 +168,10 @@
static int show_channeltypes(int fd, int argc, char *argv[])
{
-#define FORMAT "%-10.10s %-30.30s %-12.12s %-12.12s %-12.12s\n"
+#define FORMAT "%-10.10s %-40.40s %-12.12s %-12.12s %-12.12s\n"
struct chanlist *cl;
+ int count_chan = 0;
+
ast_cli(fd, FORMAT, "Type", "Description", "Devicestate", "Indications", "Transfer");
ast_cli(fd, FORMAT, "----------", "-----------", "-----------", "-----------", "--------");
if (ast_mutex_lock(&chlock)) {
@@ -181,8 +183,10 @@
(cl->tech->devicestate) ? "yes" : "no",
(cl->tech->indicate) ? "yes" : "no",
(cl->tech->transfer) ? "yes" : "no");
+ count_chan++;
}
ast_mutex_unlock(&chlock);
+ ast_cli(fd, "----------\n%d channel drivers registered.\n", count_chan);
return RESULT_SUCCESS;
#undef FORMAT
@@ -996,7 +1000,7 @@
AST_LIST_TRAVERSE(&chan->spies->list, spy, list) {
ast_mutex_lock(&spy->lock);
if ((spy->type == type) && (spy->status == CHANSPY_RUNNING)) {
- spy->status = CHANSPY_DONE;
+ spy->status = CHANSPY_STOP;
if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE)
ast_cond_signal(&spy->trigger);
}
Modified: team/oej/multiparking/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_iax2.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/channels/chan_iax2.c (original)
+++ team/oej/multiparking/channels/chan_iax2.c Wed Jan 4 13:19:45 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/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_sip.c?rev=7787&r1=7786&r2=7787&view=diff
==============================================================================
--- team/oej/multiparking/channels/chan_sip.c (original)
+++ team/oej/multiparking/channels/chan_sip.c Wed Jan 4 13:19:45 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>
*
@@ -104,6 +104,7 @@
#define SIPDUMPER
#define DEFAULT_DEFAULT_EXPIRY 120
+#define DEFAULT_MIN_EXPIRY 60
#define DEFAULT_MAX_EXPIRY 3600
#define DEFAULT_REGISTRATION_TIMEOUT 20
#define DEFAULT_MAX_FORWARDS "70"
@@ -120,6 +121,7 @@
#define EXPIRY_GUARD_PCT 0.20 /* Percentage of expires timeout to use when
below EXPIRY_GUARD_LIMIT */
+static int min_expiry = DEFAULT_MIN_EXPIRY;
static int max_expiry = DEFAULT_MAX_EXPIRY;
static int default_expiry = DEFAULT_DEFAULT_EXPIRY;
@@ -498,9 +500,11 @@
/*! \brief sip_history: Structure for saving transactions within a SIP dialog */
struct sip_history {
- char event[80];
- struct sip_history *next;
+ AST_LIST_ENTRY(sip_history) list;
+ char event[0]; /* actually more, depending on needs */
};
+
+AST_LIST_HEAD_NOLOCK(sip_history_head, sip_history); /*!< history list, entry in sip_pvt */
/*! \brief sip_auth: Creadentials for authentication to other SIP services */
struct sip_auth {
@@ -693,7 +697,7 @@
struct ast_rtp *rtp; /*!< RTP Session */
struct ast_rtp *vrtp; /*!< Video RTP session */
struct sip_pkt *packets; /*!< Packets scheduled for re-transmission */
- struct sip_history *history; /*!< History of this SIP dialog */
+ struct sip_history_head *history; /*!< History of this SIP dialog */
struct ast_variable *chanvars; /*!< Channel variables to set for call */
struct sip_pvt *next; /*!< Next call in chain */
struct sip_invite_param *options; /*!< Options for INVITE */
@@ -881,7 +885,7 @@
/* The list of manual NOTIFY types we know how to send */
struct ast_config *notify_types;
-static struct sip_auth *authl; /*!< Authentication list */
+static struct sip_auth *authl = NULL; /*!< Authentication list */
static int transmit_response(struct sip_pvt *p, char *msg, struct sip_request *req);
@@ -1126,40 +1130,51 @@
return 0;
}
-/*! \brief append_history: Append to SIP dialog history */
-/* Always returns 0 */
-static int append_history(struct sip_pvt *p, const char *event, const char *data)
-{
- struct sip_history *hist, *prev;
- char *c;
+/*! \brief append_history: Append to SIP dialog history
+ \return Always returns 0 */
+#define append_history(p, event, fmt , args... ) append_history_full(p, "%-15s " fmt, event, ## args)
+
+static int append_history_full(struct sip_pvt *p, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+
+/*! \brief Append to SIP dialog history with arg list */
+static void append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
+{
+ char buf[80], *c = buf; /* max history length */
+ struct sip_history *hist;
+ int l;
+
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ strsep(&c, "\r\n"); /* Trim up everything after \r or \n */
+ l = strlen(buf) + 1;
+ hist = calloc(1, sizeof(*hist) + l);
+ if (!hist) {
+ ast_log(LOG_WARNING, "Can't allocate memory for history");
+ return;
+ }
+ if (p->history == NULL)
+ p->history = calloc(1, sizeof(struct sip_history_head));
+ if (p->history == NULL) {
+ ast_log(LOG_WARNING, "Can't allocate memory for history head");
+ free(hist);
+ return;
+ }
+ memcpy(hist->event, buf, l);
+ AST_LIST_INSERT_TAIL(p->history, hist, list);
+}
+
+/*! \brief Append to SIP dialog history with arg list */
+static int append_history_full(struct sip_pvt *p, const char *fmt, ...)
+{
+ va_list ap;
if (!recordhistory || !p)
return 0;
- if(!(hist = malloc(sizeof(struct sip_history)))) {
- ast_log(LOG_WARNING, "Can't allocate memory for history");
- return 0;
- }
- memset(hist, 0, sizeof(struct sip_history));
- snprintf(hist->event, sizeof(hist->event), "%-15s %s", event, data);
- /* Trim up nicely */
- c = hist->event;
- while(*c) {
- if ((*c == '\r') || (*c == '\n')) {
- *c = '\0';
- break;
- }
- c++;
- }
- /* Enqueue into history */
- prev = p->history;
- if (prev) {
- while(prev->next)
- prev = prev->next;
- prev->next = hist;
- } else {
- p->history = hist;
- }
- return 0;
+ va_start(ap, fmt);
+ append_history_va(p, fmt, ap);
+ va_end(ap);
+
+ return 0;
}
/*! \brief retrans_pkt: Retransmit SIP message if no answer ---*/
@@ -1173,8 +1188,6 @@
ast_mutex_lock(&pkt->owner->lock);
if (pkt->retrans < MAX_RETRANS) {
- char buf[80];
-
pkt->retrans++;
if (!pkt->timer_t1) { /* Re-schedule using timer_a and timer_t1 */
if (sipdebug && option_debug > 3)
@@ -1206,9 +1219,8 @@
else
ast_verbose("Retransmitting #%d (no NAT) to %s:%d:\n%s\n---\n", pkt->retrans, ast_inet_ntoa(iabuf, sizeof(iabuf), pkt->owner->sa.sin_addr), ntohs(pkt->owner->sa.sin_port), pkt->data);
}
- snprintf(buf, sizeof(buf), "ReTx %d", reschedule);
-
- append_history(pkt->owner, buf, pkt->data);
+
+ append_history(pkt->owner, "ReTx", "%d %s", reschedule, pkt->data);
__sip_xmit(pkt->owner, pkt->data, pkt->packetlen);
ast_mutex_unlock(&pkt->owner->lock);
return reschedule;
@@ -1219,7 +1231,7 @@
if ((pkt->method == SIP_OPTIONS) && sipdebug)
ast_log(LOG_WARNING, "Cancelling retransmit of OPTIONs (call id %s) \n", pkt->owner->callid);
}
- append_history(pkt->owner, "MaxRetries", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
+ append_history(pkt->owner, "MaxRetries", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
pkt->retransid = -1;
@@ -1331,13 +1343,10 @@
/*! \brief sip_scheddestroy: Schedule destruction of SIP call ---*/
static int sip_scheddestroy(struct sip_pvt *p, int ms)
{
- char tmp[80];
if (sip_debug_test_pvt(p))
ast_verbose("Scheduling destruction of call '%s' in %d ms\n", p->callid, ms);
- if (recordhistory) {
- snprintf(tmp, sizeof(tmp), "%d ms", ms);
- append_history(p, "SchedDestroy", tmp);
- }
+ if (recordhistory)
+ append_history(p, "SchedDestroy", "%d ms", ms);
if (p->autokillid > -1)
ast_sched_del(sched, p->autokillid);
@@ -1469,31 +1478,22 @@
static int send_response(struct sip_pvt *p, struct sip_request *req, int reliable, int seqno)
{
int res;
- char iabuf[INET_ADDRSTRLEN];
- struct sip_request tmp;
- char tmpmsg[80];
if (sip_debug_test_pvt(p)) {
+ char iabuf[INET_ADDRSTRLEN];
if (ast_test_flag(p, SIP_NAT) & SIP_NAT_ROUTE)
ast_verbose("%sTransmitting (NAT) to %s:%d:\n%s\n---\n", reliable ? "Reliably " : "", ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr), ntohs(p->recv.sin_port), req->data);
else
ast_verbose("%sTransmitting (no NAT) to %s:%d:\n%s\n---\n", reliable ? "Reliably " : "", ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr), ntohs(p->sa.sin_port), req->data);
}
- if (reliable) {
- if (recordhistory) {
- parse_copy(&tmp, req);
- snprintf(tmpmsg, sizeof(tmpmsg), "%s / %s", tmp.data, get_header(&tmp, "CSeq"));
- append_history(p, "TxRespRel", tmpmsg);
- }
- res = __sip_reliable_xmit(p, seqno, 1, req->data, req->len, (reliable > 1), req->method);
- } else {
- if (recordhistory) {
- parse_copy(&tmp, req);
- snprintf(tmpmsg, sizeof(tmpmsg), "%s / %s", tmp.data, get_header(&tmp, "CSeq"));
- append_history(p, "TxResp", tmpmsg);
- }
- res = __sip_xmit(p, req->data, req->len);
- }
+ if (recordhistory) {
+ struct sip_request tmp;
+ parse_copy(&tmp, req);
+ append_history(p, reliable ? "TxRespRel" : "TxResp", "%s / %s", tmp.data, get_header(&tmp, "CSeq"));
+ }
+ res = (reliable) ?
[... 1598 lines stripped ...]
More information about the asterisk-commits
mailing list