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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 29 19:16:26 CDT 2009


Author: mmichelson
Date: Tue Sep 29 19:16:21 2009
New Revision: 221038

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221038
Log:
Change how CC is offered to a caller.

Now, CC is offered based on the cc_agent_policy of
the caller. The dialplan writer is capable of changing
this setting prior to calling the Dial app, so it is
still possible to administratively disable CC from
being used. This makes things a bit more clear and
from a user perspective, makes things "just work"


Modified:
    team/group/CCSS/apps/app_dial.c
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/include/asterisk/channel.h
    team/group/CCSS/main/ccss.c
    team/group/CCSS/main/channel.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=221038&r1=221037&r2=221038
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Tue Sep 29 19:16:21 2009
@@ -1933,6 +1933,7 @@
 
 	if (!is_tree_empty) {
 		ast_cc_core_init_instance(inbound, cc_interfaces->interface_tree);
+		ast_set_flag(inbound, AST_FLAG_OFFER_CC);
 	}
 	return 0;
 }

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=221038&r1=221037&r2=221038
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Tue Sep 29 19:16:21 2009
@@ -756,6 +756,18 @@
 
 /*!
  * \since 1.6.4
+ * \brief Offer CC to a caller
+ *
+ * This function is called from ast_hangup if the caller is
+ * eligible to be offered call completion service.
+ *
+ * \param caller_chan The calling channel
+ * \retval -1 Error
+ * \retval 0 Success
+ */
+int ast_cc_offer(struct ast_channel *caller_chan);
+/*!
+ * \since 1.6.4
  * \brief Request that the core change states
  * \param state The state to which we wish to change
  * \param core_id The unique identifier for this instance of the CCSS core state machine

Modified: team/group/CCSS/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/channel.h?view=diff&rev=221038&r1=221037&r2=221038
==============================================================================
--- team/group/CCSS/include/asterisk/channel.h (original)
+++ team/group/CCSS/include/asterisk/channel.h Tue Sep 29 19:16:21 2009
@@ -766,6 +766,10 @@
 	 *  bridge terminates, this will allow the hangup in the pbx loop to be run instead.
 	 *  */
 	AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18),
+	/*! This flag indicates that upon hangup, CCBS or CCNR should be offered to
+	 * the caller.
+	 */
+	AST_FLAG_OFFER_CC = (1 << 19),
 };
 
 /*! \brief ast_bridge_config flags */

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=221038&r1=221037&r2=221038
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Sep 29 19:16:21 2009
@@ -713,6 +713,27 @@
 	cc_unref(core_instance, "Linked core instance, unref from ao2_alloc()"); /* From ao2_alloc. */
 
 	return core_instance->core_id;
+}
+
+int ast_cc_offer(struct ast_channel *caller_chan)
+{
+	char *caller = ast_strdupa(caller_chan->name);
+	char *dash = strrchr(caller, '-');
+	struct cc_core_instance *core_instance;
+	enum match_flags match_flags = MATCH_NO_MONITOR;
+	int res;
+
+	if (dash) {
+		*dash = '\0';
+	}
+
+	if (!(core_instance = ao2_t_callback_data(cc_core_instances, 0, match_agent, caller, &match_flags, "Find core instance to offer CC"))) {
+		return -1;
+	}
+
+	res = ast_cc_request_state_change(CC_CALLER_OFFERED, core_instance->core_id, "Offer CC to caller");
+	cc_unref(core_instance, "Done with core instance while offering CC");
+	return res;
 }
 
 static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan)

Modified: team/group/CCSS/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/channel.c?view=diff&rev=221038&r1=221037&r2=221038
==============================================================================
--- team/group/CCSS/main/channel.c (original)
+++ team/group/CCSS/main/channel.c Tue Sep 29 19:16:21 2009
@@ -2209,6 +2209,9 @@
 	}
 			
 	ast_channel_unlock(chan);
+	if (ast_test_flag(chan, AST_FLAG_OFFER_CC)) {
+		ast_cc_offer(chan);
+	}
 	manager_event(EVENT_FLAG_CALL, "Hangup",
 			"Channel: %s\r\n"
 			"Uniqueid: %s\r\n"




More information about the asterisk-commits mailing list