[svn-commits] murf: branch group/newcdr r166766 - in /team/group/newcdr: ./ apps/ channels/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 24 11:49:54 CST 2008


Author: murf
Date: Wed Dec 24 11:49:54 2008
New Revision: 166766

URL: http://svn.digium.com/view/asterisk?view=rev&rev=166766
Log:
Merged revisions 166092,166095,166158,166162,166219,166258,166263,166267-166268,166273,166282,166317,166342,166377,166382,166436,166470,166533,166569,166601,166625,166665,166696,166731 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r166092 | mmichelson | 2008-12-19 15:26:16 -0700 (Fri, 19 Dec 2008) | 28 lines

Adding a new dialplan function AUDIOHOOK_INHERIT

This function is being added as a method to allow for
an audiohook to move to a new channel during a channel
masquerade. The most obvious use for such a facility is
for MixMonitor when a transfer is performed. Prior to
the addition of this functionality, if a channel 
running MixMonitor was transferred by another party, then
the recording would stop once the transfer had completed.
By using AUDIOHOOK_INHERIT, you can make MixMonitor 
continue recording the call even after the transfer
has completed.

It has also been determined that since this is seen
by most as a bug fix and is not an invasive change,
this functionality will also be backported to 1.4 and
merged into the 1.6.0 branches, even though they are
feature-frozen.

(closes issue #13538)
Reported by: mbit
Patches:
      13538.patch uploaded by putnopvut (license 60)
	  Tested by: putnopvut

Review: http://reviewboard.digium.com/r/102/


................
r166095 | mmichelson | 2008-12-19 15:40:57 -0700 (Fri, 19 Dec 2008) | 5 lines

Remove the verbatim tag from the author line

I could have sworn I already did that before, though...


................
r166158 | mmichelson | 2008-12-19 16:36:22 -0700 (Fri, 19 Dec 2008) | 16 lines

Blocked revisions 166157 via svnmerge

........
r166157 | mmichelson | 2008-12-19 17:34:57 -0600 (Fri, 19 Dec 2008) | 9 lines

Backport of AUDIOHOOK_INHERIT for Asterisk 1.4

(closes issue #13538)
Reported by: mbit
Patches:
      13538.patch uploaded by putnopvut (license 60)
Tested by: putnopvut


........

................
r166162 | mmichelson | 2008-12-19 16:45:00 -0700 (Fri, 19 Dec 2008) | 6 lines

Get rid of an extra space.

I don't know how this crept back in when I had already
fixed it earlier


................
r166219 | russell | 2008-12-19 18:37:23 -0700 (Fri, 19 Dec 2008) | 2 lines

Make a note about formatting the review URL in commit messages

................
r166258 | russell | 2008-12-22 07:16:54 -0700 (Mon, 22 Dec 2008) | 26 lines

Remove AST_PBX_KEEPALIVE usage from res_agi.

This patch removes the usage of AST_PBX_KEEPALIVE from res_agi.  The only usage
was for the AGI command, "asyncagi break".  This patch removes this feature.
Normally, a feature would not be removed like this.  However, this code is
broken and usage of it will result in a memory leak.

Usage of this feature will make the AGI code return a result of 
AST_PBX_KEEPALIVE.  The PBX handler assumes that another thread has assumed
ownership of the channel.  The channel thread will exit without destroying the
channel.  Unfortunately, _no_ thread has ownership of the channel at this
point.  There are a couple of serious problems here:

1) The only way to recover the caller is to issue a channel redirect.  This
   will work, but this will be done with a masquerade, and the old ast_channel
   structure will be lost.

2) Until the channel redirect happens, there is no code servicing the channel.
   That means nothing is reading audio or handling events coming from the
   channel.  This is very bad.

The recommended way to get this same "break" functionality is to issue the
redirect while the channel is still being handled by the AGI code.  That way,
there will be no memory leak, and there will be no period of time that the
channel is not being serviced.

................
r166263 | russell | 2008-12-22 07:52:35 -0700 (Mon, 22 Dec 2008) | 14 lines

Blocked revisions 166262 via svnmerge

........
r166262 | russell | 2008-12-22 08:45:27 -0600 (Mon, 22 Dec 2008) | 7 lines

Re-work ref count handling of MoH classes using astobj2 to resolve crashes.

(closes issue #13566)
Reported by: igorcarneiro
Tested by: russell
Review: http://reviewboard.digium.com/r/106/

........

................
r166267 | mmichelson | 2008-12-22 09:07:59 -0700 (Mon, 22 Dec 2008) | 17 lines

Fix a file playback crash and explicitly initialize values in func_timeout.c

A crash was brought up on the bugtracker. The first run through valgrind
was full of legitimate complaints of uninitialized values in func_timeout when
setting a response timeout. These were fixed but the crash persisted.

A second run through showed the real problem. The reference counting used
for filestreams was incorrect because there were some missing increments
when a frame was read from a format module.

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


................
r166268 | file | 2008-12-22 09:08:13 -0700 (Mon, 22 Dec 2008) | 7 lines

Record the previous port in the temporary address structure so that the comparison does not treat the host as having changed even if it did not. This would have been uninitialized before and would have led to a baddddd port.
(closes issue #13628)
Reported by: pananix
Patches:
      bug13628.patch uploaded by jpeeler (license 325)
Tested by: file, blitzrage

................
r166273 | russell | 2008-12-22 09:10:40 -0700 (Mon, 22 Dec 2008) | 7 lines

Re-work ref count handling of MoH classes using astobj2 to resolve crashes.

(closes issue #13566)
Reported by: igorcarneiro
Tested by: russell
Review: http://reviewboard.digium.com/r/106/

................
r166282 | russell | 2008-12-22 10:09:36 -0700 (Mon, 22 Dec 2008) | 12 lines

Introduce ast_careful_fwrite() and use in AMI to prevent partial writes.

This patch introduces a function to do careful writes on a file stream which
will handle timeouts and partial writes.  It is currently used in AMI to
address the issue that has been reported.  However, there are probably a few
other places where this could be used.

(closes issue #13546)
Reported by: srt
Tested by: russell
http://reviewboard.digium.com/r/104/

................
r166317 | russell | 2008-12-22 10:29:10 -0700 (Mon, 22 Dec 2008) | 10 lines

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

........
r166297 | russell | 2008-12-22 11:22:56 -0600 (Mon, 22 Dec 2008) | 2 lines

Fix up timeout handling in ast_carefulwrite().

........

................
r166342 | russell | 2008-12-22 10:44:23 -0700 (Mon, 22 Dec 2008) | 2 lines

Remove some error messages.  This is the default handler that is valid to use.

................
r166377 | russell | 2008-12-22 13:26:48 -0700 (Mon, 22 Dec 2008) | 2 lines

Fix a bad typo.

................
r166382 | mmichelson | 2008-12-22 14:08:03 -0700 (Mon, 22 Dec 2008) | 44 lines

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

........
r166380 | mmichelson | 2008-12-22 14:56:29 -0600 (Mon, 22 Dec 2008) | 36 lines

Fix a deadlock relating to channel locks and autoservice

It has been discovered that if a channel is locked prior
to a call to ast_autoservice_stop, then it is likely that
a deadlock will occur. The reason is that the call to 
ast_autoservice_stop has a check built into it to be sure
that the thread running autoservice is not currently trying
to manipulate the channel we are about to pull out of 
autoservice.

The autoservice thread, however, cannot advance beyond where
it currently is, though, because it is trying to acquire
the lock of the channel for which autoservice is attempting
to be stopped.

The gist of all this is that a channel MUST NOT be locked
when attempting to stop autoservice on the channel.

In this particular case, the channel was locked by a call
to ast_read. A call to ast_exists_extension led to autoservice
being started and stopped due to the existence of dialplan
switches.

It may be that there are future commits which handle the same
symptoms but in a different location, but based on my looks through
the code, it is very rare to see a construct such as this one.

(closes issue #14057)
Reported by: rtrauntvein
Patches:
      14057v3.patch uploaded by putnopvut (license 60)
Tested by: rtrauntvein

Review: http://reviewboard.digium.com/r/107/


........

................
r166436 | russell | 2008-12-22 14:45:28 -0700 (Mon, 22 Dec 2008) | 2 lines

Cosmetic change - don't mix struct initializer styles.

................
r166470 | mmichelson | 2008-12-22 16:25:34 -0700 (Mon, 22 Dec 2008) | 11 lines

Always use the value of the AGISIGHUP when running an AGI.

Prior to this patch, the value of AGISIGUP was not always
honored when set on a channel.

(closes issue #13711)
Reported by: fmueller
Patches:
      13711.patch uploaded by putnopvut (license 60)


................
r166533 | tilghman | 2008-12-22 21:32:15 -0700 (Mon, 22 Dec 2008) | 11 lines

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

........
  r166509 | tilghman | 2008-12-22 22:05:25 -0600 (Mon, 22 Dec 2008) | 4 lines
  
  Use the integer form of condition for integer comparisons.
  (closes issue #14127)
   Reported by: andrew
........

................
r166569 | mmichelson | 2008-12-23 08:17:54 -0700 (Tue, 23 Dec 2008) | 20 lines

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

........
r166568 | mmichelson | 2008-12-23 09:16:26 -0600 (Tue, 23 Dec 2008) | 12 lines

Fix a crash resulting from a datastore with inheritance but no duplicate callback

The fix for this is to simply set the newly created datastore's data pointer
to NULL if it is inherited but has no duplicate callback.

(closes issue #14113)
Reported by: francesco_r
Patches:
      14113.patch uploaded by putnopvut (license 60)
Tested by: francesco_r


........

................
r166601 | tilghman | 2008-12-23 08:41:42 -0700 (Tue, 23 Dec 2008) | 9 lines

Blocked revisions 166592 via svnmerge

........
  r166592 | tilghman | 2008-12-23 09:35:38 -0600 (Tue, 23 Dec 2008) | 3 lines
  
  Compile, even if both DAHDI and Zaptel are not installed.
  (Closes issue #14120)
........

................
r166625 | russell | 2008-12-23 09:04:54 -0700 (Tue, 23 Dec 2008) | 1 line

Fix spelling error.
................
r166665 | murf | 2008-12-23 11:13:49 -0700 (Tue, 23 Dec 2008) | 153 lines

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

In order to merge this 1.4 patch into trunk,
I had to resolve some conflicts and wait for
Russell to make some changes to res_agi.
I re-ran all the tests; 39 calls in all, and
made fairly careful notes and comparisons: I
don't want this to blow up some aspect of 
asterisk; I completely removed the KEEPALIVE
from the pbx.h decls. The first 3 scenarios
involving feature park; feature xfer to 700;
hookflash park to Park() app call all behave
the same, don't appear to leave hung channels,
and no crashes.

........
  r166093 | murf | 2008-12-19 15:30:32 -0700 (Fri, 19 Dec 2008) | 131 lines
  
  This merges the masqpark branch into 1.4
  
  These changes eliminate the need for (and use of)
  the KEEPALIVE return code in res_features.c;
  There are other places that use this result code
  for similar purposes at a higher level, these appear
  to be left alone in 1.4, but attacked in trunk.
  
  The reason these changes are being made in 1.4, is
  that parking ends a channel's life, in some situations,
  and the code in the bridge (and some other places),
  was not checking the result code properly, and dereferencing
  the channel pointer, which could lead to memory corruption
  and crashes.
  
  Calling the masq_park function eliminates this danger 
  in higher levels.
  
  A series of previous commits have replaced some parking calls
  with masq_park, but this patch puts them ALL to rest,
  (except one, purposely left alone because a masquerade
  is done anyway), and gets rid of the code that tests
  the KEEPALIVE result, and the NOHANGUP_PEER result codes.
  
  While bug 13820 inspired this work, this patch does
  not solve all the problems mentioned there.
  
  I have tested this patch (again) to make sure I have
  not introduced regressions. 
  
  Crashes that occurred when a parked party hung up
  while the parking party was listening to the numbers
  of the parking stall being assigned, is eliminated.
  
  These are the cases where parking code may be activated:
  
  1. Feature one touch (eg. *3)
  2. Feature blind xfer to parking lot (eg ##700)
  3. Run Park() app from dialplan (eg sip xfer to 700)
     (eg. dahdi hookflash xfer to 700)
  4. Run Park via manager.
  
  The interesting testing cases for parking are:
  I. A calls B, A parks B
      a. B hangs up while A is getting the numbers announced.
      b. B hangs up after A gets the announcement, but 
         before the parking time expires
      c. B waits, time expires, A is redialed,
         A answers, B and A are connected, after
         which, B hangs up.
      d. C picks up B while still in parking lot.
  
  II. A calls B, B parks A
      a. A hangs up while B is getting the numbers announced.
      b. A hangs up after B gets the announcement, but 
         before the parking time expires
      c. A waits, time expires, B is redialed,
         B answers, A and B are connected, after
         which, A hangs up.
      d. C picks up A while still in parking lot.
  
  Testing this throroughly involves acting all the permutations
  of I and II, in situations 1,2,3, and 4.
  
  Since I added a few more changes (ALL references to KEEPALIVE in the bridge
  code eliimated (I missed one earlier), I retested
  most of the above cases, and no crashes.
  
  H-extension weirdness.
  
  Current h-extension execution is not completely
  correct for several of the cases.
  
  For the case where A calls B, and A parks B, the
  'h' exten is run on A's channel as soon as the park
  is accomplished. This is expected behavior.
  
  But when A calls B, and B parks A, this will be
  current behavior:
  
  After B parks A, B is hung up by the system, and
  the 'h' (hangup) exten gets run, but the channel
  mentioned will be a derivative of A's...
  
  Thus, if A is DAHDI/1, and B is DAHDI/2,
  the h-extension will be run on channel
  Parked/DAHDI/1-1<ZOMBIE>, and the 
  start/answer/end info will be those 
  relating to Channel A.
  
  And, in the case where A is reconnected to
  B after the park time expires, when both parties
  hang up after the joyful reunion, no h-exten
  will be run at all.
  
  In the case where C picks up A from the 
  parking lot, when either A or C hang up,
  the h-exten will be run for the C channel.
  
  CDR's are a separate issue, and not addressed
  here.
  
  As to WHY this strange behavior occurs, 
  the answer lies in the procedure followed
  to accomplish handing over the channel
  to the parking manager thread. This procedure
  is called masquerading. In the process,
  a duplicate copy of the channel is created,
  and most of the active data is given to the
  new copy. The original channel gets its name
  changed to XXX<ZOMBIE> and keeps the PBX
  information for the sake of the original
  thread (preserving its role as a call 
  originator, if it had this role to begin
  with), while the new channel is without
  this info and becomes a call target (a
  "peer").
  
  In this case, the parking lot manager
  thread is handed the new (masqueraded)
  channel. It will not run an h-exten
  on the channel if it hangs up while
  in the parking lot. The h exten will
  be run on the original channel instead,
  in the original thread, after the bridge
  completes.
  
  See bug 13820 for our intentions as
  to how to clean up the h exten behavior.

Review: http://reviewboard.digium.com/r/29/

........

................
r166696 | tilghman | 2008-12-23 13:47:08 -0700 (Tue, 23 Dec 2008) | 7 lines

Allow semicolons and extended characters in user-specified SIP headers.
(closes issue #14110)
 Reported by: gork
 Patches: 
       20081222__bug14110__2.diff.txt uploaded by Corydon76 (license 14)
 Tested by: gork, putnopvut

................
r166731 | twilson | 2008-12-24 08:10:42 -0700 (Wed, 24 Dec 2008) | 10 lines

There is no section 22.2.2 in rfc 3261.  I believe 26.2.2 is what was meant:

      Note that in the SIPS URI scheme, transport is independent of TLS,
      and thus "sips:alice at atlanta.com;transport=tcp" and
      "sips:alice at atlanta.com;transport=sctp" are both valid (although
      note that UDP is not a valid transport for SIPS).  The use of
      "transport=tls" has consequently been deprecated, partly because
      it was specific to a single hop of the request.  This is a change
      since RFC 2543.

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

Added:
    team/group/newcdr/funcs/func_audiohookinherit.c
      - copied unchanged from r166731, trunk/funcs/func_audiohookinherit.c
Modified:
    team/group/newcdr/   (props changed)
    team/group/newcdr/CHANGES
    team/group/newcdr/apps/app_dial.c
    team/group/newcdr/apps/app_macro.c
    team/group/newcdr/apps/app_queue.c
    team/group/newcdr/channels/chan_dahdi.c
    team/group/newcdr/channels/chan_sip.c
    team/group/newcdr/funcs/func_timeout.c
    team/group/newcdr/include/asterisk/audiohook.h
    team/group/newcdr/include/asterisk/doxyref.h
    team/group/newcdr/include/asterisk/features.h
    team/group/newcdr/include/asterisk/pbx.h
    team/group/newcdr/include/asterisk/utils.h
    team/group/newcdr/main/astobj2.c
    team/group/newcdr/main/audiohook.c
    team/group/newcdr/main/channel.c
    team/group/newcdr/main/dnsmgr.c
    team/group/newcdr/main/features.c
    team/group/newcdr/main/file.c
    team/group/newcdr/main/manager.c
    team/group/newcdr/main/pbx.c
    team/group/newcdr/main/utils.c
    team/group/newcdr/res/res_agi.c
    team/group/newcdr/res/res_musiconhold.c

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/newcdr/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Dec 24 11:49:54 2008
@@ -1,1 +1,1 @@
-/trunk:1-166066
+/trunk:1-166765

Modified: team/group/newcdr/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/CHANGES?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/CHANGES (original)
+++ team/group/newcdr/CHANGES Wed Dec 24 11:49:54 2008
@@ -44,7 +44,7 @@
 
 Skinny Changes
 --------------
- * The configuration file now holds seperate sections for devices and lines.
+ * The configuration file now holds separate sections for devices and lines.
    Please have a look at configs/skinny.conf.sample and change your skinny.conf
    accordingly.
 
@@ -71,6 +71,8 @@
  * Added LOCAL_PEEK, which I have no idea how to use, but Leif Madsen wanted it.
    Russell says it's, like, a scope resolution function for LOCAL variables.
    Totally.  Hopefully, that means more to you than it does to me.
+ * Added AUDIOHOOK_INHERIT. For information on its use, please see the output
+   of "core show function AUDIOHOOK_INHERIT" from the CLI
 
 Applications
 ------------

Modified: team/group/newcdr/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_dial.c?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/apps/app_dial.c (original)
+++ team/group/newcdr/apps/app_dial.c Wed Dec 24 11:49:54 2008
@@ -2220,14 +2220,9 @@
 			res = ast_bridge_call(chan, peer, &config);
 		}
 
-		if (res != AST_PBX_NO_HANGUP_PEER_PARKED && ast_test_flag64(&opts, OPT_PEER_H)) {
-			ast_log(LOG_NOTICE, "PEER context: %s; PEER exten: %s;  PEER priority: %d\n",
-				peer->context, peer->exten, peer->priority);
-		}
-		if (res != AST_PBX_NO_HANGUP_PEER_PARKED)
-			strcpy(peer->context, chan->context);
-
-		if (res != AST_PBX_NO_HANGUP_PEER_PARKED && ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
+		strcpy(peer->context, chan->context);
+
+		if (ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
 			int autoloopflag;
 			int found;
 			int res9;
@@ -2247,41 +2242,34 @@
 			}
 			ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP);  /* set it back the way it was */
 		}
-		if (res != AST_PBX_NO_HANGUP_PEER && res != AST_PBX_NO_HANGUP_PEER_PARKED) {
-			if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {		
-				replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
-				ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
-				ast_pbx_start(peer);
-			} else {
-				if (!ast_check_hangup(chan))
-					chan->hangupcause = peer->hangupcause;
-				ast_hangup(peer);
-			}
+		if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {		
+			replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
+			ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
+			ast_pbx_start(peer);
+		} else {
+			if (!ast_check_hangup(chan))
+				chan->hangupcause = peer->hangupcause;
+			ast_hangup(peer);
 		}
 	}
 out:
-	/* cleaning up chan is not a good idea here if AST_PBX_KEEPALIVE
-	   is returned; chan will get the love it needs from another
-	   thread */
-	if (res != AST_PBX_KEEPALIVE) {
-		if (moh) {
-			moh = 0;
-			ast_moh_stop(chan);
-		} else if (sentringing) {
-			sentringing = 0;
-			ast_indicate(chan, -1);
-		}
-		ast_channel_early_bridge(chan, NULL);
-		hanguptree(outgoing, NULL, 0); /* In this case, there's no answer anywhere */
-		pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
-		senddialendevent(chan, pa.status);
-		ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
-
-		if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE) && (res != AST_PBX_INCOMPLETE)) {
-			if (!ast_tvzero(calldurationlimit))
-				memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
-			res = 0;
-		}
+	if (moh) {
+		moh = 0;
+		ast_moh_stop(chan);
+	} else if (sentringing) {
+		sentringing = 0;
+		ast_indicate(chan, -1);
+	}
+	ast_channel_early_bridge(chan, NULL);
+	hanguptree(outgoing, NULL, 0); /* In this case, there's no answer anywhere */
+	pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
+	senddialendevent(chan, pa.status);
+	ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
+	
+	if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_INCOMPLETE)) {
+		if (!ast_tvzero(calldurationlimit))
+			memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
+		res = 0;
 	}
 
 done:

Modified: team/group/newcdr/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_macro.c?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/apps/app_macro.c (original)
+++ team/group/newcdr/apps/app_macro.c Wed Dec 24 11:49:54 2008
@@ -406,10 +406,6 @@
 			case MACRO_EXIT_RESULT:
 				res = 0;
 				goto out;
-			case AST_PBX_KEEPALIVE:
-				ast_debug(2, "Spawn extension (%s,%s,%d) exited KEEPALIVE in macro %s on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
-				ast_verb(2, "Spawn extension (%s, %s, %d) exited KEEPALIVE in macro '%s' on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
-				goto out;
 			default:
 				ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
 				ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);

Modified: team/group/newcdr/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/apps/app_queue.c?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/apps/app_queue.c (original)
+++ team/group/newcdr/apps/app_queue.c Wed Dec 24 11:49:54 2008
@@ -4072,24 +4072,21 @@
 		/* 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
 		 */
-		if (bridge != AST_PBX_KEEPALIVE && !attended_transfer_occurred(qe->chan)) {
+		if (!attended_transfer_occurred(qe->chan)) {
 			struct ast_datastore *tds;
 			if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
 					qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
 					(long) (time(NULL) - callstart), qe->opos);
-				if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
-					send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
+				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
 			} else if (ast_check_hangup(qe->chan)) {
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
 					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
-				if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
-					send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
+				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
 			} else {
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
 					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
-				if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
-					send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
+				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
 			}
 			ast_channel_lock(qe->chan);
 			if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
@@ -4102,8 +4099,7 @@
 		if (transfer_ds) {
 			ast_datastore_free(transfer_ds);
 		}
-		if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
-			ast_hangup(peer);
+		ast_hangup(peer);
 		res = bridge ? bridge : 1;
 		ao2_ref(member, -1);
 	}
@@ -5068,7 +5064,7 @@
 	}
 
 	/* Don't allow return code > 0 */
-	if (res >= 0 && res != AST_PBX_KEEPALIVE) {
+	if (res >= 0) {
 		res = 0;	
 		if (ringing) {
 			ast_indicate(chan, -1);

Modified: team/group/newcdr/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_dahdi.c?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/channels/chan_dahdi.c (original)
+++ team/group/newcdr/channels/chan_dahdi.c Wed Dec 24 11:49:54 2008
@@ -4426,18 +4426,31 @@
 			if (strcmp(ast->exten, "fax")) {
 				const char *target_context = S_OR(ast->macrocontext, ast->context);
 
+				/* We need to unlock 'ast' here because ast_exists_extension has the
+				 * potential to start autoservice on the channel. Such action is prone
+				 * to deadlock.
+				 */
+				ast_mutex_unlock(&p->lock);
+				ast_channel_unlock(ast);
 				if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) {
+					ast_channel_lock(ast);
+					ast_mutex_lock(&p->lock);
 					ast_verb(3, "Redirecting %s to fax extension\n", ast->name);
 					/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
 					pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
 					if (ast_async_goto(ast, target_context, "fax", 1))
 						ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, target_context);
-				} else
+				} else {
+					ast_channel_lock(ast);
+					ast_mutex_lock(&p->lock);
 					ast_log(LOG_NOTICE, "Fax detected, but no fax extension\n");
-			} else
+				}
+			} else {
 				ast_debug(1, "Already in a fax extension, not redirecting\n");
-		} else
+			}
+		} else {
 			ast_debug(1, "Fax already handled\n");
+		}
 		dahdi_confmute(p, 0);
 		p->subs[idx].f.frametype = AST_FRAME_NULL;
 		p->subs[idx].f.subclass = 0;

Modified: team/group/newcdr/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/channels/chan_sip.c?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/channels/chan_sip.c (original)
+++ team/group/newcdr/channels/chan_sip.c Wed Dec 24 11:49:54 2008
@@ -117,7 +117,7 @@
  *       specially to communication with other peers (proxies).
  * \todo We need to test TCP sessions with SIP proxies and in regards
  *       to the SIP outbound specs.
- * \todo transport=tls was deprecated in RFC3261 and should not be used at all. See section 22.2.2.
+ * \todo ;transport=tls was deprecated in RFC3261 and should not be used at all. See section 26.2.2.
  *
  * \todo If the message is smaller than the given Content-length, the request should get a 400 Bad request
  *       message. If it's a response, it should be dropped. (RFC 3261, Section 18.3)
@@ -23632,7 +23632,7 @@
 	int no = 0;
 	int ok = FALSE;
 	char varbuf[30];
-	char *inbuf = data;
+	char *inbuf = data, *subbuf;
 	
 	if (ast_strlen_zero(inbuf)) {
 		ast_log(LOG_WARNING, "This application requires the argument: Header\n");
@@ -23646,13 +23646,18 @@
 		snprintf(varbuf, sizeof(varbuf), "__SIPADDHEADER%.2d", no);
 
 		/* Compare without the leading underscores */
-		if( (pbx_builtin_getvar_helper(chan, (const char *) varbuf + 2) == (const char *) NULL) )
+		if ((pbx_builtin_getvar_helper(chan, (const char *) varbuf + 2) == (const char *) NULL)) {
 			ok = TRUE;
+		}
 	}
 	if (ok) {
-		pbx_builtin_setvar_helper (chan, varbuf, inbuf);
-		if (sipdebug)
+		size_t len = strlen(inbuf);
+		subbuf = alloca(len + 1);
+		ast_get_encoded_str(inbuf, subbuf, len + 1);
+		pbx_builtin_setvar_helper(chan, varbuf, subbuf);
+		if (sipdebug) {
 			ast_debug(1, "SIP Header added \"%s\" as %s\n", inbuf, varbuf);
+		}
 	} else {
 		ast_log(LOG_WARNING, "Too many SIP headers added, max 50\n");
 	}

Modified: team/group/newcdr/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/funcs/func_timeout.c?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/funcs/func_timeout.c (original)
+++ team/group/newcdr/funcs/func_timeout.c Wed Dec 24 11:49:54 2008
@@ -119,11 +119,12 @@
 static int timeout_write(struct ast_channel *chan, const char *cmd, char *data,
 			 const char *value)
 {
-	double x;
-	long sec;
+	double x = 0.0;
+	long sec = 0L;
 	char timestr[64];
 	struct ast_tm myt;
-	struct timeval when;
+	struct timeval when = {0,};
+	int res;
 
 	if (!chan)
 		return -1;
@@ -136,9 +137,13 @@
 	if (!value)
 		return -1;
 
-	if ((sscanf(value, "%ld%lf", &sec, &x) == 0) || sec < 0)
+	res = sscanf(value, "%ld%lf", &sec, &x);
+	if (res == 0 || sec < 0) {
 		when.tv_sec = 0;
-	else {
+		when.tv_usec = 0;
+	} else if (res == 1) {
+		when.tv_sec = sec;
+	} else if (res == 2) {
 		when.tv_sec = sec;
 		when.tv_usec = x * 1000000;
 	}

Modified: team/group/newcdr/include/asterisk/audiohook.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/audiohook.h?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/include/asterisk/audiohook.h (original)
+++ team/group/newcdr/include/asterisk/audiohook.h Wed Dec 24 11:49:54 2008
@@ -150,6 +150,21 @@
  */
 int ast_audiohook_detach_list(struct ast_audiohook_list *audiohook_list);
 
+/*! \brief Move an audiohook from one channel to a new one
+ *
+ * \todo Currently only the first audiohook of a specific source found will be moved.
+ * We should add the capability to move multiple audiohooks from a single source as well.
+ *
+ * \note It is required that both old_chan and new_chan are locked prior to calling
+ * this function. Besides needing to protect the data within the channels, not locking
+ * these channels can lead to a potential deadlock
+ *
+ * \param old_chan The source of the audiohook to move
+ * \param new_chan The destination to which we want the audiohook to move
+ * \param source The source of the audiohook we want to move
+ */
+void ast_audiohook_move_by_source(struct ast_channel *old_chan, struct ast_channel *new_chan, const char *source);
+
 /*! 
  * \brief Detach specified source audiohook from channel
  *

Modified: team/group/newcdr/include/asterisk/doxyref.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/doxyref.h?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/include/asterisk/doxyref.h (original)
+++ team/group/newcdr/include/asterisk/doxyref.h Wed Dec 24 11:49:54 2008
@@ -408,6 +408,8 @@
  * To have a commit set a review request as submitted, include the full URL
  * to the review request.  For example:
  * \arg Review: %http://reviewboard.digium.com/r/95/
+ *
+ * \note The trailing slash in the review URL is required.
  *
  * <hr/>
  *

Modified: team/group/newcdr/include/asterisk/features.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/features.h?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/include/asterisk/features.h (original)
+++ team/group/newcdr/include/asterisk/features.h Wed Dec 24 11:49:54 2008
@@ -61,17 +61,12 @@
 	AST_LIST_ENTRY(ast_call_feature) feature_entry;
 };
 
-
 #define AST_FEATURE_RETURN_HANGUP                   -1
 #define AST_FEATURE_RETURN_SUCCESSBREAK             0
-#define AST_FEATURE_RETURN_PBX_KEEPALIVE            AST_PBX_KEEPALIVE
-#define AST_FEATURE_RETURN_NO_HANGUP_PEER           AST_PBX_NO_HANGUP_PEER
-#define AST_FEATURE_RETURN_NO_HANGUP_PEER_PARKED    AST_PBX_NO_HANGUP_PEER_PARKED
 #define AST_FEATURE_RETURN_PASSDIGITS               21
 #define AST_FEATURE_RETURN_STOREDIGITS              22
 #define AST_FEATURE_RETURN_SUCCESS                  23
 #define AST_FEATURE_RETURN_KEEPTRYING               24
-
 
 /*!
  * \brief Park a call and read back parked location 

Modified: team/group/newcdr/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/pbx.h?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/include/asterisk/pbx.h (original)
+++ team/group/newcdr/include/asterisk/pbx.h Wed Dec 24 11:49:54 2008
@@ -41,10 +41,7 @@
 #define AST_PBX_HANGUP                -1    /*!< Jump to the 'h' exten */
 #define AST_PBX_OK                     0    /*!< No errors */
 #define AST_PBX_ERROR                  1    /*!< Jump to the 'e' exten */
-#define AST_PBX_KEEPALIVE              10   /*!< Destroy the thread, but don't hang up the channel */
-#define AST_PBX_NO_HANGUP_PEER         11   /*!< The peer has been involved in a transfer */
 #define AST_PBX_INCOMPLETE             12   /*!< Return to PBX matching, allowing more digits for the extension */
-#define AST_PBX_NO_HANGUP_PEER_PARKED  13   /*!< Don't touch the peer channel - it was sent to the parking lot and might be gone by now */
 /*! } */
 
 #define PRIORITY_HINT	-1	/*!< Special Priority for a hint */

Modified: team/group/newcdr/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/include/asterisk/utils.h?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/include/asterisk/utils.h (original)
+++ team/group/newcdr/include/asterisk/utils.h Wed Dec 24 11:49:54 2008
@@ -326,6 +326,25 @@
 	have a need to wait.  This way, we get better performance.
 */
 int ast_carefulwrite(int fd, char *s, int len, int timeoutms);
+
+/*!
+ * \brief Write data to a file stream with a timeout
+ *
+ * \param f the file stream to write to
+ * \param fd the file description to poll on to know when the file stream can
+ *        be written to without blocking.
+ * \param s the buffer to write from
+ * \param len the number of bytes to write
+ * \param timeoutms The maximum amount of time to block in this function trying
+ *        to write, specified in milliseconds.
+ *
+ * \note This function assumes that the associated file stream has been set up
+ *       as non-blocking.
+ *
+ * \retval 0 success
+ * \retval -1 error
+ */
+int ast_careful_fwrite(FILE *f, int fd, const char *s, size_t len, int timeoutms);
 
 /*
  * Thread management support (should be moved to lock.h or a different header)

Modified: team/group/newcdr/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/main/astobj2.c?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/main/astobj2.c (original)
+++ team/group/newcdr/main/astobj2.c Wed Dec 24 11:49:54 2008
@@ -567,7 +567,6 @@
  */ 
 static int cb_true(void *user_data, void *arg, int flags)
 {
-	ast_log(LOG_ERROR, "Using default callback (cb_true).  If you see this, something is strange!\n");
 	return CMP_MATCH;
 }
 
@@ -576,7 +575,6 @@
  */
 static int cb_true_data(void *user_data, void *arg, void *data, int flags)
 {
-	ast_log(LOG_ERROR, "Using default callback (cb_true_data).  If you see this, something is strange!\n");
 	return CMP_MATCH;
 }
 

Modified: team/group/newcdr/main/audiohook.c
URL: http://svn.digium.com/view/asterisk/team/group/newcdr/main/audiohook.c?view=diff&rev=166766&r1=166765&r2=166766
==============================================================================
--- team/group/newcdr/main/audiohook.c (original)
+++ team/group/newcdr/main/audiohook.c Wed Dec 24 11:49:54 2008
@@ -412,6 +412,11 @@
 	return 0;
 }
 
+/*! \brief find an audiohook based on its source
+ * \param audiohook_list The list of audiohooks to search in
+ * \param source The source of the audiohook we wish to find
+ * \return Return the corresponding audiohook or NULL if it cannot be found.
+ */
 static struct ast_audiohook *find_audiohook_by_source(struct ast_audiohook_list *audiohook_list, const char *source)
 {
 	struct ast_audiohook *audiohook = NULL;
@@ -432,6 +437,25 @@
 	}
 
 	return NULL;
+}
+
+void ast_audiohook_move_by_source(struct ast_channel *old_chan, struct ast_channel *new_chan, const char *source)
+{
+	struct ast_audiohook *audiohook = find_audiohook_by_source(old_chan->audiohooks, source);
+
+	if (!audiohook) {
+		return;
+	}
+	
+	/* By locking both channels and the audiohook, we can assure that
+	 * another thread will not have a chance to read the audiohook's status
+	 * as done, even though ast_audiohook_remove signals the trigger
+	 * condition
+	 */
+	ast_audiohook_lock(audiohook);
+	ast_audiohook_remove(old_chan, audiohook);
+	ast_audiohook_attach(new_chan, audiohook);
+	ast_audiohook_unlock(audiohook);
 }
 
 /*! \brief Detach specified source audiohook from channel

Modified: team/group/newcdr/main/channel.c

[... 1949 lines stripped ...]



More information about the svn-commits mailing list