[svn-commits] kharwell: branch group/pimp_my_sip r391886 - in /team/group/pimp_my_sip: chan...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 14 15:26:31 CDT 2013


Author: kharwell
Date: Fri Jun 14 15:26:23 2013
New Revision: 391886

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391886
Log:
Added call pickup group configuration options

Added the ability to configure pick up groups automatically on a channel
created for a chan_gulp endpoint. This includes: callgroup, pickupgroup,
namedcallgroup, namedpickupgroup.

(closes issue ASTERISK-21505)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2589/

Modified:
    team/group/pimp_my_sip/channels/chan_gulp.c
    team/group/pimp_my_sip/include/asterisk/res_sip.h
    team/group/pimp_my_sip/res/res_sip.c
    team/group/pimp_my_sip/res/res_sip/sip_configuration.c

Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=391886&r1=391885&r2=391886
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Fri Jun 14 15:26:23 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/group/pimp_my_sip/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/res_sip.h?view=diff&rev=391886&r1=391885&r2=391886
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/res_sip.h (original)
+++ team/group/pimp_my_sip/include/asterisk/res_sip.h Fri Jun 14 15:26:23 2013
@@ -360,6 +360,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/group/pimp_my_sip/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip.c?view=diff&rev=391886&r1=391885&r2=391886
==============================================================================
--- team/group/pimp_my_sip/res/res_sip.c (original)
+++ team/group/pimp_my_sip/res/res_sip.c Fri Jun 14 15:26:23 2013
@@ -352,6 +352,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/group/pimp_my_sip/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip/sip_configuration.c?view=diff&rev=391886&r1=391885&r2=391886
==============================================================================
--- team/group/pimp_my_sip/res/res_sip/sip_configuration.c (original)
+++ team/group/pimp_my_sip/res/res_sip/sip_configuration.c Fri Jun 14 15:26:23 2013
@@ -302,6 +302,48 @@
 		endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_SDES;
 	/*} else if (!strcasecmp("dtls", var->value)) {
 		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 (!strncmp(var->name, "callgroup", 9)) {
+		if (!(endpoint->callgroup = ast_get_group(var->value))) {
+			return -1;
+		}
+	} else if (!strncmp(var->name, "pickupgroup", 11)) {
+		if (!(endpoint->pickupgroup = ast_get_group(var->value))) {
+			return -1;
+		}
+	} else {
+		return -1;
+	}
+
+	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 (!strncmp(var->name, "namedcallgroup", 14)) {
+		if (!(endpoint->named_callgroups =
+		      ast_get_namedgroups(var->value))) {
+			return -1;
+		}
+	} else if (!strncmp(var->name, "namedpickupgroup", 16)) {
+		if (!(endpoint->named_pickupgroups =
+		      ast_get_namedgroups(var->value))) {
+			return -1;
+		}
 	} else {
 		return -1;
 	}
@@ -390,6 +432,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, 0, 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, 0, 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");
@@ -443,6 +489,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 svn-commits mailing list