[asterisk-commits] mmichelson: branch group/pimp_my_sip r390756 - in /team/group/pimp_my_sip: ./...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 6 17:04:02 CDT 2013


Author: mmichelson
Date: Thu Jun  6 17:04:00 2013
New Revision: 390756

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390756
Log:
Reset the automerge property.


Added:
    team/group/pimp_my_sip/include/asterisk/features_config.h
      - copied unchanged from r390751, trunk/include/asterisk/features_config.h
    team/group/pimp_my_sip/main/features_config.c
      - copied unchanged from r390751, trunk/main/features_config.c
Modified:
    team/group/pimp_my_sip/   (props changed)
    team/group/pimp_my_sip/CHANGES
    team/group/pimp_my_sip/apps/app_bridgewait.c
    team/group/pimp_my_sip/apps/app_dial.c
    team/group/pimp_my_sip/bridges/bridge_builtin_features.c
    team/group/pimp_my_sip/channels/chan_dahdi.c
    team/group/pimp_my_sip/channels/chan_mgcp.c
    team/group/pimp_my_sip/channels/chan_misdn.c
    team/group/pimp_my_sip/channels/chan_sip.c
    team/group/pimp_my_sip/channels/chan_unistim.c
    team/group/pimp_my_sip/channels/sig_analog.c
    team/group/pimp_my_sip/channels/sip/include/sip.h
    team/group/pimp_my_sip/include/asterisk/channel.h
    team/group/pimp_my_sip/include/asterisk/features.h
    team/group/pimp_my_sip/include/asterisk/stasis_message_router.h
    team/group/pimp_my_sip/main/bridging.c
    team/group/pimp_my_sip/main/features.c
    team/group/pimp_my_sip/main/manager.c
    team/group/pimp_my_sip/main/stasis_message_router.c
    team/group/pimp_my_sip/res/parking/parking_manager.c
    team/group/pimp_my_sip/res/res_agi.c

Propchange: team/group/pimp_my_sip/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/pimp_my_sip/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jun  6 17:04:00 2013
@@ -1,1 +1,1 @@
-/trunk:1-390675
+/trunk:1-390755

Modified: team/group/pimp_my_sip/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/CHANGES?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/CHANGES (original)
+++ team/group/pimp_my_sip/CHANGES Thu Jun  6 17:04:00 2013
@@ -105,6 +105,13 @@
  * The AMI 'Hold' event has been moved out of individual channel drivers, into
    core, and is now two events: Hold and Unhold.  The status field has been
    removed.
+
+AGI (Asterisk Gateway Interface)
+------------------
+ * The manager event AGIExec has been split into AGIExecStart and AGIExecEnd.
+
+ * The manager event AsyncAGI has been split into AsyncAGIStart, AsyncAGIExec,
+   and AsyncAGIEnd.
 
 Channel Drivers
 ------------------

Modified: team/group/pimp_my_sip/apps/app_bridgewait.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_bridgewait.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/apps/app_bridgewait.c (original)
+++ team/group/pimp_my_sip/apps/app_bridgewait.c Thu Jun  6 17:04:00 2013
@@ -141,7 +141,7 @@
 
 	/* Limits struct holds time as milliseconds, so muliply 1000x */
 	hold_limits.duration *= 1000;
-	ast_bridge_features_set_limits(features, &hold_limits, 1 /* remove_on_pull */);
+	ast_bridge_features_set_limits(features, &hold_limits, AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 	ast_bridge_features_limits_destroy(&hold_limits);
 
 	return 0;

Modified: team/group/pimp_my_sip/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_dial.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/apps/app_dial.c (original)
+++ team/group/pimp_my_sip/apps/app_dial.c Thu Jun  6 17:04:00 2013
@@ -69,6 +69,7 @@
 #include "asterisk/dial.h"
 #include "asterisk/stasis_channels.h"
 #include "asterisk/bridging.h"
+#include "asterisk/features_config.h"
 
 /*** DOCUMENTATION
 	<application name="Dial" language="en_US">
@@ -1074,7 +1075,7 @@
 	int caller_entertained = outgoing
 		&& ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
 	struct ast_party_connected_line connected_caller;
-	struct ast_str *featurecode = ast_str_alloca(FEATURE_MAX_LEN + 1);
+	struct ast_str *featurecode = ast_str_alloca(AST_FEATURE_MAX_LEN + 1);
 	int cc_recall_core_id;
 	int is_cc_recall;
 	int cc_frame_received = 0;
@@ -1701,22 +1702,31 @@
 
 static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str **featurecode)
 {
-	struct ast_flags features = { AST_FEATURE_DISCONNECT }; /* only concerned with disconnect feature */
-	struct ast_call_feature feature = { 0, };
+	char disconnect_code[AST_FEATURE_MAX_LEN];
 	int res;
 
 	ast_str_append(featurecode, 1, "%c", code);
 
-	res = ast_feature_detect(chan, &features, ast_str_buffer(*featurecode), &feature);
-
-	if (res != AST_FEATURE_RETURN_STOREDIGITS) {
+	res = ast_get_builtin_feature(chan, "disconnect", disconnect_code, sizeof(disconnect_code));
+	if (res) {
 		ast_str_reset(*featurecode);
-	}
-	if (feature.feature_mask & AST_FEATURE_DISCONNECT) {
-		return 1;
-	}
-
-	return 0;
+		return 0;
+	}
+
+	if (strlen(disconnect_code) > ast_str_strlen(*featurecode)) {
+		/* Could be a partial match, anyway */
+		if (strncmp(disconnect_code, ast_str_buffer(*featurecode), ast_str_strlen(*featurecode))) {
+			ast_str_reset(*featurecode);
+		}
+		return 0;
+	}
+
+	if (strcmp(disconnect_code, ast_str_buffer(*featurecode))) {
+		ast_str_reset(*featurecode);
+		return 0;
+	}
+
+	return 1;
 }
 
 /* returns true if there is a valid privacy reply */

Modified: team/group/pimp_my_sip/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/bridges/bridge_builtin_features.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/bridges/bridge_builtin_features.c (original)
+++ team/group/pimp_my_sip/bridges/bridge_builtin_features.c Thu Jun  6 17:04:00 2013
@@ -49,6 +49,7 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/pbx.h"
 #include "asterisk/parking.h"
+#include "asterisk/features_config.h"
 
 /*!
  * \brief Helper function that presents dialtone and grabs extension
@@ -59,6 +60,18 @@
 static int grab_transfer(struct ast_channel *chan, char *exten, size_t exten_len, const char *context)
 {
 	int res;
+	int digit_timeout;
+	RAII_VAR(struct ast_features_xfer_config *, xfer_cfg, NULL, ao2_cleanup);
+
+	ast_channel_lock(chan);
+	xfer_cfg = ast_get_chan_features_xfer_config(chan);
+	if (!xfer_cfg) {
+		ast_log(LOG_ERROR, "Unable to get transfer configuration\n");
+		ast_channel_unlock(chan);
+		return -1;
+	}
+	digit_timeout = xfer_cfg->transferdigittimeout;
+	ast_channel_unlock(chan);
 
 	/* Play the simple "transfer" prompt out and wait */
 	res = ast_stream_and_wait(chan, "pbx-transfer", AST_DIGIT_ANY);
@@ -73,8 +86,7 @@
 	}
 
 	/* Drop to dialtone so they can enter the extension they want to transfer to */
-/* BUGBUG the timeout needs to be configurable from features.conf. */
-	res = ast_app_dtget(chan, context, exten, exten_len, exten_len - 1, 3000);
+	res = ast_app_dtget(chan, context, exten, exten_len, exten_len - 1, digit_timeout);
 	if (res < 0) {
 		/* Hangup or error */
 		res = -1;
@@ -265,6 +277,11 @@
 	struct ast_bridge_features_attended_transfer *attended_transfer = hook_pvt;
 	const char *context;
 	enum atxfer_code transfer_code = ATXFER_INCOMPLETE;
+	const char *atxfer_abort;
+	const char *atxfer_threeway;
+	const char *atxfer_complete;
+	const char *fail_sound;
+	RAII_VAR(struct ast_features_xfer_config *, xfer_cfg, NULL, ao2_cleanup);
 
 	ast_bridge_channel_write_hold(bridge_channel, NULL);
 
@@ -273,6 +290,22 @@
 	ast_channel_lock(bridge_channel->chan);
 	context = ast_strdupa(get_transfer_context(bridge_channel->chan,
 		attended_transfer ? attended_transfer->context : NULL));
+	xfer_cfg = ast_get_chan_features_xfer_config(bridge_channel->chan);
+	if (!xfer_cfg) {
+		ast_log(LOG_ERROR, "Unable to get transfer configuration options\n");
+		ast_channel_unlock(bridge_channel->chan);
+		return 0;
+	}
+	if (attended_transfer) {
+		atxfer_abort = ast_strdupa(S_OR(attended_transfer->abort, xfer_cfg->atxferabort));
+		atxfer_threeway = ast_strdupa(S_OR(attended_transfer->threeway, xfer_cfg->atxferthreeway));
+		atxfer_complete = ast_strdupa(S_OR(attended_transfer->complete, xfer_cfg->atxfercomplete));
+	} else {
+		atxfer_abort = ast_strdupa(xfer_cfg->atxferabort);
+		atxfer_threeway = ast_strdupa(xfer_cfg->atxferthreeway);
+		atxfer_complete = ast_strdupa(xfer_cfg->atxfercomplete);
+	}
+	fail_sound = ast_strdupa(xfer_cfg->xferfailsound);
 	ast_channel_unlock(bridge_channel->chan);
 
 	/* Grab the extension to transfer to */
@@ -288,36 +321,27 @@
 	if (!peer) {
 		ast_bridge_merge_inhibit(bridge, -1);
 		ao2_ref(bridge, -1);
-/* BUGBUG beeperr needs to be configurable from features.conf */
-		ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
-		ast_bridge_channel_write_unhold(bridge_channel);
-		return 0;
-	}
-
-/* BUGBUG bridging API features does not support features.conf featuremap */
+		ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
+		ast_bridge_channel_write_unhold(bridge_channel);
+		return 0;
+	}
+
 /* BUGBUG bridging API features does not support the features.conf atxfer bounce between C & B channels */
 	/* Setup a DTMF menu to control the transfer. */
 	if (ast_bridge_features_init(&caller_features)
 		|| ast_bridge_hangup_hook(&caller_features,
 			attended_transfer_complete, &transfer_code, NULL, 0)
-		|| ast_bridge_dtmf_hook(&caller_features,
-			attended_transfer && !ast_strlen_zero(attended_transfer->abort)
-				? attended_transfer->abort : "*1",
+		|| ast_bridge_dtmf_hook(&caller_features, atxfer_abort,
 			attended_transfer_abort, &transfer_code, NULL, 0)
-		|| ast_bridge_dtmf_hook(&caller_features,
-			attended_transfer && !ast_strlen_zero(attended_transfer->complete)
-				? attended_transfer->complete : "*2",
+		|| ast_bridge_dtmf_hook(&caller_features, atxfer_complete,
 			attended_transfer_complete, &transfer_code, NULL, 0)
-		|| ast_bridge_dtmf_hook(&caller_features,
-			attended_transfer && !ast_strlen_zero(attended_transfer->threeway)
-				? attended_transfer->threeway : "*3",
+		|| ast_bridge_dtmf_hook(&caller_features, atxfer_threeway,
 			attended_transfer_threeway, &transfer_code, NULL, 0)) {
 		ast_bridge_features_cleanup(&caller_features);
 		ast_hangup(peer);
 		ast_bridge_merge_inhibit(bridge, -1);
 		ao2_ref(bridge, -1);
-/* BUGBUG beeperr needs to be configurable from features.conf */
-		ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+		ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
 		ast_bridge_channel_write_unhold(bridge_channel);
 		return 0;
 	}
@@ -330,8 +354,7 @@
 		ast_hangup(peer);
 		ast_bridge_merge_inhibit(bridge, -1);
 		ao2_ref(bridge, -1);
-/* BUGBUG beeperr needs to be configurable from features.conf */
-		ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+		ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
 		ast_bridge_channel_write_unhold(bridge_channel);
 		return 0;
 	}
@@ -345,8 +368,7 @@
 		ast_hangup(peer);
 		ast_bridge_merge_inhibit(bridge, -1);
 		ao2_ref(bridge, -1);
-/* BUGBUG beeperr needs to be configurable from features.conf */
-		ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+		ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
 		ast_bridge_channel_write_unhold(bridge_channel);
 		return 0;
 	}
@@ -415,7 +437,7 @@
 	if (xfer_failed) {
 		ast_hangup(peer);
 		if (!ast_check_hangup_locked(bridge_channel->chan)) {
-			ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+			ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
 		}
 		ast_bridge_channel_write_unhold(bridge_channel);
 	}

Modified: team/group/pimp_my_sip/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_dahdi.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/channels/chan_dahdi.c (original)
+++ team/group/pimp_my_sip/channels/chan_dahdi.c Thu Jun  6 17:04:00 2013
@@ -130,6 +130,7 @@
 #include "asterisk/paths.h"
 #include "asterisk/ccss.h"
 #include "asterisk/data.h"
+#include "asterisk/features_config.h"
 
 /*** DOCUMENTATION
 	<application name="DAHDISendKeypadFacility" language="en_US">
@@ -10137,15 +10138,15 @@
 	return 0;
 }
 
-static int canmatch_featurecode(const char *exten)
+static int canmatch_featurecode(const char *pickupexten, const char *exten)
 {
 	int extlen = strlen(exten);
-	const char *pickup_ext;
+
 	if (!extlen) {
 		return 1;
 	}
-	pickup_ext = ast_pickup_ext();
-	if (extlen < strlen(pickup_ext) && !strncmp(pickup_ext, exten, extlen)) {
+
+	if (extlen < strlen(pickupexten) && !strncmp(pickupexten, exten, extlen)) {
 		return 1;
 	}
 	/* hardcoded features are *60, *67, *69, *70, *72, *73, *78, *79, *82, *0 */
@@ -10191,6 +10192,8 @@
 	int res;
 	int idx;
 	struct ast_format tmpfmt;
+	RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+	const char *pickupexten;
 
 	ast_mutex_lock(&ss_thread_lock);
 	ss_thread_count++;
@@ -10210,6 +10213,17 @@
 		ast_hangup(chan);
 		goto quit;
 	}
+
+	ast_channel_lock(chan);
+	pickup_cfg = ast_get_chan_features_pickup_config(chan);
+	if (!pickup_cfg) {
+		ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+		pickupexten = "";
+	} else {
+		pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+	}
+	ast_channel_unlock(chan);
+
 	if (p->dsp)
 		ast_dsp_digitreset(p->dsp);
 	switch (p->sig) {
@@ -10576,7 +10590,7 @@
 				memset(exten, 0, sizeof(exten));
 				timeout = firstdigittimeout;
 
-			} else if (!strcmp(exten,ast_pickup_ext())) {
+			} else if (!strcmp(exten, pickupexten)) {
 				/* Scan all channels and see if there are any
 				 * ringing channels that have call groups
 				 * that equal this channels pickup group
@@ -10708,7 +10722,7 @@
 				}
 			} else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1,
 				S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
-				&& !canmatch_featurecode(exten)) {
+				&& !canmatch_featurecode(pickupexten, exten)) {
 				ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
 					S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<Unknown Caller>"),
 					ast_channel_context(chan));

Modified: team/group/pimp_my_sip/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_mgcp.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/channels/chan_mgcp.c (original)
+++ team/group/pimp_my_sip/channels/chan_mgcp.c Thu Jun  6 17:04:00 2013
@@ -84,6 +84,7 @@
 #include "asterisk/pktccops.h"
 #include "asterisk/stasis.h"
 #include "asterisk/bridging.h"
+#include "asterisk/features_config.h"
 
 /*
  * Define to work around buggy dlink MGCP phone firmware which
@@ -2971,8 +2972,20 @@
 	int res= 0;
 	int getforward = 0;
 	int loop_pause = 100;
+	RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+	const char *pickupexten;
 
 	len = strlen(p->dtmf_buf);
+
+	ast_channel_lock(chan);
+	pickup_cfg = ast_get_chan_features_pickup_config(chan);
+	if (!pickup_cfg) {
+		ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+		pickupexten = "";
+	} else {
+		pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+	}
+	ast_channel_unlock(chan);
 
 	while (len < AST_MAX_EXTENSION - 1) {
 		ast_debug(1, "Dtmf buffer '%s' for '%s@%s'\n", p->dtmf_buf, p->name, p->parent->name);
@@ -3065,7 +3078,7 @@
 			len = 0;
 			memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
 			timeout = firstdigittimeout;
-		} else if (!strcmp(p->dtmf_buf,ast_pickup_ext())) {
+		} else if (!strcmp(p->dtmf_buf, pickupexten)) {
 			/* Scan all channels and see if any there
 			 * ringing channqels with that have call groups
 			 * that equal this channels pickup group

Modified: team/group/pimp_my_sip/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_misdn.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/channels/chan_misdn.c (original)
+++ team/group/pimp_my_sip/channels/chan_misdn.c Thu Jun  6 17:04:00 2013
@@ -102,6 +102,7 @@
 #include "asterisk/causes.h"
 #include "asterisk/format.h"
 #include "asterisk/format_cap.h"
+#include "asterisk/features_config.h"
 
 #include "chan_misdn_config.h"
 #include "isdn_lib.h"
@@ -10071,6 +10072,9 @@
 		}
 
 		if (ch->state == MISDN_WAITING4DIGS) {
+			RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+			const char *pickupexten;
+
 			/*  Ok, incomplete Setup, waiting till extension exists */
 			if (ast_strlen_zero(bc->info_dad) && ! ast_strlen_zero(bc->keypad)) {
 				chan_misdn_log(1, bc->port, " --> using keypad as info\n");
@@ -10080,8 +10084,18 @@
 			strncat(bc->dialed.number, bc->info_dad, sizeof(bc->dialed.number) - strlen(bc->dialed.number) - 1);
 			ast_channel_exten_set(ch->ast, bc->dialed.number);
 
+			ast_channel_lock(ch->ast);
+			pickup_cfg = ast_get_chan_features_pickup_config(ch->ast);
+			if (!pickup_cfg) {
+				ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+				pickupexten = "";
+			} else {
+				pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+			}
+			ast_channel_unlock(ch->ast);
+
 			/* Check for Pickup Request first */
-			if (!strcmp(ast_channel_exten(ch->ast), ast_pickup_ext())) {
+			if (!strcmp(ast_channel_exten(ch->ast), pickupexten)) {
 				if (ast_pickup_call(ch->ast)) {
 					hangup_chan(ch, bc);
 				} else {
@@ -10169,6 +10183,8 @@
 		int ai;
 		int im;
 		int append_msn = 0;
+		RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+		const char *pickupexten;
 
 		if (ch) {
 			switch (ch->state) {
@@ -10223,6 +10239,16 @@
 			ast_log(LOG_ERROR, "cb_events: misdn_new failed!\n");
 			return RESPONSE_RELEASE_SETUP;
 		}
+
+		ast_channel_lock(chan);
+		pickup_cfg = ast_get_chan_features_pickup_config(chan);
+		if (!pickup_cfg) {
+			ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+			pickupexten = "";
+		} else {
+			pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+		}
+		ast_channel_unlock(chan);
 
 		if ((exceed = add_in_calls(bc->port))) {
 			char tmp[16];
@@ -10315,7 +10341,7 @@
 		}
 
 		/* Check for Pickup Request first */
-		if (!strcmp(ast_channel_exten(chan), ast_pickup_ext())) {
+		if (!strcmp(ast_channel_exten(chan), pickupexten)) {
 			if (!ch->noautorespond_on_setup) {
 				/* Sending SETUP_ACK */
 				misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE);

Modified: team/group/pimp_my_sip/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_sip.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/channels/chan_sip.c (original)
+++ team/group/pimp_my_sip/channels/chan_sip.c Thu Jun  6 17:04:00 2013
@@ -295,6 +295,7 @@
 #include "asterisk/app.h"
 #include "asterisk/bridging.h"
 #include "asterisk/stasis_endpoints.h"
+#include "asterisk/features_config.h"
 
 /*** DOCUMENTATION
 	<application name="SIPDtmfMode" language="en_US">
@@ -17628,6 +17629,16 @@
 	char tmpf[256] = "", *from = NULL;
 	struct sip_request *req;
 	char *decoded_uri;
+	RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, ast_get_chan_features_pickup_config(p->owner), ao2_cleanup);
+	const char *pickupexten;
+
+	if (!pickup_cfg) {
+		ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+		pickupexten = "";
+	} else {
+		/* Don't need to duplicate since channel is locked for the duration of this function */
+		pickupexten = pickup_cfg->pickupexten;
+	}
 
 	req = oreq;
 	if (!req) {
@@ -17738,7 +17749,7 @@
 			return SIP_GET_DEST_EXTEN_FOUND;
 		}
 		if (ast_exists_extension(NULL, p->context, decoded_uri, 1, S_OR(p->cid_num, from))
-			|| !strcmp(decoded_uri, ast_pickup_ext())) {
+			|| !strcmp(decoded_uri, pickupexten)) {
 			if (!oreq) {
 				ast_string_field_set(p, exten, decoded_uri);
 			}
@@ -17766,7 +17777,7 @@
 	if (ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP)
 		&& (ast_canmatch_extension(NULL, p->context, uri, 1, S_OR(p->cid_num, from))
 			|| ast_canmatch_extension(NULL, p->context, decoded_uri, 1, S_OR(p->cid_num, from))
-			|| !strncmp(decoded_uri, ast_pickup_ext(), strlen(decoded_uri)))) {
+			|| !strncmp(decoded_uri, pickupexten, strlen(decoded_uri)))) {
 		/* Overlap dialing is enabled and we need more digits to match an extension. */
 		return SIP_GET_DEST_EXTEN_MATCHMORE;
 	}
@@ -21665,7 +21676,8 @@
 		 * on phone calls.
 		 */
 
-		struct ast_call_feature *feat = NULL;
+		char feat[AST_FEATURE_MAX_LEN];
+		int feat_res = -1;
 		int j;
 		struct ast_frame f = { AST_FRAME_DTMF, };
 		int suppress_warning = 0; /* Supress warning if the feature is blank */
@@ -21677,43 +21689,40 @@
 		}
 
 		/* first, get the feature string, if it exists */
-		ast_rdlock_call_features();
 		if (p->relatedpeer) {
 			if (!strcasecmp(c, "on")) {
 				if (ast_strlen_zero(p->relatedpeer->record_on_feature)) {
 					suppress_warning = 1;
 				} else {
-					feat = ast_find_call_feature(p->relatedpeer->record_on_feature);
+					feat_res = ast_get_feature(p->owner, p->relatedpeer->record_on_feature, feat, sizeof(feat));
 				}
 			} else if (!strcasecmp(c, "off")) {
 				if (ast_strlen_zero(p->relatedpeer->record_off_feature)) {
 					suppress_warning = 1;
 				} else {
-					feat = ast_find_call_feature(p->relatedpeer->record_off_feature);
+					feat_res = ast_get_feature(p->owner, p->relatedpeer->record_off_feature, feat, sizeof(feat));
 				}
 			} else {
 				ast_log(LOG_ERROR, "Received INFO requesting to record with invalid value: %s\n", c);
 			}
 		}
-		if (!feat || ast_strlen_zero(feat->exten)) {
+		if (feat_res || ast_strlen_zero(feat)) {
 			if (!suppress_warning) {
 				ast_log(LOG_WARNING, "Recording requested, but no One Touch Monitor registered. (See features.conf)\n");
 			}
 			/* 403 means that we don't support this feature, so don't request it again */
 			transmit_response(p, "403 Forbidden", req);
-			ast_unlock_call_features();
 			return;
 		}
 		/* Send the feature code to the PBX as DTMF, just like the handset had sent it */
 		f.len = 100;
-		for (j = 0; j < strlen(feat->exten); j++) {
-			f.subclass.integer = feat->exten[j];
+		for (j = 0; j < strlen(feat); j++) {
+			f.subclass.integer = feat[j];
 			ast_queue_frame(p->owner, &f);
 			if (sipdebug) {
 				ast_verbose("* DTMF-relay event faked: %c\n", f.subclass.integer);
 			}
 		}
-		ast_unlock_call_features();
 
 		ast_debug(1, "Got a Request to Record the channel, state %s\n", c);
 		transmit_response(p, "200 OK", req);
@@ -25616,6 +25625,15 @@
 
 	if (c) {	/* We have a call  -either a new call or an old one (RE-INVITE) */
 		enum ast_channel_state c_state = ast_channel_state(c);
+		RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, ast_get_chan_features_pickup_config(c), ao2_cleanup);
+		const char *pickupexten;
+
+		if (!pickup_cfg) {
+			ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+			pickupexten = "";
+		} else {
+			pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+		}
 
 		if (c_state != AST_STATE_UP && reinvite &&
 			(p->invitestate == INV_TERMINATED || p->invitestate == INV_CONFIRMED)) {
@@ -25637,7 +25655,7 @@
 			transmit_provisional_response(p, "100 Trying", req, 0);
 			p->invitestate = INV_PROCEEDING;
 			ast_setstate(c, AST_STATE_RING);
-			if (strcmp(p->exten, ast_pickup_ext())) {	/* Call to extension -start pbx on this call */
+			if (strcmp(p->exten, pickupexten)) {	/* Call to extension -start pbx on this call */
 				enum ast_pbx_result result;
 
 				result = ast_pbx_start(c);

Modified: team/group/pimp_my_sip/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_unistim.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/channels/chan_unistim.c (original)
+++ team/group/pimp_my_sip/channels/chan_unistim.c Thu Jun  6 17:04:00 2013
@@ -76,6 +76,7 @@
 #include "asterisk/features.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/astdb.h"
+#include "asterisk/features_config.h"
 
 
 #define DEFAULTCONTEXT	  "default"
@@ -3086,11 +3087,25 @@
 	send_favorite_short(sub->softkey, FAV_ICON_OFFHOOK_BLACK, s);
 	s->device->selected = -1;
 	if (!sub->owner) {		      /* A call is already in progress ? */
+		RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+		const char *pickupexten;
+
 		c = unistim_new(sub, AST_STATE_DOWN, NULL);   /* No, starting a new one */
 		if (!sub->rtp) { /* Need to start RTP before calling ast_pbx_run */
 			start_rtp(sub);
 		}
-		if (c && !strcmp(s->device->phone_number, ast_pickup_ext())) {
+		if (c) {
+			ast_channel_lock(c);
+			pickup_cfg = ast_get_chan_features_pickup_config(c);
+			if (!pickup_cfg) {
+				ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+				pickupexten = "";
+			} else {
+				pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+			}
+			ast_channel_unlock(c);
+		}
+		if (c && !strcmp(s->device->phone_number, pickupexten)) {
 			if (unistimdebug) {
 				ast_verb(0, "Try to pickup in unistim_new\n");
 			}
@@ -4099,8 +4114,17 @@
 			ast_mutex_unlock(&devicelock);
 			show_extension_page(pte);
 		} else { /* Pickup function */
+			/* XXX Is there a way to get a specific channel here? */
+			RAII_VAR(struct ast_features_pickup_config *, pickup_cfg,
+					ast_get_chan_features_pickup_config(NULL), ao2_cleanup);
+
+			if (!pickup_cfg) {
+				ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+				break;
+			}
+
 			pte->device->selected = -1;
-			ast_copy_string(pte->device->phone_number, ast_pickup_ext(),
+			ast_copy_string(pte->device->phone_number, pickup_cfg->pickupexten,
 						sizeof(pte->device->phone_number));
 			handle_call_outgoing(pte);
                 }

Modified: team/group/pimp_my_sip/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/sig_analog.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/channels/sig_analog.c (original)
+++ team/group/pimp_my_sip/channels/sig_analog.c Thu Jun  6 17:04:00 2013
@@ -43,6 +43,7 @@
 #include "asterisk/features.h"
 #include "asterisk/cel.h"
 #include "asterisk/causes.h"
+#include "asterisk/features_config.h"
 
 #include "sig_analog.h"
 
@@ -1708,15 +1709,13 @@
 
 #define ANALOG_NEED_MFDETECT(p) (((p)->sig == ANALOG_SIG_FEATDMF) || ((p)->sig == ANALOG_SIG_FEATDMF_TA) || ((p)->sig == ANALOG_SIG_E911) || ((p)->sig == ANALOG_SIG_FGC_CAMA) || ((p)->sig == ANALOG_SIG_FGC_CAMAMF) || ((p)->sig == ANALOG_SIG_FEATB))
 
-static int analog_canmatch_featurecode(const char *exten)
+static int analog_canmatch_featurecode(const char *pickupexten, const char *exten)
 {
 	int extlen = strlen(exten);
-	const char *pickup_ext;
 	if (!extlen) {
 		return 1;
 	}
-	pickup_ext = ast_pickup_ext();
-	if (extlen < strlen(pickup_ext) && !strncmp(pickup_ext, exten, extlen)) {
+	if (extlen < strlen(pickupexten) && !strncmp(pickupexten, exten, extlen)) {
 		return 1;
 	}
 	/* hardcoded features are *60, *67, *69, *70, *72, *73, *78, *79, *82, *0 */
@@ -1756,6 +1755,8 @@
 	int res;
 	int idx;
 	struct ast_callid *callid;
+	RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+	const char *pickupexten;
 
 	analog_increase_ss_count();
 
@@ -1786,6 +1787,17 @@
 		ast_hangup(chan);
 		goto quit;
 	}
+
+	ast_channel_lock(chan);
+	pickup_cfg = ast_get_chan_features_pickup_config(chan);
+	if (!pickup_cfg) {
+		ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+		pickupexten = "";
+	} else {
+		pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+	}
+	ast_channel_unlock(chan);
+
 	analog_dsp_reset_and_flush_digits(p);
 	switch (p->sig) {
 	case ANALOG_SIG_FEATD:
@@ -2190,7 +2202,7 @@
 				memset(exten, 0, sizeof(exten));
 				timeout = analog_firstdigittimeout;
 
-			} else if (!strcmp(exten,ast_pickup_ext())) {
+			} else if (!strcmp(exten, pickupexten)) {
 				/* Scan all channels and see if there are any
 				 * ringing channels that have call groups
 				 * that equal this channels pickup group
@@ -2334,7 +2346,7 @@
 				}
 			} else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1,
 				ast_channel_caller(chan)->id.number.valid ? ast_channel_caller(chan)->id.number.str : NULL)
-				&& !analog_canmatch_featurecode(exten)) {
+				&& !analog_canmatch_featurecode(pickupexten, exten)) {
 				ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
 					ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str
 						? ast_channel_caller(chan)->id.number.str : "<Unknown Caller>",

Modified: team/group/pimp_my_sip/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/sip/include/sip.h?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/channels/sip/include/sip.h (original)
+++ team/group/pimp_my_sip/channels/sip/include/sip.h Thu Jun  6 17:04:00 2013
@@ -38,6 +38,7 @@
 #include "asterisk/http_websocket.h"
 #include "asterisk/rtp_engine.h"
 #include "asterisk/netsock2.h"
+#include "asterisk/features_config.h"
 
 #ifndef FALSE
 #define FALSE    0
@@ -762,8 +763,8 @@
 	struct sip_proxy outboundproxy; /*!< Outbound proxy */
 	char default_context[AST_MAX_CONTEXT];
 	char default_subscribecontext[AST_MAX_CONTEXT];
-	char default_record_on_feature[FEATURE_MAX_LEN];
-	char default_record_off_feature[FEATURE_MAX_LEN];
+	char default_record_on_feature[AST_FEATURE_MAX_LEN];
+	char default_record_off_feature[AST_FEATURE_MAX_LEN];
 	struct ast_acl_list *contact_acl;  /*! \brief Global list of addresses dynamic peers are not allowed to use */
 	struct ast_format_cap *caps; /*!< Supported codecs */
 	int tcp_enabled;

Modified: team/group/pimp_my_sip/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/channel.h?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/channel.h (original)
+++ team/group/pimp_my_sip/include/asterisk/channel.h Thu Jun  6 17:04:00 2013
@@ -926,6 +926,9 @@
 	AST_FEATURE_PARKCALL =     (1 << 5),
 	AST_FEATURE_AUTOMIXMON =   (1 << 6),
 };
+
+#define AST_FEATURE_DTMF_MASK (AST_FEATURE_REDIRECT | AST_FEATURE_DISCONNECT |\
+	AST_FEATURE_ATXFER | AST_FEATURE_AUTOMON | AST_FEATURE_PARKCALL | AST_FEATURE_AUTOMIXMON)
 
 /*! \brief bridge configuration */
 struct ast_bridge_config {

Modified: team/group/pimp_my_sip/include/asterisk/features.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/features.h?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/features.h (original)
+++ team/group/pimp_my_sip/include/asterisk/features.h Thu Jun  6 17:04:00 2013
@@ -62,20 +62,6 @@
 	AST_FEATURE_FLAG_BYBOTH	 =   (3 << 3),
 };
 
-struct ast_call_feature {
-	int feature_mask;
-	char *fname;
-	char sname[FEATURE_SNAME_LEN];
-	char exten[FEATURE_MAX_LEN];
-	char default_exten[FEATURE_MAX_LEN];
-	ast_feature_operation operation;
-	unsigned int flags;
-	char app[FEATURE_APP_LEN];		
-	char app_args[FEATURE_APP_ARGS_LEN];
-	char moh_class[FEATURE_MOH_LEN];
-	AST_LIST_ENTRY(ast_call_feature) feature_entry;
-};
-
 /*!
  * \brief Park a call and read back parked location
  *
@@ -166,9 +152,6 @@
 */
 int ast_parking_ext_valid(const char *exten_str, struct ast_channel *chan, const char *context);
 
-/*! \brief Determine system call pickup extension */
-const char *ast_pickup_ext(void);
-
 /*!
  * \brief Simulate a DTMF end on a broken bridge channel.
  *
@@ -221,39 +204,6 @@
  */
 int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target);
 
-/*! 
- * \brief register new feature into feature_set 
- * \param feature an ast_call_feature object which contains a keysequence
- * and a callback function which is called when this keysequence is pressed
- * during a call. 
-*/
-void ast_register_feature(struct ast_call_feature *feature);
-
-/*! 
- * \brief unregister feature from feature_set
- * \param feature the ast_call_feature object which was registered before
-*/
-void ast_unregister_feature(struct ast_call_feature *feature);
-
-/*! 
- * \brief detect a feature before bridging 
- * \param chan
- * \param features an ast_flags ptr
- * \param code ptr of input code
- * \param feature
- * \retval ast_call_feature ptr to be set if found 
-*/
-int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature);
-
-/*! 
- * \brief look for a call feature entry by its sname
- * \param name a string ptr, should match "automon", "blindxfer", "atxfer", etc. 
-*/
-struct ast_call_feature *ast_find_call_feature(const char *name);
-
-void ast_rdlock_call_features(void);
-void ast_unlock_call_features(void);
-
 /*! \brief Reload call features from features.conf */
 int ast_features_reload(void);
 

Modified: team/group/pimp_my_sip/include/asterisk/stasis_message_router.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/stasis_message_router.h?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/stasis_message_router.h (original)
+++ team/group/pimp_my_sip/include/asterisk/stasis_message_router.h Thu Jun  6 17:04:00 2013
@@ -47,9 +47,12 @@
 
 /*!
  * \brief Create a new message router object.
+ *
  * \param topic Topic to subscribe route to.
+ *
  * \return New \ref stasis_message_router.
  * \return \c NULL on error.
+ *
  * \since 12
  */
 struct stasis_message_router *stasis_message_router_create(
@@ -59,6 +62,7 @@
  * \brief Unsubscribe the router from the upstream topic.
  *
  * \param router Router to unsubscribe.
+ *
  * \since 12
  */
 void stasis_message_router_unsubscribe(struct stasis_message_router *router);
@@ -71,6 +75,7 @@
  * vs. stasis_message_router_unsubscribe().
  *
  * \param router Router to unsubscribe.
+ *
  * \since 12
  */
 void stasis_message_router_unsubscribe_and_join(
@@ -80,6 +85,7 @@
  * \brief Returns whether \a router has received its final message.
  *
  * \param router Router.
+ *
  * \return True (non-zero) if stasis_subscription_final_message() has been
  *         received.
  * \return False (zero) if waiting for the end.
@@ -88,10 +94,15 @@
 
 /*!
  * \brief Add a route to a message router.
+ *
  * \param router Router to add the route to.
  * \param message_type Type of message to route.
  * \param callback Callback to forard messages of \a message_type to.
  * \param data Data pointer to pass to \a callback.
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
  * \since 12
  */
 int stasis_message_router_add(struct stasis_message_router *router,
@@ -100,10 +111,26 @@
 			      void *data);
 
 /*!
+ * \brief Remove a route from a message router.
+ *
+ * \param router Router to remove the route from.
+ * \param message_type Type of message to route.
+ *
+ * \since 12
+ */
+void stasis_message_router_remove(struct stasis_message_router *router,
+			      struct stasis_message_type *message_type);
+
+/*!
  * \brief Sets the default route of a router.
+ *
  * \param router Router to set the default route of.
  * \param callback Callback to forard messages which otherwise have no home.
  * \param data Data pointer to pass to \a callback.
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
  * \since 12
  */
 int stasis_message_router_set_default(struct stasis_message_router *router,

Modified: team/group/pimp_my_sip/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/main/bridging.c?view=diff&rev=390756&r1=390755&r2=390756
==============================================================================
--- team/group/pimp_my_sip/main/bridging.c (original)
+++ team/group/pimp_my_sip/main/bridging.c Thu Jun  6 17:04:00 2013
@@ -61,6 +61,7 @@
 #include "asterisk/cli.h"
 #include "asterisk/parking.h"
 #include "asterisk/core_local.h"
+#include "asterisk/features_config.h"
 
 /*! All bridges container. */
 static struct ao2_container *bridges;
@@ -75,7 +76,7 @@
 
 static void cleanup_video_mode(struct ast_bridge *bridge);
 static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
-static void bridge_features_remove(struct ast_bridge_features *features, enum ast_bridge_hook_remove_flags flags);
+static void bridge_features_remove(struct ast_bridge_features *features, enum ast_bridge_hook_remove_flags remove_flags);
 
 /*! Default DTMF keys for built in features */
 static char builtin_features_dtmf[AST_BRIDGE_BUILTIN_END][MAXIMUM_DTMF_FEATURE_STRING];
@@ -1914,6 +1915,18 @@
 	struct ast_bridge_hook *hook = NULL;
 	char dtmf[MAXIMUM_DTMF_FEATURE_STRING] = "";
 	size_t dtmf_len = 0;
+	unsigned int digit_timeout;
+	RAII_VAR(struct ast_features_general_config *, gen_cfg, NULL, ao2_cleanup);
+
+	ast_channel_lock(bridge_channel->chan);
+	gen_cfg = ast_get_chan_features_general_config(bridge_channel->chan);
+	if (!gen_cfg) {
+		ast_log(LOG_ERROR, "Unable to retrieve features configuration.\n");
+		ast_channel_unlock(bridge_channel->chan);
+		return;
+	}
+	digit_timeout = gen_cfg->featuredigittimeout;
+	ast_channel_unlock(bridge_channel->chan);
 
 	/* The channel is now under our control and we don't really want any begin frames to do our DTMF matching so disable 'em at the core level */
 	ast_set_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_END_DTMF_ONLY);
@@ -1923,7 +1936,7 @@
 		int res;
 
 		/* If the above timed out simply exit */
-		res = ast_waitfordigit(bridge_channel->chan, 3000);
+		res = ast_waitfordigit(bridge_channel->chan, digit_timeout);
 		if (!res) {
 			ast_debug(1, "DTMF feature string collection on %p(%s) timed out\n",
 				bridge_channel, ast_channel_name(bridge_channel->chan));
@@ -4626,17 +4639,17 @@
  *
  * \param obj Feature hook object.
  * \param arg Removal flags
- * \param unused Not used
+ * \param flags Not used
  *
  * \retval CMP_MATCH if hook's remove_flags match the removal flags set.
  * \retval 0 if not match.
  */
-static int hook_remove_match(void *obj, void *arg, int unused)
+static int hook_remove_match(void *obj, void *arg, int flags)
 {
 	struct ast_bridge_hook *hook = obj;
-	enum ast_bridge_hook_remove_flags *flags = arg;
-
-	if (ast_test_flag(&hook->remove_flags, *flags)) {
+	enum ast_bridge_hook_remove_flags *remove_flags = arg;
+

[... 4337 lines stripped ...]



More information about the asterisk-commits mailing list