[asterisk-commits] mmichelson: branch group/CCSS r213249 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 20 11:02:36 CDT 2009


Author: mmichelson
Date: Thu Aug 20 11:02:32 2009
New Revision: 213249

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213249
Log:
Finalize parsing of cc config options in chan_sip

Now you can place cc options in the general section and
have it apply to all peers. Individual options placed
in a peer definition will override the defaults.


Modified:
    team/group/CCSS/channels/chan_sip.c

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=213249&r1=213248&r2=213249
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Thu Aug 20 11:02:32 2009
@@ -1239,6 +1239,7 @@
 static int global_qualifyfreq;			/*!< Qualify frequency */
 static int global_qualify_gap;              /*!< Time between our group of peer pokes */
 static int global_qualify_peers;          /*!< Number of peers to poke at a given time */
+struct ast_cc_config_params *global_cc_params;
 
 
 /*! \brief Codecs that we support by default: */
@@ -7082,6 +7083,8 @@
 		ao2_t_ref(p, -1, "Yuck, couldn't allocate cc_params struct. Get rid o' p");
 		return NULL;
 	}
+
+	ast_cc_copy_config_params(p->cc_params, global_cc_params);
 
 	if (req) {
 		set_socket_transport(&p->socket, req->socket.type); /* Later in ast_sip_ouraddrfor we need this to choose the right ip and port for the specific transport */
@@ -23965,6 +23968,7 @@
 	peer->timer_b = global_timer_b;
 	clear_peer_mailboxes(peer);
 	peer->disallowed_methods = sip_cfg.disallowed_methods;
+	ast_cc_copy_config_params(peer->cc_params, global_cc_params);
 }
 
 /*! \brief Create temporary peer (used in autocreatepeer mode) */
@@ -23977,6 +23981,11 @@
 
 	if (ast_string_field_init(peer, 512)) {
 		ao2_t_ref(peer, -1, "failed to string_field_init, drop peer");
+		return NULL;
+	}
+
+	if (!(peer->cc_params = ast_cc_config_params_init())) {
+		ao2_t_ref(peer, -1, "failed to allocate cc_params, drop peer");
 		return NULL;
 	}
 
@@ -24793,6 +24802,13 @@
 	ast_clear_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT);
 	ast_clear_flag(&global_flags[1], SIP_PAGE2_IGNORESDPVERSION);
 
+	if (global_cc_params) {
+		ast_cc_config_params_destroy(global_cc_params);
+	}
+
+	if (!(global_cc_params = ast_cc_config_params_init())) {
+		return -1;
+	}
 
 	/* Read the [general] config section of sip.conf (or from realtime config) */
 	for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
@@ -25217,6 +25233,8 @@
 		} else if (!strcasecmp(v->name, "disallowed_methods")) {
 			char *disallow = ast_strdupa(v->value);
 			mark_parsed_methods(&sip_cfg.disallowed_methods, disallow);
+		} else if (ast_cc_is_config_param(v->name)) {
+			ast_cc_set_param(global_cc_params, v->name, v->value);
 		}
 	}
 




More information about the asterisk-commits mailing list