[svn-commits] mmichelson: branch group/CCSS r240366 - in /team/group/CCSS: apps/ include/as...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jan 15 11:37:04 CST 2010


Author: mmichelson
Date: Fri Jan 15 11:37:00 2010
New Revision: 240366

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=240366
Log:
Offer CCBS to the caller if ast_call fails due to busy or congestion.

Thanks to Richard for discovering this oversight.


Modified:
    team/group/CCSS/apps/app_dial.c
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/apps/app_dial.c?view=diff&rev=240366&r1=240365&r2=240366
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Fri Jan 15 11:37:00 2010
@@ -2035,6 +2035,7 @@
 				chan->hangupcause = tc->hangupcause;
 			}
 			ast_channel_unlock(chan);
+			ast_cc_call_failed(chan, tc, interface);
 			ast_hangup(tc);
 			tc = NULL;
 			chanlist_free(tmp);

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=240366&r1=240365&r2=240366
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Fri Jan 15 11:37:00 2010
@@ -1418,6 +1418,21 @@
 
 /*!
  * \since 1.8
+ * \brief Make CCBS available in the case that ast_call fails
+ *
+ * In some situations, notably if a call-limit is reached in SIP, ast_call will fail
+ * due to Asterisk's knowing that the desired device is currently busy. In such a situation,
+ * CCBS should be made available to the caller.
+ *
+ * One caveat is that this may only be used if generic monitoring is being used. The reason
+ * is that since Asterisk determined that the device was busy without actually placing a call to it,
+ * the far end will have no idea what call we are requesting call completion for if we wer to send
+ * a call completion request.
+ */
+void ast_cc_call_failed(struct ast_channel *incoming, struct ast_channel *outgoing, const char * const dialstring);
+
+/*!
+ * \since 1.8
  * \brief Callback made from ast_cc_callback for certain channel types
  *
  * \details
@@ -1429,12 +1444,6 @@
  * it from the nonexistent outgoing channel's frame queue. We then handle this
  * simulated frame just as we would a normal CC frame which had actually been queued
  * by the channel driver.
- *
- * XXX Currently, this function may not work all that well if dialing, say a DAHDI
- * group. The reason is that a DAHDI group has multiple potential targets, and each
- * will call this callback with the same interface_name parameter. The assumed result
- * is that a bunch of duplicate interfaces will be created and a bunch of duplicated
- * monitors would be created. Not sure of all the implications really.
  */
 void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params,
 		const char * const interface_name, const char * const dialable_name);

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=240366&r1=240365&r2=240366
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Jan 15 11:37:00 2010
@@ -37,6 +37,7 @@
 #include "asterisk/app.h"
 #include "asterisk/cli.h"
 #include "asterisk/manager.h"
+#include "asterisk/causes.h"
 
 /*** DOCUMENTATION
 	<application name="CallCompletionRequest" language="en_US">
@@ -3379,6 +3380,30 @@
 	return 0;
 }
 
+void ast_cc_call_failed(struct ast_channel *incoming, struct ast_channel *outgoing, const char * const dialstring)
+{
+	char device_name[AST_CHANNEL_NAME];
+	struct ast_control_cc_payload payload;
+	if (outgoing->hangupcause != AST_CAUSE_BUSY && outgoing->hangupcause != AST_CAUSE_CONGESTION) {
+		/* It doesn't make sense to try to offer CCBS to the caller if the reason for ast_call
+		 * failing is something other than busy or congestion
+		 */
+		return;
+	}
+
+	if (!ast_get_cc_monitor_policy(ast_channel_get_cc_config_params(outgoing)) == AST_CC_MONITOR_GENERIC) {
+		/* This sort of CCBS only works if using generic CC. For native, we would end up sending
+		 * a CC request for a non-existent call. The far end will reject this every time
+		 */
+		return;
+	}
+
+	ast_channel_get_device_name(outgoing, device_name, sizeof(device_name));
+	cc_build_payload(outgoing, ast_channel_get_cc_config_params(outgoing), device_name,
+			dialstring, AST_CC_CCBS, &payload);
+	ast_handle_cc_control_frame(incoming, outgoing, &payload);
+}
+
 void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params,
 		const char * const interface_name, const char * const dialable_name)
 {




More information about the svn-commits mailing list