[asterisk-commits] branch oej/multiparking r8706 - in
/team/oej/multiparking: ./ apps/ channels/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jan 26 06:37:16 MST 2006
Author: oej
Date: Thu Jan 26 07:36:33 2006
New Revision: 8706
URL: http://svn.digium.com/view/asterisk?rev=8706&view=rev
Log:
Updates...
Added:
team/oej/multiparking/doc/README.callingpres
- copied unchanged from r8438, trunk/doc/README.callingpres
Modified:
team/oej/multiparking/ (props changed)
team/oej/multiparking/apps/Makefile
team/oej/multiparking/apps/app_authenticate.c
team/oej/multiparking/apps/app_chanspy.c
team/oej/multiparking/apps/app_curl.c
team/oej/multiparking/apps/app_db.c
team/oej/multiparking/apps/app_dial.c
team/oej/multiparking/apps/app_dictate.c
team/oej/multiparking/apps/app_directory.c
team/oej/multiparking/apps/app_disa.c
team/oej/multiparking/apps/app_exec.c
team/oej/multiparking/apps/app_externalivr.c
team/oej/multiparking/apps/app_festival.c
team/oej/multiparking/apps/app_hasnewvoicemail.c
team/oej/multiparking/apps/app_image.c
team/oej/multiparking/apps/app_macro.c
team/oej/multiparking/apps/app_meetme.c
team/oej/multiparking/apps/app_mixmonitor.c
team/oej/multiparking/apps/app_osplookup.c
team/oej/multiparking/apps/app_page.c
team/oej/multiparking/apps/app_parkandannounce.c
team/oej/multiparking/apps/app_playback.c
team/oej/multiparking/apps/app_privacy.c
team/oej/multiparking/apps/app_queue.c
team/oej/multiparking/apps/app_random.c
team/oej/multiparking/apps/app_read.c
team/oej/multiparking/apps/app_readfile.c
team/oej/multiparking/apps/app_record.c
team/oej/multiparking/apps/app_sayunixtime.c
team/oej/multiparking/apps/app_senddtmf.c
team/oej/multiparking/apps/app_sendtext.c
team/oej/multiparking/apps/app_setcallerid.c
team/oej/multiparking/apps/app_skel.c
team/oej/multiparking/apps/app_sql_postgres.c
team/oej/multiparking/apps/app_stack.c
team/oej/multiparking/apps/app_talkdetect.c
team/oej/multiparking/apps/app_transfer.c
team/oej/multiparking/apps/app_url.c
team/oej/multiparking/apps/app_userevent.c
team/oej/multiparking/apps/app_verbose.c
team/oej/multiparking/apps/app_voicemail.c
team/oej/multiparking/apps/app_while.c
team/oej/multiparking/apps/app_zapras.c
team/oej/multiparking/callerid.c
team/oej/multiparking/channel.c
team/oej/multiparking/channels/chan_agent.c
team/oej/multiparking/channels/chan_alsa.c
team/oej/multiparking/channels/chan_iax2.c
team/oej/multiparking/channels/chan_mgcp.c
team/oej/multiparking/channels/chan_sip.c
team/oej/multiparking/channels/chan_zap.c
team/oej/multiparking/codecs/codec_a_mu.c
team/oej/multiparking/codecs/codec_adpcm.c
team/oej/multiparking/codecs/codec_alaw.c
team/oej/multiparking/codecs/codec_g723_1.c
team/oej/multiparking/codecs/codec_g726.c
team/oej/multiparking/codecs/codec_gsm.c
team/oej/multiparking/codecs/codec_ilbc.c
team/oej/multiparking/codecs/codec_lpc10.c
team/oej/multiparking/codecs/codec_speex.c
team/oej/multiparking/codecs/codec_ulaw.c
team/oej/multiparking/codecs/gsm/Makefile
team/oej/multiparking/configs/alsa.conf.sample
team/oej/multiparking/configs/sip.conf.sample
team/oej/multiparking/configs/zapata.conf.sample
team/oej/multiparking/doc/README.variables
team/oej/multiparking/formats/format_pcm.c
team/oej/multiparking/formats/format_pcm_alaw.c
team/oej/multiparking/funcs/func_cdr.c
team/oej/multiparking/funcs/func_cut.c
team/oej/multiparking/funcs/func_logic.c
team/oej/multiparking/funcs/func_math.c
team/oej/multiparking/funcs/func_md5.c
team/oej/multiparking/funcs/func_odbc.c
team/oej/multiparking/funcs/func_rand.c
team/oej/multiparking/funcs/func_strings.c
team/oej/multiparking/include/asterisk/channel.h
team/oej/multiparking/include/asterisk/utils.h
team/oej/multiparking/pbx.c
team/oej/multiparking/res/res_agi.c
team/oej/multiparking/res/res_crypto.c
team/oej/multiparking/res/res_features.c
team/oej/multiparking/res/res_indications.c
team/oej/multiparking/res/res_monitor.c
team/oej/multiparking/res/res_musiconhold.c
team/oej/multiparking/res/res_osp.c
Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
--- svnmerge-blocked (original)
+++ svnmerge-blocked Thu Jan 26 07:36:33 2006
@@ -1,1 +1,1 @@
-/branches/1.2:7490,7497,7517,7529,7546,7550,7552,7557,7580,7586,7595,7605,7641,7663,7706,7738,7771,7792,7812,7870-7871,7898-7900,7915,7960,7965,7970,7976,8047,8112
+/branches/1.2:7490,7497,7517,7529,7546,7550,7552,7557,7580,7586,7595,7605,7641,7663,7706,7738,7771,7792,7812,7870-7871,7898-7900,7915,7960,7965,7970,7976,8047,8112,8394,8412,8418
Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 26 07:36:33 2006
@@ -1,1 +1,1 @@
-/trunk:1-8335
+/trunk:1-8442
Modified: team/oej/multiparking/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/Makefile?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/Makefile (original)
+++ team/oej/multiparking/apps/Makefile Thu Jan 26 07:36:33 2006
@@ -96,7 +96,7 @@
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
app_sql_postgres.o: app_sql_postgres.c
- $(CC) -pipe -I/usr/local/pgsql/include $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
+ $(CC) -pipe -I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include -I$(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
app_sql_postgres.so: app_sql_postgres.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq
Modified: team/oej/multiparking/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_authenticate.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_authenticate.c (original)
+++ team/oej/multiparking/apps/app_authenticate.c Thu Jan 26 07:36:33 2006
@@ -128,9 +128,7 @@
}
}
- argcopy = ast_strdupa(data);
- if (!argcopy) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(argcopy = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_chanspy.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_chanspy.c (original)
+++ team/oej/multiparking/apps/app_chanspy.c Thu Jan 26 07:36:33 2006
@@ -383,10 +383,8 @@
struct ast_flags flags;
signed char zero_volume = 0;
- if (!(args = ast_strdupa((char *)data))) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(args = ast_strdupa(data)))
return -1;
- }
LOCAL_USER_ADD(u);
Modified: team/oej/multiparking/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_curl.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_curl.c (original)
+++ team/oej/multiparking/apps/app_curl.c Thu Jan 26 07:36:33 2006
@@ -128,9 +128,7 @@
LOCAL_USER_ACF_ADD(u);
- info = ast_strdupa(data);
- if (!info) {
- ast_log(LOG_ERROR, "Out of memory\n");
+ if (!(info = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return buf;
}
Modified: team/oej/multiparking/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_db.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_db.c (original)
+++ team/oej/multiparking/apps/app_db.c Thu Jan 26 07:36:33 2006
@@ -75,9 +75,7 @@
LOCAL_USER_ADD(u);
- argv = ast_strdupa(data);
- if (!argv) {
- ast_log(LOG_ERROR, "Memory allocation failed\n");
+ if (!(argv = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return 0;
}
@@ -121,9 +119,7 @@
LOCAL_USER_ADD(u);
- argv = ast_strdupa(data);
- if (!argv) {
- ast_log (LOG_ERROR, "Memory allocation failed\n");
+ if (!(argv = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return 0;
}
Modified: team/oej/multiparking/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_dial.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_dial.c (original)
+++ team/oej/multiparking/apps/app_dial.c Thu Jan 26 07:36:33 2006
@@ -787,7 +787,6 @@
LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory allocation failure\n");
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -1627,9 +1626,7 @@
LOCAL_USER_ADD(u);
- announce = ast_strdupa(data);
- if (!announce) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(announce = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_dictate.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_dictate.c (original)
+++ team/oej/multiparking/apps/app_dictate.c Thu Jan 26 07:36:33 2006
@@ -110,11 +110,8 @@
snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
if (!ast_strlen_zero(data)) {
- parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(parse = ast_strdupa(data)))
return -1;
- }
AST_STANDARD_APP_ARGS(args, parse);
} else
args.argc = 0;
Modified: team/oej/multiparking/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_directory.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_directory.c (original)
+++ team/oej/multiparking/apps/app_directory.c Thu Jan 26 07:36:33 2006
@@ -431,10 +431,7 @@
LOCAL_USER_ADD(u);
- parse = ast_strdupa(data);
-
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(parse = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_disa.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_disa.c (original)
+++ team/oej/multiparking/apps/app_disa.c Thu Jan 26 07:36:33 2006
@@ -161,9 +161,7 @@
ast_log(LOG_DEBUG, "Digittimeout: %d\n", digittimeout);
ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
- tmp = ast_strdupa(data);
- if (!tmp) {
- ast_log(LOG_ERROR, "Out of memory\n");
+ if (!(tmp = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_exec.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_exec.c (original)
+++ team/oej/multiparking/apps/app_exec.c Thu Jan 26 07:36:33 2006
@@ -73,8 +73,7 @@
/* Check and parse arguments */
if (data) {
- s = ast_strdupa((char *)data);
- if (s) {
+ if ((s = ast_strdupa(data))) {
appname = strsep(&s, "(");
if (s) {
endargs = strrchr(s, ')');
@@ -91,10 +90,8 @@
res = -1;
}
}
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
+ } else
res = -1;
- }
}
LOCAL_USER_REMOVE(u);
Modified: team/oej/multiparking/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_externalivr.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_externalivr.c (original)
+++ team/oej/multiparking/apps/app_externalivr.c Thu Jan 26 07:36:33 2006
@@ -271,9 +271,7 @@
goto exit;
}
- buf = ast_strdupa(data);
- if (!buf) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(buf = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_festival.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_festival.c (original)
+++ team/oej/multiparking/apps/app_festival.c Thu Jan 26 07:36:33 2006
@@ -339,9 +339,7 @@
festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
}
- data = ast_strdupa(vdata);
- if (!data) {
- ast_log(LOG_ERROR, "Out of memery\n");
+ if (!(data = ast_strdupa(vdata))) {
ast_config_destroy(cfg);
LOCAL_USER_REMOVE(u);
return -1;
Modified: team/oej/multiparking/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_hasnewvoicemail.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_hasnewvoicemail.c (original)
+++ team/oej/multiparking/apps/app_hasnewvoicemail.c Thu Jan 26 07:36:33 2006
@@ -129,9 +129,7 @@
LOCAL_USER_ADD(u);
- input = ast_strdupa((char *)data);
- if (! input) {
- ast_log(LOG_ERROR, "Out of memory error\n");
+ if (!(input = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -193,9 +191,7 @@
buf[0] = '\0';
- argsstr = ast_strdupa(data);
- if (!argsstr) {
- ast_log(LOG_ERROR, "Out of memory");
+ if (!(argsstr = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return buf;
}
Modified: team/oej/multiparking/apps/app_image.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_image.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_image.c (original)
+++ team/oej/multiparking/apps/app_image.c Thu Jan 26 07:36:33 2006
@@ -79,7 +79,6 @@
LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_macro.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_macro.c (original)
+++ team/oej/multiparking/apps/app_macro.c Thu Jan 26 07:36:33 2006
@@ -307,9 +307,7 @@
LOCAL_USER_ADD(u);
- expr = ast_strdupa(data);
- if (!expr) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
+ if (!(expr = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_meetme.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_meetme.c (original)
+++ team/oej/multiparking/apps/app_meetme.c Thu Jan 26 07:36:33 2006
@@ -1778,11 +1778,8 @@
if (strcasecmp(var->name, "conf"))
continue;
- parse = ast_strdupa(var->value);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of Memory!\n");
+ if (!(parse = ast_strdupa(var->value)))
return NULL;
- }
AST_STANDARD_APP_ARGS(args, parse);
if (!strcasecmp(args.confno, confno)) {
@@ -1838,9 +1835,7 @@
LOCAL_USER_ADD(u);
- localdata = ast_strdupa(data);
- if (!localdata) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(localdata = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -1987,8 +1982,6 @@
}
}
}
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
}
}
var = var->next;
Modified: team/oej/multiparking/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_mixmonitor.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_mixmonitor.c (original)
+++ team/oej/multiparking/apps/app_mixmonitor.c Thu Jan 26 07:36:33 2006
@@ -334,7 +334,6 @@
LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_osplookup.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_osplookup.c (original)
+++ team/oej/multiparking/apps/app_osplookup.c Thu Jan 26 07:36:33 2006
@@ -138,9 +138,7 @@
LOCAL_USER_ADD(u);
- temp = ast_strdupa(data);
- if (!temp) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(temp = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -201,9 +199,7 @@
LOCAL_USER_ADD(u);
- temp = ast_strdupa(data);
- if (!temp) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(temp = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -275,9 +271,7 @@
LOCAL_USER_ADD(u);
- temp = ast_strdupa(data);
- if (!temp) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(temp = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_page.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_page.c (original)
+++ team/oej/multiparking/apps/app_page.c Thu Jan 26 07:36:33 2006
@@ -163,9 +163,7 @@
return -1;
};
- options = ast_strdupa(data);
- if (!options) {
- ast_log(LOG_ERROR, "Out of memory\n");
+ if (!(options = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_parkandannounce.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_parkandannounce.c (original)
+++ team/oej/multiparking/apps/app_parkandannounce.c Thu Jan 26 07:36:33 2006
@@ -59,12 +59,21 @@
static char *descrip =
" ParkAndAnnounce(announce:template|timeout|dial|[return_context]):\n"
-"Park a call into the parkinglot and announce the call over the console.\n"
-"announce template: colon separated list of files to announce, the word PARKED\n"
-" will be replaced by a say_digits of the ext the call is parked in\n"
-"timeout: time in seconds before the call returns into the return context.\n"
-"dial: The app_dial style resource to call to make the announcement. Console/dsp calls the console.\n"
-"return_context: the goto style label to jump the call back into after timeout. default=prio+1\n";
+"Park a call into the parkinglot and announce the call to another channel.\n"
+"\n"
+"announce template: Colon-separated list of files to announce. The word PARKED\n"
+" will be replaced by a say_digits of the extension in which\n"
+" the call is parked.\n"
+"timeout: Time in seconds before the call returns into the return\n"
+" context.\n"
+"dial: The app_dial style resource to call to make the\n"
+" announcement. Console/dsp calls the console.\n"
+"return_context: The goto-style label to jump the call back into after\n"
+" timeout. Default <priority+1>.\n"
+"\n"
+"The variable ${PARKEDAT} will contain the parking extension into which the\n"
+"call was placed. Use with the Local channel to allow the dialplan to make\n"
+"use of this information.\n";
STANDARD_LOCAL_USER;
@@ -79,6 +88,7 @@
char *working, *context, *exten, *priority, *dial, *dialtech, *dialstr;
char *template, *tpl_working, *tpl_current;
char *tmp[100];
+ char buf[13];
int looptemp=0,i=0;
char *s,*orig_s;
@@ -183,8 +193,10 @@
/* Now place the call to the extention */
+ snprintf(buf, sizeof(buf), "%d", lot);
memset(&oh, 0, sizeof(oh));
oh.parent_channel = chan;
+ oh.vars = ast_variable_new("_PARKEDAT", buf);
dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, dialstr,30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
if(dchan) {
Modified: team/oej/multiparking/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_playback.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_playback.c (original)
+++ team/oej/multiparking/apps/app_playback.c Thu Jan 26 07:36:33 2006
@@ -89,11 +89,8 @@
return -1;
}
- tmp = ast_strdupa(data);
- if (!tmp) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(tmp = ast_strdupa(data)))
return -1;
- }
LOCAL_USER_ADD(u);
AST_STANDARD_APP_ARGS(args, tmp);
Modified: team/oej/multiparking/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_privacy.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_privacy.c (original)
+++ team/oej/multiparking/apps/app_privacy.c Thu Jan 26 07:36:33 2006
@@ -117,9 +117,7 @@
if (!ast_strlen_zero((char *)data))
{
- parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(parse = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/oej/multiparking/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_queue.c?rev=8706&r1=8705&r2=8706&view=diff
==============================================================================
--- team/oej/multiparking/apps/app_queue.c (original)
+++ team/oej/multiparking/apps/app_queue.c Thu Jan 26 07:36:33 2006
@@ -367,11 +367,10 @@
struct member *members; /*!< Head of the list of members */
struct queue_ent *head; /*!< Head of the list of callers */
- struct ast_call_queue *next; /*!< Next call queue */
+ AST_LIST_ENTRY(ast_call_queue) list; /*!< Next call queue */
};
-static struct ast_call_queue *queues = NULL;
-AST_MUTEX_DEFINE_STATIC(qlock);
+static AST_LIST_HEAD_STATIC(queues, ast_call_queue);
static int set_member_paused(char *queuename, char *interface, int paused);
@@ -481,8 +480,8 @@
}
if (option_debug)
ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state));
- ast_mutex_lock(&qlock);
- for (q = queues; q; q = q->next) {
+ AST_LIST_LOCK(&queues);
+ AST_LIST_TRAVERSE(&queues, q, list) {
ast_mutex_lock(&q->lock);
cur = q->members;
while(cur) {
@@ -508,7 +507,7 @@
}
ast_mutex_unlock(&q->lock);
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
free(sc);
return NULL;
}
@@ -791,26 +790,21 @@
/*!\brief Reload a single queue via realtime.
\return Return the queue, or NULL if it doesn't exist.
- \note Should be called with the global qlock locked.
- When found, the queue is returned with q->lock locked. */
+ \note Should be called with the global qlock locked. */
static struct ast_call_queue *find_queue_by_name_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
{
struct ast_variable *v;
- struct ast_call_queue *q, *prev_q;
+ struct ast_call_queue *q;
struct member *m, *prev_m, *next_m;
char *interface;
char *tmp, *tmp_name;
char tmpbuf[64]; /* Must be longer than the longest queue param name. */
/* Find the queue in the in-core list (we will create a new one if not found). */
- q = queues;
- prev_q = NULL;
- while (q) {
+ AST_LIST_TRAVERSE(&queues, q, list) {
if (!strcasecmp(q->name, queuename)) {
break;
}
- q = q->next;
- prev_q = q;
}
/* Static queues override realtime. */
@@ -821,6 +815,7 @@
ast_mutex_unlock(&q->lock);
return NULL;
} else {
+ ast_mutex_unlock(&q->lock);
return q;
}
}
@@ -841,11 +836,7 @@
/* Delete if unused (else will be deleted when last caller leaves). */
if (!q->count) {
/* Delete. */
- if (!prev_q) {
- queues = q->next;
- } else {
- prev_q->next = q->next;
- }
+ AST_LIST_REMOVE(&queues, q, list);
ast_mutex_unlock(&q->lock);
free(q);
} else
@@ -861,8 +852,7 @@
ast_mutex_lock(&q->lock);
clear_queue(q);
q->realtime = 1;
- q->next = queues;
- queues = q;
+ AST_LIST_INSERT_HEAD(&queues, q, list);
}
init_queue(q); /* Ensure defaults for all parameters not set explicitly. */
@@ -914,13 +904,60 @@
m = next_m;
}
+ ast_mutex_unlock(&q->lock);
+
return q;
}
-static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
+static struct ast_call_queue *load_realtime_queue(char *queuename)
{
struct ast_variable *queue_vars = NULL;
struct ast_config *member_config = NULL;
+ struct ast_call_queue *q;
+
+ /* Find the queue in the in-core list first. */
+ AST_LIST_LOCK(&queues);
+ AST_LIST_TRAVERSE(&queues, q, list) {
+ if (!strcasecmp(q->name, queuename)) {
+ break;
+ }
+ }
+ AST_LIST_UNLOCK(&queues);
+
+ if (!q) {
+ /*! \note Load from realtime before taking the global qlock, to avoid blocking all
+ queue operations while waiting for the DB.
+
+ This will be two separate database transactions, so we might
+ see queue parameters as they were before another process
+ changed the queue and member list as it was after the change.
+ Thus we might see an empty member list when a queue is
+ deleted. In practise, this is unlikely to cause a problem. */
+
+ queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
+ if (queue_vars) {
+ member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
+ if (!member_config) {
+ ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
+ return NULL;
+ }
+ }
+
+ AST_LIST_LOCK(&queues);
+
+ q = find_queue_by_name_rt(queuename, queue_vars, member_config);
+ if (member_config)
+ ast_config_destroy(member_config);
+ if (queue_vars)
+ ast_variables_destroy(queue_vars);
+
+ AST_LIST_UNLOCK(&queues);
+ }
+ return q;
+}
+
+static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
+{
struct ast_call_queue *q;
struct queue_ent *cur, *prev = NULL;
int res = -1;
@@ -928,35 +965,12 @@
int inserted = 0;
enum queue_member_status stat;
- /*! \note Load from realtime before taking the global qlock, to avoid blocking all
- queue operations while waiting for the DB.
-
- This will be two separate database transactions, so we might
- see queue parameters as they were before another process
- changed the queue and member list as it was after the change.
- Thus we might see an empty member list when a queue is
- deleted. In practise, this is unlikely to cause a problem. */
- queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
- if (queue_vars) {
- member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
- if (!member_config) {
- ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
- return res;
- }
- }
-
- ast_mutex_lock(&qlock);
- q = find_queue_by_name_rt(queuename, queue_vars, member_config);
- /* Note: If found, find_queue_by_name_rt() returns with q->lock locked. */
- if(member_config)
- ast_config_destroy(member_config);
- if(queue_vars)
- ast_variables_destroy(queue_vars);
-
- if (!q) {
- ast_mutex_unlock(&qlock);
+ q = load_realtime_queue(queuename);
+ if (!q)
return res;
- }
+
+ AST_LIST_LOCK(&queues);
+ ast_mutex_lock(&q->lock);
/* This is our one */
stat = get_member_status(q, qe->max_penalty);
@@ -1004,7 +1018,7 @@
#endif
}
ast_mutex_unlock(&q->lock);
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
return res;
}
@@ -1031,22 +1045,11 @@
static void destroy_queue(struct ast_call_queue *q)
{
- struct ast_call_queue *cur, *prev = NULL;
-
- ast_mutex_lock(&qlock);
- for (cur = queues; cur; cur = cur->next) {
- if (cur == q) {
- if (prev)
- prev->next = cur->next;
- else
- queues = cur->next;
- } else {
- prev = cur;
- }
- }
- ast_mutex_unlock(&qlock);
+ AST_LIST_LOCK(&queues);
+ AST_LIST_REMOVE(&queues, q, list);
+ AST_LIST_UNLOCK(&queues);
free_members(q, 1);
- ast_mutex_destroy(&q->lock);
+ ast_mutex_destroy(&q->lock);
free(q);
}
@@ -1331,7 +1334,7 @@
/* &qlock and &rq->lock already set by try_calling()
* to solve deadlock */
- for (q = queues; q; q = q->next) {
+ AST_LIST_TRAVERSE(&queues, q, list) {
if (q == rq) /* don't check myself, could deadlock */
continue;
ast_mutex_lock(&q->lock);
@@ -2092,7 +2095,7 @@
/* Hold the lock while we setup the outgoing calls */
if (use_weight)
- ast_mutex_lock(&qlock);
+ AST_LIST_LOCK(&queues);
ast_mutex_lock(&qe->parent->lock);
if (option_debug)
ast_log(LOG_DEBUG, "%s is trying to call a queue member.\n",
@@ -2108,7 +2111,7 @@
if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
ast_mutex_unlock(&qe->parent->lock);
if (use_weight)
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
goto out;
}
tmp->stillgoing = -1;
@@ -2155,7 +2158,7 @@
ring_one(qe, outgoing, &numbusies);
ast_mutex_unlock(&qe->parent->lock);
if (use_weight)
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT));
ast_mutex_lock(&qe->parent->lock);
if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY) {
@@ -2410,8 +2413,8 @@
struct member *last_member, *look;
int res = RES_NOSUCHQUEUE;
- ast_mutex_lock(&qlock);
- for (q = queues ; q ; q = q->next) {
+ AST_LIST_LOCK(&queues);
+ AST_LIST_TRAVERSE(&queues, q, list) {
ast_mutex_lock(&q->lock);
if (!strcmp(q->name, queuename)) {
if ((last_member = interface_exists(q, interface))) {
@@ -2445,7 +2448,7 @@
}
ast_mutex_unlock(&q->lock);
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
return res;
}
@@ -2455,45 +2458,46 @@
struct member *new_member;
int res = RES_NOSUCHQUEUE;
- ast_mutex_lock(&qlock);
- for (q = queues ; q ; q = q->next) {
+ /* \note Ensure the appropriate realtime queue is loaded. Note that this
+ * short-circuits if the queue is already in memory. */
+ q = load_realtime_queue(queuename);
+
+ AST_LIST_LOCK(&queues);
+
+ if (q) {
ast_mutex_lock(&q->lock);
- if (!strcmp(q->name, queuename)) {
- if (interface_exists(q, interface) == NULL) {
- new_member = create_queue_member(interface, penalty, paused);
-
- if (new_member != NULL) {
- new_member->dynamic = 1;
- new_member->next = q->members;
- q->members = new_member;
- manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
- "Queue: %s\r\n"
- "Location: %s\r\n"
- "Membership: %s\r\n"
- "Penalty: %d\r\n"
- "CallsTaken: %d\r\n"
- "LastCall: %d\r\n"
- "Status: %d\r\n"
- "Paused: %d\r\n",
- q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
- new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
+ if (interface_exists(q, interface) == NULL) {
+ new_member = create_queue_member(interface, penalty, paused);
+
+ if (new_member != NULL) {
+ new_member->dynamic = 1;
+ new_member->next = q->members;
+ q->members = new_member;
+ manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
+ "Queue: %s\r\n"
+ "Location: %s\r\n"
+ "Membership: %s\r\n"
+ "Penalty: %d\r\n"
+ "CallsTaken: %d\r\n"
+ "LastCall: %d\r\n"
+ "Status: %d\r\n"
+ "Paused: %d\r\n",
+ q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
+ new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
- if (dump)
- dump_queue_members(q);
-
- res = RES_OKAY;
- } else {
- res = RES_OUTOFMEMORY;
- }
+ if (dump)
+ dump_queue_members(q);
+
+ res = RES_OKAY;
} else {
- res = RES_EXISTS;
- }
- ast_mutex_unlock(&q->lock);
- break;
+ res = RES_OUTOFMEMORY;
+ }
+ } else {
+ res = RES_EXISTS;
}
ast_mutex_unlock(&q->lock);
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
return res;
}
@@ -2508,8 +2512,8 @@
if (ast_strlen_zero(queuename))
ast_queue_log("NONE", "NONE", interface, (paused ? "PAUSEALL" : "UNPAUSEALL"), "%s", "");
- ast_mutex_lock(&qlock);
- for (q = queues ; q ; q = q->next) {
+ AST_LIST_LOCK(&queues);
+ AST_LIST_TRAVERSE(&queues, q, list) {
ast_mutex_lock(&q->lock);
if (ast_strlen_zero(queuename) || !strcasecmp(q->name, queuename)) {
if ((mem = interface_exists(q, interface))) {
@@ -2532,7 +2536,7 @@
}
ast_mutex_unlock(&q->lock);
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
if (found)
return RESULT_SUCCESS;
@@ -2556,7 +2560,7 @@
struct ast_call_queue *cur_queue;
char queue_data[PM_MAX_LEN];
- ast_mutex_lock(&qlock);
+ AST_LIST_LOCK(&queues);
/* Each key in 'pm_family' is the name of a queue */
db_tree = ast_db_gettree(pm_family, NULL);
@@ -2564,13 +2568,11 @@
queue_name = entry->key + strlen(pm_family) + 2;
- cur_queue = queues;
- while (cur_queue) {
+ AST_LIST_TRAVERSE(&queues, cur_queue, list) {
ast_mutex_lock(&cur_queue->lock);
if (!strcmp(queue_name, cur_queue->name))
break;
ast_mutex_unlock(&cur_queue->lock);
- cur_queue = cur_queue->next;
}
if (!cur_queue) {
@@ -2623,7 +2625,7 @@
}
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
if (db_tree) {
ast_log(LOG_NOTICE, "Queue members successfully reloaded from database.\n");
ast_db_freetree(db_tree);
@@ -2649,7 +2651,6 @@
LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -2705,9 +2706,8 @@
LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u);
- return -1;
+ return -1;
}
AST_STANDARD_APP_ARGS(args, parse);
@@ -2763,7 +2763,6 @@
LOCAL_USER_ADD(u);
if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -2830,11 +2829,7 @@
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory Error!\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -3170,17 +3165,17 @@
return buf;
}
- ast_mutex_lock(&qlock);
+ AST_LIST_LOCK(&queues);
/* Find the right queue */
- for (q = queues; q; q = q->next) {
+ AST_LIST_TRAVERSE(&queues, q, list) {
if (!strcasecmp(q->name, data)) {
ast_mutex_lock(&q->lock);
break;
}
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
if (q) {
for (m = q->members; m; m = m->next) {
@@ -3213,17 +3208,17 @@
LOCAL_USER_ACF_ADD(u);
- ast_mutex_lock(&qlock);
+ AST_LIST_LOCK(&queues);
/* Find the right queue */
- for (q = queues; q; q = q->next) {
+ AST_LIST_TRAVERSE(&queues, q, list) {
if (!strcasecmp(q->name, data)) {
ast_mutex_lock(&q->lock);
break;
}
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
if (q) {
int buflen = 0, count = 0;
@@ -3280,7 +3275,7 @@
static void reload_queues(void)
{
- struct ast_call_queue *q, *ql, *qn;
+ struct ast_call_queue *q;
struct ast_config *cfg;
char *cat, *tmp;
struct ast_variable *var;
@@ -3296,13 +3291,11 @@
return;
}
memset(interface, 0, sizeof(interface));
- ast_mutex_lock(&qlock);
+ AST_LIST_LOCK(&queues);
use_weight=0;
/* Mark all queues as dead for the moment */
- q = queues;
- while(q) {
+ AST_LIST_TRAVERSE(&queues, q, list) {
q->dead = 1;
- q = q->next;
}
/* Chug through config file */
cat = ast_category_browse(cfg, NULL);
@@ -3314,11 +3307,9 @@
queue_persistent_members = ast_true(general_val);
} else { /* Define queue */
/* Look for an existing one */
- q = queues;
- while(q) {
+ AST_LIST_TRAVERSE(&queues, q, list) {
if (!strcmp(q->name, cat))
break;
- q = q->next;
}
if (!q) {
/* Make one then */
@@ -3368,26 +3359,18 @@
}
var = var->next;
}
- if (!new)
+ if (new) {
+ AST_LIST_INSERT_HEAD(&queues, q, list);
+ } else
ast_mutex_unlock(&q->lock);
- if (new) {
- q->next = queues;
- queues = q;
- }
}
}
cat = ast_category_browse(cfg, cat);
}
ast_config_destroy(cfg);
- q = queues;
- ql = NULL;
- while(q) {
- qn = q->next;
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&queues, q, list) {
if (q->dead) {
- if (ql)
- ql->next = q->next;
- else
- queues = q->next;
+ AST_LIST_REMOVE_CURRENT(&queues, list);
if (!q->count) {
free(q);
} else
@@ -3395,11 +3378,10 @@
} else {
for (cur = q->members; cur; cur = cur->next)
cur->status = ast_device_state(cur->interface);
- ql = q;
- }
- q = qn;
- }
- ast_mutex_unlock(&qlock);
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END;
+ AST_LIST_UNLOCK(&queues);
}
static int __queues_show(int manager, int fd, int argc, char **argv, int queue_show)
@@ -3418,23 +3400,26 @@
time(&now);
if ((!queue_show && argc != 2) || (queue_show && argc != 3))
return RESULT_SHOWUSAGE;
- ast_mutex_lock(&qlock);
- q = queues;
- if (!q) {
- ast_mutex_unlock(&qlock);
+
+ /* We only want to load realtime queues when a specific queue is asked for. */
+ if (queue_show)
+ load_realtime_queue(argv[2]);
+
+ AST_LIST_LOCK(&queues);
+ if (AST_LIST_EMPTY(&queues)) {
+ AST_LIST_UNLOCK(&queues);
if (queue_show)
ast_cli(fd, "No such queue: %s.%s",argv[2], term);
else
ast_cli(fd, "No queues.%s", term);
return RESULT_SUCCESS;
}
- while (q) {
+ AST_LIST_TRAVERSE(&queues, q, list) {
ast_mutex_lock(&q->lock);
if (queue_show) {
if (strcasecmp(q->name, argv[2]) != 0) {
ast_mutex_unlock(&q->lock);
- q = q->next;
- if (!q) {
+ if (!AST_LIST_NEXT(q, list)) {
ast_cli(fd, "No such queue: %s.%s",argv[2], term);
break;
}
@@ -3485,11 +3470,10 @@
ast_cli(fd, " No Callers%s", term);
ast_cli(fd, "%s", term);
ast_mutex_unlock(&q->lock);
- q = q->next;
if (queue_show)
break;
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
return RESULT_SUCCESS;
}
@@ -3510,8 +3494,8 @@
int which = 0;
int wordlen = strlen(word);
- ast_mutex_lock(&qlock);
- for (q = queues; q; q = q->next) {
+ AST_LIST_LOCK(&queues);
+ AST_LIST_TRAVERSE(&queues, q, list) {
if (!strncasecmp(word, q->name, wordlen)) {
if (++which > state) {
ret = strdup(q->name);
@@ -3519,7 +3503,7 @@
}
}
}
- ast_mutex_unlock(&qlock);
+ AST_LIST_UNLOCK(&queues);
return ret;
}
@@ -3552,11 +3536,11 @@
astman_send_ack(s, m, "Queue status will follow");
time(&now);
- ast_mutex_lock(&qlock);
+ AST_LIST_LOCK(&queues);
if (!ast_strlen_zero(id)) {
snprintf(idText,256,"ActionID: %s\r\n",id);
}
- for (q = queues; q; q = q->next) {
[... 5956 lines stripped ...]
More information about the asterisk-commits
mailing list