[asterisk-commits] may: branch may/ooh323_ipv6_direct_rtp r308202 - in /team/may/ooh323_ipv6_dir...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 17 03:29:56 CST 2011


Author: may
Date: Thu Feb 17 03:29:48 2011
New Revision: 308202

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=308202
Log:
Merged revisions 307913,307942,307986,308037,308114,308200-308201 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/may/ooh323_ipv6

................
  r307913 | root | 2011-02-15 20:23:15 +0300 (Tue, 15 Feb 2011) | 51 lines
  
  Merged revisions 307883 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r307883 | rmudgett | 2011-02-15 10:18:43 -0600 (Tue, 15 Feb 2011) | 44 lines
    
    Merged revisions 307879 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r307879 | rmudgett | 2011-02-15 10:13:55 -0600 (Tue, 15 Feb 2011) | 37 lines
      
      No response sent for SIP CC subscribe/resubscribe request.
      
      Asterisk does not send a response if we try to subscribe for call
      completion after we have received a 180 Ringing.  You can only subscribe
      for call completion when the call has been cleared.
      
      When we receive the 180 Ringing, for this call, its call-completion state
      is 'CC_AVAILABLE'.  If we then send a subscribe message to Asterisk, it
      trys to change the call-completion state to 'CC_CALLER_REQUESTED'.
      Because this is an invalid state change, it just ignores the message.  The
      only state Asterisk will accept our subscribe message is in the
      'CC_CALLER_OFFERED' state.
      
      Asterisk will go into the 'CC_CALLER_OFFERED' when the SIP client clears
      the call by sending a CANCEL.
      
      Asterisk should always send a response.  Even if its a negative one.
      
      
      The fix is to allow for the CCSS core to notify a CC agent that a failure
      has occurred when CC is requested.  The "ack" callback is replaced with a
      "respond" callback.  The "respond" callback has a parameter indicating
      either a successful response or a specific type of failure that may need
      to be communicated to the requester.
      
      (closes issue #18336)
      Reported by: GeorgeKonopacki
      Tested by: mmichelson, rmudgett
      
      JIRA SWP-2633
      
      (closes issue #18337)
      Reported by: GeorgeKonopacki
      Tested by: mmichelson
      
      JIRA SWP-2634
    ........
  ................
................
  r307942 | root | 2011-02-15 21:22:15 +0300 (Tue, 15 Feb 2011) | 9 lines
  
  Merged revisions 307927 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ........
    r307927 | dvossel | 2011-02-15 12:09:25 -0600 (Tue, 15 Feb 2011) | 2 lines
    
    Fixes compile error in chan_phone for big endian 
  ........
................
  r307986 | root | 2011-02-16 02:28:13 +0300 (Wed, 16 Feb 2011) | 32 lines
  
  Merged revisions 307963-307964,307969 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r307963 | rmudgett | 2011-02-15 13:53:32 -0600 (Tue, 15 Feb 2011) | 9 lines
    
    Merged revisions 307962 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r307962 | rmudgett | 2011-02-15 13:52:45 -0600 (Tue, 15 Feb 2011) | 1 line
      
      Don't crash when forcing caller id.
    ........
  ................
    r307964 | rmudgett | 2011-02-15 15:42:55 -0600 (Tue, 15 Feb 2011) | 9 lines
    
    Add CLI "pri show channels" command.
    
    List the current mapping of DAHDI B channels to Asterisk channel names and
    which calls are on hold or call-waiting.  Calls on hold or call-waiting
    are not associated with any B channel.
    
    JIRA LIBPRI-27
    JIRA SWP-2547
  ................
    r307969 | may | 2011-02-15 17:07:47 -0600 (Tue, 15 Feb 2011) | 3 lines
    
    include tcp keepalive socket calls only on linux, freebsd and others
    don't have these options on sockets.
  ................
................
  r308037 | root | 2011-02-16 03:22:06 +0300 (Wed, 16 Feb 2011) | 38 lines
  
  Merged revisions 308013 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r308013 | qwell | 2011-02-15 17:34:27 -0600 (Tue, 15 Feb 2011) | 31 lines
    
    Merged revisions 308010 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ................
      r308010 | qwell | 2011-02-15 17:34:03 -0600 (Tue, 15 Feb 2011) | 24 lines
      
      Merged revisions 308007 via svnmerge from 
      https://origsvn.digium.com/svn/asterisk/branches/1.6.2
      
      ................
        r308007 | qwell | 2011-02-15 17:33:24 -0600 (Tue, 15 Feb 2011) | 17 lines
        
        Merged revisions 308002 via svnmerge from 
        https://origsvn.digium.com/svn/asterisk/branches/1.4
        
        ........
          r308002 | qwell | 2011-02-15 17:32:20 -0600 (Tue, 15 Feb 2011) | 10 lines
          
          Fix regression that changed behavior of queues when ringing a queue member.
          
          This reverts r298596, which was to fix a highly bizarre and contrived issue
          with a queue member that called into his own queue being transferred back
          into his own queue.  I couldn't reproduce that issue in any way.  I think one
          of the other recent transfer fixes actually fixed this.
          
          (closes issue #18747)
          Reported by: vrban
        ........
      ................
    ................
  ................
................
  r308114 | root | 2011-02-16 11:20:39 +0300 (Wed, 16 Feb 2011) | 1 line
  
  automerge cancel
................
  r308200 | may | 2011-02-17 12:15:48 +0300 (Thu, 17 Feb 2011) | 27 lines
  
  Recorded merge of revisions 308099,308157 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/trunk
  
  ................
    r308099 | may | 2011-02-16 11:06:01 +0300 (Wed, 16 Feb 2011) | 9 lines
    
    Merged revisions 308098 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r308098 | may | 2011-02-16 10:57:22 +0300 (Wed, 16 Feb 2011) | 2 lines
      
      ifdef __linux__ keepalive variables also
    ........
  ................
    r308157 | pabelanger | 2011-02-17 01:02:41 +0300 (Thu, 17 Feb 2011) | 9 lines
    
    Merged revisions 308150 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.8
    
    ........
      r308150 | pabelanger | 2011-02-16 15:21:17 -0500 (Wed, 16 Feb 2011) | 2 lines
      
      Fix FreeBSD builds.
    ........
  ................
................
  r308201 | may | 2011-02-17 12:18:39 +0300 (Thu, 17 Feb 2011) | 2 lines
  
  reinit automerge
................

Modified:
    team/may/ooh323_ipv6_direct_rtp/   (props changed)
    team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooSocket.c
    team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c
    team/may/ooh323_ipv6_direct_rtp/apps/app_queue.c
    team/may/ooh323_ipv6_direct_rtp/cel/cel_odbc.c   (props changed)
    team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c
    team/may/ooh323_ipv6_direct_rtp/channels/chan_phone.c
    team/may/ooh323_ipv6_direct_rtp/channels/chan_sip.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/configs/cel_odbc.conf.sample   (props changed)
    team/may/ooh323_ipv6_direct_rtp/include/asterisk/ccss.h
    team/may/ooh323_ipv6_direct_rtp/main/ccss.c
    team/may/ooh323_ipv6_direct_rtp/sounds/Makefile   (props changed)

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

Propchange: team/may/ooh323_ipv6_direct_rtp/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 17 03:29:48 2011
@@ -1,2 +1,2 @@
 /team/may/ooh323_ipv6:307716-307877
-/trunk:307751-307752
+/trunk:307751-307752,308099-308157

Propchange: team/may/ooh323_ipv6_direct_rtp/
------------------------------------------------------------------------------
--- svnmerge-custom (original)
+++ svnmerge-custom Thu Feb 17 03:29:48 2011
@@ -1,1 +1,1 @@
-/team/may/ooh323_ipv6:1-307877
+/team/may/ooh323_ipv6:1-308201

Propchange: team/may/ooh323_ipv6_direct_rtp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 17 03:29:48 2011
@@ -1,1 +1,1 @@
-/trunk:1-307876
+/trunk:1-308199

Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooSocket.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooSocket.c?view=diff&rev=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooSocket.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooSocket.c Thu Feb 17 03:29:48 2011
@@ -199,7 +199,10 @@
 {
    int on;
    OOSOCKET sock;
-   int keepalive = 1, keepcnt = 24, keepidle = 120, keepintvl = 30;
+   int keepalive = 1;
+#ifdef __linux__
+   int keepcnt = 24, keepidle = 120, keepintvl = 30;
+#endif
    struct linger linger;
 
    if (family == 6) {
@@ -234,9 +237,11 @@
    }
    setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, (const char *)&keepalive,
 			sizeof(keepalive));
+#ifdef __linux__
    setsockopt (sock, SOL_TCP, TCP_KEEPCNT, &keepcnt, sizeof(keepcnt));
    setsockopt (sock, SOL_TCP, TCP_KEEPIDLE, &keepidle, sizeof(keepidle));
    setsockopt (sock, SOL_TCP, TCP_KEEPINTVL, &keepintvl, sizeof(keepintvl));
+#endif
    *psocket = sock;
    return ASN_OK;
 }

Modified: team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c?view=diff&rev=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/apps/app_dial.c Thu Feb 17 03:29:48 2011
@@ -2115,7 +2115,7 @@
 			struct ast_party_connected_line connected;
 			int pres;
 
-			ast_party_connected_line_set_init(&connected, &tmp->chan->connected);
+			ast_party_connected_line_set_init(&connected, &tc->connected);
 			if (cid_pres) {
 				pres = ast_parse_caller_presentation(cid_pres);
 				if (pres < 0) {
@@ -2135,7 +2135,7 @@
 				connected.id.name.presentation = pres;
 			}
 			connected.id.tag = cid_tag;
-			ast_channel_set_connected_line(tmp->chan, &connected, NULL);
+			ast_channel_set_connected_line(tc, &connected, NULL);
 		} else {
 			ast_connected_line_copy_from_caller(&tc->connected, &chan->caller);
 		}

Modified: team/may/ooh323_ipv6_direct_rtp/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/apps/app_queue.c?view=diff&rev=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/apps/app_queue.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/apps/app_queue.c Thu Feb 17 03:29:48 2011
@@ -3719,7 +3719,6 @@
 								ast_moh_stop(qe->chan);
 								ast_indicate(qe->chan, AST_CONTROL_RINGING);
 							}
-							ast_indicate(in, AST_CONTROL_RINGING);
 							break;
 						case AST_CONTROL_OFFHOOK:
 							/* Ignore going off hook */

Propchange: team/may/ooh323_ipv6_direct_rtp/cel/cel_odbc.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 17 03:29:48 2011
@@ -1,2 +1,2 @@
 /team/may/ooh323_ipv6/cel/cel_odbc.c:307716-307877
-/trunk/cel/cel_odbc.c:307751-307752
+/trunk/cel/cel_odbc.c:307751-307752,308099-308157

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=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/chan_dahdi.c Thu Feb 17 03:29:48 2011
@@ -14025,6 +14025,7 @@
 }
 #endif	/* defined(HAVE_PRI) */
 
+#if defined(HAVE_PRI)
 #if defined(HAVE_PRI_SERVICE_MESSAGES)
 static char *handle_pri_service_generic(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a, int changestatus)
 {
@@ -14168,6 +14169,36 @@
 	return handle_pri_service_generic(e, cmd, a, 2);
 }
 #endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
+static char *handle_pri_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	int span;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "pri show channels";
+		e->usage =
+			"Usage: pri show channels\n"
+			"       Displays PRI channel information\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 3)
+		return CLI_SHOWUSAGE;
+
+	sig_pri_cli_show_channels_header(a->fd);
+	for (span = 0; span < NUM_SPANS; ++span) {
+		if (pris[span].pri.pri) {
+			sig_pri_cli_show_channels(a->fd, &pris[span].pri);
+		}
+	}
+	return CLI_SUCCESS;
+}
+#endif	/* defined(HAVE_PRI) */
 
 #if defined(HAVE_PRI)
 static char *handle_pri_show_spans(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -14179,7 +14210,7 @@
 		e->command = "pri show spans";
 		e->usage =
 			"Usage: pri show spans\n"
-			"       Displays PRI Information\n";
+			"       Displays PRI span information\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
@@ -14300,8 +14331,9 @@
  	AST_CLI_DEFINE(handle_pri_service_enable_channel, "Return a channel to service"),
  	AST_CLI_DEFINE(handle_pri_service_disable_channel, "Remove a channel from service"),
 #endif	/* defined(HAVE_PRI_SERVICE_MESSAGES) */
-	AST_CLI_DEFINE(handle_pri_show_spans, "Displays PRI Information"),
-	AST_CLI_DEFINE(handle_pri_show_span, "Displays PRI Information"),
+	AST_CLI_DEFINE(handle_pri_show_channels, "Displays PRI channel information"),
+	AST_CLI_DEFINE(handle_pri_show_spans, "Displays PRI span information"),
+	AST_CLI_DEFINE(handle_pri_show_span, "Displays PRI span information"),
 	AST_CLI_DEFINE(handle_pri_show_debug, "Displays current PRI debug settings"),
 	AST_CLI_DEFINE(handle_pri_set_debug_file, "Sends PRI debug output to the specified file"),
 	AST_CLI_DEFINE(handle_pri_version, "Displays libpri version"),
@@ -14892,7 +14924,7 @@
 				}
 				break;
 			default:
-				;
+				break;
 			}
 		}
 		if (tmp->channel > 0) {
@@ -16205,7 +16237,7 @@
 	.init = dahdi_pri_cc_agent_init,
 	.start_offer_timer = sig_pri_cc_agent_start_offer_timer,
 	.stop_offer_timer = sig_pri_cc_agent_stop_offer_timer,
-	.ack = sig_pri_cc_agent_req_ack,
+	.respond = sig_pri_cc_agent_req_rsp,
 	.status_request = sig_pri_cc_agent_status_req,
 	.stop_ringing = sig_pri_cc_agent_stop_ringing,
 	.party_b_free = sig_pri_cc_agent_party_b_free,

Modified: team/may/ooh323_ipv6_direct_rtp/channels/chan_phone.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/chan_phone.c?view=diff&rev=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/chan_phone.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/chan_phone.c Thu Feb 17 03:29:48 2011
@@ -819,7 +819,7 @@
 		} else {
 			int swap = 0;
 #if __BYTE_ORDER == __BIG_ENDIAN
-			if (frame->subclass.codec == AST_FORMAT_SLINEAR)
+			if (frame->subclass.format.id == AST_FORMAT_SLINEAR)
 				swap = 1; /* Swap big-endian samples to little-endian as we copy */
 #endif
 			res = phone_write_buf(p, pos, expected, maxfr, swap);

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=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/chan_sip.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/chan_sip.c Thu Feb 17 03:29:48 2011
@@ -1614,7 +1614,7 @@
 static int sip_cc_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
 static int sip_cc_agent_start_offer_timer(struct ast_cc_agent *agent);
 static int sip_cc_agent_stop_offer_timer(struct ast_cc_agent *agent);
-static void sip_cc_agent_ack(struct ast_cc_agent *agent);
+static void sip_cc_agent_respond(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason);
 static int sip_cc_agent_status_request(struct ast_cc_agent *agent);
 static int sip_cc_agent_start_monitoring(struct ast_cc_agent *agent);
 static int sip_cc_agent_recall(struct ast_cc_agent *agent);
@@ -1625,7 +1625,7 @@
 	.init = sip_cc_agent_init,
 	.start_offer_timer = sip_cc_agent_start_offer_timer,
 	.stop_offer_timer = sip_cc_agent_stop_offer_timer,
-	.ack = sip_cc_agent_ack,
+	.respond = sip_cc_agent_respond,
 	.status_request = sip_cc_agent_status_request,
 	.start_monitoring = sip_cc_agent_start_monitoring,
 	.callee_available = sip_cc_agent_recall,
@@ -1726,14 +1726,30 @@
 	return 0;
 }
 
-static void sip_cc_agent_ack(struct ast_cc_agent *agent)
+static void sip_cc_agent_respond(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
 {
 	struct sip_cc_agent_pvt *agent_pvt = agent->private_data;
 
 	sip_pvt_lock(agent_pvt->subscribe_pvt);
 	ast_set_flag(&agent_pvt->subscribe_pvt->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
-	transmit_response(agent_pvt->subscribe_pvt, "200 OK", &agent_pvt->subscribe_pvt->initreq);
-	transmit_cc_notify(agent, agent_pvt->subscribe_pvt, CC_QUEUED);
+	if (reason == AST_CC_AGENT_RESPONSE_SUCCESS || !ast_strlen_zero(agent_pvt->notify_uri)) {
+		/* The second half of this if statement may be a bit hard to grasp,
+		 * so here's an explanation. When a subscription comes into
+		 * chan_sip, as long as it is not malformed, it will be passed
+		 * to the CC core. If the core senses an out-of-order state transition,
+		 * then the core will call this callback with the "reason" set to a
+		 * failure condition.
+		 * However, an out-of-order state transition will occur during a resubscription
+		 * for CC. In such a case, we can see that we have already generated a notify_uri
+		 * and so we can detect that this isn't a *real* failure. Rather, it is just
+		 * something the core doesn't recognize as a legitimate SIP state transition.
+		 * Thus we respond with happiness and flowers.
+		 */
+		transmit_response(agent_pvt->subscribe_pvt, "200 OK", &agent_pvt->subscribe_pvt->initreq);
+		transmit_cc_notify(agent, agent_pvt->subscribe_pvt, CC_QUEUED);
+	} else {
+		transmit_response(agent_pvt->subscribe_pvt, "500 Internal Error", &agent_pvt->subscribe_pvt->initreq);
+	}
 	sip_pvt_unlock(agent_pvt->subscribe_pvt);
 	agent_pvt->is_available = TRUE;
 }

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=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.c Thu Feb 17 03:29:48 2011
@@ -108,6 +108,25 @@
 	} while (0)
 
 static int pri_active_dchan_index(struct sig_pri_span *pri);
+
+static const char *sig_pri_call_level2str(enum sig_pri_call_level level)
+{
+	switch (level) {
+	case SIG_PRI_CALL_LEVEL_IDLE:
+		return "Idle";
+	case SIG_PRI_CALL_LEVEL_SETUP:
+		return "Setup";
+	case SIG_PRI_CALL_LEVEL_OVERLAP:
+		return "Overlap";
+	case SIG_PRI_CALL_LEVEL_PROCEEDING:
+		return "Proceeding";
+	case SIG_PRI_CALL_LEVEL_ALERTING:
+		return "Alerting";
+	case SIG_PRI_CALL_LEVEL_CONNECT:
+		return "Connect";
+	}
+	return "Unknown";
+}
 
 static inline void pri_rel(struct sig_pri_span *pri)
 {
@@ -7880,8 +7899,9 @@
 		}
 		if (pvt->call_level < SIG_PRI_CALL_LEVEL_CONNECT) {
 			ast_log(LOG_WARNING,
-				"Span %d: Digit '%c' may be ignored by peer. (Call level:%d)\n",
-				pvt->pri->span, digit, pvt->call_level);
+				"Span %d: Digit '%c' may be ignored by peer. (Call level:%d(%s))\n",
+				pvt->pri->span, digit, pvt->call_level,
+				sig_pri_call_level2str(pvt->call_level));
 		}
 	}
 	return 1;
@@ -8300,6 +8320,54 @@
 	ast_free(doomed);
 }
 
+#define SIG_PRI_SC_HEADER	"%-4s %4s %-4s %-10s %-4s %s\n"
+#define SIG_PRI_SC_LINE		"%4d %4d %-4s %-10s %-4s %s"
+void sig_pri_cli_show_channels_header(int fd)
+{
+	ast_cli(fd, SIG_PRI_SC_HEADER, "PRI",  "",     "B",    "Call",  "PRI",  "Channel");
+	ast_cli(fd, SIG_PRI_SC_HEADER, "Span", "Chan", "Chan", "Level", "Call", "Name");
+}
+
+void sig_pri_cli_show_channels(int fd, struct sig_pri_span *pri)
+{
+	char line[256];
+	int idx;
+	struct sig_pri_chan *pvt;
+
+	ast_mutex_lock(&pri->lock);
+	for (idx = 0; idx < pri->numchans; ++idx) {
+		if (!pri->pvts[idx]) {
+			continue;
+		}
+		pvt = pri->pvts[idx];
+		sig_pri_lock_private(pvt);
+		sig_pri_lock_owner(pri, idx);
+		if (pvt->no_b_channel && !pvt->call && !pvt->owner) {
+			/* Don't show held/call-waiting channels if they are not in use. */
+			sig_pri_unlock_private(pvt);
+			continue;
+		}
+
+		snprintf(line, sizeof(line), SIG_PRI_SC_LINE,
+			pri->span,
+			pvt->channel,
+			pvt->no_b_channel ? "No" : "Yes",/* Has media */
+			sig_pri_call_level2str(pvt->call_level),
+			pvt->call ? "Yes" : "No",
+			pvt->owner ? pvt->owner->name : "");
+
+		if (pvt->owner) {
+			ast_channel_unlock(pvt->owner);
+		}
+		sig_pri_unlock_private(pvt);
+
+		ast_mutex_unlock(&pri->lock);
+		ast_cli(fd, "%s\n", line);
+		ast_mutex_lock(&pri->lock);
+	}
+	ast_mutex_unlock(&pri->lock);
+}
+
 static void build_status(char *s, size_t len, int status, int active)
 {
 	if (!s || len < 1) {
@@ -8542,38 +8610,75 @@
 
 #if defined(HAVE_PRI_CCSS)
 /*!
- * \brief Acknowledge CC request.
+ * \brief Response to a CC request.
  * \since 1.8
  *
  * \param agent CC core agent control.
+ * \param reason CC request response status.
  *
  * \details
  * When the core receives knowledge that a called
  * party has accepted a CC request, it will call
- * this callback.
- *
- * The duty of this is to accept a CC request from
- * the caller by acknowledging receipt of that request.
+ * this callback.  The core may also call this
+ * if there is some error when attempting to process
+ * the incoming CC request.
+ *
+ * The duty of this is to issue a propper response to a
+ * CC request from the caller by acknowledging receipt
+ * of that request or rejecting it.
  *
  * \return Nothing
  */
-void sig_pri_cc_agent_req_ack(struct ast_cc_agent *agent)
+void sig_pri_cc_agent_req_rsp(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
 {
 	struct sig_pri_cc_agent_prv *cc_pvt;
 	int res;
+	int status;
+	const char *failed_msg;
+	static const char *failed_to_send = "Failed to send the CC request response.";
+	static const char *not_accepted = "The core declined the CC request.";
 
 	cc_pvt = agent->private_data;
 	ast_mutex_lock(&cc_pvt->pri->lock);
 	if (cc_pvt->cc_request_response_pending) {
 		cc_pvt->cc_request_response_pending = 0;
-		res = pri_cc_req_rsp(cc_pvt->pri->pri, cc_pvt->cc_id, 0/* success */);
+
+		/* Convert core response reason to ISDN response status. */
+		status = 2;/* short_term_denial */
+		switch (reason) {
+		case AST_CC_AGENT_RESPONSE_SUCCESS:
+			status = 0;/* success */
+			break;
+		case AST_CC_AGENT_RESPONSE_FAILURE_INVALID:
+			status = 2;/* short_term_denial */
+			break;
+		case AST_CC_AGENT_RESPONSE_FAILURE_TOO_MANY:
+			status = 5;/* queue_full */
+			break;
+		}
+
+		res = pri_cc_req_rsp(cc_pvt->pri->pri, cc_pvt->cc_id, status);
+		if (!status) {
+			/* CC core request was accepted. */
+			if (res) {
+				failed_msg = failed_to_send;
+			} else {
+				failed_msg = NULL;
+			}
+		} else {
+			/* CC core request was declined. */
+			if (res) {
+				failed_msg = failed_to_send;
+			} else {
+				failed_msg = not_accepted;
+			}
+		}
 	} else {
-		res = 0;
+		failed_msg = NULL;
 	}
 	ast_mutex_unlock(&cc_pvt->pri->lock);
-	if (res) {
-		ast_cc_failed(agent->core_id, "%s agent failed to send the CC request ack.",
-			sig_pri_cc_type_name);
+	if (failed_msg) {
+		ast_cc_failed(agent->core_id, "%s agent: %s", sig_pri_cc_type_name, failed_msg);
 	}
 }
 #endif	/* defined(HAVE_PRI_CCSS) */

Modified: team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.h?view=diff&rev=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/channels/sig_pri.h Thu Feb 17 03:29:48 2011
@@ -572,6 +572,8 @@
 
 int pri_is_up(struct sig_pri_span *pri);
 
+void sig_pri_cli_show_channels_header(int fd);
+void sig_pri_cli_show_channels(int fd, struct sig_pri_span *pri);
 void sig_pri_cli_show_spans(int fd, int span, struct sig_pri_span *pri);
 
 void sig_pri_cli_show_span(int fd, int *dchannels, struct sig_pri_span *pri);
@@ -591,7 +593,7 @@
 int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan);
 int sig_pri_cc_agent_start_offer_timer(struct ast_cc_agent *agent);
 int sig_pri_cc_agent_stop_offer_timer(struct ast_cc_agent *agent);
-void sig_pri_cc_agent_req_ack(struct ast_cc_agent *agent);
+void sig_pri_cc_agent_req_rsp(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason);
 int sig_pri_cc_agent_status_req(struct ast_cc_agent *agent);
 int sig_pri_cc_agent_stop_ringing(struct ast_cc_agent *agent);
 int sig_pri_cc_agent_party_b_free(struct ast_cc_agent *agent);

Propchange: team/may/ooh323_ipv6_direct_rtp/configs/cel_odbc.conf.sample
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 17 03:29:48 2011
@@ -1,2 +1,2 @@
 /team/may/ooh323_ipv6/configs/cel_odbc.conf.sample:307716-307877
-/trunk/configs/cel_odbc.conf.sample:307751-307752
+/trunk/configs/cel_odbc.conf.sample:307751-307752,308099-308157

Modified: team/may/ooh323_ipv6_direct_rtp/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/include/asterisk/ccss.h?view=diff&rev=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/include/asterisk/ccss.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/include/asterisk/ccss.h Thu Feb 17 03:29:48 2011
@@ -858,6 +858,15 @@
 	char device_name[1];
 };
 
+enum ast_cc_agent_response_reason {
+	/*! CC request accepted */
+	AST_CC_AGENT_RESPONSE_SUCCESS,
+	/*! CC request not allowed at this time. Invalid state transition. */
+	AST_CC_AGENT_RESPONSE_FAILURE_INVALID,
+	/*! Too many CC requests in the system. */
+	AST_CC_AGENT_RESPONSE_FAILURE_TOO_MANY,
+};
+
 struct ast_cc_agent_callbacks {
 	/*!
 	 * \brief Type of agent the callbacks belong to.
@@ -920,19 +929,23 @@
 	 */
 	int (*stop_offer_timer)(struct ast_cc_agent *agent);
 	/*!
-	 * \brief Acknowledge CC request.
+	 * \brief Respond to a CC request.
 	 *
 	 * \param agent CC core agent control.
+	 * \param reason CC request response status.
 	 *
 	 * \details
 	 * When the core receives knowledge that a called
 	 * party has accepted a CC request, it will call
-	 * this callback.
-	 *
-	 * The duty of this is to accept a CC request from
-	 * the caller by acknowledging receipt of that request.
-	 */
-	void (*ack)(struct ast_cc_agent *agent);
+	 * this callback. The core may also call this
+	 * if there is some error when attempting to process
+	 * the incoming CC request.
+	 *
+	 * The duty of this is to issue a propper response to a
+	 * CC request from the caller by acknowledging receipt
+	 * of that request or rejecting it.
+	 */
+	void (*respond)(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason);
 	/*!
 	 * \brief Request the status of the agent's device.
 	 *

Modified: team/may/ooh323_ipv6_direct_rtp/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/main/ccss.c?view=diff&rev=308202&r1=308201&r2=308202
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/main/ccss.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/main/ccss.c Thu Feb 17 03:29:48 2011
@@ -2205,7 +2205,7 @@
 	ast_assert(callbacks->init != NULL);
 	ast_assert(callbacks->start_offer_timer != NULL);
 	ast_assert(callbacks->stop_offer_timer != NULL);
-	ast_assert(callbacks->ack != NULL);
+	ast_assert(callbacks->respond != NULL);
 	ast_assert(callbacks->status_request != NULL);
 	ast_assert(callbacks->start_monitoring != NULL);
 	ast_assert(callbacks->callee_available != NULL);
@@ -2267,7 +2267,7 @@
 static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
 static int cc_generic_agent_start_offer_timer(struct ast_cc_agent *agent);
 static int cc_generic_agent_stop_offer_timer(struct ast_cc_agent *agent);
-static void cc_generic_agent_ack(struct ast_cc_agent *agent);
+static void cc_generic_agent_respond(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason);
 static int cc_generic_agent_status_request(struct ast_cc_agent *agent);
 static int cc_generic_agent_stop_ringing(struct ast_cc_agent *agent);
 static int cc_generic_agent_start_monitoring(struct ast_cc_agent *agent);
@@ -2279,7 +2279,7 @@
 	.init = cc_generic_agent_init,
 	.start_offer_timer = cc_generic_agent_start_offer_timer,
 	.stop_offer_timer = cc_generic_agent_stop_offer_timer,
-	.ack = cc_generic_agent_ack,
+	.respond = cc_generic_agent_respond,
 	.status_request = cc_generic_agent_status_request,
 	.stop_ringing = cc_generic_agent_stop_ringing,
 	.start_monitoring = cc_generic_agent_start_monitoring,
@@ -2403,7 +2403,7 @@
 	return 0;
 }
 
-static void cc_generic_agent_ack(struct ast_cc_agent *agent)
+static void cc_generic_agent_respond(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
 {
 	/* The generic agent doesn't have to do anything special to
 	 * acknowledge a CC request. Just return.
@@ -2635,6 +2635,7 @@
 }
 
 struct cc_state_change_args {
+	struct cc_core_instance *core_instance;/*!< Holds reference to core instance. */
 	enum cc_state state;
 	int core_id;
 	char debug[1];
@@ -2783,6 +2784,8 @@
 {
 	if (!ast_cc_request_is_within_limits()) {
 		ast_log(LOG_WARNING, "Cannot request CC since there is no more room for requests\n");
+		core_instance->agent->callbacks->respond(core_instance->agent,
+			AST_CC_AGENT_RESPONSE_FAILURE_TOO_MANY);
 		ast_cc_failed(core_instance->core_id, "Too many requests in the system");
 		return -1;
 	}
@@ -2821,7 +2824,8 @@
 	 *    call monitor's unsuspend callback.
 	 */
 	if (previous_state == CC_CALLER_REQUESTED) {
-		core_instance->agent->callbacks->ack(core_instance->agent);
+		core_instance->agent->callbacks->respond(core_instance->agent,
+			AST_CC_AGENT_RESPONSE_SUCCESS);
 		manager_event(EVENT_FLAG_CC, "CCRequestAcknowledged",
 			"CoreID: %d\r\n"
 			"Caller: %s\r\n",
@@ -2958,15 +2962,19 @@
 	ast_log_dynamic_level(cc_logger_level, "Core %d: State change to %d requested. Reason: %s\n",
 			args->core_id, args->state, args->debug);
 
-	if (!(core_instance = find_cc_core_instance(args->core_id))) {
-		ast_log_dynamic_level(cc_logger_level, "Core %d: Unable to find core instance.\n", args->core_id);
-		ast_free(args);
-		return -1;
-	}
+	core_instance = args->core_instance;
 
 	if (!is_state_change_valid(core_instance->current_state, args->state, core_instance->agent)) {
 		ast_log_dynamic_level(cc_logger_level, "Core %d: Invalid state change requested. Cannot go from %s to %s\n",
 				args->core_id, cc_state_to_string(core_instance->current_state), cc_state_to_string(args->state));
+		if (args->state == CC_CALLER_REQUESTED) {
+			/*
+			 * For out-of-order requests, we need to let the requester know that
+			 * we can't handle the request now.
+			 */
+			core_instance->agent->callbacks->respond(core_instance->agent,
+				AST_CC_AGENT_RESPONSE_FAILURE_INVALID);
+		}
 		ast_free(args);
 		cc_unref(core_instance, "Unref core instance from when it was found earlier");
 		return -1;
@@ -2988,6 +2996,7 @@
 	int debuglen;
 	char dummy[1];
 	va_list aq;
+	struct cc_core_instance *core_instance;
 	struct cc_state_change_args *args;
 	/* This initial call to vsnprintf is simply to find what the
 	 * size of the string needs to be
@@ -3003,12 +3012,22 @@
 		return -1;
 	}
 
+	core_instance = find_cc_core_instance(core_id);
+	if (!core_instance) {
+		ast_log_dynamic_level(cc_logger_level, "Core %d: Unable to find core instance.\n",
+			core_id);
+		ast_free(args);
+		return -1;
+	}
+
+	args->core_instance = core_instance;
 	args->state = state;
 	args->core_id = core_id;
 	vsnprintf(args->debug, debuglen, debug, ap);
 
 	res = ast_taskprocessor_push(cc_core_taskprocessor, cc_do_state_change, args);
 	if (res) {
+		cc_unref(core_instance, "Unref core instance. ast_taskprocessor_push failed");
 		ast_free(args);
 	}
 	return res;

Propchange: team/may/ooh323_ipv6_direct_rtp/sounds/Makefile
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 17 03:29:48 2011
@@ -1,2 +1,2 @@
 /team/may/ooh323_ipv6/sounds/Makefile:307716-307877
-/trunk/sounds/Makefile:307751-307752
+/trunk/sounds/Makefile:307751-307752,308099-308157




More information about the asterisk-commits mailing list