[asterisk-commits] murf: branch murf/bug11210 r105584 - in /team/murf/bug11210: ./ apps/ build_t...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 3 18:30:30 CST 2008


Author: murf
Date: Mon Mar  3 18:30:29 2008
New Revision: 105584

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105584
Log:
Merged revisions 104866,104869,104921,104974,105006,105060-105061,105144,105176,105210,105262-105263,105327,105378,105410-105411,105461,105477,105479,105509,105558,105561,105564,105566,105569,105571,105573-105574 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r104866 | russell | 2008-02-27 16:58:49 -0700 (Wed, 27 Feb 2008) | 6 lines

reduce indentation in alloc_sub
(issue #12079)
Reported by: tzafrir
Patches:
      alloc_sub uploaded by tzafrir (license 46)

................
r104869 | tilghman | 2008-02-27 17:11:31 -0700 (Wed, 27 Feb 2008) | 15 lines

Merged revisions 104868 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r104868 | tilghman | 2008-02-27 18:05:06 -0600 (Wed, 27 Feb 2008) | 7 lines

Compatibility fix for PPC64
(closes issue #12081)
 Reported by: jcollie
 Patches: 
       asterisk-1.4.18-funcdesc.patch uploaded by jcollie (license 412)
 Tested by: jcollie, Corydon76

........

................
r104921 | qwell | 2008-02-27 21:37:28 -0700 (Wed, 27 Feb 2008) | 10 lines

Merged revisions 104920 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r104920 | qwell | 2008-02-27 22:31:21 -0600 (Wed, 27 Feb 2008) | 2 lines

According to a video at www.cisco.com, the 7921G supports 6 line appearances.

........

................
r104974 | tilghman | 2008-02-28 07:42:32 -0700 (Thu, 28 Feb 2008) | 6 lines

Fix crash when configuration does not match hardware detection.
(closes issue #12096)
 Reported by: mmickan
 Patches: 
       chan_vpb.cc.diff uploaded by mmickan (license 400)

................
r105006 | qwell | 2008-02-28 12:21:15 -0700 (Thu, 28 Feb 2008) | 17 lines

Merged revisions 105005 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105005 | qwell | 2008-02-28 13:20:10 -0600 (Thu, 28 Feb 2008) | 9 lines

Make pbx_exec pass an empty string into applications, if we get NULL.
This protects against possible segfaults in applications that may try
 to use data before checking length (ast_strdupa'ing it, for example)

(closes issue #12100)
Reported by: foxfire
Patches:
      12100-nullappargs.diff uploaded by qwell (license 4)

........

................
r105060 | mmichelson | 2008-02-28 13:14:04 -0700 (Thu, 28 Feb 2008) | 25 lines

Merged revisions 104841 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r104841 | mmichelson | 2008-02-27 15:49:20 -0600 (Wed, 27 Feb 2008) | 17 lines

Two fixes:

1. Make the list of ast_dial_channels a lockable list. This is because in some cases,
   the ast_dial may exist in multiple threads due to asynchronous execution of its application, and
   I found some cases where race conditions could exist.

2. Check in ast_dial_join to be sure that the channel still exists before attempting to lock it, since
   it could have gotten hung up but the is_running_app flag on the ast_dial_channel may not have been
   cleared yet.

(closes issue #12038)
Reported by: jvandal
Patches:
      12038v2.patch uploaded by putnopvut (license 60)
Tested by: jvandal


........

................
r105061 | mmichelson | 2008-02-28 13:14:38 -0700 (Thu, 28 Feb 2008) | 14 lines

Merged revisions 105059 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105059 | mmichelson | 2008-02-28 14:11:57 -0600 (Thu, 28 Feb 2008) | 6 lines

When using autofill, members who are in use should be counted towards the 
number of available members to call if ringinuse is set to yes.

Thanks to jmls who brought this issue up on IRC


........

................
r105144 | russell | 2008-02-28 15:39:26 -0700 (Thu, 28 Feb 2008) | 16 lines

Merged revisions 105116 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105116 | russell | 2008-02-28 16:23:05 -0600 (Thu, 28 Feb 2008) | 8 lines

Fix a bug in the lock tracking code that was discovered by mmichelson.  The issue
is that if the lock history array was full, then the functions to mark a lock as
acquired or not would adjust the stats for whatever lock is at the end of the array,
which may not be itself.  So, do a sanity check to make sure that we're updating
lock info for the proper lock.

(This explains the bizarre stats on lock #63 in BE-396, thanks Mark!)

........

................
r105176 | tilghman | 2008-02-28 18:15:20 -0700 (Thu, 28 Feb 2008) | 15 lines

Merged revisions 105113 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105113 | tilghman | 2008-02-28 15:56:54 -0600 (Thu, 28 Feb 2008) | 7 lines

Update init script for LSB compat
(closes issue #9843)
 Reported by: ibc
 Patches: 
       rc.debian.asterisk.patch uploaded by ibc (license 211)
 Tested by: paravoid

........

................
r105210 | phsultan | 2008-02-29 06:12:34 -0700 (Fri, 29 Feb 2008) | 9 lines

Automatically create new buddy upon reception of a presence stanza of
type subscribed.

(closes issue #12066)
Reported by: ffadaie
Patches:
      branch-1.4-12066-1.diff uploaded by phsultan (license 73)
      trunk-12066-1.diff uploaded by phsultan (license 73)
Tested by: ffadaie, phsultan
................
r105262 | file | 2008-02-29 06:55:22 -0700 (Fri, 29 Feb 2008) | 12 lines

Merged revisions 105261 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105261 | file | 2008-02-29 09:48:13 -0400 (Fri, 29 Feb 2008) | 4 lines

Bump up the size of the uniqueid variable.
(closes issue #12107)
Reported by: asgaroth

........

................
r105263 | phsultan | 2008-02-29 07:15:03 -0700 (Fri, 29 Feb 2008) | 3 lines

Remove unnecessary if statements before calling iks_delete (redundant check is
done inside iks_delete), thus making the code conform with coding guidelines.

................
r105327 | phsultan | 2008-02-29 07:50:40 -0700 (Fri, 29 Feb 2008) | 9 lines

Merged revisions 105326 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105326 | phsultan | 2008-02-29 15:47:10 +0100 (Fri, 29 Feb 2008) | 1 line

Fix a potential memory leak
........

................
r105378 | file | 2008-02-29 11:34:46 -0700 (Fri, 29 Feb 2008) | 6 lines

Add documentation for setting username/password in SIP dial string.
(closes issue #11587)
Reported by: sobomax
Patches:
      dialstring_doc.diff uploaded by sobomax (license 359)

................
r105410 | russell | 2008-02-29 16:36:46 -0700 (Fri, 29 Feb 2008) | 31 lines

Merged revisions 105409 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105409 | russell | 2008-02-29 17:34:32 -0600 (Fri, 29 Feb 2008) | 23 lines

Fix a major bug in autoservice.  There was a race condition in the handling of
the list of channels in autoservice.  The problem was that it was possible for
a channel to get removed from autoservice and destroyed, while the autoservice
thread was still messing with the channel.  This led to memory corruption, and
caused crashes.  This explains multiple backtraces I have seen that have
references to autoservice, but do to the nature of the issue (memory corruption),
could cause crashes in a number of areas.

(fixes the crash in BE-386)
(closes issue #11694)
(closes issue #11940)

The following issues could be related.  If you are the reporter of one of these,
please update to include this fix and try again.

(potentially fixes issue #11189)
(potentially fixes issue #12107)
(potentially fixes issue #11573)
(potentially fixes issue #12008)
(potentially fixes issue #11189)
(potentially fixes issue #11993)
(potentially fixes issue #11791)

........

................
r105411 | tilghman | 2008-02-29 16:53:42 -0700 (Fri, 29 Feb 2008) | 2 lines

Convert to use ast_str

................
r105461 | russell | 2008-02-29 17:53:25 -0700 (Fri, 29 Feb 2008) | 9 lines

Add a "devstate change" CLI command to control custom device states.  Also,
do some additional code cleanup and improvement in passing.

(closes issue #12106)
Reported by: nizon
Patches:
      devstate-patch.txt uploaded by nizon (license 415)
        -- Updated to trunk, and tab completion added by me

................
r105477 | twilson | 2008-02-29 18:30:37 -0700 (Fri, 29 Feb 2008) | 6 lines

Asterisk, when parking can drop rights a caller when a parking timeout occurs.  Also, when doing built-in attended transfers, sometimes incorrectly passes rights from the transferrer to the transferee.  This patch tries to fixes the parking issue and lays some groundwork for later fixing the transfer issue.

(closes issue #11520)
Reported by: pliew
Tested by: otherwiseguy

................
r105479 | tilghman | 2008-02-29 19:03:51 -0700 (Fri, 29 Feb 2008) | 2 lines

Drop bad property

................
r105509 | file | 2008-02-29 20:59:41 -0700 (Fri, 29 Feb 2008) | 2 lines

Add support for 16KHz signed linear.

................
r105558 | file | 2008-03-03 08:16:57 -0700 (Mon, 03 Mar 2008) | 14 lines

Merged revisions 105557 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105557 | file | 2008-03-03 11:15:39 -0400 (Mon, 03 Mar 2008) | 6 lines

Add a comment to describe some logic.
(closes issue #12120)
Reported by: flefoll
Patches:
      chan_sip.c.br14.patch-just-a-comment uploaded by flefoll (license 244)

........

................
r105561 | file | 2008-03-03 08:30:29 -0700 (Mon, 03 Mar 2008) | 15 lines

Merged revisions 105560 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105560 | file | 2008-03-03 11:28:59 -0400 (Mon, 03 Mar 2008) | 7 lines

It is possible for no audio to pass between the current digit and next digit so expand logic that clears emulation to AST_FRAME_NULL.
(closes issue #11911)
Reported by: edgreenberg
Patches:
      v1-11911.patch uploaded by dimas (license 88)
Tested by: tbsky

........

................
r105564 | russell | 2008-03-03 08:59:50 -0700 (Mon, 03 Mar 2008) | 40 lines

3) In addition to merging the changes below, change trunk back to a regular
   LIST instead of an RWLIST.  The way this list works makes it such that
   a RWLIST provides no additional benefit.  Also, a mutex is needed for
   use with the thread condition.


Merged revisions 105563 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105563 | russell | 2008-03-03 09:50:43 -0600 (Mon, 03 Mar 2008) | 24 lines

Merge in some changes from team/russell/autoservice-nochans-1.4

These changes fix up some dubious code that I came across while auditing what
happens in the autoservice thread when there are no channels currently in
autoservice.

1) Change it so that autoservice thread doesn't keep looping around calling
   ast_waitfor_n() on 0 channels twice a second.  Instead, use a thread condition
   so that the thread properly goes to sleep and does not wake up until a
   channel is put into autoservice.

   This actually fixes an interesting bug, as well.  If the autoservice thread
   is already running (almost always is the case), then when the thread goes
   from having 0 channels to have 1 channel to autoservice, that channel would
   have to wait for up to 1/2 of a second to have the first frame read from it.

2) Fix up the code in ast_waitfor_nandfds() for when it gets called with no
   channels and no fds to poll() on, such as was the case with the previous code
   for the autoservice thread.  In this case, the code would call alloca(0), and
   pass the result as the first argument to poll().  In this case, the 2nd
   argument to poll() specified that there were no fds, so this invalid pointer
   shouldn't actually get dereferenced, but, this code makes it explicit and
   ensures the pointers are NULL unless we have valid data to put there.

(related to issue #12116)

........

................
r105566 | russell | 2008-03-03 09:02:19 -0700 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105565 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105565 | russell | 2008-03-03 10:01:50 -0600 (Mon, 03 Mar 2008) | 3 lines

Update the copyright information for autoservice.  Most of the code in this file
now is stuff that I have written recently ...

........

................
r105569 | russell | 2008-03-03 10:06:35 -0700 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105568 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105568 | russell | 2008-03-03 11:05:16 -0600 (Mon, 03 Mar 2008) | 3 lines

Fix a potential memory leak of the local_pvt struct when ast_channel allocation
fails.  Also, in passing, centralize the code necessary to destroy a local_pvt.

........

................
r105571 | russell | 2008-03-03 10:17:27 -0700 (Mon, 03 Mar 2008) | 11 lines

Merged revisions 105570 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105570 | russell | 2008-03-03 11:16:53 -0600 (Mon, 03 Mar 2008) | 3 lines

In the case of an ast_channel allocation failure, take the local_pvt out of the
pvt list before destroying it.

........

................
r105573 | qwell | 2008-03-03 11:08:05 -0700 (Mon, 03 Mar 2008) | 15 lines

Merged revisions 105572 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105572 | qwell | 2008-03-03 12:06:52 -0600 (Mon, 03 Mar 2008) | 7 lines

Fix types for astNumChannels and astConfigCallsProcessed.

(closes issue #12114)
Reported by: jeffg
Patches:
      12114.patch uploaded by jeffg (license 192)

........

................
r105574 | russell | 2008-03-03 11:49:34 -0700 (Mon, 03 Mar 2008) | 4 lines

Fix some code that was improperly changed in revision 104866 from issue #12079.

(closes issue #12129, reported by elguero, patched by me)

................

Modified:
    team/murf/bug11210/   (props changed)
    team/murf/bug11210/CHANGES
    team/murf/bug11210/apps/app_dial.c
    team/murf/bug11210/apps/app_queue.c
    team/murf/bug11210/apps/app_voicemail.c
    team/murf/bug11210/build_tools/strip_nonapi
    team/murf/bug11210/cdr/cdr_adaptive_odbc.c
    team/murf/bug11210/channels/chan_gtalk.c
    team/murf/bug11210/channels/chan_jingle.c
    team/murf/bug11210/channels/chan_local.c
    team/murf/bug11210/channels/chan_sip.c
    team/murf/bug11210/channels/chan_skinny.c
    team/murf/bug11210/channels/chan_vpb.cc
    team/murf/bug11210/channels/chan_zap.c
    team/murf/bug11210/configs/sip.conf.sample
    team/murf/bug11210/contrib/init.d/rc.debian.asterisk
    team/murf/bug11210/funcs/func_devstate.c
    team/murf/bug11210/include/asterisk/_private.h
    team/murf/bug11210/include/asterisk/app.h
    team/murf/bug11210/include/asterisk/global_datastores.h
    team/murf/bug11210/include/asterisk/lock.h
    team/murf/bug11210/main/Makefile
    team/murf/bug11210/main/app.c
    team/murf/bug11210/main/asterisk.c
    team/murf/bug11210/main/autoservice.c
    team/murf/bug11210/main/cdr.c
    team/murf/bug11210/main/channel.c
    team/murf/bug11210/main/dial.c
    team/murf/bug11210/main/features.c
    team/murf/bug11210/main/global_datastores.c
    team/murf/bug11210/main/pbx.c
    team/murf/bug11210/main/slinfactory.c
    team/murf/bug11210/main/utils.c
    team/murf/bug11210/res/res_jabber.c
    team/murf/bug11210/res/snmp/agent.c
    team/murf/bug11210/utils/check_expr.c

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Mar  3 18:30:29 2008
@@ -1,1 +1,1 @@
-/trunk:1-104841
+/trunk:1-105583

Modified: team/murf/bug11210/CHANGES
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/CHANGES?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/CHANGES (original)
+++ team/murf/bug11210/CHANGES Mon Mar  3 18:30:29 2008
@@ -97,6 +97,9 @@
   * New CLI command: "core set chanvar" to set a channel variable from the CLI.
   * Added an easy way to execute Asterisk CLI commands at startup.  Any commands
     listed in the startup_commands section of cli.conf will get executed.
+  * Added a CLI command, "devstate change", which allows you to set custom device
+     states from the func_devstate module that provides the DEVICE_STATE() function
+     and handling of the "Custom:" devices.
 
 SIP changes
 -----------
@@ -170,7 +173,7 @@
   * Proper codec support in chan_skinny.
   * Added settings for IP and Ethernet QoS requests
 
-MGCP changes
+
 ------------
   * Added separate settings for media QoS in mgcp.conf
 

Modified: team/murf/bug11210/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_dial.c?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/apps/app_dial.c (original)
+++ team/murf/bug11210/apps/app_dial.c Mon Mar  3 18:30:29 2008
@@ -1208,6 +1208,19 @@
 	return 1; /* success */
 }
 
+static void set_dial_features(struct ast_flags64 *opts, struct ast_dial_features *features)
+{
+	struct ast_flags64 perm_opts = {.flags = 0};
+
+	ast_copy_flags64(&perm_opts, opts,
+		OPT_CALLER_TRANSFER | OPT_CALLER_PARK | OPT_CALLER_MONITOR | OPT_CALLER_MIXMONITOR | OPT_CALLER_HANGUP |
+		OPT_CALLEE_TRANSFER | OPT_CALLEE_PARK | OPT_CALLEE_MONITOR | OPT_CALLEE_MIXMONITOR | OPT_CALLEE_HANGUP);
+
+	memset(features->options, 0, sizeof(features->options));
+
+	ast_app_options2str64(dial_exec_options, &perm_opts, features->options, sizeof(features->options));
+}
+
 static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags64 *peerflags, int *continue_exec)
 {
 	int res = -1; /* default: error */
@@ -1243,6 +1256,9 @@
 	struct ast_flags64 opts = { 0, };
 	char *opt_args[OPT_ARG_ARRAY_SIZE];
 	struct ast_datastore *datastore = NULL;
+	struct ast_datastore *ds_caller_features = NULL;
+	struct ast_datastore *ds_callee_features = NULL;
+	struct ast_dial_features *caller_features;
 	int fulldial = 0, num_dialed = 0;
 
 	if (ast_strlen_zero(data)) {
@@ -1316,6 +1332,29 @@
 	}
 
 	ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
+
+	/* Create datastore for channel dial features for caller */
+	if (!(ds_caller_features = ast_channel_datastore_alloc(&dial_features_info, NULL))) {
+		ast_log(LOG_WARNING, "Unable to create channel datastore for dial features. Aborting!\n");
+		goto out;
+	}
+
+	if (!(caller_features = ast_malloc(sizeof(*caller_features)))) {
+		ast_log(LOG_WARNING, "Unable to allocate memory for feature flags. Aborting!\n");
+		goto out;
+	}
+
+	ast_copy_flags(&(caller_features->features_callee), &(config.features_caller), AST_FLAGS_ALL);
+	caller_features->is_caller = 1;
+	set_dial_features(&opts, caller_features);
+
+	ds_caller_features->inheritance = DATASTORE_INHERIT_FOREVER;
+	ds_caller_features->data = caller_features;
+
+	ast_channel_lock(chan);
+	ast_channel_datastore_add(chan, ds_caller_features);
+	ast_channel_unlock(chan);
+
 	/* loop through the list of dial destinations */
 	rest = args.peers;
 	while ((cur = strsep(&rest, "&")) ) {
@@ -1327,6 +1366,7 @@
 		char *tech = strsep(&number, "/");
 		/* find if we already dialed this interface */
 		struct ast_dialed_interface *di;
+		struct ast_dial_features *callee_features;
 		AST_LIST_HEAD(, ast_dialed_interface) *dialed_interfaces;
 		num_dialed++;
 		if (!number) {
@@ -1465,6 +1505,30 @@
 			ast_copy_string(tc->exten, chan->macroexten, sizeof(tc->exten));
 		else
 			ast_copy_string(tc->exten, chan->exten, sizeof(tc->exten));
+
+		/* Save callee features */
+		if (!(ds_callee_features = ast_channel_datastore_alloc(&dial_features_info, NULL))) {
+			ast_log(LOG_WARNING, "Unable to create channel datastore for dial features. Aborting!\n");
+			ast_free(tmp);
+			goto out;
+		}
+
+		if (!(callee_features = ast_malloc(sizeof(*callee_features)))) {
+			ast_log(LOG_WARNING, "Unable to allocate memory for feature flags. Aborting!\n");
+			ast_free(tmp);
+			goto out;
+		}
+
+		ast_copy_flags(&(callee_features->features_callee), &(config.features_callee), AST_FLAGS_ALL);
+		callee_features->is_caller = 0;
+		set_dial_features(&opts, callee_features);
+
+		ds_callee_features->inheritance = DATASTORE_INHERIT_FOREVER;
+		ds_callee_features->data = callee_features;
+
+		ast_channel_lock(chan);
+		ast_channel_datastore_add(tc, ds_callee_features);
+		ast_channel_unlock(chan);
 
 		res = ast_call(tc, numsubst, 0); /* Place the call, but don't wait on the answer */
 

Modified: team/murf/bug11210/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_queue.c?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/apps/app_queue.c (original)
+++ team/murf/bug11210/apps/app_queue.c Mon Mar  3 18:30:29 2008
@@ -2687,6 +2687,10 @@
 			struct ao2_iterator mem_iter = ao2_iterator_init(qe->parent->members, 0);
 			while ((cur = ao2_iterator_next(&mem_iter))) {
 				switch (cur->status) {
+				case AST_DEVICE_INUSE:
+					if (!qe->parent->ringinuse)
+						break;
+					/* else fall through */
 				case AST_DEVICE_NOT_INUSE:
 				case AST_DEVICE_UNKNOWN:
 					if (!cur->paused)

Modified: team/murf/bug11210/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_voicemail.c?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/apps/app_voicemail.c (original)
+++ team/murf/bug11210/apps/app_voicemail.c Mon Mar  3 18:30:29 2008
@@ -375,7 +375,7 @@
 	char zonetag[80];                /*!< Time zone */
 	char callback[80];
 	char dialout[80];
-	char uniqueid[20];               /*!< Unique integer identifier */
+	char uniqueid[80];               /*!< Unique integer identifier */
 	char exit[80];
 	char attachfmt[20];              /*!< Attachment format */
 	unsigned int flags;              /*!< VM_ flags */	

Modified: team/murf/bug11210/build_tools/strip_nonapi
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/build_tools/strip_nonapi?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/build_tools/strip_nonapi (original)
+++ team/murf/bug11210/build_tools/strip_nonapi Mon Mar  3 18:30:29 2008
@@ -18,9 +18,18 @@
 
 FILTER="${GREP} -v -e ^ast_ -e ^_ast_ -e ^__ast_ -e ^astman_ -e ^pbx_ -e ^resample_"
 
+case "${PROC}" in
+	powerpc64)
+		TEXTSYM=" D "
+		;;
+	*)
+		TEXTSYM=" T "
+		;;
+esac
+
 case "${OSARCH}" in
     linux-gnu|FreeBSD)
-	nm ${1} | ${GREP} -e " T " | cut -d" " -f3 | ${FILTER} > striplist
+	nm ${1} | ${GREP} -e "$TEXTSYM" | cut -d" " -f3 | ${FILTER} > striplist
 	sed -e "s/^/-N /" striplist | xargs ${STRIP} ${1}
 	rm -f striplist
 	;;

Modified: team/murf/bug11210/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/cdr/cdr_adaptive_odbc.c?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/cdr/cdr_adaptive_odbc.c (original)
+++ team/murf/bug11210/cdr/cdr_adaptive_odbc.c Mon Mar  3 18:30:29 2008
@@ -293,11 +293,8 @@
 #define LENGTHEN_BUF1(size)														\
 			do {																\
 				/* Lengthen buffer, if necessary */								\
-				if ((newsize = lensql + (size) + 3) > sizesql) {	\
-					if ((tmp = ast_realloc(sql, (newsize / 512 + 1) * 512))) {	\
-						sql = tmp;												\
-						sizesql = (newsize / 512 + 1) * 512;					\
-					} else {													\
+				if (sql->used + size + 1 > sql->len) {                          \
+					if (ast_str_make_space(&sql, ((sql->len + size + 1) / 512 + 1) * 512) != 0) { \
 						ast_log(LOG_ERROR, "Unable to allocate sufficient memory.  Insert CDR '%s:%s' failed.\n", tableptr->connection, tableptr->table); \
 						ast_free(sql);											\
 						ast_free(sql2);											\
@@ -309,12 +306,9 @@
 
 #define LENGTHEN_BUF2(size)														\
 			do {																\
-				if ((newsize = lensql2 + (size) + 3) > sizesql2) {				\
-					if ((tmp = ast_realloc(sql2, (newsize / 512 + 1) * 512))) {	\
-						sql2 = tmp;												\
-						sizesql2 = (newsize / 512 + 1) * 512;					\
-					} else {													\
-						ast_log(LOG_ERROR, "Unable to allocate sufficient memory.  Insert CDR '%s:%s' failed.\n", tableptr->connection, tableptr->table);	\
+				if (sql2->used + size + 1 > sql2->len) {                        \
+					if (ast_str_make_space(&sql2, ((sql2->len + size + 3) / 512 + 1) * 512) != 0) { \
+						ast_log(LOG_ERROR, "Unable to allocate sufficient memory.  Insert CDR '%s:%s' failed.\n", tableptr->connection, tableptr->table); \
 						ast_free(sql);											\
 						ast_free(sql2);											\
 						AST_RWLIST_UNLOCK(&odbc_tables);						\
@@ -328,9 +322,8 @@
 	struct tables *tableptr;
 	struct columns *entry;
 	struct odbc_obj *obj;
-	int lensql, lensql2, sizesql = maxsize, sizesql2 = maxsize2, newsize;
-	/* Allocated, so we can realloc() */
-	char *sql = ast_calloc(sizeof(char), sizesql), *sql2 = ast_calloc(sizeof(char), sizesql2), *tmp;
+	struct ast_str *sql = ast_str_create(maxsize), *sql2 = ast_str_create(maxsize2);
+	char *tmp;
 	char colbuf[1024], *colptr;
 	SQLHSTMT stmt = NULL;
 	SQLLEN rows = 0;
@@ -351,12 +344,12 @@
 	}
 
 	AST_LIST_TRAVERSE(&odbc_tables, tableptr, list) {
-		lensql = snprintf(sql, sizesql, "INSERT INTO %s (", tableptr->table);
-		lensql2 = snprintf(sql2, sizesql2, " VALUES (");
+		ast_str_set(&sql, 0, "INSERT INTO %s (", tableptr->table);
+		ast_str_set(&sql2, 0, " VALUES (");
 
 		/* No need to check the connection now; we'll handle any failure in prepare_and_execute */
 		if (!(obj = ast_odbc_request_obj(tableptr->connection, 0))) {
-			ast_log(LOG_WARNING, "cdr_adaptive_odbc: Unable to retrieve database handle for '%s:%s'.  CDR failed: %s\n", tableptr->connection, tableptr->table, sql);
+			ast_log(LOG_WARNING, "cdr_adaptive_odbc: Unable to retrieve database handle for '%s:%s'.  CDR failed: %s\n", tableptr->connection, tableptr->table, sql->str);
 			continue;
 		}
 
@@ -407,26 +400,21 @@
 							colptr[entry->octetlen] = '\0';
 					}
 
-					lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+					ast_str_append(&sql, 0, "%s,", entry->name);
 					LENGTHEN_BUF2(strlen(colptr));
 
 					/* Encode value, with escaping */
-					strcpy(sql2 + lensql2, "'");
-					lensql2++;
+					ast_str_append(&sql2, 0, "'");
 					for (tmp = colptr; *tmp; tmp++) {
 						if (*tmp == '\'') {
-							strcpy(sql2 + lensql2, "''");
-							lensql2 += 2;
+							ast_str_append(&sql2, 0, "''");
 						} else if (*tmp == '\\' && ast_odbc_backslash_is_escape(obj)) {
-							strcpy(sql2 + lensql2, "\\\\");
-							lensql2 += 2;
+							ast_str_append(&sql2, 0, "\\\\");
 						} else {
-							sql2[lensql2++] = *tmp;
-							sql2[lensql2] = '\0';
-						}
-					}
-					strcpy(sql2 + lensql2, "',");
-					lensql2 += 2;
+							ast_str_append(&sql2, 0, "%c", *tmp);
+						}
+					}
+					ast_str_append(&sql2, 0, "',");
 					break;
 				case SQL_TYPE_DATE:
 					{
@@ -445,9 +433,9 @@
 						if (year > 0 && year < 100)
 							year += 2000;
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(17);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "{ d '%04d-%02d-%02d' },", year, month, day);
+						ast_str_append(&sql2, 0, "{ d '%04d-%02d-%02d' },", year, month, day);
 					}
 					break;
 				case SQL_TYPE_TIME:
@@ -460,9 +448,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(15);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "{ t '%02d:%02d:%02d' },", hour, minute, second);
+						ast_str_append(&sql2, 0, "{ t '%02d:%02d:%02d' },", hour, minute, second);
 					}
 					break;
 				case SQL_TYPE_TIMESTAMP:
@@ -486,9 +474,9 @@
 						if (year > 0 && year < 100)
 							year += 2000;
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(26);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "{ ts '%04d-%02d-%02d %02d:%02d:%02d' },", year, month, day, hour, minute, second);
+						ast_str_append(&sql2, 0, "{ ts '%04d-%02d-%02d %02d:%02d:%02d' },", year, month, day, hour, minute, second);
 					}
 					break;
 				case SQL_INTEGER:
@@ -499,9 +487,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(12);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%d,", integer);
+						ast_str_append(&sql2, 0, "%d,", integer);
 					}
 					break;
 				case SQL_BIGINT:
@@ -512,9 +500,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(24);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%lld,", integer);
+						ast_str_append(&sql2, 0, "%lld,", integer);
 					}
 					break;
 				case SQL_SMALLINT:
@@ -525,9 +513,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(6);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%d,", integer);
+						ast_str_append(&sql2, 0, "%d,", integer);
 					}
 					break;
 				case SQL_TINYINT:
@@ -538,9 +526,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(4);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%d,", integer);
+						ast_str_append(&sql2, 0, "%d,", integer);
 					}
 					break;
 				case SQL_BIT:
@@ -553,9 +541,9 @@
 						if (integer != 0)
 							integer = 1;
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(2);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%d,", integer);
+						ast_str_append(&sql2, 0, "%d,", integer);
 					}
 					break;
 				case SQL_NUMERIC:
@@ -567,9 +555,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(entry->decimals);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%*.*lf,", entry->decimals, entry->radix, number);
+						ast_str_append(&sql2, 0, "%*.*lf,", entry->decimals, entry->radix, number);
 					}
 					break;
 				case SQL_FLOAT:
@@ -582,9 +570,9 @@
 							break;
 						}
 
-						lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", entry->name);
+						ast_str_append(&sql, 0, "%s,", entry->name);
 						LENGTHEN_BUF2(entry->decimals);
-						lensql2 += snprintf(sql2 + lensql2, sizesql2 - lensql2, "%lf,", number);
+						ast_str_append(&sql2, 0, "%lf,", number);
 					}
 					break;
 				default:
@@ -594,20 +582,20 @@
 		}
 
 		/* Concatenate the two constructed buffers */
-		LENGTHEN_BUF1(lensql2);
-		sql[lensql - 1] = ')';
-		sql2[lensql2 - 1] = ')';
-		strcat(sql + lensql, sql2);
-
-		ast_verb(11, "[%s]\n", sql);
-
-		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, sql);
+		LENGTHEN_BUF1(sql2->used);
+		sql->str[sql->used - 1] = ')';
+		sql2->str[sql2->used - 1] = ')';
+		ast_str_append(&sql, 0, "%s", sql2->str);
+
+		ast_verb(11, "[%s]\n", sql->str);
+
+		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, sql->str);
 		if (stmt) {
 			SQLRowCount(stmt, &rows);
 			SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 		}
 		if (rows == 0) {
-			ast_log(LOG_WARNING, "cdr_adaptive_odbc: Insert failed on '%s:%s'.  CDR failed: %s\n", tableptr->connection, tableptr->table, sql);
+			ast_log(LOG_WARNING, "cdr_adaptive_odbc: Insert failed on '%s:%s'.  CDR failed: %s\n", tableptr->connection, tableptr->table, sql->str);
 		}
 early_release:
 		ast_odbc_release_obj(obj);
@@ -615,10 +603,10 @@
 	AST_RWLIST_UNLOCK(&odbc_tables);
 
 	/* Next time, just allocate buffers that are that big to start with. */
-	if (sizesql > maxsize)
-		maxsize = sizesql;
-	if (sizesql2 > maxsize2)
-		maxsize2 = sizesql2;
+	if (sql->used > maxsize)
+		maxsize = sql->used;
+	if (sql2->used > maxsize2)
+		maxsize2 = sql2->used;
 
 	ast_free(sql);
 	ast_free(sql2);

Modified: team/murf/bug11210/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_gtalk.c?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/channels/chan_gtalk.c (original)
+++ team/murf/bug11210/channels/chan_gtalk.c Mon Mar  3 18:30:29 2008
@@ -281,10 +281,8 @@
 		payload_eg711u = iks_new("payload-type");
 	
 		if(!payload_eg711u || !payload_pcmu) {
-			if(payload_pcmu)
-				iks_delete(payload_pcmu);
-			if(payload_eg711u)
-				iks_delete(payload_eg711u);
+			iks_delete(payload_pcmu);
+			iks_delete(payload_eg711u);
 			ast_log(LOG_WARNING,"Failed to allocate iks node");
 			return -1;
 		}
@@ -304,10 +302,8 @@
 		payload_pcma = iks_new("payload-type");
 		payload_eg711a = iks_new("payload-type");
 		if(!payload_eg711a || !payload_pcma) {
-			if(payload_eg711a)
-				iks_delete(payload_eg711a);
-			if(payload_pcma)
-				iks_delete(payload_pcma);
+			iks_delete(payload_eg711a);
+			iks_delete(payload_pcma);
 			ast_log(LOG_WARNING,"Failed to allocate iks node");
 			return -1;
 		}
@@ -378,17 +374,12 @@
 	transport = iks_new("transport");
 	payload_telephone = iks_new("payload-type");
 	if (!(iq && gtalk && dcodecs && transport && payload_telephone)){
-		if(iq)
-			iks_delete(iq);
-		if(gtalk)
-			iks_delete(gtalk);
-		if(dcodecs)
-			iks_delete(dcodecs);
-		if(transport)
-			iks_delete(transport);
-		if(payload_telephone)
-			iks_delete(payload_telephone);
-
+		iks_delete(iq);
+		iks_delete(gtalk);
+		iks_delete(dcodecs);
+		iks_delete(transport);
+		iks_delete(payload_telephone);
+		
 		ast_log(LOG_ERROR, "Could not allocate iksemel nodes\n");
 		return 0;
 	}
@@ -428,6 +419,7 @@
 	iks_insert_node(dcodecs, payload_telephone);
 
 	ast_aji_send(client->connection, iq);
+
 	iks_delete(payload_telephone);
 	iks_delete(transport);
 	iks_delete(dcodecs);
@@ -443,12 +435,9 @@
 	session = iks_new("session");
 	transport = iks_new("transport");
 	if(!(iq && session && transport)) {
-		if(iq)
-			iks_delete(iq);
-		if(session)
-			iks_delete(session);
-		if(transport)
-			iks_delete(transport);
+		iks_delete(iq);
+		iks_delete(session);
+		iks_delete(transport);
 		ast_log(LOG_ERROR, " Unable to allocate IKS node\n");
 		return -1;
 	}
@@ -465,6 +454,7 @@
 	iks_insert_node(iq,session);
 	iks_insert_node(session,transport);
 	ast_aji_send(p->parent->connection, iq);
+
 	iks_delete(transport);
 	iks_delete(session);
 	iks_delete(iq);
@@ -564,13 +554,13 @@
 			}
 		}
 		ast_aji_send(client->connection, response);
-		if (reason)
-			iks_delete(reason);
-		if (error)
-			iks_delete(error);
-		iks_delete(response);
 		res = 0;
 	}
+
+	iks_delete(reason);
+	iks_delete(error);
+	iks_delete(response);
+
 	return res;
 }
 
@@ -832,14 +822,11 @@
 		ast_free(ours1);
 	if (ours2)
 		ast_free(ours2);
-	if (iq)
-		iks_delete(iq);
-	if (gtalk)
-		iks_delete(gtalk);
-	if (candidate)
-		iks_delete(candidate);
-	if(transport)
-		iks_delete(transport);
+	iks_delete(iq);
+	iks_delete(gtalk);
+	iks_delete(candidate);
+	iks_delete(transport);
+
 	return 1;
 }
 
@@ -1022,11 +1009,13 @@
 			iks_insert_attrib(session, "xmlns", "http://www.google.com/session");
 			iks_insert_node(request, session);
 			ast_aji_send(client->connection, request);
-			iks_delete(session);
 			res = 0;
 		}
-		iks_delete(request);
-	}
+	}
+
+	iks_delete(session);
+	iks_delete(request);
+
 	return res;
 }
 
@@ -1260,6 +1249,7 @@
 	iks_insert_attrib(receipt, "to", iks_find_attrib(pak->x, "from"));
 	iks_insert_attrib(receipt, "id", iks_find_attrib(pak->x, "id"));
 	ast_aji_send(c, receipt);
+
 	iks_delete(receipt);
 
 	return 1;
@@ -1402,12 +1392,9 @@
 	gtalk = iks_new("gtalk");
 	dtmf = iks_new("dtmf");
 	if(!iq || !gtalk || !dtmf) {
-		if(iq)
-			iks_delete(iq);
-		if(gtalk)
-			iks_delete(gtalk);
-		if(dtmf)
-			iks_delete(dtmf);
+		iks_delete(iq);
+		iks_delete(gtalk);
+		iks_delete(dtmf);
 		ast_log(LOG_ERROR, "Did not send dtmf do to memory issue\n");
 		return -1;
 	}
@@ -1433,6 +1420,7 @@
 		iks_insert_attrib(dtmf, "action", "button-up");
 	}
 	ast_aji_send(client->connection, iq);
+
 	iks_delete(iq);
 	iks_delete(gtalk);
 	iks_delete(dtmf);

Modified: team/murf/bug11210/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_jingle.c?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/channels/chan_jingle.c (original)
+++ team/murf/bug11210/channels/chan_jingle.c Mon Mar  3 18:30:29 2008
@@ -362,6 +362,7 @@
 		iks_insert_node(dcodecs, payload_cn);
 
 		ast_aji_send(c, iq);
+
 		iks_delete(payload_red);
 		iks_delete(payload_audio);
 		iks_delete(payload_cn);
@@ -463,13 +464,13 @@
 			}
 		}
 		ast_aji_send(client->connection, response);
-		if (reason)
-			iks_delete(reason);
-		if (error)
-			iks_delete(error);
-		iks_delete(response);
 		res = 0;
 	}
+	
+	iks_delete(reason);
+	iks_delete(error);
+	iks_delete(response);
+
 	return res;
 }
 
@@ -727,16 +728,12 @@
 		ast_free(ours1);
 	if (ours2)
 		ast_free(ours2);
-	if (iq)
-		iks_delete(iq);
-	if (jingle)
-		iks_delete(jingle);
-	if (content)
-		iks_delete(content);
-	if (transport)
-		iks_delete(transport);
-	if (candidate)
-		iks_delete(candidate);
+	iks_delete(iq);
+	iks_delete(jingle);
+	iks_delete(content);
+	iks_delete(transport);
+	iks_delete(candidate);
+
 	return 1;
 }
 
@@ -905,11 +902,13 @@
 			iks_insert_node(iq, jingle);
 
 			ast_aji_send(client->connection, iq);
-			iks_delete(jingle);
 			res = 0;
 		}
-		iks_delete(iq);
-	}
+	}
+	
+	iks_delete(jingle);
+	iks_delete(iq);
+	
 	return res;
 }
 
@@ -1114,6 +1113,7 @@
 	iks_insert_attrib(receipt, "to", iks_find_attrib(pak->x, "from"));
 	iks_insert_attrib(receipt, "id", iks_find_attrib(pak->x, "id"));
 	ast_aji_send(c, receipt);
+
 	iks_delete(receipt);
 
 	return 1;
@@ -1246,12 +1246,9 @@
 	jingle = iks_new("jingle");
 	dtmf = iks_new("dtmf");
 	if(!iq || !jingle || !dtmf) {
-		if(iq)
-			iks_delete(iq);
-		if(jingle)
-			iks_delete(jingle);
-		if(dtmf)
-			iks_delete(dtmf);
+		iks_delete(iq);
+		iks_delete(jingle);
+		iks_delete(dtmf);
 		ast_log(LOG_ERROR, "Did not send dtmf do to memory issue\n");
 		return -1;
 	}
@@ -1277,6 +1274,7 @@
 		iks_insert_attrib(dtmf, "action", "button-up");
 	}
 	ast_aji_send(client->connection, iq);
+
 	iks_delete(iq);
 	iks_delete(jingle);
 	iks_delete(dtmf);

Modified: team/murf/bug11210/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_local.c?view=diff&rev=105584&r1=105583&r2=105584
==============================================================================
--- team/murf/bug11210/channels/chan_local.c (original)
+++ team/murf/bug11210/channels/chan_local.c Mon Mar  3 18:30:29 2008
@@ -157,6 +157,16 @@
 	return res;
 }
 
+/*!
+ * \note Assumes the pvt is no longer in the pvts list
+ */

[... 1766 lines stripped ...]



More information about the asterisk-commits mailing list