[asterisk-commits] rmudgett: trunk r300716 - in /trunk: ./ channels/sig_pri.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 5 21:07:43 UTC 2011


Author: rmudgett
Date: Wed Jan  5 15:07:40 2011
New Revision: 300716

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=300716
Log:
Merged revisions 300714 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r300714 | rmudgett | 2011-01-05 14:54:21 -0600 (Wed, 05 Jan 2011) | 21 lines
  
  Merged revision 300711 from
  https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier
  
  ..........
    r300711 | rmudgett | 2011-01-05 13:43:55 -0600 (Wed, 05 Jan 2011) | 14 lines
  
    A call retrieved from hold may wind up with no audio.
  
    If the retrieved call is natively bridged then the call may not have any
    audio path.  The following warning message is given:
    "Failed to add <dfd> to conference <chan>/<chan>: Invalid argument".
  
    * Open the media on a B channel when pri_fixup_principle() moves the call
    from a no_b_channel channel to a real channel.
  
    * Added lock protection while pri_fixup_principle() moves a call from one
    private structure to another.
  
    * Made some pri_fixup_principle() messages more meaningful.
  ..........
................

Modified:
    trunk/   (props changed)
    trunk/channels/sig_pri.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=300716&r1=300715&r2=300716
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Wed Jan  5 15:07:40 2011
@@ -1108,6 +1108,19 @@
 	return -1;
 }
 
+/*!
+ * \internal
+ * \brief Find the private structure for the libpri call.
+ *
+ * \param pri Span controller structure.
+ * \param channel LibPRI encoded channel ID.
+ * \param call LibPRI opaque call pointer.
+ *
+ * \note Assumes the pri->lock is already obtained.
+ *
+ * \retval array-index into private pointer array on success.
+ * \retval -1 on error.
+ */
 static int pri_find_principle(struct sig_pri_span *pri, int channel, q931_call *call)
 {
 	int x;
@@ -1151,6 +1164,19 @@
 	return principle;
 }
 
+/*!
+ * \internal
+ * \brief Fixup the private structure associated with the libpri call.
+ *
+ * \param pri Span controller structure.
+ * \param principle Array-index into private array to move call to if not already there.
+ * \param call LibPRI opaque call pointer to find if need to move call.
+ *
+ * \note Assumes the pri->lock is already obtained.
+ *
+ * \retval principle on success.
+ * \retval -1 on error.
+ */
 static int pri_fixup_principle(struct sig_pri_span *pri, int principle, q931_call *call)
 {
 	int x;
@@ -1181,12 +1207,24 @@
 		new_chan = pri->pvts[principle];
 		old_chan = pri->pvts[x];
 
-		ast_verb(3, "Moving call from channel %d to channel %d\n",
+		/* Get locks to safely move to the new private structure. */
+		sig_pri_lock_private(old_chan);
+		sig_pri_lock_owner(pri, x);
+		sig_pri_lock_private(new_chan);
+
+		ast_verb(3, "Moving call (%s) from channel %d to %d.\n",
+			old_chan->owner ? old_chan->owner->name : "",
 			old_chan->channel, new_chan->channel);
 		if (new_chan->owner) {
 			ast_log(LOG_WARNING,
-				"Can't fix up channel from %d to %d because %d is already in use\n",
-				old_chan->channel, new_chan->channel, new_chan->channel);
+				"Can't move call (%s) from channel %d to %d.  It is already in use.\n",
+				old_chan->owner ? old_chan->owner->name : "",
+				old_chan->channel, new_chan->channel);
+			sig_pri_unlock_private(new_chan);
+			if (old_chan->owner) {
+				ast_channel_unlock(old_chan->owner);
+			}
+			sig_pri_unlock_private(old_chan);
 			return -1;
 		}
 
@@ -1267,7 +1305,21 @@
 			/* Become a member of the old channel span/trunk-group. */
 			new_chan->logicalspan = old_chan->logicalspan;
 			new_chan->mastertrunkgroup = old_chan->mastertrunkgroup;
-		}
+		} else if (old_chan->no_b_channel) {
+			/*
+			 * We are transitioning from a held/call-waiting channel to a
+			 * real channel so we need to make sure that the media path is
+			 * open.  (Needed especially if the channel is natively
+			 * bridged.)
+			 */
+			sig_pri_open_media(new_chan);
+		}
+
+		sig_pri_unlock_private(old_chan);
+		if (new_chan->owner) {
+			ast_channel_unlock(new_chan->owner);
+		}
+		sig_pri_unlock_private(new_chan);
 
 		return principle;
 	}




More information about the asterisk-commits mailing list