[asterisk-commits] branch murf/AEL2 r10176 - in /team/murf/AEL2: ./
apps/ channels/ funcs/ inclu...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Feb 14 20:45:36 MST 2006
Author: murf
Date: Tue Feb 14 21:45:29 2006
New Revision: 10176
URL: http://svn.digium.com/view/asterisk?rev=10176&view=rev
Log:
Merged revisions 8232,8242,8276,8281,8320,8347,8394,8412,8414,8418 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r8232 | russell | 2006-01-18 21:17:45 -0700 (Wed, 18 Jan 2006) | 3 lines
fix a seg fault due to assuming that space gets allocatted on the stack in the
same order that we declare the variables (issue #6290)
........
r8242 | russell | 2006-01-18 21:56:48 -0700 (Wed, 18 Jan 2006) | 3 lines
fix Message-Account header to use the ip address if the fromdomain
isn't set (issue #6278)
........
r8276 | tilghman | 2006-01-19 12:14:37 -0700 (Thu, 19 Jan 2006) | 2 lines
Bug 6072 - Memory leaks in the expression parser
........
r8281 | oej | 2006-01-19 12:40:28 -0700 (Thu, 19 Jan 2006) | 2 lines
Enable "musicclass" setting for sip peers as per the config sample.
........
r8320 | mogorman | 2006-01-19 18:00:46 -0700 (Thu, 19 Jan 2006) | 3 lines
solved problem with delayreject and iax trunking
bug 4291
........
r8347 | russell | 2006-01-20 11:34:42 -0700 (Fri, 20 Jan 2006) | 2 lines
fix invalid value of prev_q (issue #6302)
........
r8394 | tilghman | 2006-01-21 11:29:39 -0700 (Sat, 21 Jan 2006) | 2 lines
Bug 5936 - AddQueueMember fails on realtime queue, if queue not yet loaded
........
r8412 | russell | 2006-01-21 16:17:06 -0700 (Sat, 21 Jan 2006) | 2 lines
prevent the possibility of writing outside of the available workspace (issue #6271)
........
r8414 | russell | 2006-01-21 16:43:14 -0700 (Sat, 21 Jan 2006) | 2 lines
temporarily revert substring fix pending the result of the discussion in issue #6271
........
r8418 | russell | 2006-01-21 19:05:41 -0700 (Sat, 21 Jan 2006) | 3 lines
add a modified fix to prevent writing outside of the provided workspace when
calculating a substring (issue #6271)
........
Modified:
team/murf/AEL2/ (props changed)
team/murf/AEL2/.cleancount
team/murf/AEL2/apps/app_queue.c
team/murf/AEL2/apps/app_sayunixtime.c
team/murf/AEL2/apps/app_voicemail.c
team/murf/AEL2/channels/chan_agent.c
team/murf/AEL2/channels/chan_iax2.c
team/murf/AEL2/channels/chan_sip.c
team/murf/AEL2/funcs/func_enum.c
team/murf/AEL2/funcs/func_strings.c
team/murf/AEL2/include/asterisk/strings.h
team/murf/AEL2/res/res_agi.c
team/murf/AEL2/utils.c
Propchange: team/murf/AEL2/
------------------------------------------------------------------------------
automerge = 1
Propchange: team/murf/AEL2/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/murf/AEL2/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/murf/AEL2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Feb 14 21:45:29 2006
@@ -1,1 +1,1 @@
-/trunk:1-10091
+/trunk:1-10138
Modified: team/murf/AEL2/.cleancount
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/.cleancount?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/.cleancount (original)
+++ team/murf/AEL2/.cleancount Tue Feb 14 21:45:29 2006
@@ -1,1 +1,1 @@
-10
+11
Modified: team/murf/AEL2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/apps/app_queue.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/apps/app_queue.c (original)
+++ team/murf/AEL2/apps/app_queue.c Tue Feb 14 21:45:29 2006
@@ -1034,11 +1034,11 @@
q->count++;
res = 0;
manager_event(EVENT_FLAG_CALL, "Join",
- "Channel: %s\r\nCallerID: %s\r\nCallerIDName: %s\r\nQueue: %s\r\nPosition: %d\r\nCount: %d\r\n",
+ "Channel: %s\r\nCallerID: %s\r\nCallerIDName: %s\r\nQueue: %s\r\nPosition: %d\r\nCount: %d\r\nUniqueid: %s\r\n",
qe->chan->name,
qe->chan->cid.cid_num ? qe->chan->cid.cid_num : "unknown",
qe->chan->cid.cid_name ? qe->chan->cid.cid_name : "unknown",
- q->name, qe->pos, q->count );
+ q->name, qe->pos, q->count, qe->chan->uniqueid );
#if 0
ast_log(LOG_NOTICE, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
#endif
Modified: team/murf/AEL2/apps/app_sayunixtime.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/apps/app_sayunixtime.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/apps/app_sayunixtime.c (original)
+++ team/murf/AEL2/apps/app_sayunixtime.c Tue Feb 14 21:45:29 2006
@@ -2,6 +2,7 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (c) 2003 Tilghman Lesher. All rights reserved.
+ * Copyright (c) 2006 Digium, Inc.
*
* Tilghman Lesher <app_sayunixtime__200309 at the-tilghman.com>
*
@@ -40,7 +41,7 @@
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/say.h"
-
+#include "asterisk/app.h"
static char *tdesc = "Say time";
@@ -72,53 +73,39 @@
static int sayunixtime_exec(struct ast_channel *chan, void *data)
{
- int res=0;
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(timeval);
+ AST_APP_ARG(timezone);
+ AST_APP_ARG(format);
+ );
+ char *parse;
+ int res = 0;
struct localuser *u;
- char *s,*zone=NULL,*timec,*format;
time_t unixtime;
- struct timeval tv;
+ if (!data)
+ return 0;
+
+ if (!(parse = ast_strdupa(data)))
+ return -1;
+
LOCAL_USER_ADD(u);
- tv = ast_tvnow();
- unixtime = (time_t)tv.tv_sec;
+ args.format = "c"; /* default datetime */
- if( !strcasecmp(chan->language, "da" ) ) {
- format = "A dBY HMS";
- } else if ( !strcasecmp(chan->language, "de" ) ) {
- format = "A dBY HMS";
- } else {
- format = "ABdY 'digits/at' IMp";
- }
+ AST_STANDARD_APP_ARGS(args, parse);
- if (data) {
- s = data;
- if ((s = ast_strdupa(s))) {
- timec = strsep(&s,"|");
- if ((timec) && (*timec != '\0')) {
- long timein;
- if (sscanf(timec,"%ld",&timein) == 1) {
- unixtime = (time_t)timein;
- }
- }
- }
- if (s) {
- zone = strsep(&s,"|");
- if (zone && (*zone == '\0'))
- zone = NULL;
- if (s) {
- format = s;
- }
- }
- }
+ ast_get_time_t(args.timeval, &unixtime, time(NULL));
- if (chan->_state != AST_STATE_UP) {
+ if (chan->_state != AST_STATE_UP)
res = ast_answer(chan);
- }
+
if (!res)
- res = ast_say_date_with_format(chan, unixtime, AST_DIGIT_ANY, chan->language, format, zone);
+ res = ast_say_date_with_format(chan, unixtime, AST_DIGIT_ANY,
+ chan->language, args.format, args.timezone);
LOCAL_USER_REMOVE(u);
+
return res;
}
Modified: team/murf/AEL2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/apps/app_voicemail.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/apps/app_voicemail.c (original)
+++ team/murf/AEL2/apps/app_voicemail.c Tue Feb 14 21:45:29 2006
@@ -3608,25 +3608,21 @@
int res = 0;
struct vm_zone *the_zone = NULL;
time_t t;
- long tin;
-
- if (sscanf(origtime,"%ld",&tin) < 1) {
+
+ if (ast_get_time_t(origtime, &t, 0)) {
ast_log(LOG_WARNING, "Couldn't find origtime in %s\n", filename);
return 0;
}
- t = tin;
/* Does this user have a timezone specified? */
if (!ast_strlen_zero(vmu->zonetag)) {
/* Find the zone in the list */
struct vm_zone *z;
- z = zones;
- while (z) {
+ for (z = zones; z; z = z->next) {
if (!strcmp(z->name, vmu->zonetag)) {
the_zone = z;
break;
}
- z = z->next;
}
}
Modified: team/murf/AEL2/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/channels/chan_agent.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/channels/chan_agent.c (original)
+++ team/murf/AEL2/channels/chan_agent.c Tue Feb 14 21:45:29 2006
@@ -2193,6 +2193,8 @@
ast_verbose(VERBOSE_PREFIX_2 "Callback Agent '%s' logged in on %s\n", p->agent, p->loginchan);
ast_device_state_changed("Agent/%s", p->agent);
ast_mutex_unlock(&p->lock);
+ if (persistent_agents)
+ dump_agents();
}
AST_LIST_UNLOCK(&agents);
Modified: team/murf/AEL2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/channels/chan_iax2.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/channels/chan_iax2.c (original)
+++ team/murf/AEL2/channels/chan_iax2.c Tue Feb 14 21:45:29 2006
@@ -2562,7 +2562,7 @@
struct ast_variable *var;
struct ast_variable *tmp;
struct iax2_peer *peer=NULL;
- time_t regseconds, nowtime;
+ time_t regseconds = 0, nowtime;
int dynamic=0;
if (peername)
@@ -2603,8 +2603,7 @@
break;
}
} else if (!strcasecmp(tmp->name, "regseconds")) {
- if (sscanf(tmp->value, "%ld", (time_t *)®seconds) != 1)
- regseconds = 0;
+ ast_get_time_t(tmp->value, ®seconds, 0);
} else if (!strcasecmp(tmp->name, "ipaddr")) {
inet_aton(tmp->value, &(peer->addr.sin_addr));
} else if (!strcasecmp(tmp->name, "port")) {
Modified: team/murf/AEL2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/channels/chan_sip.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/channels/chan_sip.c (original)
+++ team/murf/AEL2/channels/chan_sip.c Tue Feb 14 21:45:29 2006
@@ -12129,15 +12129,12 @@
ast_variables_destroy(peer->chanvars);
peer->chanvars = NULL;
}
- while(v) {
- if (handle_common_options(&peerflags, &mask, v)) {
- v = v->next;
+ for (; v; v = v->next) {
+ if (handle_common_options(&peerflags, &mask, v))
continue;
- }
if (realtime && !strcasecmp(v->name, "regseconds")) {
- if (sscanf(v->value, "%ld", (time_t *)®seconds) != 1)
- regseconds = 0;
+ ast_get_time_t(v->value, ®seconds, 0);
} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
inet_aton(v->value, &(peer->addr.sin_addr));
} else if (realtime && !strcasecmp(v->name, "name"))
@@ -12286,10 +12283,6 @@
peer->maxms = 0;
}
}
- /* else if (strcasecmp(v->name,"type"))
- * ast_log(LOG_WARNING, "Ignoring %s\n", v->name);
- */
- v=v->next;
}
if (!ast_test_flag((&global_flags_page2), SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC) && realtime) {
time_t nowtime;
Modified: team/murf/AEL2/funcs/func_enum.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/funcs/func_enum.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/funcs/func_enum.c (original)
+++ team/murf/AEL2/funcs/func_enum.c Tue Feb 14 21:45:29 2006
@@ -66,7 +66,7 @@
);
int res = 0;
char tech[80];
- char dest[80] = "";
+ char dest[256] = "";
struct localuser *u;
char *s, *p;
Modified: team/murf/AEL2/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/funcs/func_strings.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/funcs/func_strings.c (original)
+++ team/murf/AEL2/funcs/func_strings.c Tue Feb 14 21:45:29 2006
@@ -232,8 +232,8 @@
AST_APP_ARG(timezone);
AST_APP_ARG(format);
);
- long epochi;
- struct tm time;
+ time_t epochi;
+ struct tm tm;
buf[0] = '\0';
@@ -245,14 +245,13 @@
AST_STANDARD_APP_ARGS(args, parse);
- if (ast_strlen_zero(args.epoch) || !sscanf(args.epoch, "%ld", &epochi)) {
- struct timeval tv = ast_tvnow();
- epochi = tv.tv_sec;
- }
-
- ast_localtime(&epochi, &time, args.timezone);
-
- if (!strftime(buf, len, args.format ? args.format : "%c", &time))
+ ast_get_time_t(args.epoch, &epochi, time(NULL));
+ ast_localtime(&epochi, &tm, args.timezone);
+
+ if (!args.format)
+ args.format = "%c";
+
+ if (!strftime(buf, len, args.format, &tm))
ast_log(LOG_WARNING, "C function strftime() output nothing?!!\n");
buf[len - 1] = '\0';
@@ -350,6 +349,49 @@
.read = function_eval,
};
+static int keypadhash(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+ char *bufptr, *dataptr;
+
+ for (bufptr = buf, dataptr = data; bufptr < buf + len - 1; dataptr++) {
+ if (*dataptr == '1') {
+ *bufptr++ = '1';
+ } else if (strchr("AaBbCc2", *dataptr)) {
+ *bufptr++ = '2';
+ } else if (strchr("DdEeFf3", *dataptr)) {
+ *bufptr++ = '3';
+ } else if (strchr("GgHhIi4", *dataptr)) {
+ *bufptr++ = '4';
+ } else if (strchr("JjKkLl5", *dataptr)) {
+ *bufptr++ = '5';
+ } else if (strchr("MmNnOo6", *dataptr)) {
+ *bufptr++ = '6';
+ } else if (strchr("PpQqRrSs7", *dataptr)) {
+ *bufptr++ = '7';
+ } else if (strchr("TtUuVv8", *dataptr)) {
+ *bufptr++ = '8';
+ } else if (strchr("WwXxYyZz9", *dataptr)) {
+ *bufptr++ = '9';
+ } else if (*dataptr == '0') {
+ *bufptr++ = '0';
+ } else if (*dataptr == '\0') {
+ *bufptr++ = '\0';
+ break;
+ }
+ }
+ buf[len - 1] = '\0';
+
+ return 0;
+}
+
+static struct ast_custom_function keypadhash_function = {
+ .name = "KEYPADHASH",
+ .synopsis = "Hash the letters in the string into the equivalent keypad numbers.",
+ .syntax = "KEYPADHASH(<string>)",
+ .read = keypadhash,
+ .desc = "Example: ${KEYPADHASH(Les)} returns \"537\"\n",
+};
+
static char *tdesc = "String handling dialplan functions";
int unload_module(void)
@@ -364,6 +406,7 @@
res |= ast_custom_function_unregister(&strftime_function);
res |= ast_custom_function_unregister(&strptime_function);
res |= ast_custom_function_unregister(&eval_function);
+ res |= ast_custom_function_unregister(&keypadhash_function);
return res;
}
@@ -380,6 +423,7 @@
res |= ast_custom_function_register(&strftime_function);
res |= ast_custom_function_register(&strptime_function);
res |= ast_custom_function_register(&eval_function);
+ res |= ast_custom_function_register(&keypadhash_function);
return res;
}
Modified: team/murf/AEL2/include/asterisk/strings.h
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/include/asterisk/strings.h?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/include/asterisk/strings.h (original)
+++ team/murf/AEL2/include/asterisk/strings.h Tue Feb 14 21:45:29 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -223,6 +223,15 @@
*/
void ast_join(char *s, size_t len, char * const w[]);
+/*
+ \brief Parse a time (integer) string.
+ \param src String to parse
+ \param dst Destination
+ \param _default Value to use if the string does not contain a valid time
+ \return zero on success, non-zero on failure
+*/
+int ast_get_time_t(const char *src, time_t *dst, time_t _default);
+
/* The realloca lets us ast_restrdupa(), but you can't mix any other ast_strdup calls! */
struct ast_realloca {
Modified: team/murf/AEL2/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/res/res_agi.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/res/res_agi.c (original)
+++ team/murf/AEL2/res/res_agi.c Tue Feb 14 21:45:29 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -190,17 +190,23 @@
close(s);
return -1;
}
+
pfds[0].fd = s;
pfds[0].events = POLLOUT;
- if (poll(pfds, 1, MAX_AGI_CONNECT) != 1) {
- ast_log(LOG_WARNING, "Connect to '%s' failed!\n", agiurl);
- close(s);
- return -1;
- }
- if (write(s, "agi_network: yes\n", strlen("agi_network: yes\n")) < 0) {
- ast_log(LOG_WARNING, "Connect to '%s' failed: %s\n", agiurl, strerror(errno));
- close(s);
- return -1;
+ while (poll(pfds, 1, MAX_AGI_CONNECT) != 1) {
+ if (errno != EINTR) {
+ ast_log(LOG_WARNING, "Connect to '%s' failed: %s\n", agiurl, strerror(errno));
+ close(s);
+ return -1;
+ }
+ }
+
+ while (write(s, "agi_network: yes\n", strlen("agi_network: yes\n")) < 0) {
+ if (errno != EINTR) {
+ ast_log(LOG_WARNING, "Connect to '%s' failed: %s\n", agiurl, strerror(errno));
+ close(s);
+ return -1;
+ }
}
/* If we have a script parameter, relay it to the fastagi server */
@@ -742,16 +748,13 @@
if (res == 1)
return RESULT_SUCCESS;
fdprintf(agi->fd, "200 result=%d\n", res);
- if (res >= 0)
- return RESULT_SUCCESS;
- else
- return RESULT_FAILURE;
+ return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
{
int res=0;
- long unixtime;
+ time_t unixtime;
char *format, *zone=NULL;
if (argc < 4)
@@ -770,19 +773,15 @@
if (argc > 5 && !ast_strlen_zero(argv[5]))
zone = argv[5];
- if (sscanf(argv[2], "%ld", &unixtime) != 1)
- return RESULT_SHOWUSAGE;
-
- res = ast_say_date_with_format(chan, (time_t) unixtime, argv[3], chan->language, format, zone);
+ if (ast_get_time_t(argv[2], &unixtime, 0))
+ return RESULT_SHOWUSAGE;
+
+ res = ast_say_date_with_format(chan, unixtime, argv[3], chan->language, format, zone);
if (res == 1)
return RESULT_SUCCESS;
fdprintf(agi->fd, "200 result=%d\n", res);
-
- if (res >= 0)
- return RESULT_SUCCESS;
- else
- return RESULT_FAILURE;
+ return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
static int handle_sayphonetic(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
Modified: team/murf/AEL2/utils.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2/utils.c?rev=10176&r1=10175&r2=10176&view=diff
==============================================================================
--- team/murf/AEL2/utils.c (original)
+++ team/murf/AEL2/utils.c Tue Feb 14 21:45:29 2006
@@ -1046,3 +1046,27 @@
va_end(ap2);
}
+
+
+/*
+ * get values from config variables.
+ */
+int ast_get_time_t(const char *src, time_t *dst, time_t _default)
+{
+ long t;
+
+ if (dst == NULL)
+ return -1;
+
+ *dst = _default;
+
+ if (ast_strlen_zero(src))
+ return -1;
+
+ /* only integer at the moment, but one day we could accept more formats */
+ if (sscanf(src, "%ld", &t) == 1) {
+ *dst = t;
+ return 0;
+ } else
+ return -1;
+}
More information about the asterisk-commits
mailing list