[asterisk-commits] kharwell: branch kharwell/pimp_my_sip r385161 - in /team/kharwell/pimp_my_sip...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 9 16:58:32 CDT 2013


Author: kharwell
Date: Tue Apr  9 16:58:31 2013
New Revision: 385161

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385161
Log:
Multiple revisions 384992,385052,385090,385107,385110,385125,385144

........
  r384992 | root | 2013-04-08 14:17:44 -0500 (Mon, 08 Apr 2013) | 7 lines
  
  Clean up Makefile "warning" clutter when makeopts doesn't exist.
  
  Review: https://reviewboard.asterisk.org/r/2304
  ........
  
  Merged revisions 384989 from file:///srv/subversion/repos/asterisk/trunk
........
  r385052 | root | 2013-04-08 19:17:38 -0500 (Mon, 08 Apr 2013) | 13 lines
  
  Modified the list of keys for the driver backends for sake of sample clarity
  
  Added a line showing the mapping of "mysql" to res_config_mysql available in add-ons. We used "mysql" as an example driver key in the sample, but didn't show what module it mapped too. Also added a subtitle above the list of keys for driver backends.
  ........
  
  Merged revisions 385047 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 385048 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 385049 from file:///srv/subversion/repos/asterisk/trunk
........
  r385090 | root | 2013-04-09 01:17:38 -0500 (Tue, 09 Apr 2013) | 11 lines
  
  Add inheritance support to FEATURE()/FEATUREMAP().
  
  The settings saved on the channel for FEATURE()/FEATUREMAP() were only
  for that channel.  This patch adds the ability to have these settings
  inherited to child channels if you set FEATURE(inherit)=yes.
  
  Review: https://reviewboard.asterisk.org/r/2415/
  ........
  
  Merged revisions 385088 from file:///srv/subversion/repos/asterisk/trunk
........
  r385107 | file | 2013-04-09 09:53:54 -0500 (Tue, 09 Apr 2013) | 2 lines
  
  Now that res_sorcery_astdb is in trunk make the default for contacts to be astdb so they are persisted across restarts.
........
  r385110 | file | 2013-04-09 10:24:03 -0500 (Tue, 09 Apr 2013) | 2 lines
  
  Be more tolerate within res_sip_session of res_sip failing to load properly, plus I want Bamboo to run for kicks.
........
  r385125 | root | 2013-04-09 14:17:40 -0500 (Tue, 09 Apr 2013) | 9 lines
  
  Backported app_stasis fix from stasis-http branch.
  
  The hash and compare functions for the control container was reusing
  the wrong ones, causing some problems. I fixed it, but in the wrong
  branch. Oh well, it happens.
  ........
  
  Merged revisions 385116 from file:///srv/subversion/repos/asterisk/trunk
........
  r385144 | root | 2013-04-09 15:17:38 -0500 (Tue, 09 Apr 2013) | 7 lines
  
  Rename struct feature_ds to struct feature_datastore.
  
  Because "struct feature_ds *feature_ds" is not a good thing.
  ........
  
  Merged revisions 385142 from file:///srv/subversion/repos/asterisk/trunk
........

Merged revisions 384992,385052,385090,385107,385110,385125,385144 from http://svn.asterisk.org/svn/asterisk/team/group/pimp_my_sip

Modified:
    team/kharwell/pimp_my_sip/   (props changed)
    team/kharwell/pimp_my_sip/CHANGES
    team/kharwell/pimp_my_sip/Makefile
    team/kharwell/pimp_my_sip/apps/app_stasis.c
    team/kharwell/pimp_my_sip/build_tools/make_buildopts_h
    team/kharwell/pimp_my_sip/build_tools/make_linker_version_script
    team/kharwell/pimp_my_sip/build_tools/make_version
    team/kharwell/pimp_my_sip/build_tools/mkpkgconfig
    team/kharwell/pimp_my_sip/configs/extconfig.conf.sample
    team/kharwell/pimp_my_sip/main/features.c
    team/kharwell/pimp_my_sip/res/res_sip/location.c
    team/kharwell/pimp_my_sip/res/res_sip_session.c

Propchange: team/kharwell/pimp_my_sip/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kharwell/pimp_my_sip/
------------------------------------------------------------------------------
--- pimp_my_sip-integrated (original)
+++ pimp_my_sip-integrated Tue Apr  9 16:58:31 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-384980
+/team/group/pimp_my_sip:1-385160

Modified: team/kharwell/pimp_my_sip/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/CHANGES?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/CHANGES (original)
+++ team/kharwell/pimp_my_sip/CHANGES Tue Apr  9 16:58:31 2013
@@ -88,6 +88,10 @@
 
  * PARKINGSLOT and PARKEDLOT channel variables will now be set for a parked
    channel even when comebactoorigin=yes
+
+ * You can now have the settings for a channel updated using the FEATURE()
+   and FEATUREMAP() functions inherited to child channels by setting
+   FEATURE(inherit)=yes.
 
 Logging
 -------------------

Modified: team/kharwell/pimp_my_sip/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/Makefile?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/Makefile (original)
+++ team/kharwell/pimp_my_sip/Makefile Tue Apr  9 16:58:31 2013
@@ -81,6 +81,8 @@
                           # should go directly to ASTLDFLAGS
 
 #--- paths to various commands
+# The makeopts include below tries to set these if they're found during
+# configure.
 export CC
 export CXX
 export AR
@@ -221,10 +223,13 @@
   _ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__
 endif
 
-ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)
-
-ifneq ($(wildcard .version),)
-  ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
+ifneq ($(GREP),)
+  ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) GIT=$(GIT) build_tools/make_version .)
+endif
+ifneq ($(AWK),)
+  ifneq ($(wildcard .version),)
+    ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
+  endif
 endif
 
 ifneq ($(wildcard .svn),)
@@ -450,7 +455,11 @@
 	done
 	$(MAKE) -C sounds install
 
-doc/core-en_US.xml: makeopts cleantest $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+ifneq ($(GREP),)
+  XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+endif
+
+doc/core-en_US.xml: makeopts cleantest $(XML_core_en_US)
 	@printf "Building Documentation For: "
 	@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
 	@echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@@ -464,7 +473,11 @@
 	@echo
 	@echo "</docs>" >> $@
 
-doc/full-en_US.xml: makeopts cleantest $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+ifneq ($(GREP),)
+  XMX_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+endif
+
+doc/full-en_US.xml: makeopts cleantest $(XML_full_en_US)
 ifeq ($(PYTHON),:)
 	@echo "--------------------------------------------------------------------------"
 	@echo "---        Please install python to build full documentation           ---"

Modified: team/kharwell/pimp_my_sip/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/apps/app_stasis.c?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/apps/app_stasis.c (original)
+++ team/kharwell/pimp_my_sip/apps/app_stasis.c Tue Apr  9 16:58:31 2013
@@ -35,6 +35,7 @@
 #include "asterisk/app_stasis.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/channel.h"
+#include "asterisk/lock.h"
 #include "asterisk/module.h"
 #include "asterisk/stasis.h"
 #include "asterisk/strings.h"
@@ -48,7 +49,8 @@
 				<para>Name of the application to invoke.</para>
 			</parameter>
 			<parameter name="args">
-				<para>Optional comma-delimited arguments for the application invocation.</para>
+				<para>Optional comma-delimited arguments for the
+				application invocation.</para>
 			</parameter>
 		</syntax>
 		<description>
@@ -178,7 +180,7 @@
 	 */
 	int continue_to_dialplan:1;
 	/*! Uniqueid of the associated channel */
-	char channel_uniqueid[];
+	char channel_id[];
 };
 
 static struct stasis_app_control *control_create(const char *uniqueid)
@@ -192,9 +194,33 @@
 		return NULL;
 	}
 
-	strncpy(control->channel_uniqueid, uniqueid, size - sizeof(*control));
+	strncpy(control->channel_id, uniqueid, size - sizeof(*control));
 
 	return control;
+}
+
+/*! AO2 hash function for \ref stasis_app_control */
+static int control_hash(const void *obj, const int flags)
+{
+	const struct stasis_app_control *control = obj;
+	const char *id = flags & OBJ_KEY ? obj : control->channel_id;
+
+	return ast_str_hash(id);
+}
+
+/*! AO2 comparison function for \ref stasis_app_control */
+static int control_compare(void *lhs, void *rhs, int flags)
+{
+	const struct stasis_app_control *lhs_control = lhs;
+	const struct stasis_app_control *rhs_control = rhs;
+	const char *rhs_name =
+		flags & OBJ_KEY ? rhs : rhs_control->channel_id;
+
+	if (strcmp(lhs_control->channel_id, rhs_name) == 0) {
+		return CMP_MATCH | CMP_STOP;
+	} else {
+		return 0;
+	}
 }
 
 struct stasis_app_control *stasis_app_control_find_by_channel(
@@ -366,7 +392,8 @@
 	}
 
 	controls = app_controls();
-	ao2_unlink_flags(controls, control, OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
+	ao2_unlink_flags(controls, control,
+			 OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
 	ao2_cleanup(control);
 }
 
@@ -376,7 +403,8 @@
 	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
 	RAII_VAR(struct app *, app, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_app_control *, control, NULL, control_unlink);
-	RAII_VAR(struct stasis_subscription *, subscription, NULL, stasis_unsubscribe);
+	RAII_VAR(struct stasis_subscription *, subscription, NULL,
+		 stasis_unsubscribe);
 	int res = 0;
 	char *parse = NULL;
 	int hungup = 0;
@@ -400,7 +428,8 @@
 
 	app = ao2_find(apps, args.app_name, OBJ_KEY);
 	if (!app) {
-		ast_log(LOG_ERROR, "Stasis app '%s' not registered\n", args.app_name);
+		ast_log(LOG_ERROR,
+			"Stasis app '%s' not registered\n", args.app_name);
 		return -1;
 	}
 
@@ -416,30 +445,35 @@
 		ao2_link(controls, control);
 	}
 
-	subscription = stasis_subscribe(ast_channel_topic(chan), sub_handler, app);
+	subscription =
+		stasis_subscribe(ast_channel_topic(chan), sub_handler, app);
 	if (subscription == NULL) {
-		ast_log(LOG_ERROR, "Error subscribing app %s to channel %s\n", args.app_name, ast_channel_name(chan));
+		ast_log(LOG_ERROR, "Error subscribing app %s to channel %s\n",
+			args.app_name, ast_channel_name(chan));
 		return -1;
 	}
 	ao2_ref(app, +1); /* subscription now has a reference */
 
 	res = send_start_msg(app, chan, args.argc - 1, args.app_argv);
 	if (res != 0) {
-		ast_log(LOG_ERROR, "Error sending start message to %s\n", args.app_name);
+		ast_log(LOG_ERROR,
+			"Error sending start message to %s\n", args.app_name);
 		return res;
 	}
 
 	while (!hungup && !control_continue_test_and_reset(control) && ast_waitfor(chan, -1) > -1) {
 		RAII_VAR(struct ast_frame *, f, ast_read(chan), ast_frame_dtor);
 		if (!f) {
-			ast_debug(3, "%s: No more frames. Must be done, I guess.\n", ast_channel_uniqueid(chan));
+			ast_debug(3, "%s: No more frames. Must be done, I guess.\n",
+				  ast_channel_uniqueid(chan));
 			break;
 		}
 
 		switch (f->frametype) {
 		case AST_FRAME_CONTROL:
 			if (f->subclass.integer == AST_CONTROL_HANGUP) {
-				ast_debug(3, "%s: Received hangup\n", ast_channel_uniqueid(chan));
+				ast_debug(3, "%s: Received hangup\n",
+					  ast_channel_uniqueid(chan));
 				hungup = 1;
 			}
 			break;
@@ -451,7 +485,8 @@
 
 	res = send_end_msg(app, chan);
 	if (res != 0) {
-		ast_log(LOG_ERROR, "Error sending end message to %s\n", args.app_name);
+		ast_log(LOG_ERROR,
+			"Error sending end message to %s\n", args.app_name);
 		return res;
 	}
 
@@ -466,10 +501,11 @@
 	app = ao2_find(apps, app_name, OBJ_KEY);
 
 	if (!app) {
-		/* XXX We can do a better job handling late binding, queueing up the call for a few seconds
-		 * to wait for the app to register.
+		/* XXX We can do a better job handling late binding, queueing up
+		 * the call for a few seconds to wait for the app to register.
 		 */
-		ast_log(LOG_WARNING, "Stasis app '%s' not registered\n", app_name);
+		ast_log(LOG_WARNING,
+			"Stasis app '%s' not registered\n", app_name);
 		return -1;
 	}
 
@@ -523,12 +559,14 @@
 {
 	int r = 0;
 
-	__apps_registry = ao2_container_alloc(APPS_NUM_BUCKETS, app_hash, app_compare);
+	__apps_registry =
+		ao2_container_alloc(APPS_NUM_BUCKETS, app_hash, app_compare);
 	if (__apps_registry == NULL) {
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	__app_controls = ao2_container_alloc(CONTROLS_NUM_BUCKETS, app_hash, app_compare);
+	__app_controls = ao2_container_alloc(CONTROLS_NUM_BUCKETS,
+					     control_hash, control_compare);
 	if (__app_controls == NULL) {
 		return AST_MODULE_LOAD_FAILURE;
 	}
@@ -551,6 +589,7 @@
 	return r;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Stasis dialplan application",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS,
+		"Stasis dialplan application",
 		.load = load_module,
 		.unload = unload_module);

Modified: team/kharwell/pimp_my_sip/build_tools/make_buildopts_h
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/build_tools/make_buildopts_h?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/build_tools/make_buildopts_h (original)
+++ team/kharwell/pimp_my_sip/build_tools/make_buildopts_h Tue Apr  9 16:58:31 2013
@@ -1,4 +1,7 @@
 #!/bin/sh
+
+GREP=${GREP:-grep}
+MD5=${MD5:-md5sum}
 
 cat << END
 /*

Modified: team/kharwell/pimp_my_sip/build_tools/make_linker_version_script
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/build_tools/make_linker_version_script?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/build_tools/make_linker_version_script (original)
+++ team/kharwell/pimp_my_sip/build_tools/make_linker_version_script Tue Apr  9 16:58:31 2013
@@ -1,5 +1,6 @@
 #!/bin/sh
+
+AWK=${AWK:-awk}
 
 test -f ${1}.exports.in && ${AWK} "{sub(\"LINKER_SYMBOL_PREFIX\", \"${2}\"); print;}" ${1}.exports.in > ${1}.exports && exit 0
 test -f ${1}.exports.in || rm -f ${1}.exports && cp ${3}/default.exports ${1}.exports && exit 0
-

Modified: team/kharwell/pimp_my_sip/build_tools/make_version
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/build_tools/make_version?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/build_tools/make_version (original)
+++ team/kharwell/pimp_my_sip/build_tools/make_version Tue Apr  9 16:58:31 2013
@@ -1,4 +1,8 @@
 #!/bin/sh
+
+AWK=${AWK:-awk}
+GIT=${GIT:-git}
+GREP=${GREP:-grep}
 
 if [ -f ${1}/.version ]; then
     cat ${1}/.version
@@ -92,7 +96,7 @@
     # If the first log commit messages indicates that this is checked into
     # subversion, we'll just use the SVN- form of the revision.
     MODIFIED=""
-    SVN_REV=`${GIT} log --pretty=full -1 | grep -F "git-svn-id:" | sed -e "s/.*\@\([^\s]*\)\s.*/\1/g"`
+    SVN_REV=`${GIT} log --pretty=full -1 | ${GREP} -F "git-svn-id:" | sed -e "s/.*\@\([^\s]*\)\s.*/\1/g"`
     if [ -z "$SVN_REV" ]; then
         VERSION=GIT-`${GIT} describe --long --always --tags --dirty=M 2> /dev/null`
         if [ $? -ne 0 ]; then
@@ -105,7 +109,7 @@
         fi
         echo ${VERSION}
     else
-        PARTS=`LANG=C ${GIT} log --pretty=full | grep -F "git-svn-id:" | head -1 | awk '{print $2;}' | sed -e s:^.*/svn/$2/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'`
+        PARTS=`LANG=C ${GIT} log --pretty=full | ${GREP} -F "git-svn-id:" | head -1 | ${AWK} '{print $2;}' | sed -e s:^.*/svn/$2/:: | sed -e 's:/: :g' | sed -e 's/@.*$//g'`
         BRANCH=0
         TEAM=0
         TAG=0

Modified: team/kharwell/pimp_my_sip/build_tools/mkpkgconfig
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/build_tools/mkpkgconfig?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/build_tools/mkpkgconfig (original)
+++ team/kharwell/pimp_my_sip/build_tools/mkpkgconfig Tue Apr  9 16:58:31 2013
@@ -1,5 +1,6 @@
 #!/bin/sh
 PPATH="$1"
+GREP=${GREP:-grep}
 ## Make sure we were called from Makefile
 
 if [ "x$ASTERISKVERSIONNUM" = "x" ]; then

Modified: team/kharwell/pimp_my_sip/configs/extconfig.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/configs/extconfig.conf.sample?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/configs/extconfig.conf.sample (original)
+++ team/kharwell/pimp_my_sip/configs/extconfig.conf.sample Tue Apr  9 16:58:31 2013
@@ -58,13 +58,17 @@
 ; start at 1 and be sequential (i.e. if you have only priorities 1, 2,
 ; and 4, then 4 will be ignored, because there is no 3).
 ;
+;
+; Possible driver backends:
+;
 ; "odbc" is shown in the examples below, but is not the only valid realtime
-; engine.  There is:
+; engine.  Here are several of the possible options:
 ;    odbc ... res_config_odbc
 ;    sqlite ... res_config_sqlite
 ;    pgsql ... res_config_pgsql
 ;    curl ... res_config_curl
 ;    ldap ... res_config_ldap
+;    mysql ... res_config_mysql (available via add-ons in menuselect)
 ;
 ; Note: The res_config_pgsql and res_config_sqlite backends configure the
 ; database used in their respective configuration files and ignore the

Modified: team/kharwell/pimp_my_sip/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/main/features.c?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/main/features.c (original)
+++ team/kharwell/pimp_my_sip/main/features.c Tue Apr  9 16:58:31 2013
@@ -438,6 +438,7 @@
 				<para>The allowed values are:</para>
 				<enumlist>
 					<enum name="parkingtime"><para>Specified in seconds.</para></enum>
+					<enum name="inherit"><para>Inherit feature settings made in FEATURE or FEATUREMAP to child channels.</para></enum>
 				</enumlist>
 			</parameter>
 		</syntax>
@@ -3324,7 +3325,7 @@
 	char exten[FEATURE_MAX_LEN];
 };
 
-struct feature_ds {
+struct feature_datastore {
 	struct ao2_container *feature_map;
 
 	/*!
@@ -3333,14 +3334,34 @@
 	 * \todo XXX This isn't pretty.  At some point it would be nice to have all
 	 * of the global / [general] options in a config object that we store here
 	 * instead of handling each one manually.
+	 *
+	 * \note If anything gets added here, don't forget to update
+	 * feature_ds_duplicate, as well.
 	 * */
 	unsigned int parkingtime;
 	unsigned int parkingtime_is_set:1;
 };
 
+static int feature_exten_hash(const void *obj, int flags)
+{
+	const struct feature_exten *fe = obj;
+	const char *sname = obj;
+
+	return ast_str_hash(flags & OBJ_KEY ? sname : fe->sname);
+}
+
+static int feature_exten_cmp(void *obj, void *arg, int flags)
+{
+	const struct feature_exten *fe = obj, *fe2 = arg;
+	const char *sname = arg;
+
+	return !strcmp(fe->sname, flags & OBJ_KEY ? sname : fe2->sname) ?
+			CMP_MATCH | CMP_STOP : 0;
+}
+
 static void feature_ds_destroy(void *data)
 {
-	struct feature_ds *feature_ds = data;
+	struct feature_datastore *feature_ds = data;
 
 	if (feature_ds->feature_map) {
 		ao2_ref(feature_ds->feature_map, -1);
@@ -3350,27 +3371,31 @@
 	ast_free(feature_ds);
 }
 
+static void *feature_ds_duplicate(void *data)
+{
+	struct feature_datastore *old_ds = data;
+	struct feature_datastore *new_ds;
+
+	if (!(new_ds = ast_calloc(1, sizeof(*new_ds)))) {
+		return NULL;
+	}
+
+	if (old_ds->feature_map) {
+		ao2_ref(old_ds->feature_map, +1);
+		new_ds->feature_map = old_ds->feature_map;
+	}
+
+	new_ds->parkingtime = old_ds->parkingtime;
+	new_ds->parkingtime_is_set = old_ds->parkingtime_is_set;
+
+	return new_ds;
+}
+
 static const struct ast_datastore_info feature_ds_info = {
 	.type = "FEATURE",
 	.destroy = feature_ds_destroy,
+	.duplicate = feature_ds_duplicate,
 };
-
-static int feature_exten_hash(const void *obj, int flags)
-{
-	const struct feature_exten *fe = obj;
-	const char *sname = obj;
-
-	return ast_str_hash(flags & OBJ_KEY ? sname : fe->sname);
-}
-
-static int feature_exten_cmp(void *obj, void *arg, int flags)
-{
-	const struct feature_exten *fe = obj, *fe2 = arg;
-	const char *sname = arg;
-
-	return !strcmp(fe->sname, flags & OBJ_KEY ? sname : fe2->sname) ?
-			CMP_MATCH | CMP_STOP : 0;
-}
 
 /*!
  * \internal
@@ -3380,9 +3405,9 @@
  *
  * \return the data on the FEATURE datastore, or NULL on error
  */
-static struct feature_ds *get_feature_ds(struct ast_channel *chan)
-{
-	struct feature_ds *feature_ds;
+static struct feature_datastore *get_feature_ds(struct ast_channel *chan)
+{
+	struct feature_datastore *feature_ds;
 	struct ast_datastore *ds;
 
 	if ((ds = ast_channel_datastore_find(chan, &feature_ds_info, NULL))) {
@@ -3409,6 +3434,19 @@
 	ast_channel_datastore_add(chan, ds);
 
 	return feature_ds;
+}
+
+static struct ast_datastore *get_feature_chan_ds(struct ast_channel *chan)
+{
+	struct ast_datastore *ds;
+
+	if (!(ds = ast_channel_datastore_find(chan, &feature_ds_info, NULL))) {
+		/* Hasn't been created yet.  Trigger creation. */
+		get_feature_ds(chan);
+		ds = ast_channel_datastore_find(chan, &feature_ds_info, NULL);
+	}
+
+	return ds;
 }
 
 /*!
@@ -3424,7 +3462,7 @@
 		char *buf, size_t len)
 {
 	struct ast_call_feature *feature;
-	struct feature_ds *feature_ds;
+	struct feature_datastore *feature_ds;
 	struct feature_exten *fe = NULL;
 
 	*buf = '\0';
@@ -8921,7 +8959,7 @@
 static unsigned int get_parkingtime(struct ast_channel *chan, struct ast_parkinglot *parkinglot)
 {
 	const char *parkinglot_name;
-	struct feature_ds *feature_ds;
+	struct feature_datastore *feature_ds;
 	unsigned int parkingtime;
 
 	ast_channel_lock(chan);
@@ -8964,6 +9002,16 @@
 
 	if (!strcasecmp(data, "parkingtime")) {
 		snprintf(buf, len, "%u", get_parkingtime(chan, NULL) / 1000);
+	} else if (!strcasecmp(data, "inherit")) {
+		struct ast_datastore *ds;
+		unsigned int inherit;
+
+		ast_channel_lock(chan);
+		ds = get_feature_chan_ds(chan);
+		inherit = ds ? ds->inheritance : 0;
+		ast_channel_unlock(chan);
+
+		snprintf(buf, len, "%s", inherit ? "yes" : "no");
 	} else {
 		ast_log(LOG_WARNING, "Invalid argument '%s' to FEATURE()\n", data);
 		res = -1;
@@ -8976,7 +9024,7 @@
 		const char *value)
 {
 	int res = 0;
-	struct feature_ds *feature_ds;
+	struct feature_datastore *feature_ds;
 
 	ast_channel_lock(chan);
 
@@ -8994,6 +9042,11 @@
 			feature_ds->parkingtime_is_set = 0;
 			res = -1;
 		}
+	} else if (!strcasecmp(data, "inherit")) {
+		struct ast_datastore *ds;
+		if ((ds = get_feature_chan_ds(chan))) {
+			ds->inheritance = ast_true(value) ? DATASTORE_INHERIT_FOREVER : 0;
+		}
 	} else {
 		ast_log(LOG_WARNING, "Invalid argument '%s' to FEATURE()\n", data);
 		res = -1;
@@ -9024,7 +9077,7 @@
 static int featuremap_write(struct ast_channel *chan, const char *cmd, char *data,
 		const char *value)
 {
-	struct feature_ds *feature_ds;
+	struct feature_datastore *feature_ds;
 	struct feature_exten *fe;
 
 	if (!ast_find_call_feature(data)) {

Modified: team/kharwell/pimp_my_sip/res/res_sip/location.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/res/res_sip/location.c?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/res/res_sip/location.c (original)
+++ team/kharwell/pimp_my_sip/res/res_sip/location.c Tue Apr  9 16:58:31 2013
@@ -231,7 +231,7 @@
 /*! \brief Initialize sorcery with location support */
 int ast_sip_initialize_sorcery_location(struct ast_sorcery *sorcery)
 {
-	ast_sorcery_apply_default(sorcery, "contact", "memory", NULL);
+	ast_sorcery_apply_default(sorcery, "contact", "astdb", "registrar");
 	ast_sorcery_apply_default(sorcery, "aor", "config", "res_sip.conf,criteria=type=aor");
 
 	if (ast_sorcery_object_register(sorcery, "contact", contact_alloc, NULL, NULL) ||

Modified: team/kharwell/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/res/res_sip_session.c?view=diff&rev=385161&r1=385160&r2=385161
==============================================================================
--- team/kharwell/pimp_my_sip/res/res_sip_session.c (original)
+++ team/kharwell/pimp_my_sip/res/res_sip_session.c Tue Apr  9 16:58:31 2013
@@ -1739,6 +1739,9 @@
 static int load_module(void)
 {
 	pjsip_endpoint *endpt;
+	if (!ast_sip_get_sorcery() || !ast_sip_get_pjsip_endpoint()) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
 	if (!(nat_hook = ast_sorcery_alloc(ast_sip_get_sorcery(), "nat_hook", NULL))) {
 		return AST_MODULE_LOAD_DECLINE;
 	}




More information about the asterisk-commits mailing list