[asterisk-commits] seanbright: branch seanbright/resolve-shadow-warnings r115193 - in /team/sean...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 2 07:54:07 CDT 2008
Author: seanbright
Date: Fri May 2 07:54:06 2008
New Revision: 115193
URL: http://svn.digium.com/view/asterisk?view=rev&rev=115193
Log:
Merged revisions 115076,115078,115104,115157,115159 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r115076 | tilghman | 2008-05-01 19:06:23 -0400 (Thu, 01 May 2008) | 7 lines
Modify TIMEOUT() to be accurate down to the millisecond.
(closes issue #10540)
Reported by: spendergrass
Patches:
20080417__bug10540.diff.txt uploaded by Corydon76 (license 14)
Tested by: blitzrage
................
r115078 | bbryant | 2008-05-01 19:09:08 -0400 (Thu, 01 May 2008) | 2 lines
Add two new console commands "pri show version" and "ss7 show version" that will show the version of each library respectively.
................
r115104 | tilghman | 2008-05-01 19:21:13 -0400 (Thu, 01 May 2008) | 10 lines
Merged revisions 115102 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r115102 | tilghman | 2008-05-01 18:20:25 -0500 (Thu, 01 May 2008) | 2 lines
Change the comment of deprecated to an actual compiler deprecation
........
................
r115157 | tilghman | 2008-05-01 22:33:04 -0400 (Thu, 01 May 2008) | 2 lines
Add attributes to various API calls, to help track down bugs (and remove a deprecated function)
................
r115159 | tilghman | 2008-05-01 22:56:39 -0400 (Thu, 01 May 2008) | 2 lines
Okay, maybe FreeBSD will like this better.
................
Modified:
team/seanbright/resolve-shadow-warnings/ (props changed)
team/seanbright/resolve-shadow-warnings/CHANGES
team/seanbright/resolve-shadow-warnings/apps/app_dial.c
team/seanbright/resolve-shadow-warnings/apps/app_disa.c
team/seanbright/resolve-shadow-warnings/apps/app_dumpchan.c
team/seanbright/resolve-shadow-warnings/apps/app_queue.c
team/seanbright/resolve-shadow-warnings/apps/app_read.c
team/seanbright/resolve-shadow-warnings/apps/app_readexten.c
team/seanbright/resolve-shadow-warnings/apps/app_rpt.c
team/seanbright/resolve-shadow-warnings/apps/app_speech_utils.c
team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c
team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
team/seanbright/resolve-shadow-warnings/channels/chan_zap.c
team/seanbright/resolve-shadow-warnings/configure
team/seanbright/resolve-shadow-warnings/configure.ac
team/seanbright/resolve-shadow-warnings/funcs/func_timeout.c
team/seanbright/resolve-shadow-warnings/include/asterisk/autoconfig.h.in
team/seanbright/resolve-shadow-warnings/include/asterisk/channel.h
team/seanbright/resolve-shadow-warnings/include/asterisk/compiler.h
team/seanbright/resolve-shadow-warnings/include/asterisk/config.h
team/seanbright/resolve-shadow-warnings/include/asterisk/logger.h
team/seanbright/resolve-shadow-warnings/include/asterisk/pbx.h
team/seanbright/resolve-shadow-warnings/include/asterisk/res_odbc.h
team/seanbright/resolve-shadow-warnings/include/asterisk/sched.h
team/seanbright/resolve-shadow-warnings/main/app.c
team/seanbright/resolve-shadow-warnings/main/asterisk.c
team/seanbright/resolve-shadow-warnings/main/channel.c
team/seanbright/resolve-shadow-warnings/main/cli.c
team/seanbright/resolve-shadow-warnings/main/config.c
team/seanbright/resolve-shadow-warnings/main/dial.c
team/seanbright/resolve-shadow-warnings/main/manager.c
team/seanbright/resolve-shadow-warnings/main/pbx.c
team/seanbright/resolve-shadow-warnings/main/sched.c
team/seanbright/resolve-shadow-warnings/res/res_agi.c
Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 2 07:54:06 2008
@@ -1,1 +1,1 @@
-/trunk:1-115069
+/trunk:1-115192
Modified: team/seanbright/resolve-shadow-warnings/CHANGES
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/CHANGES?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/CHANGES (original)
+++ team/seanbright/resolve-shadow-warnings/CHANGES Fri May 2 07:54:06 2008
@@ -82,11 +82,20 @@
* New CLI command, "config reload <file.conf>" which reloads any module that
references that particular configuration file. Also added "config list"
which shows which configuration files are in use.
+ * New CLI commands, "pri show version" and "ss7 show version" that will
+ display which version of libpri and libss7 are being used, respectively.
+ A new API call was added so trunk will now have to be compiled against
+ a versions of libpri and libss7 that have them or it will not know that
+ these libraries exist.
DNS manager changes
-------------------
* Addresses managed by DNS manager now can check to see if there is a DNS
SRV record for a given domain and will use that hostname/port if present.
+
+Dialplan function changes
+-------------------------
+ * TIMEOUT() has been modified to be accurate down to the millisecond.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0 -------------
Modified: team/seanbright/resolve-shadow-warnings/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_dial.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_dial.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_dial.c Fri May 2 07:54:06 2008
@@ -1472,7 +1472,7 @@
tc->appl = "AppDial";
tc->data = "(Outgoing Line)";
- tc->whentohangup = 0;
+ memset(&tc->whentohangup, 0, sizeof(tc->whentohangup));
S_REPLACE(tc->cid.cid_num, ast_strdup(chan->cid.cid_num));
S_REPLACE(tc->cid.cid_name, ast_strdup(chan->cid.cid_name));
@@ -1839,7 +1839,8 @@
if (!res) {
if (calldurationlimit > 0) {
- peer->whentohangup = time(NULL) + calldurationlimit;
+ struct timeval whentohangup = { calldurationlimit, 0 };
+ peer->whentohangup = ast_tvadd(ast_tvnow(), whentohangup);
}
if (!ast_strlen_zero(dtmfcalled)) {
ast_verb(3, "Sending DTMF '%s' to the called party.\n", dtmfcalled);
@@ -1967,7 +1968,7 @@
if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE) && (res != AST_PBX_INCOMPLETE)) {
if (calldurationlimit)
- chan->whentohangup = 0;
+ memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
res = 0;
}
Modified: team/seanbright/resolve-shadow-warnings/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_disa.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_disa.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_disa.c Fri May 2 07:54:06 2008
@@ -116,8 +116,8 @@
static int disa_exec(struct ast_channel *chan, void *data)
{
int i = 0, j, k = 0, did_ignore = 0, special_noanswer = 0;
- int firstdigittimeout = (chan->pbx ? chan->pbx->rtimeout * 1000 : 20000);
- int digittimeout = (chan->pbx ? chan->pbx->dtimeout * 1000 : 10000);
+ int firstdigittimeout = (chan->pbx ? chan->pbx->rtimeoutms : 20000);
+ int digittimeout = (chan->pbx ? chan->pbx->dtimeoutms : 10000);
struct ast_flags flags;
char *tmp, exten[AST_MAX_EXTENSION] = "", acctcode[20]="";
char pwline[256];
Modified: team/seanbright/resolve-shadow-warnings/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_dumpchan.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_dumpchan.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_dumpchan.c Fri May 2 07:54:06 2008
@@ -115,7 +115,7 @@
ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->rawwriteformat),
ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->rawreadformat),
c->fds[0], c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
- c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup,
+ c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup.tv_sec,
hour,
min,
sec,
Modified: team/seanbright/resolve-shadow-warnings/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_queue.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_queue.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_queue.c Fri May 2 07:54:06 2008
@@ -2228,7 +2228,7 @@
tmp->chan->appl = "AppQueue";
tmp->chan->data = "(Outgoing Line)";
- tmp->chan->whentohangup = 0;
+ memset(&tmp->chan->whentohangup, 0, sizeof(tmp->chan->whentohangup));
if (tmp->chan->cid.cid_num)
ast_free(tmp->chan->cid.cid_num);
tmp->chan->cid.cid_num = ast_strdup(qe->chan->cid.cid_num);
Modified: team/seanbright/resolve-shadow-warnings/apps/app_read.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_read.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_read.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_read.c Fri May 2 07:54:06 2008
@@ -162,7 +162,7 @@
ast_stopstream(chan);
if (ts && ts->data[0]) {
if (!to)
- to = chan->pbx ? chan->pbx->rtimeout * 1000 : 6000;
+ to = chan->pbx ? chan->pbx->rtimeoutms : 6000;
res = ast_playtones_start(chan, 0, ts->data, 0);
for (x = 0; x < maxdigits; ) {
res = ast_waitfordigit(chan, to);
Modified: team/seanbright/resolve-shadow-warnings/apps/app_readexten.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_readexten.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_readexten.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_readexten.c Fri May 2 07:54:06 2008
@@ -121,10 +121,10 @@
}
if (timeout <= 0)
- timeout = chan->pbx ? chan->pbx->rtimeout * 1000 : 10000;
+ timeout = chan->pbx ? chan->pbx->rtimeoutms : 10000;
if (digit_timeout <= 0)
- digit_timeout = chan->pbx ? chan->pbx->dtimeout * 1000 : 5000;
+ digit_timeout = chan->pbx ? chan->pbx->dtimeoutms : 5000;
if (ast_test_flag(&flags, OPT_INDICATION) && !ast_strlen_zero(arglist.filename))
ts = ast_get_indication_tone(chan->zone, arglist.filename);
Modified: team/seanbright/resolve-shadow-warnings/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_rpt.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_rpt.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_rpt.c Fri May 2 07:54:06 2008
@@ -297,6 +297,8 @@
#define FUNCTDELAY 1500
static pthread_t rpt_master_thread;
+
+struct timeval cancel_atimeout = { 0, 0 };
struct rpt;
@@ -2930,7 +2932,7 @@
if (l->chan) {
ast_set_read_format(l->chan, AST_FORMAT_SLINEAR);
ast_set_write_format(l->chan, AST_FORMAT_SLINEAR);
- l->chan->whentohangup = 0;
+ ast_channel_setwhentohangup_tv(l->chan, cancel_atimeout);
l->chan->appl = "Apprpt";
l->chan->data = "(Remote Rx)";
ast_verb(3, "rpt (remote) initiating call to %s/%s on %s\n",
@@ -3041,7 +3043,7 @@
if (l->chan) {
ast_set_read_format(l->chan, AST_FORMAT_SLINEAR);
ast_set_write_format(l->chan, AST_FORMAT_SLINEAR);
- l->chan->whentohangup = 0;
+ ast_channel_setwhentohangup_tv(l->chan, cancel_atimeout);
l->chan->appl = "Apprpt";
l->chan->data = "(Remote Rx)";
ast_verb(3, "rpt (remote) initiating call to %s/%s on %s\n",
@@ -5462,7 +5464,7 @@
if (l->chan) {
ast_set_read_format(l->chan, AST_FORMAT_SLINEAR);
ast_set_write_format(l->chan, AST_FORMAT_SLINEAR);
- l->chan->whentohangup = 0;
+ ast_channel_setwhentohangup_tv(l->chan, cancel_atimeout);
l->chan->appl = "Apprpt";
l->chan->data = "(Remote Rx)";
ast_verb(3, "rpt (attempt_reconnect) initiating call to %s/%s on %s\n",
@@ -5699,7 +5701,7 @@
}
ast_set_read_format(myrpt->rxchannel, AST_FORMAT_SLINEAR);
ast_set_write_format(myrpt->rxchannel, AST_FORMAT_SLINEAR);
- myrpt->rxchannel->whentohangup = 0;
+ ast_channel_setwhentohangup_tv(myrpt->rxchannel, cancel_atimeout);
myrpt->rxchannel->appl = "Apprpt";
myrpt->rxchannel->data = "(Repeater Rx)";
ast_verb(3, "rpt (Rx) initiating call to %s/%s on %s\n",
@@ -5740,7 +5742,7 @@
}
ast_set_read_format(myrpt->txchannel, AST_FORMAT_SLINEAR);
ast_set_write_format(myrpt->txchannel, AST_FORMAT_SLINEAR);
- myrpt->txchannel->whentohangup = 0;
+ ast_channel_setwhentohangup_tv(myrpt->txchannel, cancel_atimeout);
myrpt->txchannel->appl = "Apprpt";
myrpt->txchannel->data = "(Repeater Tx)";
ast_verb(3, "rpt (Tx) initiating call to %s/%s on %s\n",
@@ -7109,7 +7111,7 @@
if (myrpt->rxchannel) {
ast_set_read_format(myrpt->rxchannel, AST_FORMAT_SLINEAR);
ast_set_write_format(myrpt->rxchannel, AST_FORMAT_SLINEAR);
- myrpt->rxchannel->whentohangup = 0;
+ ast_channel_setwhentohangup_tv(myrpt->rxchannel, cancel_atimeout);
myrpt->rxchannel->appl = "Apprpt";
myrpt->rxchannel->data = "(Link Rx)";
ast_verb(3, "rpt (Rx) initiating call to %s/%s on %s\n",
@@ -7136,7 +7138,7 @@
if (myrpt->txchannel) {
ast_set_read_format(myrpt->txchannel, AST_FORMAT_SLINEAR);
ast_set_write_format(myrpt->txchannel, AST_FORMAT_SLINEAR);
- myrpt->txchannel->whentohangup = 0;
+ ast_channel_setwhentohangup_tv(myrpt->txchannel, cancel_atimeout);
myrpt->txchannel->appl = "Apprpt";
myrpt->txchannel->data = "(Link Tx)";
ast_verb(3, "rpt (Tx) initiating call to %s/%s on %s\n",
Modified: team/seanbright/resolve-shadow-warnings/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_speech_utils.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_speech_utils.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_speech_utils.c Fri May 2 07:54:06 2008
@@ -513,7 +513,7 @@
struct ast_frame *f = NULL;
int oldreadformat = AST_FORMAT_SLINEAR;
char dtmf[AST_MAX_EXTENSION] = "";
- time_t start, current;
+ struct timeval start = { 0, 0 }, current;
struct ast_datastore *datastore = NULL;
char *parse, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
const char *tmp2 = NULL;
@@ -552,7 +552,7 @@
/* Yay sound file */
filename_tmp = ast_strdupa(args.soundfile);
if (!ast_strlen_zero(args.timeout)) {
- if ((timeout = atoi(args.timeout)) == 0)
+ if ((timeout = atof(args.timeout) * 1000.0) == 0)
timeout = -1;
} else
timeout = 0;
@@ -612,8 +612,8 @@
/* Do timeout check (shared between audio/dtmf) */
if ((!quieted || strlen(dtmf)) && started == 1) {
- time(¤t);
- if ((current-start) >= timeout) {
+ current = ast_tvnow();
+ if ((ast_tvdiff_ms(start, current)) >= timeout) {
done = 1;
if (f)
ast_frfree(f);
@@ -642,7 +642,7 @@
ast_frfree(f);
break;
}
- time(&start);
+ start = ast_tvnow();
started = 1;
}
/* Write audio frame out to speech engine if no DTMF has been received */
@@ -701,10 +701,10 @@
}
if (!started) {
/* Change timeout to be 5 seconds for DTMF input */
- timeout = (chan->pbx && chan->pbx->dtimeout) ? chan->pbx->dtimeout : 5;
+ timeout = (chan->pbx && chan->pbx->dtimeoutms) ? chan->pbx->dtimeoutms : 5000;
started = 1;
}
- time(&start);
+ start = ast_tvnow();
snprintf(tmp, sizeof(tmp), "%c", f->subclass);
strncat(dtmf, tmp, sizeof(dtmf) - strlen(dtmf) - 1);
/* If the maximum length of the DTMF has been reached, stop now */
Modified: team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c Fri May 2 07:54:06 2008
@@ -1621,6 +1621,59 @@
return;
}
+struct insert_data {
+ char *sql;
+ char *dir;
+ char *msgnums;
+ void *data;
+ SQLLEN datalen;
+ const char *context;
+ const char *macrocontext;
+ const char *callerid;
+ const char *origtime;
+ const char *duration;
+ char *mailboxuser;
+ char *mailboxcontext;
+ const char *category;
+};
+
+static SQLHSTMT insert_data_cb(struct odbc_obj *obj, void *vdata)
+{
+ struct insert_data *data = vdata;
+ int res;
+ SQLHSTMT stmt;
+ SQLLEN len = data->datalen;
+
+ res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
+ if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+ ast_log(AST_LOG_WARNING, "SQL Alloc Handle failed!\n");
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ return NULL;
+ }
+
+ SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->dir), 0, (void *)data->dir, 0, NULL);
+ SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msgnums), 0, (void *)data->msgnums, 0, NULL);
+ SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, data->datalen, 0, (void *)data->data, data->datalen, &len);
+ SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->context), 0, (void *)data->context, 0, NULL);
+ SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->macrocontext), 0, (void *)data->macrocontext, 0, NULL);
+ SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->callerid), 0, (void *)data->callerid, 0, NULL);
+ SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->origtime), 0, (void *)data->origtime, 0, NULL);
+ SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->duration), 0, (void *)data->duration, 0, NULL);
+ SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxuser), 0, (void *)data->mailboxuser, 0, NULL);
+ SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxcontext), 0, (void *)data->mailboxcontext, 0, NULL);
+ if (!ast_strlen_zero(data->category)) {
+ SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->category), 0, (void *)data->category, 0, NULL);
+ }
+ res = SQLExecDirect(stmt, (unsigned char *)data->sql, SQL_NTS);
+ if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+ ast_log(AST_LOG_WARNING, "SQL Direct Execute failed!\n");
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ return NULL;
+ }
+
+ return stmt;
+}
+
/*!
* \brief Stores a voicemail into the database.
* \param dir the folder the mailbox folder to store the message.
@@ -1636,32 +1689,29 @@
*/
static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int msgnum)
{
- int x = 0;
- int res;
+ int res = 0;
int fd = -1;
void *fdm = MAP_FAILED;
size_t fdlen = -1;
SQLHSTMT stmt;
- SQLLEN len;
char sql[PATH_MAX];
char msgnums[20];
char fn[PATH_MAX];
char full_fn[PATH_MAX];
char fmt[80] = "";
char *c;
- const char *context = "";
- const char *macrocontext = "";
- const char *callerid = "";
- const char *origtime = "";
- const char *duration = "";
- const char *category = "";
struct ast_config *cfg = NULL;
struct odbc_obj *obj;
+ struct insert_data idata = { .sql = sql, .msgnums = msgnums, .dir = dir, .mailboxuser = mailboxuser, .mailboxcontext = mailboxcontext };
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
delete_file(dir, msgnum);
- obj = ast_odbc_request_obj(odbc_database, 0);
- if (obj) {
+ if (!(obj = ast_odbc_request_obj(odbc_database, 0))) {
+ ast_log(AST_LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
+ return -1;
+ }
+
+ do {
ast_copy_string(fmt, vmfmts, sizeof(fmt));
c = strchr(fmt, '|');
if (c)
@@ -1679,22 +1729,28 @@
fd = open(full_fn, O_RDWR);
if (fd < 0) {
ast_log(AST_LOG_WARNING, "Open of sound file '%s' failed: %s\n", full_fn, strerror(errno));
- ast_odbc_release_obj(obj);
- goto yuck;
+ res = -1;
+ break;
}
if (cfg) {
- context = ast_variable_retrieve(cfg, "message", "context");
- if (!context) context = "";
- macrocontext = ast_variable_retrieve(cfg, "message", "macrocontext");
- if (!macrocontext) macrocontext = "";
- callerid = ast_variable_retrieve(cfg, "message", "callerid");
- if (!callerid) callerid = "";
- origtime = ast_variable_retrieve(cfg, "message", "origtime");
- if (!origtime) origtime = "";
- duration = ast_variable_retrieve(cfg, "message", "duration");
- if (!duration) duration = "";
- category = ast_variable_retrieve(cfg, "message", "category");
- if (!category) category = "";
+ if (!(idata.context = ast_variable_retrieve(cfg, "message", "context"))) {
+ idata.context = "";
+ }
+ if (!(idata.macrocontext = ast_variable_retrieve(cfg, "message", "macrocontext"))) {
+ idata.macrocontext = "";
+ }
+ if (!(idata.callerid = ast_variable_retrieve(cfg, "message", "callerid"))) {
+ idata.callerid = "";
+ }
+ if (!(idata.origtime = ast_variable_retrieve(cfg, "message", "origtime"))) {
+ idata.origtime = "";
+ }
+ if (!(idata.duration = ast_variable_retrieve(cfg, "message", "duration"))) {
+ idata.duration = "";
+ }
+ if (!(idata.category = ast_variable_retrieve(cfg, "message", "category"))) {
+ idata.category = "";
+ }
}
fdlen = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
@@ -1702,58 +1758,34 @@
fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (fdm == MAP_FAILED) {
ast_log(AST_LOG_WARNING, "Memory map failed!\n");
- ast_odbc_release_obj(obj);
- goto yuck;
+ res = -1;
+ break;
}
- res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
- if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
- ast_log(AST_LOG_WARNING, "SQL Alloc Handle failed!\n");
- ast_odbc_release_obj(obj);
- goto yuck;
- }
- if (!ast_strlen_zero(category))
+ idata.data = fdm;
+ idata.datalen = fdlen;
+
+ if (!ast_strlen_zero(idata.category))
snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)", odbc_table);
else
snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)", odbc_table);
- res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
- if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
- ast_log(AST_LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
+
+ if ((stmt = ast_odbc_direct_execute(obj, insert_data_cb, &idata))) {
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
- ast_odbc_release_obj(obj);
- goto yuck;
- }
- len = fdlen; /* SQL_LEN_DATA_AT_EXEC(fdlen); */
- SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(dir), 0, (void *)dir, 0, NULL);
- SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL);
- SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, fdlen, 0, (void *)fdm, fdlen, &len);
- SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(context), 0, (void *)context, 0, NULL);
- SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(macrocontext), 0, (void *)macrocontext, 0, NULL);
- SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(callerid), 0, (void *)callerid, 0, NULL);
- SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(origtime), 0, (void *)origtime, 0, NULL);
- SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(duration), 0, (void *)duration, 0, NULL);
- SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(mailboxuser), 0, (void *)mailboxuser, 0, NULL);
- SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(mailboxcontext), 0, (void *)mailboxcontext, 0, NULL);
- if (!ast_strlen_zero(category))
- SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(category), 0, (void *)category, 0, NULL);
- res = ast_odbc_smart_execute(obj, stmt);
- if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+ } else {
ast_log(AST_LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
- SQLFreeHandle (SQL_HANDLE_STMT, stmt);
- ast_odbc_release_obj(obj);
- goto yuck;
- }
- SQLFreeHandle (SQL_HANDLE_STMT, stmt);
+ res = -1;
+ }
+ } while (0);
+ if (obj) {
ast_odbc_release_obj(obj);
- } else
- ast_log(AST_LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
-yuck:
+ }
if (cfg)
ast_config_destroy(cfg);
if (fdm != MAP_FAILED)
munmap(fdm, fdlen);
if (fd > -1)
close(fd);
- return x;
+ return res;
}
/*!
Modified: team/seanbright/resolve-shadow-warnings/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_sip.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_sip.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_sip.c Fri May 2 07:54:06 2008
@@ -4607,7 +4607,7 @@
/* Destroy Session-Timers if allocated */
if (p->stimer) {
if (p->stimer->st_active == TRUE && p->stimer->st_schedid > -1)
- ast_sched_del(sched, p->stimer->st_schedid);
+ AST_SCHED_DEL(sched, p->stimer->st_schedid);
ast_free(p->stimer);
p->stimer = NULL;
}
@@ -15977,7 +15977,7 @@
case 423: /* Interval too brief */
r->expiry = atoi(get_header(req, "Min-Expires"));
ast_log(LOG_WARNING, "Got 423 Interval too brief for service %s@%s, minimum is %d seconds\n", p->registry->username, p->registry->hostname, r->expiry);
- ast_sched_del(sched, r->timeout);
+ AST_SCHED_DEL(sched, r->timeout);
r->timeout = -1;
if (r->call) {
r->call = dialog_unref(r->call, "unsetting registry->call pointer-- case 423");
Modified: team/seanbright/resolve-shadow-warnings/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_zap.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_zap.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_zap.c Fri May 2 07:54:06 2008
@@ -11691,6 +11691,21 @@
return CLI_SUCCESS;
}
+static char *handle_pri_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "pri show version";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ ast_cli(a->fd, "libpri version: %s\n", pri_get_version());
+
+ return CLI_SUCCESS;
+}
+
static struct ast_cli_entry zap_pri_cli[] = {
AST_CLI_DEFINE(handle_pri_debug, "Enables PRI debugging on a span"),
AST_CLI_DEFINE(handle_pri_no_debug, "Disables PRI debugging on a span"),
@@ -11700,6 +11715,7 @@
AST_CLI_DEFINE(handle_pri_show_debug, "Displays current PRI debug settings"),
AST_CLI_DEFINE(handle_pri_set_debug_file, "Sends PRI debug output to the specified file"),
AST_CLI_DEFINE(handle_pri_unset_debug_file, "Ends PRI debug output to file"),
+ AST_CLI_DEFINE(handle_pri_version, "Displays libpri version"),
};
#endif /* HAVE_PRI */
@@ -13101,12 +13117,28 @@
return CLI_SUCCESS;
}
+static char *handle_ss7_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "ss7 show version";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ ast_cli(a->fd, "libss7 version: %s\n", ss7_get_version());
+
+ return CLI_SUCCESS;
+}
+
static struct ast_cli_entry zap_ss7_cli[] = {
AST_CLI_DEFINE(handle_ss7_debug, "Enables SS7 debugging on a linkset"),
AST_CLI_DEFINE(handle_ss7_no_debug, "Disables SS7 debugging on a linkset"),
AST_CLI_DEFINE(handle_ss7_block_cic, "Disables SS7 debugging on a linkset"),
AST_CLI_DEFINE(handle_ss7_unblock_cic, "Disables SS7 debugging on a linkset"),
AST_CLI_DEFINE(handle_ss7_show_linkset, "Shows the status of a linkset"),
+ AST_CLI_DEFINE(handle_ss7_version, "Displays libss7 version"),
};
#endif /* HAVE_SS7 */
Modified: team/seanbright/resolve-shadow-warnings/configure.ac
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/configure.ac?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/configure.ac (original)
+++ team/seanbright/resolve-shadow-warnings/configure.ac Fri May 2 07:54:06 2008
@@ -437,6 +437,7 @@
AST_GCC_ATTRIBUTE(unused)
AST_GCC_ATTRIBUTE(always_inline)
AST_GCC_ATTRIBUTE(deprecated)
+AST_GCC_ATTRIBUTE(sentinel)
AC_MSG_CHECKING(for -ffunction-sections support)
saved_CFLAGS="${CFLAGS}"
@@ -1274,9 +1275,9 @@
AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
-AST_EXT_LIB_CHECK([PRI], [pri], [pri_new_bri], [libpri.h])
-
-AST_EXT_LIB_CHECK([SS7], [ss7], [isup_set_generic_name], [libss7.h])
+AST_EXT_LIB_CHECK([PRI], [pri], [pri_get_version], [libpri.h])
+
+AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_get_version], [libss7.h])
if test "${USE_PWLIB}" != "no"; then
if test -n "${PWLIB_DIR}"; then
Modified: team/seanbright/resolve-shadow-warnings/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/funcs/func_timeout.c?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/funcs/func_timeout.c (original)
+++ team/seanbright/resolve-shadow-warnings/funcs/func_timeout.c Fri May 2 07:54:06 2008
@@ -37,7 +37,7 @@
static int timeout_read(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
- time_t myt;
+ struct timeval myt;
if (!chan)
return -1;
@@ -50,25 +50,25 @@
switch (*data) {
case 'a':
case 'A':
- if (chan->whentohangup == 0) {
+ if (ast_tvzero(chan->whentohangup)) {
ast_copy_string(buf, "0", len);
} else {
- time(&myt);
- snprintf(buf, len, "%d", (int) (chan->whentohangup - myt));
+ myt = ast_tvnow();
+ snprintf(buf, len, "%.3f", ast_tvdiff_ms(myt, chan->whentohangup) / 1000.0);
}
break;
case 'r':
case 'R':
if (chan->pbx) {
- snprintf(buf, len, "%d", chan->pbx->rtimeout);
+ snprintf(buf, len, "%.3f", chan->pbx->rtimeoutms / 1000.0);
}
break;
case 'd':
case 'D':
if (chan->pbx) {
- snprintf(buf, len, "%d", chan->pbx->dtimeout);
+ snprintf(buf, len, "%.3f", chan->pbx->dtimeoutms / 1000.0);
}
break;
@@ -83,9 +83,10 @@
static int timeout_write(struct ast_channel *chan, const char *cmd, char *data,
const char *value)
{
- int x;
+ double x;
char timestr[64];
struct ast_tm myt;
+ struct timeval when;
if (!chan)
return -1;
@@ -98,19 +99,20 @@
if (!value)
return -1;
- x = atoi(value);
- if (x < 0)
- x = 0;
+ if ((sscanf(value, "%ld%lf", (long *)&when.tv_sec, &x) == 0) || when.tv_sec < 0)
+ when.tv_sec = 0;
+ else
+ when.tv_usec = x * 1000000;
switch (*data) {
case 'a':
case 'A':
- ast_channel_setwhentohangup(chan, x);
+ ast_channel_setwhentohangup_tv(chan, when);
if (VERBOSITY_ATLEAST(3)) {
- if (chan->whentohangup) {
- struct timeval whentohangup = { chan->whentohangup, 0 };
+ if (!ast_tvzero(chan->whentohangup)) {
+ when = ast_tvadd(when, ast_tvnow());
ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S.%3q %Z",
- ast_localtime(&whentohangup, &myt, NULL));
+ ast_localtime(&when, &myt, NULL));
ast_verbose("Channel will hangup at %s.\n", timestr);
} else {
ast_verbose("Channel hangup cancelled.\n");
@@ -121,16 +123,16 @@
case 'r':
case 'R':
if (chan->pbx) {
- chan->pbx->rtimeout = x;
- ast_verb(3, "Response timeout set to %d\n", chan->pbx->rtimeout);
+ chan->pbx->rtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000.0;
+ ast_verb(3, "Response timeout set to %.3f\n", chan->pbx->rtimeoutms / 1000.0);
}
break;
case 'd':
case 'D':
if (chan->pbx) {
- chan->pbx->dtimeout = x;
- ast_verb(3, "Digit timeout set to %d\n", chan->pbx->dtimeout);
+ chan->pbx->dtimeoutms = when.tv_sec * 1000 + when.tv_usec / 1000.0;
+ ast_verb(3, "Digit timeout set to %.3f\n", chan->pbx->dtimeoutms / 1000.0);
}
break;
Modified: team/seanbright/resolve-shadow-warnings/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/include/asterisk/autoconfig.h.in?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/include/asterisk/autoconfig.h.in (original)
+++ team/seanbright/resolve-shadow-warnings/include/asterisk/autoconfig.h.in Fri May 2 07:54:06 2008
@@ -103,6 +103,9 @@
/* Define to 1 if your GCC C compiler supports the 'pure' attribute. */
#undef HAVE_ATTRIBUTE_pure
+
+/* Define to 1 if your GCC C compiler supports the 'sentinel' attribute. */
+#undef HAVE_ATTRIBUTE_sentinel
/* Define to 1 if your GCC C compiler supports the 'unused' attribute. */
#undef HAVE_ATTRIBUTE_unused
Modified: team/seanbright/resolve-shadow-warnings/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/include/asterisk/channel.h?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/include/asterisk/channel.h (original)
+++ team/seanbright/resolve-shadow-warnings/include/asterisk/channel.h Fri May 2 07:54:06 2008
@@ -455,7 +455,7 @@
int _softhangup; /*!< Whether or not we have been hung up... Do not set this value
directly, use ast_softhangup() */
- time_t whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */
+ struct timeval whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */
pthread_t blocker; /*!< If anyone is blocking, this is them */
ast_mutex_t lock_dont_use; /*!< Lock a channel for some operations. See ast_channel_lock() */
const char *blockproc; /*!< Procedure causing blocking */
@@ -920,19 +920,20 @@
/*! \brief Compare a offset with the settings of when to hang a channel up
* \param chan channel on which to check for hang up
- * \param offset offset in seconds from current time
+ * \param offset offset in seconds and useconds from current time
* \return 1, 0, or -1
* This function compares a offset from current time with the absolute time
* out on a channel (when to hang up). If the absolute time out on a channel
* is earlier than current time plus the offset, it returns 1, if the two
* time values are equal, it return 0, otherwise, it return -1.
*/
-int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset);
+int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset) __attribute__ ((deprecated));
+int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offset);
/*! \brief Set when to hang a channel up
*
* \param chan channel on which to check for hang up
- * \param offset offset in seconds from current time of when to hang up
+ * \param offset offset in seconds and useconds relative to the current time of when to hang up
*
* This function sets the absolute time out on a channel (when to hang up).
*
@@ -941,7 +942,8 @@
*
* \return Nothing
*/
-void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset);
+void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset) __attribute__ ((deprecated));
+void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset);
/*!
* \brief Answer a channel
Modified: team/seanbright/resolve-shadow-warnings/include/asterisk/compiler.h
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/include/asterisk/compiler.h?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/include/asterisk/compiler.h (original)
+++ team/seanbright/resolve-shadow-warnings/include/asterisk/compiler.h Fri May 2 07:54:06 2008
@@ -53,4 +53,10 @@
#define attribute_malloc
#endif
+#if HAVE_ATTRIBUTE_sentinel
+#define attribute_sentinel __attribute__((sentinel))
+#else
+#define attribute_sentinel
+#endif
+
#endif /* _ASTERISK_COMPILER_H */
Modified: team/seanbright/resolve-shadow-warnings/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/include/asterisk/config.h?view=diff&rev=115193&r1=115192&r2=115193
==============================================================================
--- team/seanbright/resolve-shadow-warnings/include/asterisk/config.h (original)
+++ team/seanbright/resolve-shadow-warnings/include/asterisk/config.h Fri May 2 07:54:06 2008
@@ -182,8 +182,8 @@
* that unlike the variables in ast_config, the resulting list of variables
* MUST be freed with ast_variables_destroy() as there is no container.
*/
-struct ast_variable *ast_load_realtime(const char *family, ...);
-struct ast_variable *ast_load_realtime_all(const char *family, ...);
+struct ast_variable *ast_load_realtime(const char *family, ...) attribute_sentinel;
+struct ast_variable *ast_load_realtime_all(const char *family, ...) attribute_sentinel;
/*!
* \brief Retrieve realtime configuration
@@ -194,7 +194,7 @@
* is thus stored inside a taditional ast_config structure rather than
* just returning a linked list of variables.
*/
-struct ast_config *ast_load_realtime_multientry(const char *family, ...);
+struct ast_config *ast_load_realtime_multientry(const char *family, ...) attribute_sentinel;
/*!
* \brief Update realtime configuration
@@ -204,7 +204,7 @@
* This function is used to update a parameter in realtime configuration space.
*
*/
-int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...);
+int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...) attribute_sentinel;
/*!
* \brief Create realtime configuration
@@ -212,7 +212,7 @@
* This function is used to create a parameter in realtime configuration space.
*
*/
[... 677 lines stripped ...]
More information about the asterisk-commits
mailing list