[asterisk-commits] branch bweschke/bug_5374 - r7485 in
/team/bweschke/bug_5374: ./ apps/ channel...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Dec 14 22:07:27 CST 2005
Author: bweschke
Date: Wed Dec 14 22:07:11 2005
New Revision: 7485
URL: http://svn.digium.com/view/asterisk?rev=7485&view=rev
Log:
Merge(s) to bring the branch up to date with /trunk
Added:
team/bweschke/bug_5374/apps/app_setcallerid.c
- copied unchanged from r7484, trunk/apps/app_setcallerid.c
team/bweschke/bug_5374/channels/misdn/fac.c
- copied unchanged from r7484, trunk/channels/misdn/fac.c
team/bweschke/bug_5374/channels/misdn/fac.h
- copied unchanged from r7484, trunk/channels/misdn/fac.h
Removed:
team/bweschke/bug_5374/apps/app_enumlookup.c
team/bweschke/bug_5374/apps/app_eval.c
team/bweschke/bug_5374/apps/app_groupcount.c
team/bweschke/bug_5374/apps/app_math.c
team/bweschke/bug_5374/apps/app_md5.c
team/bweschke/bug_5374/apps/app_setcidname.c
team/bweschke/bug_5374/apps/app_setcidnum.c
team/bweschke/bug_5374/apps/app_setrdnis.c
team/bweschke/bug_5374/apps/app_txtcidname.c
Modified:
team/bweschke/bug_5374/ (props changed)
team/bweschke/bug_5374/app.c
team/bweschke/bug_5374/apps/Makefile
team/bweschke/bug_5374/apps/app_curl.c
team/bweschke/bug_5374/apps/app_cut.c
team/bweschke/bug_5374/apps/app_db.c
team/bweschke/bug_5374/apps/app_dial.c
team/bweschke/bug_5374/apps/app_externalivr.c
team/bweschke/bug_5374/apps/app_macro.c
team/bweschke/bug_5374/apps/app_voicemail.c
team/bweschke/bug_5374/channel.c
team/bweschke/bug_5374/channels/Makefile
team/bweschke/bug_5374/channels/chan_agent.c
team/bweschke/bug_5374/channels/chan_misdn.c
team/bweschke/bug_5374/channels/chan_misdn_config.c
team/bweschke/bug_5374/channels/chan_sip.c
team/bweschke/bug_5374/channels/chan_zap.c
team/bweschke/bug_5374/channels/misdn/Makefile
team/bweschke/bug_5374/channels/misdn/chan_misdn_config.h
team/bweschke/bug_5374/channels/misdn/ie.c
team/bweschke/bug_5374/channels/misdn/isdn_lib.c
team/bweschke/bug_5374/channels/misdn/isdn_lib.h
team/bweschke/bug_5374/channels/misdn/isdn_lib_intern.h
team/bweschke/bug_5374/channels/misdn/isdn_msg_parser.c
team/bweschke/bug_5374/cli.c
team/bweschke/bug_5374/configs/features.conf.sample
team/bweschke/bug_5374/configs/misdn.conf.sample
team/bweschke/bug_5374/configs/res_odbc.conf.sample
team/bweschke/bug_5374/doc/README.misdn
team/bweschke/bug_5374/doc/README.variables
team/bweschke/bug_5374/include/asterisk/linkedlists.h
team/bweschke/bug_5374/pbx.c
team/bweschke/bug_5374/res/res_features.c
team/bweschke/bug_5374/utils.c
team/bweschke/bug_5374/utils/astman.c
Propchange: team/bweschke/bug_5374/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Dec 14 22:07:11 2005
@@ -1,2 +1,2 @@
/branches/1.2:1-7351
-/trunk:1-7353
+/trunk:1-7484
Modified: team/bweschke/bug_5374/app.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/app.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/app.c (original)
+++ team/bweschke/bug_5374/app.c Wed Dec 14 22:07:11 2005
@@ -430,11 +430,11 @@
const char *stop, const char *pause,
const char *restart, int skipms)
{
- long elapsed = 0, last_elapsed = 0;
char *breaks = NULL;
char *end = NULL;
int blen = 2;
int res;
+ long pause_restart_point = 0;
if (stop)
blen += strlen(stop);
@@ -456,9 +456,6 @@
if (chan->_state != AST_STATE_UP)
res = ast_answer(chan);
- if (chan)
- ast_stopstream(chan);
-
if (file) {
if ((end = strchr(file,':'))) {
if (!strcasecmp(end, ":end")) {
@@ -469,25 +466,18 @@
}
for (;;) {
- struct timeval started = ast_tvnow();
-
- if (chan)
- ast_stopstream(chan);
+ ast_stopstream(chan);
res = ast_streamfile(chan, file, chan->language);
if (!res) {
- if (end) {
+ if (pause_restart_point) {
+ ast_seekstream(chan->stream, pause_restart_point, SEEK_SET);
+ pause_restart_point = 0;
+ }
+ else if (end) {
ast_seekstream(chan->stream, 0, SEEK_END);
- end=NULL;
- }
- res = 1;
- if (elapsed) {
- ast_stream_fastforward(chan->stream, elapsed);
- last_elapsed = elapsed - 200;
- }
- if (res)
- res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
- else
- break;
+ end = NULL;
+ };
+ res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
}
if (res < 1)
@@ -496,17 +486,16 @@
/* We go at next loop if we got the restart char */
if (restart && strchr(restart, res)) {
ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
- elapsed=0; /* To make sure the next stream will start at beginning */
+ pause_restart_point = 0;
continue;
}
- if (pause != NULL && strchr(pause, res)) {
- elapsed = ast_tvdiff_ms(ast_tvnow(), started) + last_elapsed;
- for(;;) {
- if (chan)
- ast_stopstream(chan);
+ if (pause && strchr(pause, res)) {
+ pause_restart_point = ast_tellstream(chan->stream);
+ for (;;) {
+ ast_stopstream(chan);
res = ast_waitfordigit(chan, 1000);
- if (res == 0)
+ if (!res)
continue;
else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
break;
@@ -516,17 +505,16 @@
continue;
}
}
+
if (res == -1)
break;
/* if we get one of our stop chars, return it to the calling function */
- if (stop && strchr(stop, res)) {
- /* res = 0; */
- break;
- }
- }
- if (chan)
- ast_stopstream(chan);
+ if (stop && strchr(stop, res))
+ break;
+ }
+
+ ast_stopstream(chan);
return res;
}
Modified: team/bweschke/bug_5374/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/Makefile?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/Makefile (original)
+++ team/bweschke/bug_5374/apps/Makefile Wed Dec 14 22:07:11 2005
@@ -11,26 +11,21 @@
# the GNU General Public License
#
-APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_mp3.so\
- app_system.so app_echo.so app_record.so app_image.so app_url.so app_disa.so \
- app_adsiprog.so app_getcpeid.so app_milliwatt.so \
- app_zapateller.so app_setcallerid.so app_festival.so \
- app_queue.so app_senddtmf.so app_parkandannounce.so \
- app_setcidname.so app_lookupcidname.so app_macro.so \
- app_authenticate.so app_softhangup.so app_lookupblacklist.so \
- app_waitforring.so app_privacy.so app_db.so app_chanisavail.so \
- app_enumlookup.so app_transfer.so app_setcidnum.so app_cdr.so \
- app_hasnewvoicemail.so app_sayunixtime.so app_cut.so app_read.so \
- app_setcdruserfield.so app_random.so app_ices.so app_eval.so \
- app_nbscat.so app_sendtext.so app_exec.so \
- app_groupcount.so app_txtcidname.so app_controlplayback.so \
- app_talkdetect.so app_alarmreceiver.so app_userevent.so app_verbose.so \
- app_test.so app_forkcdr.so app_math.so app_realtime.so \
- app_dumpchan.so app_waitforsilence.so app_while.so app_setrdnis.so \
- app_md5.so app_readfile.so app_chanspy.so app_settransfercapability.so \
- app_dictate.so app_externalivr.so app_directed_pickup.so \
- app_mixmonitor.so app_stack.so
-
+APPS=app_adsiprog.so app_alarmreceiver.so app_authenticate.so app_cdr.so \
+ app_chanisavail.so app_chanspy.so app_controlplayback.so app_db.so \
+ app_dial.so app_dictate.so app_directed_pickup.so app_directory.so \
+ app_disa.so app_dumpchan.so app_echo.so app_exec.so app_externalivr.so \
+ app_festival.so app_forkcdr.so app_getcpeid.so app_hasnewvoicemail.so \
+ app_ices.so app_image.so app_lookupblacklist.so app_lookupcidname.so \
+ app_macro.so app_milliwatt.so app_mixmonitor.so app_mp3.so app_nbscat.so \
+ app_parkandannounce.so app_playback.so app_privacy.so app_queue.so \
+ app_random.so app_read.so app_readfile.so app_realtime.so app_record.so \
+ app_sayunixtime.so app_senddtmf.so app_sendtext.so app_setcallerid.so \
+ app_setcdruserfield.so app_settransfercapability.so app_softhangup.so \
+ app_stack.so app_system.so app_talkdetect.so app_test.so app_transfer.so \
+ app_userevent.so app_url.so app_verbose.so app_voicemail.so \
+ app_waitforring.so app_waitforsilence.so app_while.so app_zapateller.so
+
#
# Obsolete things...
#
Modified: team/bweschke/bug_5374/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_curl.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_curl.c (original)
+++ team/bweschke/bug_5374/apps/app_curl.c Wed Dec 14 22:07:11 2005
@@ -43,20 +43,6 @@
#include "asterisk/app.h"
static char *tdesc = "Load external URL";
-
-static char *app = "Curl";
-
-static char *synopsis = "Load an external URL";
-
-static char *descrip =
-" Curl(URL[|postdata]): This application will request the specified URL.\n"
-"It is mainly used for signalling external applications of an event.\n"
-"Parameters:\n"
-" URL - This is the external URL to request.\n"
-" postdata - This information will be treated as POST data.\n"
-"This application will set the following variable:\n"
-" CURL - This variable will contain the resulting page.\n"
-"This application has been deprecated in favor of the CURL function.\n";
STANDARD_LOCAL_USER;
@@ -115,57 +101,6 @@
curl_easy_perform(curl);
curl_easy_cleanup(curl);
return 0;
-}
-
-static int curl_exec(struct ast_channel *chan, void *data)
-{
- int res = 0;
- struct localuser *u;
- char *info;
- struct MemoryStruct chunk = { NULL, 0 };
- static int dep_warning = 0;
- AST_DECLARE_APP_ARGS(args,
- AST_APP_ARG(url);
- AST_APP_ARG(postdata);
- );
-
- if (!dep_warning) {
- ast_log(LOG_WARNING, "The application Curl is deprecated. Please use the CURL() function instead.\n");
- dep_warning = 1;
- }
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "Curl requires an argument (URL)\n");
- return -1;
- }
-
- LOCAL_USER_ADD(u);
-
- if ((info = ast_strdupa(data))) {
- AST_STANDARD_APP_ARGS(args, info);
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
-
- if (! curl_internal(&chunk, args.url, args.postdata)) {
- if (chunk.memory) {
- chunk.memory[chunk.size] = '\0';
- if (chunk.memory[chunk.size - 1] == 10)
- chunk.memory[chunk.size - 1] = '\0';
-
- pbx_builtin_setvar_helper(chan, "CURL", chunk.memory);
-
- free(chunk.memory);
- }
- } else {
- ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
- res = -1;
- }
-
- LOCAL_USER_REMOVE(u);
- return res;
}
static char *acf_curl_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
@@ -228,7 +163,6 @@
int res;
res = ast_custom_function_unregister(&acf_curl);
- res |= ast_unregister_application(app);
STANDARD_HANGUP_LOCALUSERS;
@@ -240,7 +174,6 @@
int res;
res = ast_custom_function_register(&acf_curl);
- res |= ast_register_application(app, curl_exec, synopsis, descrip);
return res;
}
Modified: team/bweschke/bug_5374/apps/app_cut.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_cut.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_cut.c (original)
+++ team/bweschke/bug_5374/apps/app_cut.c Wed Dec 14 22:07:11 2005
@@ -42,31 +42,6 @@
#define MAXRESULT 1024
static char *tdesc = "Cut out information from a string";
-
-static char *app_cut = "Cut";
-
-static char *cut_synopsis = "Splits a variable's contents using the specified delimiter";
-
-static char *cut_descrip =
-" Cut(newvar=varname,delimiter,fieldspec): This applicaiton will split the\n"
-"contents of a variable based on the given delimeter and store the result in\n"
-"a new variable.\n"
-"Parameters:\n"
-" newvar - new variable created from result string\n"
-" varname - variable you want cut\n"
-" delimiter - defaults to '-'\n"
-" fieldspec - number of the field you want (1-based offset)\n"
-" may also be specified as a range (with -)\n"
-" or group of ranges and fields (with &)\n"
-"This application has been deprecated in favor of the CUT function.\n";
-
-static char *app_sort = "Sort";
-static char *app_sort_synopsis = "Sorts a list of keywords and values";
-static char *app_sort_descrip =
-" Sort(newvar=key1:val1[,key2:val2[[...],keyN:valN]]): This application will\n"
-"sort the list provided in ascending order. The result will be stored in the\n"
-"specified variable name.\n"
-" This applicaiton has been deprecated in favor of the SORT function.\n";
STANDARD_LOCAL_USER;
@@ -258,105 +233,6 @@
return 0;
}
-static int sort_exec(struct ast_channel *chan, void *data)
-{
- int res=0;
- struct localuser *u;
- char *varname, *strings, result[512] = "";
- static int dep_warning=0;
-
- if (!dep_warning) {
- ast_log(LOG_WARNING, "The application Sort is deprecated. Please use the SORT() function instead.\n");
- dep_warning=1;
- }
-
- if (!data) {
- ast_log(LOG_ERROR, "Sort() requires an argument\n");
- return 0;
- }
-
- LOCAL_USER_ADD(u);
-
- strings = ast_strdupa((char *)data);
- if (!strings) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
-
- varname = strsep(&strings, "=");
- switch (sort_internal(chan, strings, result, sizeof(result))) {
- case ERROR_NOARG:
- ast_log(LOG_ERROR, "Sort() requires an argument\n");
- res = 0;
- break;
- case ERROR_NOMEM:
- ast_log(LOG_ERROR, "Out of memory\n");
- res = -1;
- break;
- case 0:
- pbx_builtin_setvar_helper(chan, varname, result);
- res = 0;
- break;
- default:
- ast_log(LOG_ERROR, "Unknown internal error\n");
- res = -1;
- }
- LOCAL_USER_REMOVE(u);
- return res;
-}
-
-static int cut_exec(struct ast_channel *chan, void *data)
-{
- int res=0;
- struct localuser *u;
- char *s, *newvar=NULL, result[512];
- static int dep_warning = 0;
-
- LOCAL_USER_ADD(u);
-
- if (!dep_warning) {
- ast_log(LOG_WARNING, "The application Cut is deprecated. Please use the CUT() function instead.\n");
- dep_warning=1;
- }
-
- /* Check and parse arguments */
- if (data) {
- s = ast_strdupa((char *)data);
- if (s) {
- newvar = strsep(&s, "=");
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
- }
-
- switch (cut_internal(chan, s, result, sizeof(result))) {
- case ERROR_NOARG:
- ast_log(LOG_ERROR, "Cut() requires an argument\n");
- res = 0;
- break;
- case ERROR_NOMEM:
- ast_log(LOG_ERROR, "Out of memory\n");
- res = -1;
- break;
- case ERROR_USAGE:
- ast_log(LOG_ERROR, "Usage: %s\n", cut_synopsis);
- res = 0;
- break;
- case 0:
- pbx_builtin_setvar_helper(chan, newvar, result);
- res = 0;
- break;
- default:
- ast_log(LOG_ERROR, "Unknown internal error\n");
- res = -1;
- }
- LOCAL_USER_REMOVE(u);
- return res;
-}
-
static char *acf_sort_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
struct localuser *u;
@@ -434,8 +310,6 @@
res = ast_custom_function_unregister(&acf_cut);
res |= ast_custom_function_unregister(&acf_sort);
- res |= ast_unregister_application(app_sort);
- res |= ast_unregister_application(app_cut);
STANDARD_HANGUP_LOCALUSERS;
@@ -448,8 +322,6 @@
res = ast_custom_function_register(&acf_cut);
res |= ast_custom_function_register(&acf_sort);
- res |= ast_register_application(app_sort, sort_exec, app_sort_synopsis, app_sort_descrip);
- res |= ast_register_application(app_cut, cut_exec, cut_synopsis, cut_descrip);
return res;
}
Modified: team/bweschke/bug_5374/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_db.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_db.c (original)
+++ team/bweschke/bug_5374/apps/app_db.c Wed Dec 14 22:07:11 2005
@@ -47,21 +47,6 @@
static char *tdesc = "Database Access Functions";
-static char *g_descrip =
-" DBget(varname=family/key[|options]): This application will retrieve a value\n"
-"from the Asterisk database and store it in the given variable.\n"
-" Options:\n"
-" j - Jump to priority n+101 if the requested family/key isn't found.\n"
-" This application sets the following channel variable upon completion:\n"
-" DBGETSTATUS - This variable will contain the status of the attempt\n"
-" FOUND | NOTFOUND \n"
-" This application has been deprecated in favor of the DB function.\n";
-
-static char *p_descrip =
-" DBput(family/key=value): This application will store the given value in the\n"
-"specified location in the Asterisk database.\n"
-" This application has been deprecated in favor of the DB function.\n";
-
static char *d_descrip =
" DBdel(family/key): This applicaiton will delete a key from the Asterisk\n"
"database.\n";
@@ -70,13 +55,9 @@
" DBdeltree(family[/keytree]): This application will delete a family or keytree\n"
"from the Asterisk database\n";
-static char *g_app = "DBget";
-static char *p_app = "DBput";
static char *d_app = "DBdel";
static char *dt_app = "DBdeltree";
-static char *g_synopsis = "Retrieve a value from the database";
-static char *p_synopsis = "Store a value in the database";
static char *d_synopsis = "Delete a key from the database";
static char *dt_synopsis = "Delete a family or keytree from the database";
@@ -167,126 +148,12 @@
return 0;
}
-static int put_exec(struct ast_channel *chan, void *data)
-{
- char *argv, *value, *family, *key;
- static int dep_warning = 0;
- struct localuser *u;
-
- LOCAL_USER_ADD(u);
-
- if (!dep_warning) {
- ast_log(LOG_WARNING, "This application has been deprecated, please use the ${DB(family/key)} function instead.\n");
- dep_warning = 1;
- }
-
- argv = ast_strdupa(data);
- if (!argv) {
- ast_log(LOG_ERROR, "Memory allocation failed\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
-
- if (strchr(argv, '/') && strchr(argv, '=')) {
- family = strsep(&argv, "/");
- key = strsep(&argv, "=");
- value = strsep(&argv, "\0");
- if (!value || !family || !key) {
- ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "DBput: family=%s, key=%s, value=%s\n", family, key, value);
- if (ast_db_put(family, key, value)) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "DBput: Error writing value to database.\n");
- }
-
- } else {
- ast_log (LOG_DEBUG, "Ignoring, no parameters\n");
- }
-
- LOCAL_USER_REMOVE(u);
-
- return 0;
-}
-
-static int get_exec(struct ast_channel *chan, void *data)
-{
- char *argv, *varname, *family, *key, *options = NULL;
- char dbresult[256];
- static int dep_warning = 0;
- int priority_jump = 0;
- struct localuser *u;
-
- LOCAL_USER_ADD(u);
-
- if (!dep_warning) {
- ast_log(LOG_WARNING, "This application has been deprecated, please use the ${DB(family/key)} function instead.\n");
- dep_warning = 1;
- }
-
- argv = ast_strdupa(data);
- if (!argv) {
- ast_log(LOG_ERROR, "Memory allocation failed\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
-
- if (strchr(argv, '=') && strchr(argv, '/')) {
- varname = strsep(&argv, "=");
- family = strsep(&argv, "/");
- if (strchr((void *)&argv, '|')) {
- key = strsep(&argv, "|");
- options = strsep(&argv, "\0");
- } else
- key = strsep(&argv, "\0");
-
- if (!varname || !family || !key) {
- ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
-
- if (options) {
- if (strchr(options, 'j'))
- priority_jump = 1;
- }
-
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "DBget: varname=%s, family=%s, key=%s\n", varname, family, key);
- if (!ast_db_get(family, key, dbresult, sizeof (dbresult) - 1)) {
- pbx_builtin_setvar_helper(chan, varname, dbresult);
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "DBget: set variable %s to %s\n", varname, dbresult);
- pbx_builtin_setvar_helper(chan, "DBGETSTATUS", "FOUND");
- } else {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "DBget: Value not found in database.\n");
- if (priority_jump || ast_opt_priority_jumping) {
- /* Send the call to n+101 priority, where n is the current priority */
- ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
- }
- pbx_builtin_setvar_helper(chan, "DBGETSTATUS", "NOTFOUND");
- }
- } else {
- ast_log(LOG_DEBUG, "Ignoring, no parameters\n");
- }
-
- LOCAL_USER_REMOVE(u);
-
- return 0;
-}
-
int unload_module(void)
{
int retval;
retval = ast_unregister_application(dt_app);
retval |= ast_unregister_application(d_app);
- retval |= ast_unregister_application(p_app);
- retval |= ast_unregister_application(g_app);
STANDARD_HANGUP_LOCALUSERS;
@@ -297,9 +164,7 @@
{
int retval;
- retval = ast_register_application(g_app, get_exec, g_synopsis, g_descrip);
- retval |= ast_register_application(p_app, put_exec, p_synopsis, p_descrip);
- retval |= ast_register_application(d_app, del_exec, d_synopsis, d_descrip);
+ retval = ast_register_application(d_app, del_exec, d_synopsis, d_descrip);
retval |= ast_register_application(dt_app, deltree_exec, dt_synopsis, dt_descrip);
return retval;
Modified: team/bweschke/bug_5374/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_dial.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_dial.c (original)
+++ team/bweschke/bug_5374/apps/app_dial.c Wed Dec 14 22:07:11 2005
@@ -962,7 +962,7 @@
/* If a channel group has been specified, get it for use when we create peer channels */
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
- ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID);
+ ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP);
cur = args.peers;
do {
/* Remember where to start next time */
Modified: team/bweschke/bug_5374/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_externalivr.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_externalivr.c (original)
+++ team/bweschke/bug_5374/apps/app_externalivr.c Wed Dec 14 22:07:11 2005
@@ -345,8 +345,6 @@
goto exit;
}
- setvbuf(child_events, NULL, _IONBF, 0);
-
if (!(child_commands = fdopen(child_commands_fd, "r"))) {
ast_chan_log(LOG_WARNING, chan, "Could not open stream for child commands\n");
goto exit;
@@ -356,6 +354,10 @@
ast_chan_log(LOG_WARNING, chan, "Could not open stream for child errors\n");
goto exit;
}
+
+ setvbuf(child_events, NULL, _IONBF, 0);
+ setvbuf(child_commands, NULL, _IONBF, 0);
+ setvbuf(child_errors, NULL, _IONBF, 0);
res = 0;
Modified: team/bweschke/bug_5374/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_macro.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_macro.c (original)
+++ team/bweschke/bug_5374/apps/app_macro.c Wed Dec 14 22:07:11 2005
@@ -86,6 +86,11 @@
STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
+
+static char *safe_strdup(const char *s)
+{
+ return s ? strdup(s) : NULL;
+}
static int macro_exec(struct ast_channel *chan, void *data)
{
@@ -162,25 +167,17 @@
}
argc = 1;
/* Save old macro variables */
- save_macro_exten = pbx_builtin_getvar_helper(chan, "MACRO_EXTEN");
- if (save_macro_exten)
- save_macro_exten = strdup(save_macro_exten);
+ save_macro_exten = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_EXTEN"));
pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", oldexten);
- save_macro_context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT");
- if (save_macro_context)
- save_macro_context = strdup(save_macro_context);
+ save_macro_context = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"));
pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", oldcontext);
- save_macro_priority = pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY");
- if (save_macro_priority)
- save_macro_priority = strdup(save_macro_priority);
+ save_macro_priority = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY"));
snprintf(pc, sizeof(pc), "%d", oldpriority);
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", pc);
- save_macro_offset = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET");
- if (save_macro_offset)
- save_macro_offset = strdup(save_macro_offset);
+ save_macro_offset = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", NULL);
/* Setup environment for new run */
Modified: team/bweschke/bug_5374/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_voicemail.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_voicemail.c (original)
+++ team/bweschke/bug_5374/apps/app_voicemail.c Wed Dec 14 22:07:11 2005
@@ -536,10 +536,10 @@
if (mailbox)
ast_copy_string(retval->mailbox, mailbox, sizeof(retval->mailbox));
populate_defaults(retval);
- if (ast_test_flag((&globalflags), VM_SEARCH))
+ if (!context && ast_test_flag((&globalflags), VM_SEARCH))
var = ast_load_realtime("voicemail", "mailbox", mailbox, NULL);
else
- var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", retval->context, NULL);
+ var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", context, NULL);
if (var) {
tmp = var;
while(tmp) {
@@ -582,7 +582,7 @@
while (cur) {
if (ast_test_flag((&globalflags), VM_SEARCH) && !strcasecmp(mailbox, cur->mailbox))
break;
- if ((!strcasecmp(context, cur->context)) && (!strcasecmp(mailbox, cur->mailbox)))
+ if (context && (!strcasecmp(context, cur->context)) && (!strcasecmp(mailbox, cur->mailbox)))
break;
cur=cur->next;
}
Modified: team/bweschke/bug_5374/channel.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/channel.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/channel.c (original)
+++ team/bweschke/bug_5374/channel.c Wed Dec 14 22:07:11 2005
@@ -3053,7 +3053,6 @@
if (ast_test_flag(clone, AST_FLAG_ZOMBIE)) {
ast_log(LOG_DEBUG, "Destroying channel clone '%s'\n", clone->name);
ast_mutex_unlock(&clone->lock);
- ast_channel_free(clone);
manager_event(EVENT_FLAG_CALL, "Hangup",
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
@@ -3064,6 +3063,7 @@
clone->hangupcause,
ast_cause2str(clone->hangupcause)
);
+ ast_channel_free(clone);
} else {
struct ast_frame null_frame = { AST_FRAME_NULL, };
ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
Modified: team/bweschke/bug_5374/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/channels/Makefile?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/channels/Makefile (original)
+++ team/bweschke/bug_5374/channels/Makefile Wed Dec 14 22:07:11 2005
@@ -83,6 +83,7 @@
ifneq ($(wildcard misdn/chan_misdn_lib.a),)
CHANNEL_LIBS+=chan_misdn.so
+ CFLAGS+=-Imisdn
endif
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
@@ -234,11 +235,10 @@
endif
chan_misdn.so: chan_misdn.o chan_misdn_config.o misdn/chan_misdn_lib.a
- $(CC) -shared -Xlinker -x -o $@ $^ $(MISDNUSER)/i4lnet/libisdnnet.a $(MISDNUSER)/lib/libmISDN.a
-
-chan_misdn_config.o: chan_misdn_config.c
- $(CC) $(CFLAGS) -c chan_misdn_config.c
-
+ $(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN
+
+chan_misdn.o: chan_misdn.c
+ $(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.2.1\" -c $< -o $@
#chan_modem.so : chan_modem.o
# $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
Modified: team/bweschke/bug_5374/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/channels/chan_agent.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/channels/chan_agent.c (original)
+++ team/bweschke/bug_5374/channels/chan_agent.c Wed Dec 14 22:07:11 2005
@@ -1417,7 +1417,7 @@
/* Set a default status. It 'should' get changed. */
status = "AGENT_UNKNOWN";
- if (!ast_strlen_zero(p->loginchan)) {
+ if (!ast_strlen_zero(p->loginchan) && !p->chan) {
loginChan = p->loginchan;
talkingtoChan = "n/a";
status = "AGENT_IDLE";
Modified: team/bweschke/bug_5374/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/channels/chan_misdn.c?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- team/bweschke/bug_5374/channels/chan_misdn.c (original)
+++ team/bweschke/bug_5374/channels/chan_misdn.c Wed Dec 14 22:07:11 2005
@@ -68,6 +68,38 @@
#define release_unlock ast_mutex_unlock(&release_lock_mutex)
+char global_tracefile[BUFFERSIZE];
+
+
+struct misdn_jb{
+ int size;
+ int upper_threshold;
+ char *samples, *ok;
+ int wp,rp;
+ int state_empty;
+ int state_full;
+ int state_buffer;
+ int bytes_wrote;
+ ast_mutex_t mutexjb;
+};
+
+/* allocates the jb-structure and initialise the elements*/
+struct misdn_jb *misdn_jb_init(int size, int upper_threshold);
+
+/* frees the data and destroys the given jitterbuffer struct */
+void misdn_jb_destroy(struct misdn_jb *jb);
+
+/* fills the jitterbuffer with len data returns < 0 if there was an
+error (bufferoverun). */
+int misdn_jb_fill(struct misdn_jb *jb, const char *data, int len);
+
+/* gets len bytes out of the jitterbuffer if available, else only the
+available data is returned and the return value indicates the number
+of data. */
+int misdn_jb_empty(struct misdn_jb *jb, char *data, int len);
+
+
+
/* BEGIN: chan_misdn.h */
enum misdn_chan_state {
@@ -113,6 +145,8 @@
int faxhandled;
int ast_dsp;
+
+ struct misdn_jb *jb;
struct ast_dsp *dsp;
struct ast_trans_pvt *trans;
@@ -124,6 +158,8 @@
unsigned int l3id;
int addr;
+
+ char context[BUFFERSIZE];
struct chan_list *peer;
struct chan_list *next;
@@ -142,11 +178,11 @@
static inline void free_robin_list_r (struct robin_list *r)
{
- if (r) {
- if (r->next) free_robin_list_r(r->next);
- if (r->group) free(r->group);
- free(r);
- }
+ if (r) {
+ if (r->next) free_robin_list_r(r->next);
+ if (r->group) free(r->group);
+ free(r);
+ }
}
static void free_robin_list ( void )
@@ -155,7 +191,7 @@
robin = NULL;
}
-struct robin_list* get_robin_position (char *group)
+static struct robin_list* get_robin_position (char *group)
{
struct robin_list *iter = robin;
for (; iter; iter = iter->next) {
@@ -173,8 +209,11 @@
return robin;
}
-struct ast_channel *misdn_new(struct chan_list *cl, int state, char * name, char * context, char *exten, char *callerid, int format, int port, int c);
-void send_digit_to_chan(struct chan_list *cl, char digit );
+
+static void chan_misdn_log(int level, int port, char *tmpl, ...);
+
+static struct ast_channel *misdn_new(struct chan_list *cl, int state, char *exten, char *callerid, int format, int port, int c);
+static void send_digit_to_chan(struct chan_list *cl, char digit );
#define AST_CID_P(ast) ast->cid.cid_num
@@ -186,46 +225,46 @@
#define MISDN_ASTERISK_PVT(ast) 1
#define MISDN_ASTERISK_TYPE(ast) ast->tech->type
-/* END: chan_misdn.h */
-
#include <asterisk/strings.h>
/* #define MISDN_DEBUG 1 */
-static char *desc = "Channel driver for mISDN Support (Bri/Pri)";
-static char *type = "mISDN";
-
-int tracing = 0 ;
+static char *desc = "Channel driver for mISDN Support (Bri/Pri)";
+static char *misdn_type = "mISDN";
+
+static int tracing = 0 ;
static int usecnt=0;
-char **misdn_key_vector=NULL;
-int misdn_key_vector_size=0;
+static char **misdn_key_vector=NULL;
+static int misdn_key_vector_size=0;
/* Only alaw and mulaw is allowed for now */
static int prefformat = AST_FORMAT_ALAW ; /* AST_FORMAT_SLINEAR ; AST_FORMAT_ULAW | */
static ast_mutex_t usecnt_lock;
-int *misdn_debug;
-int *misdn_debug_only;
-int max_ports;
+static int *misdn_debug;
+static int *misdn_debug_only;
+static int max_ports;
struct chan_list dummy_cl;
struct chan_list *cl_te=NULL;
ast_mutex_t cl_te_lock;
-enum event_response_e
+static enum event_response_e
cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data);
-void send_cause2ast(struct ast_channel *ast, struct misdn_bchannel*bc);
-
-void cl_queue_chan(struct chan_list **list, struct chan_list *chan);
-void cl_dequeue_chan(struct chan_list **list, struct chan_list *chan);
-struct chan_list *find_chan_by_bc(struct chan_list *list, struct misdn_bchannel *bc);
-void chan_misdn_log(int level, int port, char *tmpl, ...);
-void chan_misdn_trace_call(struct ast_channel *chan, int debug, char *tmpl, ...);
+static void send_cause2ast(struct ast_channel *ast, struct misdn_bchannel*bc);
+
+static void cl_queue_chan(struct chan_list **list, struct chan_list *chan);
+static void cl_dequeue_chan(struct chan_list **list, struct chan_list *chan);
+static struct chan_list *find_chan_by_bc(struct chan_list *list, struct misdn_bchannel *bc);
+
+
+
+
static int start_bc_tones(struct chan_list *cl);
static int stop_bc_tones(struct chan_list *cl);
@@ -233,6 +272,8 @@
static int misdn_set_opt_exec(struct ast_channel *chan, void *data);
static int misdn_facility_exec(struct ast_channel *chan, void *data);
+
+int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len);
/*************** Helpers *****************/
@@ -306,6 +347,24 @@
}
}
+
+static void print_facility( struct misdn_bchannel *bc)
+{
+ switch (bc->fac_type) {
+ case FACILITY_CALLDEFLECT:
+ chan_misdn_log(2,bc->port," --> calldeflect: %s\n",
+ bc->fac.calldeflect_nr);
+ break;
+ case FACILITY_CENTREX:
+ chan_misdn_log(2,bc->port," --> centrex: %s\n",
+ bc->fac.cnip);
+ break;
+ default:
+ chan_misdn_log(2,bc->port," --> unknown\n");
+
+ }
+}
+
static void print_bearer(struct misdn_bchannel *bc)
{
@@ -322,7 +381,7 @@
}
/*************** Helpers END *************/
-void send_digit_to_chan(struct chan_list *cl, char digit )
+static void send_digit_to_chan(struct chan_list *cl, char digit )
{
static const char* dtmf_tones[] = {
"!941+1336/100,!0/100", /* 0 */
@@ -416,10 +475,9 @@
return 0;
}
-
static int misdn_set_crypt_debug(int fd, int argc, char *argv[])
{
- if (argc != 5 )return RESULT_SHOWUSAGE;
+ if (argc != 5) return RESULT_SHOWUSAGE;
return 0;
}
@@ -505,14 +563,12 @@
return 0;
}
-
-
struct state_struct {
enum misdn_chan_state state;
char txt[255] ;
} ;
-struct state_struct state_array[] = {
+static struct state_struct state_array[] = {
{MISDN_NOTHING,"NOTHING"}, /* at beginning */
{MISDN_WAITING4DIGS,"WAITING4DIGS"}, /* when waiting for infos */
{MISDN_EXTCANTMATCH,"EXTCANTMATCH"}, /* when asterisk couldnt match our ext */
@@ -531,10 +587,7 @@
/* misdn_hangup */
};
-
-
-
-char *misdn_get_ch_state(struct chan_list *p)
+static char *misdn_get_ch_state(struct chan_list *p)
{
int i;
if( !p) return NULL;
@@ -551,19 +604,14 @@
int i, cfg_debug;
ast_cli(fd, "Reloading mISDN Config\n");
- chan_misdn_log(0, 0, "Dynamic Crypting Activation is not support during reload at the moment\n");
+ chan_misdn_log(-1, 0, "Dynamic Crypting Activation is not support during reload at the moment\n");
free_robin_list();
misdn_cfg_reload();
-
- {
- char tempbuf[BUFFERSIZE];
- misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, tempbuf, BUFFERSIZE);
- if (strlen(tempbuf))
- tracing = 1;
- }
-
+
+ misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
+
misdn_cfg_get( 0, MISDN_GEN_DEBUG, &cfg_debug, sizeof(int));
for (i = 0; i <= max_ports; i++) {
misdn_debug[i] = cfg_debug;
@@ -578,6 +626,7 @@
struct ast_channel *ast=help->ast;
ast_cli(fd,
"* Pid:%d Prt:%d Ch:%d Mode:%s Org:%s dad:%s oad:%s ctx:%s state:%s\n",
+
bc->pid, bc->port, bc->channel,
bc->nt?"NT":"TE",
help->orginator == ORG_AST?"*":"I",
@@ -617,7 +666,6 @@
}
-
static int misdn_show_cls (int fd, int argc, char *argv[])
{
struct chan_list *help=cl_te;
@@ -642,8 +690,6 @@
return 0;
}
-
-
static int misdn_show_cl (int fd, int argc, char *argv[])
{
struct chan_list *help=cl_te;
@@ -680,13 +726,12 @@
return 0;
}
-
-
static int misdn_show_stacks (int fd, int argc, char *argv[])
{
int port;
ast_cli(fd, "BEGIN STACK_LIST:\n");
+
for (port=misdn_cfg_get_next_port(0); port > 0;
port=misdn_cfg_get_next_port(port)) {
char buf[128];
@@ -745,8 +790,6 @@
return 0;
}
-
-
static int misdn_send_digit (int fd, int argc, char *argv[])
{
@@ -819,8 +862,6 @@
return 0;
}
-
-
static int misdn_send_display (int fd, int argc, char *argv[])
{
char *channame;
@@ -851,9 +892,6 @@
return RESULT_SUCCESS ;
}
-
-
-
static char *complete_ch_helper(char *line, char *word, int pos, int state, int rpos)
{
struct ast_channel *c;
@@ -909,7 +947,6 @@
complete_ch
};
-
static struct ast_cli_entry cli_send_digit =
{ {"misdn","send","digit", NULL},
misdn_send_digit,
@@ -920,7 +957,6 @@
complete_ch
};
-
static struct ast_cli_entry cli_toggle_echocancel =
{ {"misdn","toggle","echocancel", NULL},
misdn_toggle_echocancel,
@@ -928,8 +964,6 @@
"Usage: misdn toggle echocancel <channel>\n",
complete_ch
};
-
-
static struct ast_cli_entry cli_send_display =
{ {"misdn","send","display", NULL},
@@ -941,7 +975,6 @@
complete_ch
};
-
static struct ast_cli_entry cli_show_config =
{ {"misdn","show","config", NULL},
misdn_show_config,
@@ -949,7 +982,6 @@
"Usage: misdn show config [port | 0]\n use 0 to only print the general config.\n"
};
-
static struct ast_cli_entry cli_reload =
{ {"misdn","reload", NULL},
misdn_reload,
@@ -963,7 +995,6 @@
"",
"\n"
};
-
static struct ast_cli_entry cli_show_cls =
{ {"misdn","show","channels", NULL},
@@ -989,7 +1020,6 @@
"Usage: misdn restart port\n"
};
-
static struct ast_cli_entry cli_port_up =
{ {"misdn","port","up", NULL},
misdn_port_up,
@@ -997,7 +1027,6 @@
"Usage: misdn port up <port>\n"
};
-
static struct ast_cli_entry cli_show_stacks =
{ {"misdn","show","stacks", NULL},
misdn_show_stacks,
@@ -1011,8 +1040,6 @@
"Shows detailed information for given port",
"Usage: misdn show port <port>\n"
};
-
-
static struct ast_cli_entry cli_set_debug =
{ {"misdn","set","debug", NULL},
@@ -1031,6 +1058,325 @@
/*** CLI END ***/
+
+static int read_config(struct chan_list *ch, int orig) {
+
+ if (!ch) {
+ ast_log(LOG_WARNING, "Cannot configure without chanlist\n");
+ return -1;
+ }
+
+ struct ast_channel *ast=ch->ast;
+ struct misdn_bchannel *bc=ch->bc;
+ if (! ast || ! bc ) {
+ ast_log(LOG_WARNING, "Cannot configure without ast || bc\n");
+ return -1;
+ }
+
+ int port=bc->port;
+
+ chan_misdn_log(1,port,"read_config: Getting Config\n");
+
+ char lang[BUFFERSIZE];
+
+
+ misdn_cfg_get( port, MISDN_CFG_LANGUAGE, lang, BUFFERSIZE);
+ ast_copy_string(ast->language, lang, sizeof(ast->language));
+ ast->language[sizeof(ast->language)]=0;
[... 7214 lines stripped ...]
More information about the asterisk-commits
mailing list