[asterisk-commits] branch murf/bug_6072 - r8423 in
/team/murf/bug_6072: ./ apps/ channels/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Jan 21 19:32:20 MST 2006
Author: murf
Date: Sat Jan 21 20:32:16 2006
New Revision: 8423
URL: http://svn.digium.com/view/asterisk?rev=8423&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/bug_6072/ (props changed)
team/murf/bug_6072/apps/app_milliwatt.c
team/murf/bug_6072/apps/app_queue.c
team/murf/bug_6072/ast_expr2.fl
team/murf/bug_6072/ast_expr2f.c
team/murf/bug_6072/channels/chan_iax2.c
team/murf/bug_6072/channels/chan_sip.c
team/murf/bug_6072/pbx.c
Propchange: team/murf/bug_6072/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Jan 21 20:32:16 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-8225
+/branches/1.2:1-8422
Modified: team/murf/bug_6072/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6072/apps/app_milliwatt.c?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- team/murf/bug_6072/apps/app_milliwatt.c (original)
+++ team/murf/bug_6072/apps/app_milliwatt.c Sat Jan 21 20:32:16 2006
@@ -73,30 +73,29 @@
static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int samples)
{
struct ast_frame wf;
- unsigned char waste[AST_FRIENDLY_OFFSET];
- unsigned char buf[640];
+ unsigned char buf[AST_FRIENDLY_OFFSET + 640];
int i,*indexp = (int *) data;
- if (len > sizeof(buf))
+ if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
{
- ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)sizeof(buf),len);
- len = sizeof(buf);
+ ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
+ len = sizeof(buf) - AST_FRIENDLY_OFFSET;
}
- waste[0] = 0; /* make compiler happy */
wf.frametype = AST_FRAME_VOICE;
wf.subclass = AST_FORMAT_ULAW;
wf.offset = AST_FRIENDLY_OFFSET;
wf.mallocd = 0;
- wf.data = buf;
+ wf.data = buf + AST_FRIENDLY_OFFSET;
wf.datalen = len;
wf.samples = wf.datalen;
wf.src = "app_milliwatt";
wf.delivery.tv_sec = 0;
wf.delivery.tv_usec = 0;
+ wf.prev = wf.next = NULL;
/* create a buffer containing the digital milliwatt pattern */
for(i = 0; i < len; i++)
{
- buf[i] = digital_milliwatt[(*indexp)++];
+ buf[AST_FRIENDLY_OFFSET + i] = digital_milliwatt[(*indexp)++];
*indexp &= 7;
}
if (ast_write(chan,&wf) < 0)
Modified: team/murf/bug_6072/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6072/apps/app_queue.c?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- team/murf/bug_6072/apps/app_queue.c (original)
+++ team/murf/bug_6072/apps/app_queue.c Sat Jan 21 20:32:16 2006
@@ -758,25 +758,21 @@
/*!\brief Reload a single queue via realtime.
\return Return the queue, or NULL if it doesn't exist.
- \note Should be called with the global qlock locked.
- When found, the queue is returned with q->lock locked. */
-static struct ast_call_queue *reload_queue_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
+ \note Should be called with the global qlock locked. */
+static struct ast_call_queue *find_queue_by_name_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
{
struct ast_variable *v;
- struct ast_call_queue *q, *prev_q;
+ struct ast_call_queue *q, *prev_q = NULL;
struct member *m, *prev_m, *next_m;
char *interface;
char *tmp, *tmp_name;
char tmpbuf[64]; /* Must be longer than the longest queue param name. */
/* Find the queue in the in-core list (we will create a new one if not found). */
- q = queues;
- prev_q = NULL;
- while (q) {
+ for (q = queues; q; q = q->next) {
if (!strcasecmp(q->name, queuename)) {
break;
}
- q = q->next;
prev_q = q;
}
@@ -788,6 +784,7 @@
ast_mutex_unlock(&q->lock);
return NULL;
} else {
+ ast_mutex_unlock(&q->lock);
return q;
}
}
@@ -882,13 +879,60 @@
m = next_m;
}
+ ast_mutex_unlock(&q->lock);
+
return q;
}
-static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
+static struct ast_call_queue *load_realtime_queue(char *queuename)
{
struct ast_variable *queue_vars = NULL;
struct ast_config *member_config = NULL;
+ struct ast_call_queue *q;
+
+ /* Find the queue in the in-core list first. */
+ ast_mutex_lock(&qlock);
+ for (q = queues; q; q = q->next) {
+ if (!strcasecmp(q->name, queuename)) {
+ break;
+ }
+ }
+ ast_mutex_unlock(&qlock);
+
+ if (!q) {
+ /*! \note Load from realtime before taking the global qlock, to avoid blocking all
+ queue operations while waiting for the DB.
+
+ This will be two separate database transactions, so we might
+ see queue parameters as they were before another process
+ changed the queue and member list as it was after the change.
+ Thus we might see an empty member list when a queue is
+ deleted. In practise, this is unlikely to cause a problem. */
+
+ queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
+ if (queue_vars) {
+ member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
+ if (!member_config) {
+ ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
+ return NULL;
+ }
+ }
+
+ ast_mutex_lock(&qlock);
+
+ q = find_queue_by_name_rt(queuename, queue_vars, member_config);
+ if (member_config)
+ ast_config_destroy(member_config);
+ if (queue_vars)
+ ast_variables_destroy(queue_vars);
+
+ ast_mutex_unlock(&qlock);
+ }
+ return q;
+}
+
+static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
+{
struct ast_call_queue *q;
struct queue_ent *cur, *prev = NULL;
int res = -1;
@@ -896,35 +940,12 @@
int inserted = 0;
enum queue_member_status stat;
- /*! \note Load from realtime before taking the global qlock, to avoid blocking all
- queue operations while waiting for the DB.
-
- This will be two separate database transactions, so we might
- see queue parameters as they were before another process
- changed the queue and member list as it was after the change.
- Thus we might see an empty member list when a queue is
- deleted. In practise, this is unlikely to cause a problem. */
- queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
- if (queue_vars) {
- member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
- if (!member_config) {
- ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
- return res;
- }
- }
+ q = load_realtime_queue(queuename);
+ if (!q)
+ return res;
ast_mutex_lock(&qlock);
- q = reload_queue_rt(queuename, queue_vars, member_config);
- /* Note: If found, reload_queue_rt() returns with q->lock locked. */
- if(member_config)
- ast_config_destroy(member_config);
- if(queue_vars)
- ast_variables_destroy(queue_vars);
-
- if (!q) {
- ast_mutex_unlock(&qlock);
- return res;
- }
+ ast_mutex_lock(&q->lock);
/* This is our one */
stat = get_member_status(q);
@@ -2405,41 +2426,42 @@
struct member *new_member;
int res = RES_NOSUCHQUEUE;
+ /* \note Ensure the appropriate realtime queue is loaded. Note that this
+ * short-circuits if the queue is already in memory. */
+ q = load_realtime_queue(queuename);
+
ast_mutex_lock(&qlock);
- for (q = queues ; q ; q = q->next) {
+
+ if (q) {
ast_mutex_lock(&q->lock);
- if (!strcmp(q->name, queuename)) {
- if (interface_exists(q, interface) == NULL) {
- new_member = create_queue_member(interface, penalty, paused);
-
- if (new_member != NULL) {
- new_member->dynamic = 1;
- new_member->next = q->members;
- q->members = new_member;
- manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
- "Queue: %s\r\n"
- "Location: %s\r\n"
- "Membership: %s\r\n"
- "Penalty: %d\r\n"
- "CallsTaken: %d\r\n"
- "LastCall: %d\r\n"
- "Status: %d\r\n"
- "Paused: %d\r\n",
- q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
- new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
+ if (interface_exists(q, interface) == NULL) {
+ new_member = create_queue_member(interface, penalty, paused);
+
+ if (new_member != NULL) {
+ new_member->dynamic = 1;
+ new_member->next = q->members;
+ q->members = new_member;
+ manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
+ "Queue: %s\r\n"
+ "Location: %s\r\n"
+ "Membership: %s\r\n"
+ "Penalty: %d\r\n"
+ "CallsTaken: %d\r\n"
+ "LastCall: %d\r\n"
+ "Status: %d\r\n"
+ "Paused: %d\r\n",
+ q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
+ new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
- if (dump)
- dump_queue_members(q);
-
- res = RES_OKAY;
- } else {
- res = RES_OUTOFMEMORY;
- }
+ if (dump)
+ dump_queue_members(q);
+
+ res = RES_OKAY;
} else {
- res = RES_EXISTS;
- }
- ast_mutex_unlock(&q->lock);
- break;
+ res = RES_OUTOFMEMORY;
+ }
+ } else {
+ res = RES_EXISTS;
}
ast_mutex_unlock(&q->lock);
}
@@ -3273,7 +3295,13 @@
time(&now);
if ((!queue_show && argc != 2) || (queue_show && argc != 3))
return RESULT_SHOWUSAGE;
+
+ /* We only want to load realtime queues when a specific queue is asked for. */
+ if (queue_show)
+ load_realtime_queue(argv[2]);
+
ast_mutex_lock(&qlock);
+
q = queues;
if (!q) {
ast_mutex_unlock(&qlock);
Modified: team/murf/bug_6072/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6072/ast_expr2.fl?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- team/murf/bug_6072/ast_expr2.fl (original)
+++ team/murf/bug_6072/ast_expr2.fl Sat Jan 21 20:32:16 2006
@@ -1,22 +1,4 @@
%{
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2006, Digium, Inc.
- *
- * Mark Spencer <markster at digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
/*! \file
*
* \brief Dialplan Expression Parser
@@ -112,7 +94,7 @@
[0-9]+ { SET_COLUMNS; /* the original behavior of the expression parser was to bring in numbers as a numeric string */
SET_NUMERIC_STRING;
return TOKEN;}
-[a-zA-Z0-9,.';\\_^$#@]+ {SET_COLUMNS; SET_STRING; return TOKEN;}
+[a-zA-Z0-9,.';\\_^%$#@!]+ {SET_COLUMNS; SET_STRING; return TOKEN;}
<var>[^{}]*\} {curlycount--; if(curlycount < 0){ BEGIN(trail); yymore();} else { yymore();}}
<var>[^{}]*\{ {curlycount++; yymore(); }
Modified: team/murf/bug_6072/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6072/ast_expr2f.c?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- team/murf/bug_6072/ast_expr2f.c (original)
+++ team/murf/bug_6072/ast_expr2f.c Sat Jan 21 20:32:16 2006
@@ -523,34 +523,34 @@
7, -11, -11, -11, -11, -11, -11, -11, -11, -11,
-11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
-11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, 37, -11, -11, -11, -11, -11, -11, -11, -11,
-
- -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
- -11, -11, -11, -11, -11, -11, -11, -11
- },
-
- {
- 7, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 39, 38, 38, 38, 38, 38,
-
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38
+ -11, -11, -11, 37, -11, 37, 37, 37, -11, 37,
+ -11, -11, -11, -11, 37, -11, 37, -11, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, -11, 37,
+ -11, 38, -11, -11, 37, 37, 37, 37, 37, 37,
+
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, -11, 37, -11, 37, 37, -11, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, -11, -11, -11, -11, -11
+ },
+
+ {
+ 7, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 40, 39, 39, 39, 39, 39,
+
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39
},
{
@@ -558,51 +558,51 @@
-13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
-13, -13, -13, -13, -13, -13, -13, -13, -13, -13,
- -13, -13, -13, -13, -13, 40, 40, -13, -13, 40,
- -13, -13, -13, -13, 40, -13, 40, -13, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, -13, 40,
- -13, -13, -13, -13, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, -13, 40, -13, 40, 40, -13, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
-
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, -13, -13, -13, -13, -13
+ -13, -13, -13, 37, -13, 37, 37, 37, -13, 37,
+ -13, -13, -13, -13, 37, -13, 37, -13, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, -13, 37,
+ -13, -13, -13, -13, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, -13, 37, -13, 37, 37, -13, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, -13, -13, -13, -13, -13
},
{
7, -14, -14, -14, -14, -14, -14, -14, -14, -14,
-14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
-14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
- -14, -14, -14, -14, -14, 40, 40, -14, -14, 40,
- -14, -14, -14, -14, 40, -14, 40, -14, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, -14, 40,
- -14, -14, -14, -14, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
-
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, -14, 40, -14, 40, 40, -14, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 41, -14, -14, -14, -14
+ -14, -14, -14, 37, -14, 37, 37, 37, -14, 37,
+ -14, -14, -14, -14, 37, -14, 37, -14, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, -14, 37,
+ -14, -14, -14, -14, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, -14, 37, -14, 37, 37, -14, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 41, -14, -14, -14, -14
},
{
7, -15, -15, -15, -15, -15, -15, -15, -15, -15,
-15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
-15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
-
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
- -15, -15, -15, -15, -15, -15, -15, -15
+ -15, -15, -15, 37, -15, 37, 37, 37, -15, 37,
+ -15, -15, -15, -15, 37, -15, 37, -15, 37, 37,
+
+ 37, 37, 37, 37, 37, 37, 37, 37, -15, 37,
+ -15, -15, -15, -15, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, -15, 37, -15, 37, 37, -15, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, -15, -15, -15, -15, -15
},
{
@@ -731,17 +731,17 @@
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
-23, -23, -23, -23, -23, -23, -23, -23, -23, -23,
- -23, -23, -23, -23, -23, 40, 40, -23, -23, 40,
- -23, -23, -23, -23, 40, -23, 40, -23, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42, -23, 40,
- -23, -23, -23, -23, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, -23, 40, -23, 40, 40, -23, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
-
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, -23, -23, -23, -23, -23
+ -23, -23, -23, 37, -23, 37, 37, 37, -23, 37,
+ -23, -23, -23, -23, 37, -23, 37, -23, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 42, -23, 37,
+ -23, -23, -23, -23, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, -23, 37, -23, 37, 37, -23, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, -23, -23, -23, -23, -23
},
{
@@ -973,51 +973,51 @@
7, -37, -37, -37, -37, -37, -37, -37, -37, -37,
-37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
-37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
-
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
- -37, -37, -37, -37, -37, -37, -37, -37
- },
-
- {
- 7, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 39, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
-
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 38, 38, 38, 38, 38
- },
-
- {
- 7, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
-
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
- -39, -39, -39, -39, -39, -39, -39, -39
+ -37, -37, -37, 37, -37, 37, 37, 37, -37, 37,
+ -37, -37, -37, -37, 37, -37, 37, -37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, -37, 37,
+ -37, -37, -37, -37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+
+ 37, -37, 37, -37, 37, 37, -37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, -37, -37, -37, -37, -37
+ },
+
+ {
+ 7, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
+ -38, -38, -38, -38, -38, -38, -38, -38
+ },
+
+ {
+ 7, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+
+ 39, 39, 39, 39, 40, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39
},
@@ -1025,17 +1025,17 @@
7, -40, -40, -40, -40, -40, -40, -40, -40, -40,
-40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
-40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
- -40, -40, -40, -40, -40, 40, 40, -40, -40, 40,
- -40, -40, -40, -40, 40, -40, 40, -40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, -40, 40,
- -40, -40, -40, -40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, -40, 40, -40, 40, 40, -40, 40, 40, 40,
-
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, -40, -40, -40, -40, -40
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
+ -40, -40, -40, -40, -40, -40, -40, -40
},
{
@@ -1059,17 +1059,17 @@
7, -42, -42, -42, -42, -42, -42, -42, -42, -42,
-42, -42, -42, -42, -42, -42, -42, -42, -42, -42,
-42, -42, -42, -42, -42, -42, -42, -42, -42, -42,
- -42, -42, -42, -42, -42, 40, 40, -42, -42, 40,
-
- -42, -42, -42, -42, 40, -42, 40, -42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42, -42, 40,
- -42, -42, -42, -42, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, -42, 40, -42, 40, 40, -42, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, -42, -42, -42, -42, -42
+ -42, -42, -42, 37, -42, 37, 37, 37, -42, 37,
+
+ -42, -42, -42, -42, 37, -42, 37, -42, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 42, -42, 37,
+ -42, -42, -42, -42, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, -42, 37, -42, 37, 37, -42, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 37, 37, -42, -42, -42, -42, -42
},
{
@@ -1258,9 +1258,9 @@
static yyconst flex_int16_t yy_accept[52] =
{ 0,
0, 0, 0, 0, 29, 29, 33, 32, 22, 24,
- 32, 32, 26, 26, 14, 2, 19, 20, 12, 10,
+ 26, 32, 26, 26, 14, 2, 19, 20, 12, 10,
11, 13, 25, 16, 6, 4, 5, 15, 1, 17,
- 32, 28, 27, 29, 30, 30, 9, 0, 23, 26,
+ 32, 28, 27, 29, 30, 30, 26, 9, 0, 23,
21, 25, 18, 8, 3, 7, 0, 28, 27, 29,
31
} ;
@@ -1268,9 +1268,9 @@
static yyconst yy_state_type yy_NUL_trans[52] =
{ 0,
8, 8, 31, 31, 34, 34, 0, 0, 0, 0,
- 0, 38, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 39, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 47, 0, 0, 50, 0, 0, 0, 38, 0, 0,
+ 47, 0, 0, 50, 0, 0, 0, 0, 39, 0,
0, 0, 0, 0, 0, 0, 47, 0, 0, 50,
0
} ;
Modified: team/murf/bug_6072/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6072/channels/chan_iax2.c?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- team/murf/bug_6072/channels/chan_iax2.c (original)
+++ team/murf/bug_6072/channels/chan_iax2.c Sat Jan 21 20:32:16 2006
@@ -4894,6 +4894,8 @@
fh.iseqno = 0;
fh.type = AST_FRAME_IAX;
fh.csub = compress_subclass(IAX_COMMAND_INVAL);
+ if (iaxdebug)
+ iax_showframe(NULL, &fh, 0, sin, 0);
#if 0
if (option_debug)
#endif
@@ -6766,6 +6768,10 @@
break;
if (ies.provverpres && ies.serviceident && sin.sin_addr.s_addr)
check_provisioning(&sin, fd, ies.serviceident, ies.provver);
+ /* If we're in trunk mode, do it now, and update the trunk number in our frame before continuing */
+ if (ast_test_flag(iaxs[fr.callno], IAX_TRUNK)) {
+ fr.callno = make_trunk(fr.callno, 1);
+ }
/* For security, always ack immediately */
if (delayreject)
send_command_immediate(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr.ts, NULL, 0,fr.iseqno);
@@ -6775,10 +6781,6 @@
if (authdebug)
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, who was trying to reach '%s@%s'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), iaxs[fr.callno]->exten, iaxs[fr.callno]->context);
break;
- }
- /* If we're in trunk mode, do it now, and update the trunk number in our frame before continuing */
- if (ast_test_flag(iaxs[fr.callno], IAX_TRUNK)) {
- fr.callno = make_trunk(fr.callno, 1);
}
/* This might re-enter the IAX code and need the lock */
if (strcasecmp(iaxs[fr.callno]->exten, "TBD")) {
Modified: team/murf/bug_6072/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6072/channels/chan_sip.c?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- team/murf/bug_6072/channels/chan_sip.c (original)
+++ team/murf/bug_6072/channels/chan_sip.c Sat Jan 21 20:32:16 2006
@@ -5113,13 +5113,14 @@
char tmp[500];
char *t = tmp;
size_t maxbytes = sizeof(tmp);
+ char iabuf[INET_ADDRSTRLEN];
initreqprep(&req, p, SIP_NOTIFY);
add_header(&req, "Event", "message-summary");
add_header(&req, "Content-Type", default_notifymime);
ast_build_string(&t, &maxbytes, "Messages-Waiting: %s\r\n", newmsgs ? "yes" : "no");
- ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n", !ast_strlen_zero(vmexten) ? vmexten : global_vmexten, p->fromdomain);
+ ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n", !ast_strlen_zero(vmexten) ? vmexten : global_vmexten, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain);
ast_build_string(&t, &maxbytes, "Voice-Message: %d/%d (0/0)\r\n", newmsgs, oldmsgs);
if (t > tmp + sizeof(tmp))
@@ -12171,7 +12172,7 @@
}
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode));
- } else if (!strcasecmp(v->name, "musiconhold")) {
+ } else if (!strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
ast_copy_string(peer->musicclass, v->value, sizeof(peer->musicclass));
} else if (!strcasecmp(v->name, "mailbox")) {
ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
Modified: team/murf/bug_6072/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_6072/pbx.c?rev=8423&r1=8422&r2=8423&view=diff
==============================================================================
--- team/murf/bug_6072/pbx.c (original)
+++ team/murf/bug_6072/pbx.c Sat Jan 21 20:32:16 2006
@@ -927,40 +927,38 @@
}
}
-static char *substring(char *value, int offset, int length, char *workspace, size_t workspace_len)
+/*! \brief takes a substring. It is ok to call with value == workspace.
+ *
+ * offset < 0 means start from the end of the string and set the beginning
+ * to be that many characters back.
+ * length is the length of the substring, -1 means unlimited
+ * (we take any negative value).
+ * Always return a copy in workspace.
+ */
+static char *substring(const char *value, int offset, int length, char *workspace, size_t workspace_len)
{
char *ret = workspace;
-
- /* No need to do anything */
- if (offset == 0 && length==-1) {
- return value;
- }
-
- ast_copy_string(workspace, value, workspace_len);
-
- if (abs(offset) > strlen(ret)) { /* Offset beyond string */
- if (offset >= 0)
- offset = strlen(ret);
- else
- offset =- strlen(ret);
- }
-
- /* Detect too-long length */
- if ((offset < 0 && length > -offset) || (offset >= 0 && offset+length > strlen(ret))) {
- if (offset >= 0)
- length = strlen(ret)-offset;
- else
- length = strlen(ret)+offset;
- }
-
- /* Bounce up to the right offset */
- if (offset >= 0)
- ret += offset;
- else
- ret += strlen(ret)+offset;
-
- /* Chop off at the requisite length */
- if (length >= 0)
+ int lr; /* length of the input string after the copy */
+
+ ast_copy_string(workspace, value, workspace_len); /* always make a copy */
+
+ if (offset == 0 && length < 0) /* take the whole string */
+ return ret;
+
+ lr = strlen(ret); /* compute length after copy, so we never go out of the workspace */
+
+ if (offset < 0) { /* translate negative offset into positive ones */
+ offset = lr + offset;
+ if (offset < 0) /* If the negative offset was greater than the length of the string, just start at the beginning */
+ offset = 0;
+ }
+
+ /* too large offset result in empty string so we know what to return */
+ if (offset >= lr)
+ return ret + lr; /* the final '\0' */
+
+ ret += offset; /* move to the start position */
+ if (length >= 0 && length < lr - offset) /* truncate if necessary */
ret[length] = '\0';
return ret;
More information about the asterisk-commits
mailing list