[asterisk-commits] kharwell: branch kharwell/pimp_sip_callgroup r390387 - in /team/kharwell/pimp...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 3 17:14:17 CDT 2013


Author: kharwell
Date: Mon Jun  3 17:14:15 2013
New Revision: 390387

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390387
Log:
implemented call/pickup [named]group options

Modified:
    team/kharwell/pimp_sip_callgroup/channels/chan_gulp.c
    team/kharwell/pimp_sip_callgroup/include/asterisk/res_sip.h
    team/kharwell/pimp_sip_callgroup/res/res_sip.c
    team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c

Modified: team/kharwell/pimp_sip_callgroup/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_callgroup/channels/chan_gulp.c?view=diff&rev=390387&r1=390386&r2=390387
==============================================================================
--- team/kharwell/pimp_sip_callgroup/channels/chan_gulp.c (original)
+++ team/kharwell/pimp_sip_callgroup/channels/chan_gulp.c Mon Jun  3 17:14:15 2013
@@ -578,6 +578,12 @@
 	ast_channel_context_set(chan, session->endpoint->context);
 	ast_channel_exten_set(chan, S_OR(exten, "s"));
 	ast_channel_priority_set(chan, 1);
+
+	ast_channel_callgroup_set(chan, session->endpoint->callgroup);
+	ast_channel_pickupgroup_set(chan, session->endpoint->pickupgroup);
+
+	ast_channel_named_callgroups_set(chan, session->endpoint->named_callgroups);
+	ast_channel_named_pickupgroups_set(chan, session->endpoint->named_pickupgroups);
 
 	return chan;
 }

Modified: team/kharwell/pimp_sip_callgroup/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_callgroup/include/asterisk/res_sip.h?view=diff&rev=390387&r1=390386&r2=390387
==============================================================================
--- team/kharwell/pimp_sip_callgroup/include/asterisk/res_sip.h (original)
+++ team/kharwell/pimp_sip_callgroup/include/asterisk/res_sip.h Mon Jun  3 17:14:15 2013
@@ -358,6 +358,14 @@
 	unsigned int one_touch_recording;
 	/*! Boolean indicating if ringing should be sent as inband progress */
 	unsigned int inband_progress;
+	/*! Call group */
+	ast_group_t callgroup;
+	/*! Pickup group */
+	ast_group_t pickupgroup;
+	/*! Named call group */
+	struct ast_namedgroups *named_callgroups;
+	/*! Named pickup group */
+	struct ast_namedgroups *named_pickupgroups;
 };
 
 /*!

Modified: team/kharwell/pimp_sip_callgroup/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_callgroup/res/res_sip.c?view=diff&rev=390387&r1=390386&r2=390387
==============================================================================
--- team/kharwell/pimp_sip_callgroup/res/res_sip.c (original)
+++ team/kharwell/pimp_sip_callgroup/res/res_sip.c Mon Jun  3 17:14:15 2013
@@ -339,6 +339,34 @@
 						to indicate ringing and will NOT send it as audio.
 					</para></description>
 				</configOption>
+				<configOption name="callgroup">
+					<synopsis>The numeric pickup groups for a channel.</synopsis>
+					<description><para>
+						Can be set to a comma separated list of numbers or ranges between the values
+						of 0-63 (maximum of 64 groups).
+					</para></description>
+				</configOption>
+				<configOption name="pickupgroup">
+					<synopsis>The numeric pickup groups that a channel can pickup.</synopsis>
+					<description><para>
+						Can be set to a comma separated list of numbers or ranges between the values
+						of 0-63 (maximum of 64 groups).
+					</para></description>
+				</configOption>
+				<configOption name="namedcallgroup">
+					<synopsis>The named pickup groups for a channel.</synopsis>
+					<description><para>
+						Can be set to a comma separated list of case sensitive strings limited by
+						supported line length.
+					</para></description>
+				</configOption>
+				<configOption name="namedpickupgroup">
+					<synopsis>The named pickup groups that a channel can pickup.</synopsis>
+					<description><para>
+						Can be set to a comma separated list of case sensitive strings limited by
+						supported line length.
+					</para></description>
+				</configOption>
 			</configObject>
 			<configObject name="auth">
 				<synopsis>Authentication type</synopsis>

Modified: team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c?view=diff&rev=390387&r1=390386&r2=390387
==============================================================================
--- team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c (original)
+++ team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c Mon Jun  3 17:14:15 2013
@@ -288,6 +288,32 @@
 		endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_DTLS;*/
 	} else {
 		return -1;
+	}
+
+	return 0;
+}
+
+static int group_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+	struct ast_sip_endpoint *endpoint = obj;
+
+	if (aco_option_get_flags(opt)) {
+		endpoint->callgroup = ast_get_group(var->value);
+	} else {
+		endpoint->pickupgroup = ast_get_group(var->value);
+	}
+
+	return 0;
+}
+
+static int named_groups_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+{
+	struct ast_sip_endpoint *endpoint = obj;
+
+	if (aco_option_get_flags(opt)) {
+		endpoint->named_callgroups = ast_get_namedgroups(var->value);
+	} else {
+		endpoint->named_pickupgroups = ast_get_namedgroups(var->value);
 	}
 
 	return 0;
@@ -373,6 +399,10 @@
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_avpf", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, use_avpf));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "one_touch_recording", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, one_touch_recording));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "inband_progress", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, inband_progress));
+	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callgroup", "", group_handler, NULL, 1, 0);
+	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "pickupgroup", "", group_handler, NULL, 0, 0);
+	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "namedcallgroup", "", named_groups_handler, NULL, 1, 0);
+	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "namedpickupgroup", "", named_groups_handler, NULL, 0, 0);
 
 	if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
 		ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
@@ -426,6 +456,9 @@
 	destroy_auths(endpoint->sip_inbound_auths, endpoint->num_inbound_auths);
 	destroy_auths(endpoint->sip_outbound_auths, endpoint->num_outbound_auths);
 	ast_party_id_free(&endpoint->id);
+
+	endpoint->named_callgroups = ast_unref_namedgroups(endpoint->named_callgroups);
+	endpoint->named_pickupgroups = ast_unref_namedgroups(endpoint->named_pickupgroups);
 }
 
 void *ast_sip_endpoint_alloc(const char *name)




More information about the asterisk-commits mailing list