[asterisk-commits] dlee: branch dlee/jansson r378647 - in /team/dlee/jansson: ./ addons/ apps/ a...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 7 09:32:03 CST 2013
Author: dlee
Date: Mon Jan 7 09:31:47 2013
New Revision: 378647
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378647
Log:
Multiple revisions 378220,378248-378249,378259,378288,378322,378374,378377,378384,378410,378412,378414,378429,378458,378460,378488,378516,378543,378557,378565,378585,378593,378623-378624,378634
........
r378220 | kmoore | 2012-12-31 08:46:06 -0600 (Mon, 31 Dec 2012) | 18 lines
Ensure chan_sip rejects encrypted streams without crypto info
This ensures that Asterisk rejects encrypted media streams (RTP/SAVP
audio and video) that are missing cryptographic keys and ensures that
the incoming SDP is consistent with RFC4568 as far as having a crypto
attribute present for any SAVP streams.
Review: https://reviewboard.asterisk.org/r/2204/
........
Merged revisions 378217 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378218 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 378219 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378248 | seanbright | 2013-01-01 11:03:59 -0600 (Tue, 01 Jan 2013) | 2 lines
Bail out early when building an ast_trans_pvt and the translator doesn't supply a 'newpvt'
........
r378249 | seanbright | 2013-01-01 11:10:42 -0600 (Tue, 01 Jan 2013) | 2 lines
Revert 378248. I changed the logic of this function unitentionally, pointed out by file.
........
r378259 | lathama | 2013-01-01 13:02:52 -0600 (Tue, 01 Jan 2013) | 5 lines
Add UUID packages now required to configure
In ASTERISK-20726 UUID was added to Asterisk. This commit is to add the dependancies to the install script
........
r378288 | mjordan | 2013-01-02 09:39:42 -0600 (Wed, 02 Jan 2013) | 36 lines
Resolve crashes due to large stack allocations when using TCP
Asterisk had several places where messages received over various network
transports may be copied in a single stack allocation. In the case of TCP,
since multiple packets in a stream may be concatenated together, this can
lead to large allocations that overflow the stack.
This patch modifies those portions of Asterisk using TCP to either
favor heap allocations or use an upper bound to ensure that the stack will not
overflow:
* For SIP, the allocation now has an upper limit
* For HTTP, the allocation is now a heap allocation instead of a stack
allocation
* For XMPP (in res_jabber), the allocation has been eliminated since it was
unnecesary.
Note that the HTTP portion of this issue was independently found by Brandon
Edwards of Exodus Intelligence.
(issue ASTERISK-20658)
Reported by: wdoekes, Brandon Edwards
Tested by: mmichelson, wdoekes
patches:
ASTERISK-20658_res_jabber.c.patch uploaded by mmichelson (license 5049)
issueA20658_http_postvars_use_malloc2.patch uploaded by wdoekes (license 5674)
issueA20658_limit_sip_packet_size3.patch uploaded by wdoekes (license 5674)
........
Merged revisions 378269 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378286 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 378287 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378322 | mjordan | 2013-01-02 12:11:59 -0600 (Wed, 02 Jan 2013) | 33 lines
Prevent exhaustion of system resources through exploitation of event cache
Asterisk maintains an internal cache for devices in the event subsystem. The
device state cache holds the state of each device known to Asterisk, such that
consumers of device state information can query for the last known state for
a particular device, even if it is not part of an active call. The concept of
a device in Asterisk can include entities that do not have a physical
representation. One way that this occurred was when anonymous calls are allowed
in Asterisk. A device was automatically created and stored in the cache for
each anonymous call that occurred; this was possible in the SIP and IAX2
channel drivers and through channel drivers that utilized the
res_jabber/res_xmpp resource modules (Gtalk, Jingle, and Motif). These devices
are never removed from the system, allowing anonymous calls to potentially
exhaust a system's resources.
This patch changes the event cache subsystem and device state management to
no longer cache devices that are not associated with a physical entity.
(issue ASTERISK-20175)
Reported by: Russell Bryant, Leif Madsen, Joshua Colp
Tested by: kmoore
patches:
event-cachability-3.diff uploaded by jcolp (license 5000)
........
Merged revisions 378303 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378320 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 378321 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378374 | rmudgett | 2013-01-02 15:23:16 -0600 (Wed, 02 Jan 2013) | 33 lines
Fix AMI redirect action with two channels failing to redirect both channels.
The AMI redirect action can fail to redirect two channels that are bridged
together. There is a race between the AMI thread redirecting the two
channels and the bridge thread noticing that a channel is hungup from the
redirects.
* Made the bridge wait for both channels to be redirected before exiting.
* Made the AMI redirect check that all required headers are present before
proceeding with the redirection.
* Made the AMI redirect require that any supplied ExtraChannel exist
before proceeding. Previously the code fell back to a single channel
redirect operation.
(closes issue ASTERISK-18975)
Reported by: Ben Klang
(closes issue ASTERISK-19948)
Reported by: Brent Dalgleish
Patches:
jira_asterisk_19948_v11.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett, Thomas Sevestre, Deepak Lohani, Kayode
Review: https://reviewboard.asterisk.org/r/2243/
........
Merged revisions 378356 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378358 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378377 | mjordan | 2013-01-02 16:10:32 -0600 (Wed, 02 Jan 2013) | 24 lines
Prevent crashes from occurring when reading from data sources with large values
When reading configuration data from an Asterisk .conf file or when pulling
data from an Asterisk RealTime backend, Asterisk was copying the data on the
stack for manipulation. Unfortunately, it is possible to read configuration
data or realtime data from some data source that provides a large blob of
characters. This could potentially cause a crash via a stack overflow.
This patch prevents large sets of data from being read from an ARA backend or
from an Asterisk conf file.
(issue ASTERISK-20658)
Reported by: wdoekes
Tested by: wdoekes, mmichelson
patches:
* issueA20658_dont_process_overlong_config_lines.patch uploaded by wdoekes (license 5674)
* issueA20658_func_realtime_limit.patch uploaded by wdoekes (license 5674)
........
Merged revisions 378375 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378376 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378384 | mjordan | 2013-01-02 16:19:32 -0600 (Wed, 02 Jan 2013) | 11 lines
Clean up app_mysql's application entry points to properly parse arguments
When parsing arguments, application entry points should not attempt to
directly modify the parameters to the function. This patch properly duplicates
the passed in parameters before attempting to parse them.
(issue ASTERISK-20658)
Reported by: wdoekes
patches:
issueA20658_sanitize_app_mysql.patch uploaded by wdoekes (license 5674)
........
r378410 | mjordan | 2013-01-03 09:37:31 -0600 (Thu, 03 Jan 2013) | 13 lines
Prevent crashes in res_xmpp when receiving large messages
Similar to r378287, res_xmpp was marshaling data read from an external source
onto the stack. For a sufficiently large message, this could cause a stack
overflow. This patch modifies res_xmpp in a similar fashion to res_jabber by
removing the stack allocation, as it was unnecessary.
(issue ASTERISK-20658)
Reported by: wdoekes
........
Merged revisions 378409 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378412 | file | 2013-01-03 09:40:21 -0600 (Thu, 03 Jan 2013) | 11 lines
Prevent exhaustion of system resources through exploitation of event cache
This patch changes res_xmpp to no longer cache events under certain circumstances.
(issue ASTERISK-20175)
Reported by: Russell Bryant, Leif Madsen, Joshua Colp
Tested by: kmoore
........
Merged revisions 378411 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378414 | tilghman | 2013-01-03 10:04:11 -0600 (Thu, 03 Jan 2013) | 11 lines
Add aliases to the Directory.
This is an interesting feature that allows additional strings to be used to
search the Directory, primarily intended to be used with nicknames, but could
be used with affiliations and the like. Because the name field is used in
more than one place (such as email notifications), it is important that these
additional strings not be placed in the name field, but be specified
separately.
Review: https://reviewboard.asterisk.org/r/2244/
........
r378429 | rmudgett | 2013-01-03 11:48:14 -0600 (Thu, 03 Jan 2013) | 10 lines
chan_agent: Fix agent_indicate() locking.
Avoid deadlock potential with local channels and simplify the locking.
........
Merged revisions 378427 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378428 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378458 | rmudgett | 2013-01-03 12:47:29 -0600 (Thu, 03 Jan 2013) | 18 lines
chan_agent: Misc code cleanup.
* Fix off-nominal path resource cleanup in agent_request().
* Create agent_pvt_destroy() to eliminate inlined versions in many places.
* Pull invariant code out of loop in add_agent().
* Remove redundant module user references in login_exec().
* Remove unused struct agent_pvt logincallerid[] member.
........
Merged revisions 378456 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378457 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378460 | kmoore | 2013-01-03 12:51:43 -0600 (Thu, 03 Jan 2013) | 13 lines
Add missing test event
This test event was missing from channel.c causing the dial_LS_options
test to fail intermittently because of a race condition where most code
paths emitted the test event but this one did not. The dial_LS_options
test should stop bouncing now.
........
Merged revisions 378455 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378459 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378488 | rmudgett | 2013-01-03 13:42:54 -0600 (Thu, 03 Jan 2013) | 15 lines
chan_agent: Fix wrapup time wait response.
* Made agent_cont_sleep() and agent_ack_sleep() stop waiting if the wrapup
time expires. agent_cont_sleep() had tried but returned the wrong value
to stop waiting.
* Made agent_ack_sleep() take a struct agent_pvt pointer instead of a void
pointer for better type safety.
........
Merged revisions 378486 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378487 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378516 | elguero | 2013-01-03 16:14:20 -0600 (Thu, 03 Jan 2013) | 25 lines
Fix Queue Log Reporting Every Call COMPLETECALLER With "h" Extension Present
When the "h" extension is present within the context of the queue, all calls
are being reported COMPLETECALLER even when the agent is hanging up the call.
This patch checks to see if the agent hung-up or not instead of only relying on
checking if the queue (caller) channel hung-up or not. It would appear that
having the h extension in the mix, the pbx goes to the h extension,
"hanging-up" the queue channel and triggering the reporting of COMPLETECALLER.
(closes issue ASTERISK-20743)
Reported by: call
Tested by: call, Michael L. Young
Patches:
asterisk-20743-q-cmplt-caller.diff
uploaded by Michael L. Young (license 5026)
Review: https://reviewboard.asterisk.org/r/2256/
........
Merged revisions 378514 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378515 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378543 | lathama | 2013-01-04 10:44:33 -0600 (Fri, 04 Jan 2013) | 6 lines
Doxygen Cleanups
Baseline clean up of formating to make room for extended documentation
(issue ASTERISK-20259)
........
r378557 | file | 2013-01-04 15:18:07 -0600 (Fri, 04 Jan 2013) | 11 lines
Don't pass STUN packets through the SRTP unprotect function.
(closes issue AST-1036)
Reported by: jbigelow
........
Merged revisions 378553 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378555 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378565 | elguero | 2013-01-04 15:20:12 -0600 (Fri, 04 Jan 2013) | 27 lines
Fix SIP Notify Messages To Have The Proper IP Address In The FROM Field
On a multihomed server when sending a NOTIFY message, we were not figuring out
which network should be used to contact the peer.
This patch fixes the problem by calling ast_sip_ouraddrfor() and then
build_via() so that our NOTIFY message contains the correct IP address.
Also, a debug message is being added to help follow the call-id changes that
occur. This was helpful for confirming that the IP address was set properly
since the call-id contains the IP address. It also will be helpful for
troubleshooting purposes when following a call in the debug logs.
(closes issue ASTERISK-20805)
Reported by: Bryan Hunt
Tested by: Bryan Hunt, Michael L. Young
Patches:
asterisk-20805-notify-ip-v2.diff uploaded by Michael L. Young (license 5026)
Review: https://reviewboard.asterisk.org/r/2255/
........
Merged revisions 378554 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378559 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378585 | kmoore | 2013-01-04 16:19:16 -0600 (Fri, 04 Jan 2013) | 13 lines
Fix pjproject compilation in certain circumstances
On a fresh checkout of Asterisk 11, running make before ./configure
could cause the pjproject subdirectory to get in an odd state that
would prevent compilation. This patch by Tilghman prevents that from
occurring.
(closes issue ASTERISK-20681)
Patch-by: Tilghman Lesher
........
Merged revisions 378582 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378593 | jrose | 2013-01-04 17:14:54 -0600 (Fri, 04 Jan 2013) | 23 lines
res_srtp: Prevent a crash from occurring due to srtp_create failures in srtp_create
Under some circumstances, libsrtp's srtp_create function deallocates memory that
it wasn't initially responsible for allocating. Because we weren't initially
aware of this behavior, this memory was still used in spite of being unallocated
during the course of the srtp_unprotect function. A while back I made a patch
which would set this value to NULL, but that exposed a possible condition where
we would then try to check a member of the struct which would cause a segfault.
In order to address these problems, ast_srtp_unprotect will now set an error value
when it ends without a valid SRTP session which will result in the caller of
srtp_unprotect observing this error and hanging up the relevant channel instead of
trying to keep using the invalid session address.
(closes issue ASTERISK-20499)
Reported by: Tootai
Review: https://reviewboard.asterisk.org/r/2228/diff/#index_header
........
Merged revisions 378591 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378592 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378623 | wedhorn | 2013-01-06 14:45:12 -0600 (Sun, 06 Jan 2013) | 12 lines
Rewrite skinny dialing to remove threaded simpleswitch
This rewrite changes skinny dialing from the threaded simpleswitch
to a scheduled timeout approach. There were some underlying issues
with the threaded simple switch with occasional corruption and
possible segfaults.
Review: https://reviewboard.asterisk.org/r/2240/
........
Merged revisions 378622 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r378624 | wedhorn | 2013-01-06 15:09:43 -0600 (Sun, 06 Jan 2013) | 6 lines
Add group and namedgroup pickup to skinny
Above says it all. Code by snuff, cleaned up by me.
Review: https://reviewboard.asterisk.org/r/2246/
........
r378634 | wedhorn | 2013-01-06 15:37:59 -0600 (Sun, 06 Jan 2013) | 6 lines
Skinny blob cleanup
Cleanup of red blobs in chan_skinny and possible other small formatting issues.
Review: https://reviewboard.asterisk.org/r/2262/
........
Merged revisions 378220,378248-378249,378259,378288,378322,378374,378377,378384,378410,378412,378414,378429,378458,378460,378488,378516,378543,378557,378565,378585,378593,378623-378624,378634 from http://svn.asterisk.org/svn/asterisk/trunk
Modified:
team/dlee/jansson/ (props changed)
team/dlee/jansson/addons/app_mysql.c
team/dlee/jansson/apps/app_confbridge.c
team/dlee/jansson/apps/app_directory.c
team/dlee/jansson/apps/app_meetme.c
team/dlee/jansson/apps/app_queue.c
team/dlee/jansson/apps/confbridge/conf_state_empty.c
team/dlee/jansson/channels/chan_agent.c
team/dlee/jansson/channels/chan_dahdi.c
team/dlee/jansson/channels/chan_iax2.c
team/dlee/jansson/channels/chan_local.c
team/dlee/jansson/channels/chan_sip.c
team/dlee/jansson/channels/chan_skinny.c
team/dlee/jansson/channels/sip/include/sip.h
team/dlee/jansson/configs/voicemail.conf.sample
team/dlee/jansson/contrib/realtime/mysql/voicemail.sql
team/dlee/jansson/contrib/scripts/install_prereq
team/dlee/jansson/funcs/func_devstate.c
team/dlee/jansson/funcs/func_realtime.c
team/dlee/jansson/include/asterisk/channel.h
team/dlee/jansson/include/asterisk/devicestate.h
team/dlee/jansson/include/asterisk/event_defs.h
team/dlee/jansson/main/ccss.c
team/dlee/jansson/main/channel.c
team/dlee/jansson/main/channel_internal_api.c
team/dlee/jansson/main/config.c
team/dlee/jansson/main/devicestate.c
team/dlee/jansson/main/event.c
team/dlee/jansson/main/features.c
team/dlee/jansson/main/http.c
team/dlee/jansson/main/manager.c
team/dlee/jansson/res/pjproject/aconfigure
team/dlee/jansson/res/pjproject/aconfigure.ac
team/dlee/jansson/res/pjproject/build/common.mak
team/dlee/jansson/res/res_calendar.c
team/dlee/jansson/res/res_config_ldap.c
team/dlee/jansson/res/res_jabber.c
team/dlee/jansson/res/res_rtp_asterisk.c
team/dlee/jansson/res/res_srtp.c
team/dlee/jansson/res/res_xmpp.c
Propchange: team/dlee/jansson/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/dlee/jansson/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan 7 09:31:47 2013
@@ -1,1 +1,1 @@
-/trunk:1-378208
+/trunk:1-378646
Modified: team/dlee/jansson/addons/app_mysql.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/addons/app_mysql.c?view=diff&rev=378647&r1=378646&r2=378647
==============================================================================
--- team/dlee/jansson/addons/app_mysql.c (original)
+++ team/dlee/jansson/addons/app_mysql.c Mon Jan 7 09:31:47 2013
@@ -292,16 +292,17 @@
return res;
}
-static int aMYSQL_set(struct ast_channel *chan, char *data)
-{
- char *var, *tmp;
+static int aMYSQL_set(struct ast_channel *chan, const char *data)
+{
+ char *var, *tmp, *parse;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(set);
AST_APP_ARG(variable);
AST_APP_ARG(value);
);
- AST_NONSTANDARD_APP_ARGS(args, data, ' ');
+ parse = ast_strdupa(data);
+ AST_NONSTANDARD_APP_ARGS(args, parse, ' ');
if (args.argc == 3) {
var = ast_alloca(6 + strlen(args.variable) + 1);
@@ -317,7 +318,7 @@
}
/* MYSQL operations */
-static int aMYSQL_connect(struct ast_channel *chan, char *data)
+static int aMYSQL_connect(struct ast_channel *chan, const char *data)
{
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(connect);
@@ -333,8 +334,9 @@
const char *ctimeout;
unsigned int port = 0;
char *port_str;
-
- AST_NONSTANDARD_APP_ARGS(args, data, ' ');
+ char *parse = ast_strdupa(data);
+
+ AST_NONSTANDARD_APP_ARGS(args, parse, ' ');
if (args.argc < 6) {
ast_log(LOG_WARNING, "MYSQL_connect is missing some arguments\n");
@@ -385,7 +387,7 @@
return 0;
}
-static int aMYSQL_query(struct ast_channel *chan, char *data)
+static int aMYSQL_query(struct ast_channel *chan, const char *data)
{
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(query);
@@ -397,8 +399,9 @@
MYSQL_RES *mysqlres;
int connid;
int mysql_query_res;
-
- AST_NONSTANDARD_APP_ARGS(args, data, ' ');
+ char *parse = ast_strdupa(data);
+
+ AST_NONSTANDARD_APP_ARGS(args, parse, ' ');
if (args.argc != 4 || (connid = atoi(args.connid)) == 0) {
ast_log(LOG_WARNING, "missing some arguments\n");
@@ -426,7 +429,7 @@
return -1;
}
-static int aMYSQL_nextresult(struct ast_channel *chan, char *data)
+static int aMYSQL_nextresult(struct ast_channel *chan, const char *data)
{
MYSQL *mysql;
MYSQL_RES *mysqlres;
@@ -436,8 +439,9 @@
AST_APP_ARG(connid);
);
int connid = -1;
-
- AST_NONSTANDARD_APP_ARGS(args, data, ' ');
+ char *parse = ast_strdupa(data);
+
+ AST_NONSTANDARD_APP_ARGS(args, parse, ' ');
sscanf(args.connid, "%30d", &connid);
if (args.argc != 3 || connid <= 0) {
@@ -466,7 +470,7 @@
}
-static int aMYSQL_fetch(struct ast_channel *chan, char *data)
+static int aMYSQL_fetch(struct ast_channel *chan, const char *data)
{
MYSQL_RES *mysqlres;
MYSQL_ROW mysqlrow;
@@ -518,13 +522,14 @@
return -1;
}
-static int aMYSQL_clear(struct ast_channel *chan, char *data)
+static int aMYSQL_clear(struct ast_channel *chan, const char *data)
{
MYSQL_RES *mysqlres;
int id;
- strsep(&data, " "); /* eat the first token, we already know it :P */
- id = safe_scan_int(&data, " \n", -1);
+ char *parse = ast_strdupa(data);
+ strsep(&parse, " "); /* eat the first token, we already know it :P */
+ id = safe_scan_int(&parse, " \n", -1);
if ((mysqlres = find_identifier(id, AST_MYSQL_ID_RESID)) == NULL) {
ast_log(LOG_WARNING, "Invalid result identifier %d passed in aMYSQL_clear\n", id);
} else {
@@ -535,13 +540,14 @@
return 0;
}
-static int aMYSQL_disconnect(struct ast_channel *chan, char *data)
+static int aMYSQL_disconnect(struct ast_channel *chan, const char *data)
{
MYSQL *mysql;
int id;
- strsep(&data, " "); /* eat the first token, we already know it :P */
-
- id = safe_scan_int(&data, " \n", -1);
+ char *parse = ast_strdupa(data);
+ strsep(&parse, " "); /* eat the first token, we already know it :P */
+
+ id = safe_scan_int(&parse, " \n", -1);
if ((mysql = find_identifier(id, AST_MYSQL_ID_CONNID)) == NULL) {
ast_log(LOG_WARNING, "Invalid connection identifier %d passed in aMYSQL_disconnect\n", id);
} else {
@@ -584,19 +590,19 @@
ast_mutex_lock(&_mysql_mutex);
if (strncasecmp("connect", data, strlen("connect")) == 0) {
- result = aMYSQL_connect(chan, ast_strdupa(data));
+ result = aMYSQL_connect(chan, data);
} else if (strncasecmp("query", data, strlen("query")) == 0) {
- result = aMYSQL_query(chan, ast_strdupa(data));
+ result = aMYSQL_query(chan, data);
} else if (strncasecmp("nextresult", data, strlen("nextresult")) == 0) {
- result = aMYSQL_nextresult(chan, ast_strdupa(data));
+ result = aMYSQL_nextresult(chan, data);
} else if (strncasecmp("fetch", data, strlen("fetch")) == 0) {
- result = aMYSQL_fetch(chan, ast_strdupa(data));
+ result = aMYSQL_fetch(chan, data);
} else if (strncasecmp("clear", data, strlen("clear")) == 0) {
- result = aMYSQL_clear(chan, ast_strdupa(data));
+ result = aMYSQL_clear(chan, data);
} else if (strncasecmp("disconnect", data, strlen("disconnect")) == 0) {
- result = aMYSQL_disconnect(chan, ast_strdupa(data));
+ result = aMYSQL_disconnect(chan, data);
} else if (strncasecmp("set", data, 3) == 0) {
- result = aMYSQL_set(chan, ast_strdupa(data));
+ result = aMYSQL_set(chan, data);
} else {
ast_log(LOG_WARNING, "Unknown argument to MYSQL application : %s\n", data);
result = -1;
Modified: team/dlee/jansson/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/apps/app_confbridge.c?view=diff&rev=378647&r1=378646&r2=378647
==============================================================================
--- team/dlee/jansson/apps/app_confbridge.c (original)
+++ team/dlee/jansson/apps/app_confbridge.c Mon Jan 7 09:31:47 2013
@@ -1043,7 +1043,7 @@
void conf_handle_first_join(struct conference_bridge *conference_bridge)
{
- ast_devstate_changed(AST_DEVICE_INUSE, "confbridge:%s", conference_bridge->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", conference_bridge->name);
}
void conf_handle_second_active(struct conference_bridge *conference_bridge)
Modified: team/dlee/jansson/apps/app_directory.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/apps/app_directory.c?view=diff&rev=378647&r1=378646&r2=378647
==============================================================================
--- team/dlee/jansson/apps/app_directory.c (original)
+++ team/dlee/jansson/apps/app_directory.c Mon Jan 7 09:31:47 2013
@@ -87,6 +87,12 @@
argument will be used for the number of characters the user should enter.</para>
<argument name="n" required="true" />
</option>
+ <option name="a">
+ <para>Allow the caller to additionally enter an alias for a user in the
+ directory. This option must be specified in addition to the
+ <literal>f</literal>, <literal>l</literal>, or <literal>b</literal>
+ option.</para>
+ </option>
<option name="m">
<para>Instead of reading each name sequentially and asking for
confirmation, create a menu of up to 8 names.</para>
@@ -135,6 +141,7 @@
OPT_LISTBYEITHER = OPT_LISTBYFIRSTNAME | OPT_LISTBYLASTNAME,
OPT_PAUSE = (1 << 5),
OPT_NOANSWER = (1 << 6),
+ OPT_ALIAS = (1 << 7),
};
enum {
@@ -164,6 +171,7 @@
AST_APP_OPTION('v', OPT_FROMVOICEMAIL),
AST_APP_OPTION('m', OPT_SELECTFROMMENU),
AST_APP_OPTION('n', OPT_NOANSWER),
+ AST_APP_OPTION('a', OPT_ALIAS),
});
static int compare(const char *text, const char *template)
@@ -427,6 +435,8 @@
return 0;
}
+AST_THREADSTORAGE(commonbuf);
+
static struct ast_config *realtime_directory(char *context)
{
struct ast_config *cfg;
@@ -436,8 +446,12 @@
char *mailbox;
const char *fullname;
const char *hidefromdir, *searchcontexts = NULL;
- char tmp[100];
struct ast_flags config_flags = { 0 };
+ struct ast_str *tmp = ast_str_thread_get(&commonbuf, 100);
+
+ if (!tmp) {
+ return NULL;
+ }
/* Load flat file config. */
cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags);
@@ -472,6 +486,7 @@
mailbox = NULL;
while ( (mailbox = ast_category_browse(rtdata, mailbox)) ) {
+ struct ast_variable *alias;
const char *ctx = ast_variable_retrieve(rtdata, mailbox, "context");
fullname = ast_variable_retrieve(rtdata, mailbox, "fullname");
@@ -480,7 +495,14 @@
/* Skip hidden */
continue;
}
- snprintf(tmp, sizeof(tmp), "no-password,%s", S_OR(fullname, ""));
+ ast_str_set(&tmp, 0, "no-password,%s", S_OR(fullname, ""));
+ if (ast_variable_retrieve(rtdata, mailbox, "alias")) {
+ for (alias = ast_variable_browse(rtdata, mailbox); alias; alias = alias->next) {
+ if (!strcasecmp(alias->name, "alias")) {
+ ast_str_append(&tmp, 0, "|alias=%s", alias->value);
+ }
+ }
+ }
/* Does the context exist within the config file? If not, make one */
if (!(cat = ast_category_get(cfg, ctx))) {
@@ -495,7 +517,7 @@
ast_category_append(cfg, cat);
}
- if ((var = ast_variable_new(mailbox, tmp, ""))) {
+ if ((var = ast_variable_new(mailbox, ast_str_buffer(tmp), ""))) {
ast_variable_append(cat, var);
} else {
ast_log(LOG_WARNING, "Out of memory adding mailbox '%s'\n", mailbox);
@@ -556,20 +578,26 @@
static int search_directory_sub(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist)
{
struct ast_variable *v;
- char buf[AST_MAX_EXTENSION + 1], *pos, *bufptr, *cat;
+ struct ast_str *buf = ast_str_thread_get(&commonbuf, 100);
+ char *pos, *bufptr, *cat, *alias;
struct directory_item *item;
int res;
+ if (!buf) {
+ return -1;
+ }
+
ast_debug(2, "Pattern: %s\n", ext);
for (v = ast_variable_browse(vmcfg, context); v; v = v->next) {
/* Ignore hidden */
- if (strcasestr(v->value, "hidefromdir=yes"))
+ if (strcasestr(v->value, "hidefromdir=yes")) {
continue;
-
- ast_copy_string(buf, v->value, sizeof(buf));
- bufptr = buf;
+ }
+
+ ast_str_set(&buf, 0, "%s", v->value);
+ bufptr = ast_str_buffer(buf);
/* password,Full Name,email,pager,options */
strsep(&bufptr, ",");
@@ -587,11 +615,23 @@
if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
res = check_match(&item, context, pos, v->name, ext, 1 /* use_first_name */);
}
-
- if (!res)
+ if (!res && ast_test_flag(&flags, OPT_ALIAS) && (alias = strcasestr(bufptr, "alias="))) {
+ char *a;
+ ast_debug(1, "Found alias: %s\n", alias);
+ while ((a = strsep(&alias, "|"))) {
+ if (!strncasecmp(a, "alias=", 6)) {
+ if ((res = check_match(&item, context, a + 6, v->name, ext, 1))) {
+ break;
+ }
+ }
+ }
+ }
+
+ if (!res) {
continue;
- else if (res < 0)
+ } else if (res < 0) {
return -1;
+ }
AST_LIST_INSERT_TAIL(alist, item, entry);
}
@@ -599,15 +639,18 @@
if (ucfg) {
for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
const char *position;
- if (!strcasecmp(cat, "general"))
+
+ if (!strcasecmp(cat, "general")) {
continue;
- if (!ast_true(ast_config_option(ucfg, cat, "hasdirectory")))
+ }
+ if (!ast_true(ast_config_option(ucfg, cat, "hasdirectory"))) {
continue;
+ }
/* Find all candidate extensions */
- position = ast_variable_retrieve(ucfg, cat, "fullname");
- if (!position)
+ if (!(position = ast_variable_retrieve(ucfg, cat, "fullname"))) {
continue;
+ }
res = 0;
if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
@@ -616,11 +659,20 @@
if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
res = check_match(&item, context, position, cat, ext, 1 /* use_first_name */);
}
-
- if (!res)
+ if (!res && ast_test_flag(&flags, OPT_ALIAS)) {
+ struct ast_variable *alias;
+ for (alias = ast_variable_browse(ucfg, cat); alias; alias = alias->next) {
+ if (!strcasecmp(v->name, "alias") && (res = check_match(&item, context, v->value, cat, ext, 1))) {
+ break;
+ }
+ }
+ }
+
+ if (!res) {
continue;
- else if (res < 0)
+ } else if (res < 0) {
return -1;
+ }
AST_LIST_INSERT_TAIL(alist, item, entry);
}
Modified: team/dlee/jansson/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/apps/app_meetme.c?view=diff&rev=378647&r1=378646&r2=378647
==============================================================================
--- team/dlee/jansson/apps/app_meetme.c (original)
+++ team/dlee/jansson/apps/app_meetme.c Mon Jan 7 09:31:47 2013
@@ -2706,7 +2706,7 @@
/* This device changed state now - if this is the first user */
if (conf->users == 1)
- ast_devstate_changed(AST_DEVICE_INUSE, "meetme:%s", conf->confno);
+ ast_devstate_changed(AST_DEVICE_INUSE, (conf->isdynamic ? AST_DEVSTATE_NOT_CACHABLE : AST_DEVSTATE_CACHABLE), "meetme:%s", conf->confno);
ast_mutex_unlock(&conf->playlock);
@@ -4097,7 +4097,7 @@
/* Change any states */
if (!conf->users) {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "meetme:%s", conf->confno);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, (conf->isdynamic ? AST_DEVSTATE_NOT_CACHABLE : AST_DEVSTATE_CACHABLE), "meetme:%s", conf->confno);
}
/* This flag is meant to kill a conference with only one participant remaining. */
@@ -5592,8 +5592,8 @@
|| trunk_ref == exclude)
continue;
trunk_ref->state = state;
- ast_devstate_changed(sla_state_to_devstate(state),
- "SLA:%s_%s", station->name, trunk->name);
+ ast_devstate_changed(sla_state_to_devstate(state), AST_DEVSTATE_CACHABLE,
+ "SLA:%s_%s", station->name, trunk->name);
break;
}
}
@@ -6091,8 +6091,8 @@
{
ast_atomic_fetchadd_int((int *) &event->trunk_ref->trunk->hold_stations, 1);
event->trunk_ref->state = SLA_TRUNK_STATE_ONHOLD_BYME;
- ast_devstate_changed(AST_DEVICE_ONHOLD, "SLA:%s_%s",
- event->station->name, event->trunk_ref->trunk->name);
+ ast_devstate_changed(AST_DEVICE_ONHOLD, AST_DEVSTATE_CACHABLE, "SLA:%s_%s",
+ event->station->name, event->trunk_ref->trunk->name);
sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD,
INACTIVE_TRUNK_REFS, event->trunk_ref);
@@ -6601,8 +6601,8 @@
sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
else {
trunk_ref->state = SLA_TRUNK_STATE_UP;
- ast_devstate_changed(AST_DEVICE_INUSE,
- "SLA:%s_%s", station->name, trunk_ref->trunk->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE,
+ "SLA:%s_%s", station->name, trunk_ref->trunk->name);
}
} else if (trunk_ref->state == SLA_TRUNK_STATE_RINGING) {
struct sla_ringing_trunk *ringing_trunk;
Modified: team/dlee/jansson/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/apps/app_queue.c?view=diff&rev=378647&r1=378646&r2=378647
==============================================================================
--- team/dlee/jansson/apps/app_queue.c (original)
+++ team/dlee/jansson/apps/app_queue.c Mon Jan 7 09:31:47 2013
@@ -1791,9 +1791,9 @@
if (found_member) {
found = 1;
if (avail) {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s_avail", q->name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
} else {
- ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
}
}
@@ -2083,7 +2083,7 @@
* AST_DEVICE_INUSE indicates no members are available.
* AST_DEVICE_NOT_INUSE indicates a member is available.
*/
- ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
}
static void clear_queue(struct call_queue *q)
@@ -2963,7 +2963,7 @@
ast_copy_string(qe->context, q->context, sizeof(qe->context));
q->count++;
if (q->count == 1) {
- ast_devstate_changed(AST_DEVICE_RINGING, "Queue:%s", q->name);
+ ast_devstate_changed(AST_DEVICE_RINGING, AST_DEVSTATE_CACHABLE, "Queue:%s", q->name);
}
res = 0;
@@ -3271,7 +3271,7 @@
char posstr[20];
q->count--;
if (!q->count) {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s", q->name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s", q->name);
}
/* Take us out of the queue */
@@ -3538,7 +3538,7 @@
if (newstate != tmp->member->status) {
ast_log(LOG_WARNING, "Found a channel matching iterface %s while status was %s changed to %s\n",
tmp->member->interface, ast_devstate2str(tmp->member->status), ast_devstate2str(newstate));
- ast_devstate_changed_literal(newstate, tmp->member->interface);
+ ast_devstate_changed_literal(newstate, AST_DEVSTATE_CACHABLE, tmp->member->interface);
}
}
if ((tmp->member->status != AST_DEVICE_NOT_INUSE) && (tmp->member->status != AST_DEVICE_UNKNOWN)) {
@@ -5818,7 +5818,7 @@
time(&callstart);
transfer_ds = setup_transfer_datastore(qe, member, callstart, callcompletedinsl);
- bridge = ast_bridge_call(qe->chan,peer, &bridge_config);
+ bridge = ast_bridge_call(qe->chan, peer, &bridge_config);
/* If the queue member did an attended transfer, then the TRANSFER already was logged in the queue_log
* when the masquerade occurred. These other "ending" queue_log messages are unnecessary, except for
@@ -5834,7 +5834,7 @@
ast_channel_exten(qe->chan), ast_channel_context(qe->chan), (long) (callstart - qe->start),
(long) (time(NULL) - callstart), qe->opos);
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
- } else if (ast_check_hangup(qe->chan)) {
+ } else if (ast_check_hangup(qe->chan) && !ast_check_hangup(peer)) {
ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "COMPLETECALLER", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
@@ -6027,7 +6027,7 @@
}
if (!num_available_members(q)) {
- ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
}
res = RES_OKAY;
@@ -6104,7 +6104,7 @@
new_member->status, new_member->paused);
if (is_member_available(new_member)) {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s_avail", q->name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
}
ao2_ref(new_member, -1);
@@ -6175,9 +6175,9 @@
}
if (is_member_available(mem)) {
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Queue:%s_avail", q->name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
} else if (!num_available_members(q)) {
- ast_devstate_changed(AST_DEVICE_INUSE, "Queue:%s_avail", q->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
}
ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, ""));
Modified: team/dlee/jansson/apps/confbridge/conf_state_empty.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/jansson/apps/confbridge/conf_state_empty.c?view=diff&rev=378647&r1=378646&r2=378647
==============================================================================
--- team/dlee/jansson/apps/confbridge/conf_state_empty.c (original)
+++ team/dlee/jansson/apps/confbridge/conf_state_empty.c Mon Jan 7 09:31:47 2013
@@ -81,6 +81,6 @@
static void transition_to_empty(struct conference_bridge_user *cbu)
{
/* Set device state to "not in use" */
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "confbridge:%s", cbu->conference_bridge->name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", cbu->conference_bridge->name);
conf_ended(cbu->conference_bridge);
}
Modified: team/dlee/jansson/channels/chan_agent.c
[... 4685 lines stripped ...]
More information about the asterisk-commits
mailing list