[asterisk-commits] mmichelson: branch group/CCSS r213006 - in /team/group/CCSS: channels/ includ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 18 18:48:44 CDT 2009


Author: mmichelson
Date: Tue Aug 18 18:48:39 2009
New Revision: 213006

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213006
Log:
Add some logic to help when parsing channel driver config files.

Also added the necessary logic to chan_sip.c to parse config files.
Next step is to get rid of all "ccss" from public function names
in favor of "cc." The mixture is already annoying even in this
early stage, and it seems like the best idea to go with the
shorter name.


Modified:
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/include/asterisk/ccss.h

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=213006&r1=213005&r2=213006
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Tue Aug 18 18:48:39 2009
@@ -273,6 +273,7 @@
 #include "asterisk/tcptls.h"
 #include "asterisk/stun.h"
 #include "asterisk/cel.h"
+#include "asterisk/ccss.h"
 
 /*** DOCUMENTATION
 	<application name="SIPDtmfMode" language="en_US">
@@ -1844,6 +1845,7 @@
 	 * The large-scale changes would be a good idea for implementing during an SDP rewrite.
 	 */
 	struct offered_media offered_media[4];
+	struct ast_cc_config_params *cc_params;
 }; 
 
 
@@ -2035,6 +2037,7 @@
 	/*XXX Seems like we suddenly have two flags with the same content. Why? To be continued... */
 	enum sip_peer_type type; /*!< Distinguish between "user" and "peer" types. This is used solely for CLI and manager commands */
 	unsigned int disallowed_methods;
+	struct ast_cc_config_params *cc_params;
 };
 
 
@@ -5118,6 +5121,7 @@
 	dialog->peerauth = peer->auth;
 	dialog->maxcallbitrate = peer->maxcallbitrate;
 	dialog->disallowed_methods = peer->disallowed_methods;
+	ast_ccss_copy_config_params(dialog->cc_params, peer->cc_params);
 	if (ast_strlen_zero(dialog->tohost))
 		ast_string_field_set(dialog, tohost, ast_inet_ntoa(dialog->sa.sin_addr));
 	if (!ast_strlen_zero(peer->fromdomain)) {
@@ -7063,6 +7067,12 @@
 
 	if (ast_string_field_init(p, 512)) {
 		ao2_t_ref(p, -1, "failed to string_field_init, drop p");
+		return NULL;
+	}
+
+	if (!(p->cc_params = ast_cc_config_params_init())) {
+		ast_string_field_free_memory(p);
+		ao2_t_ref(p, -1, "Yuck, couldn't allocate cc_params struct. Get rid o' p");
 		return NULL;
 	}
 
@@ -23985,6 +23995,12 @@
 			return NULL;
 		}
 
+		if (!(peer->cc_params = ast_cc_config_params_init())) {
+			ast_string_field_free_memory(peer);
+			ao2_t_ref(peer, -1, "failed to allocate cc_params for peer");
+			return NULL;
+		}
+
 		if (realtime && !ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
 			ast_atomic_fetchadd_int(&rpeerobjs, 1);
 			ast_debug(3, "-REALTIME- peer built. Name: %s. Peer objects: %d\n", name, rpeerobjs);
@@ -24348,6 +24364,8 @@
 		} else if (!strcasecmp(v->name, "disallowed_methods")) {
 			char *disallow = ast_strdupa(v->value);
 			mark_parsed_methods(&peer->disallowed_methods, disallow);
+		} else if (ast_ccss_is_cc_config_param(v->name)) {
+			ast_cc_set_param(peer->cc_params, v->name, v->value);
 		}
 	}
 

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=213006&r1=213005&r2=213006
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Tue Aug 18 18:48:39 2009
@@ -138,6 +138,19 @@
 void ast_cc_config_params_destroy(struct ast_cc_config_params *params);
 
 /*!
+ * \brief set a CCSS configuration parameter
+ *
+ * Useful when parsing config files when used in conjunction
+ * with ast_ccss_is_cc_config_param.
+ *
+ * \param name The name of the cc parameter
+ * \param value The value of the parameter
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_cc_set_param(struct ast_cc_config_params *params, const char * const name, const char * value);
+
+/*!
  * \since 1.6.4
  * \brief Is this a CCSS configuration parameter?
  * \param name Name of configuration option being parsed.
@@ -298,7 +311,7 @@
  * \param value The new callback macro  we want to change to
  * \retval void
  */
-void ast_set_callback_macro(struct ast_cc_config_params *config, const char * const value);
+void ast_set_cc_callback_macro(struct ast_cc_config_params *config, const char * const value);
 
 /*!
  * \brief a link that connects two monitors in the weighted graph of 




More information about the asterisk-commits mailing list