[svn-commits] may: branch may/ooh323_ipv6_direct_rtp r313145 - in /team/may/ooh323_ipv6_dir...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Apr 9 16:12:32 CDT 2011


Author: may
Date: Sat Apr  9 16:12:24 2011
New Revision: 313145

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=313145
Log:
Merged revisions 312598,312695,312731,312794,312895,312947,312966,313021,313065,313133,313144 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/may/ooh323_ipv6

................
  r312598 | root | 2011-04-04 20:23:53 +0400 (Mon, 04 Apr 2011) | 66 lines
  
  Merged revisions 312579 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r312579 | rmudgett | 2011-04-04 11:17:58 -0500 (Mon, 04 Apr 2011) | 59 lines
    
    Merged revisions 312575 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ................
      r312575 | rmudgett | 2011-04-04 11:10:50 -0500 (Mon, 04 Apr 2011) | 52 lines
      
      Merged revisions 312574 via svnmerge from 
      https://origsvn.digium.com/svn/asterisk/branches/1.6.2
      
      ................
        r312574 | rmudgett | 2011-04-04 11:00:02 -0500 (Mon, 04 Apr 2011) | 45 lines
        
        Merged revisions 312573 via svnmerge from 
        https://origsvn.digium.com/svn/asterisk/branches/1.4
        
        ........
          r312573 | rmudgett | 2011-04-04 10:49:30 -0500 (Mon, 04 Apr 2011) | 38 lines
          
          Issues with ISDN calls changing B channels during call negotiations.
          
          The handling of the PROCEEDING message was not using the correct call
          structure if the B channel was changed.  (The same for PROGRESS.) The call
          was also not hungup if the new B channel is not provisioned or is busy.
          
          * Made all call connection messages (SETUP_ACKNOWLEDGE, PROCEEDING,
          PROGRESS, ALERTING, CONNECT, CONNECT_ACKNOWLEDGE) ensure that they are
          using the correct structure and B channel.  If there is any problem with
          the operations then the call is now hungup with an appropriate cause code.
          
          * Made miscellaneous messages (INFORMATION, FACILITY, NOTIFY) find the
          correct structure by looking for the call and not using the channel ID.
          NOTIFY is an exception with versions of libpri before v1.4.11 because a
          call pointer is not available for Asterisk to use.
          
          * Made all hangup messages (DISCONNECT, RELEASE, RELEASE_COMPLETE) find
          the correct structure by looking for the call and not using the channel
          ID.
          
          (closes issue #18313)
          Reported by: destiny6628
          Tested by: rmudgett
          JIRA SWP-2620
          
          (closes issue #18231)
          Reported by: destiny6628
          Tested by: rmudgett
          JIRA SWP-2924
          
          (closes issue #18488)
          Reported by: jpokorny
          JIRA SWP-2929
          
          JIRA AST-437 (The issues fixed here are most likely causing this JIRA issue.)
          JIRA DAHDI-406
          JIRA LIBPRI-33 (Stuck resetting flag likely fixed)
        ........
      ................
    ................
  ................
................
  r312695 | root | 2011-04-04 22:20:56 +0400 (Mon, 04 Apr 2011) | 22 lines
  
  Merged revisions 312678,312680 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ........
    r312678 | jrose | 2011-04-04 12:32:05 -0500 (Mon, 04 Apr 2011) | 11 lines
    
    Makes 'dialplan add extension' create the specified context if it does not already exist.
    
    If the user invokes 'dialplan add extension' into a non-existing context, the context will be created
    and a message informing the user of the context being created will be issued in cli.
    
    (closes issue #17431)
    Reported by: leearcher
    Patches:
          context_auto_create.diff uploaded by kobaz (license 834)
    Tested by: leearcher, kobaz, jrose
  ........
    r312680 | jrose | 2011-04-04 12:37:47 -0500 (Mon, 04 Apr 2011) | 2 lines
    
    In handle_cli_dialplan_add_extension, const char pointer *into_context is used instead of a->argv[5] to improve readability.
  ........
................
  r312731 | root | 2011-04-05 00:20:47 +0400 (Tue, 05 Apr 2011) | 11 lines
  
  Merged revisions 312716 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ........
    r312716 | rmudgett | 2011-04-04 14:31:37 -0500 (Mon, 04 Apr 2011) | 4 lines
    
    Remove the channel parameter from sig_pri_handle_subcmds().
    
    It was only used in a debug message and may not be correct anyway.
  ........
................
  r312794 | root | 2011-04-05 18:22:20 +0400 (Tue, 05 Apr 2011) | 40 lines
  
  Merged revisions 312756,312767 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r312756 | jrose | 2011-04-05 08:55:41 -0500 (Tue, 05 Apr 2011) | 1 line
    
    Minor change to 'L' option for meetme to include some verb statements for the option.
  ................
    r312767 | mnicholson | 2011-04-05 09:16:21 -0500 (Tue, 05 Apr 2011) | 29 lines
    
    Merged revisions 312766 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ................
      r312766 | mnicholson | 2011-04-05 09:14:50 -0500 (Tue, 05 Apr 2011) | 22 lines
      
      Merged revisions 312764 via svnmerge from 
      https://origsvn.digium.com/svn/asterisk/branches/1.6.2
      
      ................
        r312764 | mnicholson | 2011-04-05 09:13:07 -0500 (Tue, 05 Apr 2011) | 15 lines
        
        Merged revisions 312761 via svnmerge from 
        https://origsvn.digium.com/svn/asterisk/branches/1.4
        
        ........
          r312761 | mnicholson | 2011-04-05 09:10:34 -0500 (Tue, 05 Apr 2011) | 8 lines
          
          Limit the number of unauthenticated manager sessions and also limit the time they have to authenticate.
          
          AST-2011-005
          
          (closes issue #18996)
          Reported by: tzafrir
          Tested by: mnicholson
        ........
      ................
    ................
  ................
................
  r312895 | root | 2011-04-05 20:21:10 +0400 (Tue, 05 Apr 2011) | 29 lines
  
  Merged revisions 312868 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r312868 | rmudgett | 2011-04-05 10:40:38 -0500 (Tue, 05 Apr 2011) | 22 lines
    
    Merged revisions 312866 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r312866 | rmudgett | 2011-04-05 10:38:14 -0500 (Tue, 05 Apr 2011) | 15 lines
      
      Responding to OPTIONS packet with 404 because Asterisk not looking for "s" extension.
      
      The get_destination() function was not using the "s" extension when the
      request URI did not specify an extension.  This is a regression caused
      when the URI parsing code was extracted into parse_uri().
      
      Made get_destination() substitute the "s" extension when the parsed URI
      results in an empty string.
      
      (closes issue #18348)
      Reported by: shmaize
      Patches:
            issue18348_v1.8.patch uploaded by rmudgett (license 664)
      Tested by: shmaize
    ........
  ................
................
  r312947 | root | 2011-04-05 21:21:00 +0400 (Tue, 05 Apr 2011) | 19 lines
  
  Merged revisions 312897 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r312897 | rmudgett | 2011-04-05 11:21:28 -0500 (Tue, 05 Apr 2011) | 12 lines
    
    Merged revisions 312889 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r312889 | rmudgett | 2011-04-05 11:19:35 -0500 (Tue, 05 Apr 2011) | 5 lines
      
      Add 416 response to OPTIONS packet.
      
      RFC3261 Section 11.2 says the response code to an OPTIONS packet needs to
      be the same as if it were an INVITE.
    ........
  ................
................
  r312966 | root | 2011-04-05 23:21:07 +0400 (Tue, 05 Apr 2011) | 20 lines
  
  Merged revisions 312950 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r312950 | rmudgett | 2011-04-05 13:47:11 -0500 (Tue, 05 Apr 2011) | 13 lines
    
    Merged revisions 312949 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r312949 | rmudgett | 2011-04-05 13:45:24 -0500 (Tue, 05 Apr 2011) | 6 lines
      
      Crash if ISDN span layer 1 is down on initial load.
      
      Regression from -r312575 B channel shifting during negotiation.
      
      * Also combine updating the alarm flag with clearing the resetting flag.
    ........
  ................
................
  r313021 | root | 2011-04-07 15:22:19 +0400 (Thu, 07 Apr 2011) | 30 lines
  
  Merged revisions 313003,313005 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r313003 | alecdavis | 2011-04-07 05:25:51 -0500 (Thu, 07 Apr 2011) | 1 line
    
    app_voicemail: close_mailbox change LOG_WARNING to LOG_NOTICE
  ................
    r313005 | alecdavis | 2011-04-07 05:30:26 -0500 (Thu, 07 Apr 2011) | 19 lines
    
    Merged revisions 313001 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r313001 | alecdavis | 2011-04-07 22:19:31 +1200 (Thu, 07 Apr 2011) | 13 lines
      
      Fix ISDN calling subaddr User Specified Odd/Even Flag
      
      Calculation of the Odd/Even flag was wrong.
      Implement correct algo, and set odd/even=0 if data would be truncated.
      Only allow automatic calculation of the O/E flag, don't let dialplan influence.
      
      (closes issue #19062)
      Reported by: festr
      Patches: 
            bug19062.diff2.txt uploaded by alecdavis (license 585)
      Tested by: festr, alecdavis, rmudgett
    ........
  ................
................
  r313065 | root | 2011-04-07 18:20:49 +0400 (Thu, 07 Apr 2011) | 30 lines
  
  Merged revisions 313049 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r313049 | jrose | 2011-04-07 08:42:13 -0500 (Thu, 07 Apr 2011) | 23 lines
    
    Merged revisions 313048 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ................
      r313048 | jrose | 2011-04-07 08:35:33 -0500 (Thu, 07 Apr 2011) | 16 lines
      
      Merged revisions 313047 via svnmerge from 
      https://origsvn.digium.com/svn/asterisk/branches/1.6.2
      
      ........
        r313047 | jrose | 2011-04-07 08:23:01 -0500 (Thu, 07 Apr 2011) | 9 lines
        
        Makes parking lots clear and rebuild properly when features reload is invoked from CLI
        
        Before, default parkinglot in context parkedcalls with ext 700 would always be present and when reload was invoked, the previous parkinglots would not be cleared.
        
        (closes issue #18801)
        Reported by: mickecarlsson
        
        Review: https://reviewboard.asterisk.org/r/1161/
      ........
    ................
  ................
................
  r313133 | root | 2011-04-08 21:20:59 +0400 (Fri, 08 Apr 2011) | 11 lines
  
  Merged revisions 313100 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ........
    r313100 | rmudgett | 2011-04-08 11:17:32 -0500 (Fri, 08 Apr 2011) | 4 lines
    
    Add private lock deadlock avoidance callback to PRI and SS7.
    
    Factor out the equivalent function for analog.
  ........
................
  r313144 | may | 2011-04-10 01:02:18 +0400 (Sun, 10 Apr 2011) | 17 lines
  
  Merged revisions 313143 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/trunk
  
  ................
    r313143 | may | 2011-04-10 01:00:15 +0400 (Sun, 10 Apr 2011) | 10 lines
    
    Merged revisions 313142 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r313142 | may | 2011-04-10 00:56:17 +0400 (Sun, 10 Apr 2011) | 3 lines
      
      fix trivial bug in ooh323_indicate on AST_CONTROL_SRC...
      check p->rtp is not null
    ........
  ................
................

Modified:
    team/may/ooh323_ipv6_direct_rtp/   (props changed)
    team/may/ooh323_ipv6_direct_rtp/CHANGES
    team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c
    team/may/ooh323_ipv6_direct_rtp/apps/app_meetme.c
    team/may/ooh323_ipv6_direct_rtp/apps/app_voicemail.c
    team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c
    team/may/ooh323_ipv6_direct_rtp/channels/chan_sip.c
    team/may/ooh323_ipv6_direct_rtp/channels/sig_analog.c
    team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.c
    team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.h
    team/may/ooh323_ipv6_direct_rtp/channels/sig_ss7.c
    team/may/ooh323_ipv6_direct_rtp/channels/sig_ss7.h
    team/may/ooh323_ipv6_direct_rtp/configs/manager.conf.sample
    team/may/ooh323_ipv6_direct_rtp/main/features.c
    team/may/ooh323_ipv6_direct_rtp/main/manager.c
    team/may/ooh323_ipv6_direct_rtp/pbx/pbx_config.c

Propchange: team/may/ooh323_ipv6_direct_rtp/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Propchange: team/may/ooh323_ipv6_direct_rtp/
------------------------------------------------------------------------------
--- svnmerge-custom (original)
+++ svnmerge-custom Sat Apr  9 16:12:24 2011
@@ -1,1 +1,1 @@
-/team/may/ooh323_ipv6:1-312553
+/team/may/ooh323_ipv6:1-313144

Propchange: team/may/ooh323_ipv6_direct_rtp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr  9 16:12:24 2011
@@ -1,1 +1,1 @@
-/trunk:1-312522
+/trunk:1-313143

Modified: team/may/ooh323_ipv6_direct_rtp/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/CHANGES?view=diff&rev=313145&r1=313144&r2=313145
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/CHANGES (original)
+++ team/may/ooh323_ipv6_direct_rtp/CHANGES Sat Apr  9 16:12:24 2011
@@ -39,6 +39,8 @@
    gtalk.conf.
  * The 'logger reload' command now supports an optional argument, specifying an
    alternate configuration file to use.
+ * 'dialplan add extension' command will now automatically create a context if
+   the specified context does not exist with a message indicated it did so.
 
 CDR
 --------------------------

Modified: team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c?view=diff&rev=313145&r1=313144&r2=313145
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c Sat Apr  9 16:12:24 2011
@@ -1237,10 +1237,14 @@
 		}
 	 break;
 	case AST_CONTROL_SRCUPDATE:
-		ast_rtp_instance_update_source(p->rtp);
+		if (p->rtp) {
+			ast_rtp_instance_update_source(p->rtp);
+		}
 		break;
 	case AST_CONTROL_SRCCHANGE:
-		ast_rtp_instance_change_source(p->rtp);
+		if (p->rtp) {
+			ast_rtp_instance_change_source(p->rtp);
+		}
 		break;
 	case AST_CONTROL_CONNECTED_LINE:
 		if (!ast->connected.id.name.valid

Modified: team/may/ooh323_ipv6_direct_rtp/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/apps/app_meetme.c?view=diff&rev=313145&r1=313144&r2=313145
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/apps/app_meetme.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/apps/app_meetme.c Sat Apr  9 16:12:24 2011
@@ -2331,6 +2331,14 @@
 			}
 		}
 
+		ast_verb(3, "Setting conference duration limit to: %ldms.\n", timelimit);
+		if (play_warning) {
+			ast_verb(3, "Setting warning time to %ldms from the conference duration limit.\n", play_warning);
+		}
+		if (warning_freq) {
+			ast_verb(3, "Setting warning frequency to %ldms.\n", warning_freq);
+		}
+
 		ast_channel_lock(chan);
 		if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_WARNING_FILE"))) {
 			var = ast_strdupa(var);

Modified: team/may/ooh323_ipv6_direct_rtp/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/apps/app_voicemail.c?view=diff&rev=313145&r1=313144&r2=313145
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/apps/app_voicemail.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/apps/app_voicemail.c Sat Apr  9 16:12:24 2011
@@ -7849,7 +7849,7 @@
 	/* update count as message may have arrived while we've got mailbox open */
 	last_msg_idx = last_message_index(vmu, vms->curdir);
 	if (last_msg_idx != vms->lastmsg) {
-		ast_log(AST_LOG_WARNING, "%d messages received after mailbox opened.\n", last_msg_idx - vms->lastmsg);
+		ast_log(AST_LOG_NOTICE, "%d messages received after mailbox opened.\n", last_msg_idx - vms->lastmsg);
 	}
 
 	/* must check up to last detected message, just in case it is erroneously greater than maxmsg */

Modified: team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c?view=diff&rev=313145&r1=313144&r2=313145
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c Sat Apr  9 16:12:24 2011
@@ -3238,12 +3238,7 @@
 		if (pri->pvts[idx] && !pri->pvts[idx]->no_b_channel) {
 			/* This is a B channel interface. */
 			++num_b_chans;
-			if (pri->pvts[idx]->owner
-#if defined(HAVE_PRI_SERVICE_MESSAGES)
-				/* Out-of-service B channels are "in-use". */
-				|| pri->pvts[idx]->service_status
-#endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
-				) {
+			if (!sig_pri_is_chan_available(pri->pvts[idx])) {
 				++in_use;
 			}
 			if (!pri->pvts[idx]->inalarm) {
@@ -3325,6 +3320,7 @@
 	.dsp_reset_and_flush_digits = my_dsp_reset_and_flush_digits,
 	.lock_private = my_lock_private,
 	.unlock_private = my_unlock_private,
+	.deadlock_avoidance_private = my_deadlock_avoidance_private,
 	.new_ast_channel = my_new_pri_ast_channel,
 	.fixup_chans = my_pri_fixup_chans,
 	.set_alarm = my_set_alarm,
@@ -3488,6 +3484,7 @@
 {
 	.lock_private = my_lock_private,
 	.unlock_private = my_unlock_private,
+	.deadlock_avoidance_private = my_deadlock_avoidance_private,
 
 	.set_echocanceller = my_set_echocanceller,
 	.set_loopback = my_ss7_set_loopback,
@@ -6458,11 +6455,9 @@
 	p->cidspill = NULL;
 
 	ast_mutex_unlock(&p->lock);
-	ast_module_unref(ast_module_info->self);
 	ast_verb(3, "Hungup '%s'\n", ast->name);
 
 	ast_mutex_lock(&iflock);
-
 	if (p->restartpending) {
 		num_restart_pending--;
 	}
@@ -6471,6 +6466,8 @@
 		destroy_channel(p, 0);
 	}
 	ast_mutex_unlock(&iflock);
+
+	ast_module_unref(ast_module_info->self);
 	return 0;
 }
 
@@ -8771,14 +8768,27 @@
 
 static struct ast_frame *dahdi_read(struct ast_channel *ast)
 {
-	struct dahdi_pvt *p = ast->tech_pvt;
+	struct dahdi_pvt *p;
 	int res;
 	int idx;
 	void *readbuf;
 	struct ast_frame *f;
 
+	/*
+	 * For analog channels, we must do deadlock avoidance because
+	 * analog ports can have more than one Asterisk channel using
+	 * the same private structure.
+	 */
+	p = ast->tech_pvt;
 	while (ast_mutex_trylock(&p->lock)) {
 		CHANNEL_DEADLOCK_AVOIDANCE(ast);
+
+		/*
+		 * For PRI channels, we must refresh the private pointer because
+		 * the call could move to another B channel while the Asterisk
+		 * channel is unlocked.
+		 */
+		p = ast->tech_pvt;
 	}
 
 	idx = dahdi_get_index(ast, p, 0);
@@ -11317,7 +11327,9 @@
 		switch (i->sig) {
 #if defined(HAVE_PRI)
 		case SIG_PRI_LIB_HANDLE_CASES:
+			ast_mutex_lock(&i->lock);
 			sig_pri_chan_alarm_notify(i->sig_pvt, 1);
+			ast_mutex_unlock(&i->lock);
 			break;
 #endif	/* defined(HAVE_PRI) */
 #if defined(HAVE_SS7)
@@ -11335,7 +11347,9 @@
 		switch (i->sig) {
 #if defined(HAVE_PRI)
 		case SIG_PRI_LIB_HANDLE_CASES:
+			ast_mutex_lock(&i->lock);
 			sig_pri_chan_alarm_notify(i->sig_pvt, 0);
+			ast_mutex_unlock(&i->lock);
 			break;
 #endif	/* defined(HAVE_PRI) */
 #if defined(HAVE_SS7)
@@ -12745,7 +12759,7 @@
 				switch (tmp->sig) {
 #ifdef HAVE_PRI
 				case SIG_PRI_LIB_HANDLE_CASES:
-					sig_pri_chan_alarm_notify(tmp->sig_pvt, si.alarms);
+					sig_pri_set_alarm(tmp->sig_pvt, !si.alarms);
 					break;
 #endif
 #if defined(HAVE_SS7)
@@ -13489,6 +13503,14 @@
 				tmp = analog_request(p->sig_pvt, &callwait, requestor);
 #ifdef HAVE_PRI
 			} else if (dahdi_sig_pri_lib_handles(p->sig)) {
+				/*
+				 * We already have the B channel reserved for this call.  We
+				 * just need to make sure that dahdi_hangup() has completed
+				 * cleaning up before continuing.
+				 */
+				ast_mutex_lock(&p->lock);
+				ast_mutex_unlock(&p->lock);
+
 				sig_pri_extract_called_num_subaddr(p->sig_pvt, data, p->dnid,
 					sizeof(p->dnid));
 				tmp = sig_pri_request(p->sig_pvt, SIG_PRI_DEFLAW, requestor, transcapdigital);
@@ -13503,18 +13525,23 @@
 			if (!tmp) {
 				p->outgoing = 0;
 #if defined(HAVE_PRI)
-#if defined(HAVE_PRI_CALL_WAITING)
 				switch (p->sig) {
 				case SIG_PRI_LIB_HANDLE_CASES:
+#if defined(HAVE_PRI_CALL_WAITING)
 					if (((struct sig_pri_chan *) p->sig_pvt)->is_call_waiting) {
 						((struct sig_pri_chan *) p->sig_pvt)->is_call_waiting = 0;
 						ast_atomic_fetchadd_int(&p->pri->num_call_waiting_calls, -1);
 					}
+#endif	/* defined(HAVE_PRI_CALL_WAITING) */
+					/*
+					 * This should be the last thing to clear when we are done with
+					 * the channel.
+					 */
+					((struct sig_pri_chan *) p->sig_pvt)->allocated = 0;
 					break;
 				default:
 					break;
 				}
-#endif	/* defined(HAVE_PRI_CALL_WAITING) */
 #endif	/* defined(HAVE_PRI) */
 			} else {
 				snprintf(p->dialstring, sizeof(p->dialstring), "DAHDI/%s", (char *) data);
@@ -15194,6 +15221,9 @@
 					ast_cli(a->fd, "Resetting ");
 				if (chan->call)
 					ast_cli(a->fd, "Call ");
+				if (chan->allocated) {
+					ast_cli(a->fd, "Allocated ");
+				}
 				ast_cli(a->fd, "\n");
 				if (tmp->logicalspan)
 					ast_cli(a->fd, "PRI Logical Span: %d\n", tmp->logicalspan);

Modified: team/may/ooh323_ipv6_direct_rtp/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/chan_sip.c?view=diff&rev=313145&r1=313144&r2=313145
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/chan_sip.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/chan_sip.c Sat Apr  9 16:12:24 2011
@@ -14656,16 +14656,20 @@
 	return 0;
 }
 
-/*! \brief Find out who the call is for.
-	We use the request uri as a destination.
-	This code assumes authentication has been done, so that the
-	device (peer/user) context is already set.
-	\return 0 on success (found a matching extension), non-zero on failure
-
-  \note If the incoming uri is a SIPS: uri, we are required to carry this across
-	the dialplan, so that the outbound call also is a sips: call or encrypted
-	IAX2 call. If that's not available, the call should FAIL.
-*/
+/*!
+ * \brief Find out who the call is for.
+ *
+ * \details
+ * We use the request uri as a destination.
+ * This code assumes authentication has been done, so that the
+ * device (peer/user) context is already set.
+ *
+ * \return 0 on success (found a matching extension), non-zero on failure
+ *
+ * \note If the incoming uri is a SIPS: uri, we are required to carry this across
+ * the dialplan, so that the outbound call also is a sips: call or encrypted
+ * IAX2 call. If that's not available, the call should FAIL.
+ */
 static enum sip_get_dest_result get_destination(struct sip_pvt *p, struct sip_request *oreq, int *cc_recall_core_id)
 {
 	char tmp[256] = "", *uri, *domain, *dummy = NULL;
@@ -14691,6 +14695,14 @@
 
 	SIP_PEDANTIC_DECODE(domain);
 	SIP_PEDANTIC_DECODE(uri);
+	if (ast_strlen_zero(uri)) {
+		/*
+		 * Either there really was no extension found or the request
+		 * URI had encoded nulls that made the string "empty".  Use "s"
+		 * as the extension.
+		 */
+		uri = "s";
+	}
 
 	ast_string_field_set(p, domain, domain);
 
@@ -21003,6 +21015,8 @@
 */
 static int handle_request_options(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e)
 {
+	const char *msg;
+	enum sip_get_dest_result gotdest;
 	int res;
 
 	if (p->lastinvite) {
@@ -21034,24 +21048,37 @@
 	}
 
 	/* must go through authentication before getting here */
-	res = (get_destination(p, req, NULL) == SIP_GET_DEST_EXTEN_FOUND ? 0 : -1);
+	gotdest = get_destination(p, req, NULL);
 	build_contact(p);
 
 	if (ast_strlen_zero(p->context))
 		ast_string_field_set(p, context, sip_cfg.default_context);
 
-	if (ast_shutting_down())
-		transmit_response_with_allow(p, "503 Unavailable", req, 0);
-	else if (res < 0)
-		transmit_response_with_allow(p, "404 Not Found", req, 0);
-	else
-		transmit_response_with_allow(p, "200 OK", req, 0);
+	if (ast_shutting_down()) {
+		msg = "503 Unavailable";
+	} else {
+		msg = "404 Not Found";
+		switch (gotdest) {
+		case SIP_GET_DEST_INVALID_URI:
+			msg = "416 Unsupported URI scheme";
+			break;
+		case SIP_GET_DEST_PICKUP_EXTEN_FOUND:
+		case SIP_GET_DEST_REFUSED:
+		case SIP_GET_DEST_EXTEN_NOT_FOUND:
+			//msg = "404 Not Found";
+			break;
+		case SIP_GET_DEST_EXTEN_FOUND:
+			msg = "200 OK";
+			break;
+		}
+	}
+	transmit_response_with_allow(p, msg, req, 0);
 
 	/* Destroy if this OPTIONS was the opening request, but not if
 	   it's in the middle of a normal call flow. */
 	sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 
-	return res;
+	return 0;
 }
 
 /*! \brief Handle the transfer part of INVITE with a replaces: header,

Modified: team/may/ooh323_ipv6_direct_rtp/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/sig_analog.c?view=diff&rev=313145&r1=313144&r2=313145
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/sig_analog.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/sig_analog.c Sat Apr  9 16:12:24 2011
@@ -518,23 +518,31 @@
 	}
 }
 
-#if 0
 static void analog_unlock_private(struct analog_pvt *p)
 {
 	if (p->calls->unlock_private) {
 		p->calls->unlock_private(p->chan_pvt);
 	}
 }
-#endif
-
-#if 0
+
 static void analog_lock_private(struct analog_pvt *p)
 {
 	if (p->calls->lock_private) {
 		p->calls->lock_private(p->chan_pvt);
 	}
 }
-#endif
+
+static void analog_deadlock_avoidance_private(struct analog_pvt *p)
+{
+	if (p->calls->deadlock_avoidance_private) {
+		p->calls->deadlock_avoidance_private(p->chan_pvt);
+	} else {
+		/* Fallback to manual avoidance if callback not present. */
+		analog_unlock_private(p);
+		usleep(1);
+		analog_lock_private(p);
+	}
+}
 
 /*!
  * \internal
@@ -563,12 +571,7 @@
 			break;
 		}
 		/* We must unlock the private to avoid the possibility of a deadlock */
-		if (pvt->calls->deadlock_avoidance_private) {
-			pvt->calls->deadlock_avoidance_private(pvt->chan_pvt);
-		} else {
-			/* Don't use 100% CPU if required callback not present. */
-			usleep(1);
-		}
+		analog_deadlock_avoidance_private(pvt);
 	}
 }
 

Modified: team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.c?view=diff&rev=313145&r1=313144&r2=313145
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.c Sat Apr  9 16:12:24 2011
@@ -56,6 +56,21 @@
 /* define this to send PRI user-user information elements */
 #undef SUPPORT_USERUSER
 
+/*!
+ * Define to make always pick a channel if allowed.  Useful for
+ * testing channel shifting.
+ */
+//#define ALWAYS_PICK_CHANNEL	1
+
+/*!
+ * Define to force a RESTART on a channel that returns a cause
+ * code of PRI_CAUSE_REQUESTED_CHAN_UNAVAIL(44).  If the cause
+ * is because of a stuck channel on the peer and the channel is
+ * always the next channel we pick for an outgoing call then
+ * this can help.
+ */
+#define FORCE_RESTART_UNAVAIL_CHANS		1
+
 #if defined(HAVE_PRI_CCSS)
 struct sig_pri_cc_agent_prv {
 	/*! Asterisk span D channel control structure. */
@@ -163,8 +178,15 @@
 	}
 }
 
-static void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
-{
+void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
+{
+	/*
+	 * Clear the channel restart flag when the channel alarm changes
+	 * to prevent the flag from getting stuck when the link goes
+	 * down.
+	 */
+	p->resetting = 0;
+
 	p->inalarm = in_alarm;
 	if (p->calls->set_alarm) {
 		p->calls->set_alarm(p->chan_pvt, in_alarm);
@@ -299,6 +321,16 @@
 		p->calls->lock_private(p->chan_pvt);
 }
 
+static void sig_pri_deadlock_avoidance_private(struct sig_pri_chan *p)
+{
+	if (p->calls->deadlock_avoidance_private) {
+		p->calls->deadlock_avoidance_private(p->chan_pvt);
+	} else {
+		/* Fallback to the old way if callback not present. */
+		PRI_DEADLOCK_AVOIDANCE(p);
+	}
+}
+
 static inline int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
 {
 	int res;
@@ -306,7 +338,7 @@
 	do {
 		res = ast_mutex_trylock(&pri->lock);
 		if (res) {
-			PRI_DEADLOCK_AVOIDANCE(p);
+			sig_pri_deadlock_avoidance_private(p);
 		}
 	} while (res);
 	/* Then break the poll */
@@ -736,8 +768,14 @@
 			int length = ast_pri_pack_hex_string(pri_subaddress->data,
 				ast_subaddress->str, sizeof(pri_subaddress->data));
 
-			pri_subaddress->length = length;
-			pri_subaddress->odd_even_indicator = (length & 1);
+			pri_subaddress->length = length; /* packed data length */
+
+			length = strlen(ast_subaddress->str);
+			if (length > 2 * sizeof(pri_subaddress->data)) {
+				pri_subaddress->odd_even_indicator = 0;
+			} else {
+				pri_subaddress->odd_even_indicator = (length & 1);
+			}
 			pri_subaddress->valid = 1;
 		}
 	}
@@ -1039,6 +1077,38 @@
 
 /*!
  * \internal
+ * \brief Determine if a private channel structure is in use.
+ * \since 1.8
+ *
+ * \param pvt Channel to determine if in use.
+ *
+ * \return TRUE if the channel is in use.
+ */
+static int sig_pri_is_chan_in_use(struct sig_pri_chan *pvt)
+{
+	return pvt->owner || pvt->call || pvt->allocated || pvt->resetting || pvt->inalarm;
+}
+
+/*!
+ * \brief Determine if a private channel structure is available.
+ * \since 1.8
+ *
+ * \param pvt Channel to determine if available.
+ *
+ * \return TRUE if the channel is available.
+ */
+int sig_pri_is_chan_available(struct sig_pri_chan *pvt)
+{
+	return !sig_pri_is_chan_in_use(pvt)
+#if defined(HAVE_PRI_SERVICE_MESSAGES)
+		/* And not out-of-service */
+		&& !pvt->service_status
+#endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
+		;
+}
+
+/*!
+ * \internal
  * \brief Obtain the sig_pri owner channel lock if the owner exists.
  * \since 1.8
  *
@@ -1063,7 +1133,7 @@
 		}
 		/* We must unlock the PRI to avoid the possibility of a deadlock */
 		ast_mutex_unlock(&pri->lock);
-		PRI_DEADLOCK_AVOIDANCE(pri->pvts[chanpos]);
+		sig_pri_deadlock_avoidance_private(pri->pvts[chanpos]);
 		ast_mutex_lock(&pri->lock);
 	}
 }
@@ -1146,6 +1216,41 @@
 		}
 	}
 	return -1;
+}
+
+/*!
+ * \internal
+ * \brief Kill the call.
+ * \since 1.10
+ *
+ * \param pri PRI span control structure.
+ * \param call LibPRI opaque call pointer to find.
+ * \param cause Reason call was killed.
+ *
+ * \note Assumes the pvt->pri->lock is already obtained.
+ *
+ * \return Nothing
+ */
+static void sig_pri_kill_call(struct sig_pri_span *pri, q931_call *call, int cause)
+{
+	int chanpos;
+
+	chanpos = pri_find_principle_by_call(pri, call);
+	if (chanpos < 0) {
+		pri_hangup(pri->pri, call, cause);
+		return;
+	}
+	sig_pri_lock_private(pri->pvts[chanpos]);
+	if (!pri->pvts[chanpos]->owner) {
+		pri_hangup(pri->pri, call, cause);
+		pri->pvts[chanpos]->call = NULL;
+		sig_pri_unlock_private(pri->pvts[chanpos]);
+		sig_pri_span_devstate_changed(pri);
+		return;
+	}
+	pri->pvts[chanpos]->owner->hangupcause = cause;
+	pri_queue_control(pri, chanpos, AST_CONTROL_HANGUP);
+	sig_pri_unlock_private(pri->pvts[chanpos]);
 }
 
 /*!
@@ -1255,7 +1360,7 @@
 		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) {
+		if (!sig_pri_is_chan_available(new_chan)) {
 			ast_log(LOG_WARNING,
 				"Can't move call (%s) from channel %d to %d.  It is already in use.\n",
 				old_chan->owner ? old_chan->owner->name : "",
@@ -1286,6 +1391,7 @@
 		new_chan->alreadyhungup = old_chan->alreadyhungup;
 		new_chan->isidlecall = old_chan->isidlecall;
 		new_chan->progress = old_chan->progress;
+		new_chan->allocated = old_chan->allocated;
 		new_chan->outgoing = old_chan->outgoing;
 		new_chan->digital = old_chan->digital;
 #if defined(HAVE_PRI_CALL_WAITING)
@@ -1300,6 +1406,7 @@
 		old_chan->alreadyhungup = 0;
 		old_chan->isidlecall = 0;
 		old_chan->progress = 0;
+		old_chan->allocated = 0;
 		old_chan->outgoing = 0;
 		old_chan->digital = 0;
 #if defined(HAVE_PRI_CALL_WAITING)
@@ -1367,6 +1474,52 @@
 	return -1;
 }
 
+/*!
+ * \internal
+ * \brief Find and fixup the private structure associated with the libpri call.
+ *
+ * \param pri PRI span control structure.
+ * \param channel LibPRI encoded channel ID.
+ * \param call LibPRI opaque call pointer.
+ *
+ * \details
+ * This is a combination of pri_find_principle() and pri_fixup_principle()
+ * to reduce code redundancy and to make handling several PRI_EVENT_xxx's
+ * consistent for the current architecture.
+ *
+ * \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_fixup_principle(struct sig_pri_span *pri, int channel, q931_call *call)
+{
+	int chanpos;
+
+	chanpos = pri_find_principle(pri, channel, call);
+	if (chanpos < 0) {
+		ast_log(LOG_WARNING, "Span %d: PRI requested channel %d/%d is unconfigured.\n",
+			pri->span, PRI_SPAN(channel), PRI_CHANNEL(channel));
+		sig_pri_kill_call(pri, call, PRI_CAUSE_IDENTIFIED_CHANNEL_NOTEXIST);
+		return -1;
+	}
+	chanpos = pri_fixup_principle(pri, chanpos, call);
+	if (chanpos < 0) {
+		ast_log(LOG_WARNING, "Span %d: PRI requested channel %d/%d is not available.\n",
+			pri->span, PRI_SPAN(channel), PRI_CHANNEL(channel));
+		/*
+		 * Using Q.931 section 5.2.3.1 b) as the reason for picking
+		 * PRI_CAUSE_CHANNEL_UNACCEPTABLE.  Receiving a
+		 * PRI_CAUSE_REQUESTED_CHAN_UNAVAIL would cause us to restart
+		 * that channel (which is not specified by Q.931) and kill some
+		 * other call which would be bad.
+		 */
+		sig_pri_kill_call(pri, call, PRI_CAUSE_CHANNEL_UNACCEPTABLE);
+		return -1;
+	}
+	return chanpos;
+}
+
 static char * redirectingreason2str(int redirectingreason)
 {
 	switch (redirectingreason) {
@@ -1415,39 +1568,49 @@
 	}
 }
 
-/*! \note Assumes the pri->lock is already obtained. */
-static int pri_check_restart(struct sig_pri_span *pri)
+/*!
+ * \internal
+ * \brief Restart the next channel we think is idle on the span.
+ *
+ * \param pri PRI span control structure.
+ *
+ * \note Assumes the pri->lock is already obtained.
+ *
+ * \return Nothing
+ */
+static void pri_check_restart(struct sig_pri_span *pri)
 {
 #if defined(HAVE_PRI_SERVICE_MESSAGES)
-tryanotherpos:
+	unsigned why;
 #endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
-	do {
-		pri->resetpos++;
-	} while (pri->resetpos < pri->numchans
-		&& (!pri->pvts[pri->resetpos]
+
+	for (++pri->resetpos; pri->resetpos < pri->numchans; ++pri->resetpos) {
+		if (!pri->pvts[pri->resetpos]
 			|| pri->pvts[pri->resetpos]->no_b_channel
-			|| pri->pvts[pri->resetpos]->call
-			|| pri->pvts[pri->resetpos]->resetting));
-	if (pri->resetpos < pri->numchans) {
+			|| sig_pri_is_chan_in_use(pri->pvts[pri->resetpos])) {
+			continue;
+		}
 #if defined(HAVE_PRI_SERVICE_MESSAGES)
-		unsigned why;
-
 		why = pri->pvts[pri->resetpos]->service_status;
 		if (why) {
-			ast_log(LOG_NOTICE, "span '%d' channel '%d' out-of-service (reason: %s), not sending RESTART\n", pri->span,
-				pri->pvts[pri->resetpos]->channel, (why & SRVST_FAREND) ? (why & SRVST_NEAREND) ? "both ends" : "far end" : "near end");
-			goto tryanotherpos;
+			ast_log(LOG_NOTICE,
+				"Span %d: channel %d out-of-service (reason: %s), not sending RESTART\n",
+				pri->span, pri->pvts[pri->resetpos]->channel,
+				(why & SRVST_FAREND) ? (why & SRVST_NEAREND) ? "both ends" : "far end" : "near end");
+			continue;
 		}
 #endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
-
+		break;
+	}
+	if (pri->resetpos < pri->numchans) {
 		/* Mark the channel as resetting and restart it */
 		pri->pvts[pri->resetpos]->resetting = 1;
 		pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[pri->resetpos]));
 	} else {
 		pri->resetting = 0;
 		time(&pri->lastreset);
-	}
-	return 0;
+		sig_pri_span_devstate_changed(pri);
+	}
 }
 
 #if defined(HAVE_PRI_CALL_WAITING)
@@ -1482,6 +1645,18 @@
 }
 #endif	/* defined(HAVE_PRI_CALL_WAITING) */
 
+/*!
+ * \internal
+ * \brief Find an empty B-channel interface to use.
+ *
+ * \param pri PRI span control structure.
+ * \param backwards TRUE if the search starts from higher channels.
+ *
+ * \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_empty_chan(struct sig_pri_span *pri, int backwards)
 {
 	int x;
@@ -1496,8 +1671,7 @@
 			break;
 		if (pri->pvts[x]
 			&& !pri->pvts[x]->no_b_channel
-			&& !pri->pvts[x]->inalarm
-			&& !pri->pvts[x]->owner) {
+			&& sig_pri_is_chan_available(pri->pvts[x])) {
 			ast_debug(1, "Found empty available channel %d/%d\n",
 				pri->pvts[x]->logicalspan, pri->pvts[x]->prioffset);
 			return x;
@@ -1530,8 +1704,7 @@
 	for (idx = 0; idx < pri->numchans; ++idx) {
 		if (pri->pvts[idx]
 			&& pri->pvts[idx]->no_b_channel
-			&& !pri->pvts[idx]->inalarm
-			&& !pri->pvts[idx]->owner) {
+			&& sig_pri_is_chan_available(pri->pvts[idx])) {
 			ast_debug(1, "Found empty available no B channel interface\n");
 			return idx;
 		}
@@ -1717,6 +1890,9 @@
 		p->exten[0] = '\0';
 		/* Since we send release complete here, we won't get one */
 		p->call = NULL;
+		ast_mutex_lock(&p->pri->lock);
+		sig_pri_span_devstate_changed(p->pri);
+		ast_mutex_unlock(&p->pri->lock);
 	}
 	return NULL;
 }
@@ -3752,9 +3928,8 @@
 			break;
 #endif	/* defined(HAVE_PRI_AOC_EVENTS) */
 		default:
-			ast_debug(2,
-				"Unknown CIS subcommand(%d) in %s event on span %d.\n",
-				subcmd->cmd, pri_event2str(event_id), pri->span);
+			ast_debug(2, "Span %d: Unknown CIS subcommand(%d) in %s event.\n", pri->span,
+				subcmd->cmd, pri_event2str(event_id));
 			break;
 		}
 	}
@@ -3805,7 +3980,6 @@
  * \param pri PRI span control structure.
  * \param chanpos Channel position in the span.
  * \param event_id PRI event id
- * \param channel PRI encoded span/channel
  * \param subcmds Subcommands to process if any. (Could be NULL).
  * \param call_rsp libpri opaque call structure to send any responses toward.
  * Could be NULL either because it is not available or the call is for the
@@ -3818,7 +3992,7 @@
  * \return Nothing
  */
 static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int event_id,
-	int channel, const struct pri_subcommands *subcmds, q931_call *call_rsp)
+	const struct pri_subcommands *subcmds, q931_call *call_rsp)
 {
 	int index;
 	struct ast_channel *owner;
@@ -4174,50 +4348,12 @@
 			break;
 #endif	/* defined(HAVE_PRI_DISPLAY_TEXT) */
 		default:
-			ast_debug(2,
-				"Unknown call subcommand(%d) in %s event on channel %d/%d on span %d.\n",
-				subcmd->cmd, pri_event2str(event_id), PRI_SPAN(channel),
-				PRI_CHANNEL(channel), pri->span);
+			ast_debug(2, "Span %d: Unknown call subcommand(%d) in %s event.\n",

[... 3195 lines stripped ...]



More information about the svn-commits mailing list