[asterisk-commits] oej: branch group/rana-moh-sip-transfer-1.8 r412880 - in /team/group/rana-moh...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 22 03:27:16 CDT 2014


Author: oej
Date: Tue Apr 22 03:27:06 2014
New Revision: 412880

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=412880
Log:
Resetting this lovely branch

Added:
    team/group/rana-moh-sip-transfer-1.8/contrib/scripts/refcounter.py
      - copied unchanged from r412821, branches/1.8/contrib/scripts/refcounter.py
Modified:
    team/group/rana-moh-sip-transfer-1.8/   (props changed)
    team/group/rana-moh-sip-transfer-1.8/CHANGES
    team/group/rana-moh-sip-transfer-1.8/Makefile
    team/group/rana-moh-sip-transfer-1.8/Makefile.rules
    team/group/rana-moh-sip-transfer-1.8/UPGRADE.txt
    team/group/rana-moh-sip-transfer-1.8/apps/app_forkcdr.c
    team/group/rana-moh-sip-transfer-1.8/apps/app_jack.c
    team/group/rana-moh-sip-transfer-1.8/apps/app_queue.c
    team/group/rana-moh-sip-transfer-1.8/apps/app_readexten.c
    team/group/rana-moh-sip-transfer-1.8/apps/app_sms.c
    team/group/rana-moh-sip-transfer-1.8/apps/app_speech_utils.c
    team/group/rana-moh-sip-transfer-1.8/apps/app_stack.c
    team/group/rana-moh-sip-transfer-1.8/build_tools/cflags.xml
    team/group/rana-moh-sip-transfer-1.8/channels/chan_iax2.c
    team/group/rana-moh-sip-transfer-1.8/channels/chan_oss.c
    team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c
    team/group/rana-moh-sip-transfer-1.8/channels/chan_unistim.c
    team/group/rana-moh-sip-transfer-1.8/channels/sip/include/sip.h
    team/group/rana-moh-sip-transfer-1.8/configs/asterisk.conf.sample
    team/group/rana-moh-sip-transfer-1.8/configs/res_fax.conf.sample
    team/group/rana-moh-sip-transfer-1.8/configs/res_odbc.conf.sample
    team/group/rana-moh-sip-transfer-1.8/configs/sip.conf.sample
    team/group/rana-moh-sip-transfer-1.8/configs/voicemail.conf.sample
    team/group/rana-moh-sip-transfer-1.8/configure
    team/group/rana-moh-sip-transfer-1.8/configure.ac
    team/group/rana-moh-sip-transfer-1.8/contrib/scripts/astgenkey
    team/group/rana-moh-sip-transfer-1.8/contrib/scripts/astgenkey.8
    team/group/rana-moh-sip-transfer-1.8/funcs/func_audiohookinherit.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_blacklist.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_callcompletion.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_callerid.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_channel.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_dialplan.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_frame_trace.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_global.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_groupcount.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_math.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_odbc.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_pitchshift.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_speex.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_strings.c
    team/group/rana-moh-sip-transfer-1.8/funcs/func_volume.c
    team/group/rana-moh-sip-transfer-1.8/include/asterisk/astobj2.h
    team/group/rana-moh-sip-transfer-1.8/include/asterisk/autoconfig.h.in
    team/group/rana-moh-sip-transfer-1.8/include/asterisk/options.h
    team/group/rana-moh-sip-transfer-1.8/include/asterisk/res_odbc.h
    team/group/rana-moh-sip-transfer-1.8/include/asterisk/rtp_engine.h
    team/group/rana-moh-sip-transfer-1.8/include/asterisk/utils.h
    team/group/rana-moh-sip-transfer-1.8/main/asterisk.c
    team/group/rana-moh-sip-transfer-1.8/main/astobj2.c
    team/group/rana-moh-sip-transfer-1.8/main/callerid.c
    team/group/rana-moh-sip-transfer-1.8/main/channel.c
    team/group/rana-moh-sip-transfer-1.8/main/config.c
    team/group/rana-moh-sip-transfer-1.8/main/http.c
    team/group/rana-moh-sip-transfer-1.8/main/logger.c
    team/group/rana-moh-sip-transfer-1.8/main/manager.c
    team/group/rana-moh-sip-transfer-1.8/main/pbx.c
    team/group/rana-moh-sip-transfer-1.8/main/rtp_engine.c
    team/group/rana-moh-sip-transfer-1.8/main/say.c
    team/group/rana-moh-sip-transfer-1.8/main/tcptls.c
    team/group/rana-moh-sip-transfer-1.8/main/utils.c
    team/group/rana-moh-sip-transfer-1.8/res/ael/pval.c
    team/group/rana-moh-sip-transfer-1.8/res/res_calendar.c
    team/group/rana-moh-sip-transfer-1.8/res/res_config_odbc.c
    team/group/rana-moh-sip-transfer-1.8/res/res_fax.c
    team/group/rana-moh-sip-transfer-1.8/res/res_jabber.c
    team/group/rana-moh-sip-transfer-1.8/res/res_musiconhold.c
    team/group/rana-moh-sip-transfer-1.8/res/res_mutestream.c
    team/group/rana-moh-sip-transfer-1.8/res/res_odbc.c
    team/group/rana-moh-sip-transfer-1.8/res/res_odbc.exports.in
    team/group/rana-moh-sip-transfer-1.8/sounds/Makefile
    team/group/rana-moh-sip-transfer-1.8/sounds/sounds.xml
    team/group/rana-moh-sip-transfer-1.8/utils/astman.c
    team/group/rana-moh-sip-transfer-1.8/utils/conf2ael.c
    team/group/rana-moh-sip-transfer-1.8/utils/extconf.c

Propchange: team/group/rana-moh-sip-transfer-1.8/
------------------------------------------------------------------------------
    automerge = Is-there-life-off-net?

Propchange: team/group/rana-moh-sip-transfer-1.8/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Apr 22 03:27:06 2014
@@ -1,1 +1,1 @@
-/branches/1.8:1-408594
+/branches/1.8:1-412878

Modified: team/group/rana-moh-sip-transfer-1.8/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/CHANGES?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/CHANGES (original)
+++ team/group/rana-moh-sip-transfer-1.8/CHANGES Tue Apr 22 03:27:06 2014
@@ -7,6 +7,29 @@
 === and the other UPGRADE files for older releases.
 ===
 ======================================================================
+
+------------------------------------------------------------------------------
+--- Functionality changes since Asterisk 1.8.26.1 ----------------------------
+------------------------------------------------------------------------------
+
+chan_sip
+-----------
+ * SIP peers can now specify 'trust_id_outbound' which affects RPID/PAI
+   fields for prohibited callingpres information. Values are legacy, no, and
+   yes. By default, legacy is used.
+   trust_id_outbound=legacy - behavior remains the same as 1.8.26.1. When
+     dealing with prohibited callingpres and sendrpid=pai/rpid, RPID/PAI
+     headers are appended to outbound SIP messages just as they are with
+     allowed callingpres values, but data about the remote party's identity is
+     anonymized.
+     When sendrpid=rpid, only the remote party's domain is anonymized.
+   trust_id_outbound=no - when dealing with prohibited callingpres, RPID/PAI
+     headers are not sent.
+   trust_id_outbound=yes - RPID/PAI headers are applied with the full remote
+     party information in tact even for prohibited callingpres information.
+     In the case of PAI, a Privacy: id header will be appended for prohibited
+     calling information to communicate that the private information should
+     not be relayed to untrusted parties.
 
 ------------------------------------------------------------------------------
 --- Functionality changes since Asterisk 1.8.19.1 ----------------------------

Modified: team/group/rana-moh-sip-transfer-1.8/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/Makefile?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/Makefile (original)
+++ team/group/rana-moh-sip-transfer-1.8/Makefile Tue Apr 22 03:27:06 2014
@@ -95,9 +95,6 @@
   include makeopts
 endif
 
-# we want the MENUSELECT_EMBED var
--include menuselect.makeopts
-
 # start the primary CFLAGS and LDFLAGS with any that were provided
 # to the configure script
 _ASTCFLAGS:=$(CONFIG_CFLAGS)
@@ -330,7 +327,7 @@
 $(SUBDIRS): main/version.c include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
 
 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
-  ifneq ($(MENUSELECT_EMBED),)
+  ifeq ($(shell grep ^MENUSELECT_EMBED=$$ menuselect.makeopts 2>/dev/null),)
     # Non-windows:
     # ensure that all module subdirectories are processed before 'main' during
     # a parallel build, since if there are modules selected to be embedded the

Modified: team/group/rana-moh-sip-transfer-1.8/Makefile.rules
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/Makefile.rules?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/Makefile.rules (original)
+++ team/group/rana-moh-sip-transfer-1.8/Makefile.rules Tue Apr 22 03:27:06 2014
@@ -35,7 +35,7 @@
     CMD_PREFIX=
 endif
 
-OPTIMIZE?=-O6
+OPTIMIZE?=-O3
 ifneq ($(findstring darwin,$(OSARCH)),)
   ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
     # Snow Leopard/Lion has an issue with this optimization flag on large files (like chan_sip)

Modified: team/group/rana-moh-sip-transfer-1.8/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/UPGRADE.txt?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/UPGRADE.txt (original)
+++ team/group/rana-moh-sip-transfer-1.8/UPGRADE.txt Tue Apr 22 03:27:06 2014
@@ -17,11 +17,32 @@
 === UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
 ===
 ===========================================================
+
+from 1.8.27.0 to 1.8.28.0:
+* The asterisk command line -I option and the asterisk.conf internal_timing
+  option are removed and always enabled if any timing module is loaded.
+
 from 1.8.26.0 to 1.8.27.0:
 * res_fax now returns the correct rates for V.27ter (4800 or 9600 bit/s).
   Because of this the default settings would not load, so the minrate (minimum
   transmission rate) option was changed to default to 4800 since that is the
   minimum rate for v.27 which is included in the default modem options.
+
+* When communicating with a peer on an Asterisk 1.4 or earlier system, the
+  chan_iax2 parameter 'connectedline' must be set to "no" in iax.conf. This
+  prevents an incompatible connected line frame from an Astersik 1.8 or later
+  system from causing a hangup in an Asterisk 1.4 or earlier system. Note that
+  this particular incompatibility has always existed between 1.4 and 1.8 and
+  later versions; this upgrade note is simply informing users of its existance.
+
+* A compatibility setting, allow_empty_string_in_nontext, has been added to
+  res_odbc.conf. When enabled (default behavior), empty column values are
+  stored as empty strings during realtime updates. Disabling this option
+  causes empty column values to be stored as NULLs for non-text columns.
+
+  Disable it for PostgreSQL backends in order to avoid errors caused by
+  updating integer columns with an empty string instead of NULL
+  (sipppeers,sipregs)
 
 from 1.8.23.0 to 1.8.24.0:
 * res_agi will now properly indicate if there was an error in streaming an

Modified: team/group/rana-moh-sip-transfer-1.8/apps/app_forkcdr.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/apps/app_forkcdr.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/apps/app_forkcdr.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/apps/app_forkcdr.c Tue Apr 22 03:27:06 2014
@@ -239,13 +239,14 @@
 {
 	int res = 0;
 	char *argcopy = NULL;
+	struct ast_cdr *cdr;
 	struct ast_flags flags = {0};
 	char *opts[OPT_ARG_ARRAY_SIZE];
 	AST_DECLARE_APP_ARGS(arglist,
 		AST_APP_ARG(options);
 	);
 
-	if (!chan->cdr) {
+	if (!(cdr = chan->cdr)) {
 		ast_log(LOG_WARNING, "Channel does not have a CDR\n");
 		return 0;
 	}
@@ -261,7 +262,10 @@
 
 	if (!ast_strlen_zero(data)) {
 		int keepvars = ast_test_flag(&flags, OPT_KEEPVARS) ? 1 : 0;
-		ast_set2_flag(chan->cdr, keepvars, AST_CDR_FLAG_KEEP_VARS);
+		while (cdr->next) {
+			cdr = cdr->next;
+		}
+		ast_set2_flag(cdr, keepvars, AST_CDR_FLAG_KEEP_VARS);
 	}
 	
 	ast_cdr_fork(chan, flags, opts[OPT_ARG_VARSET]);

Modified: team/group/rana-moh-sip-transfer-1.8/apps/app_jack.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/apps/app_jack.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/apps/app_jack.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/apps/app_jack.c Tue Apr 22 03:27:06 2014
@@ -951,6 +951,11 @@
 {
 	int res;
 
+	if (!chan) {
+		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
+		return -1;
+	}
+
 	if (!strcasecmp(value, "on"))
 		res = enable_jack_hook(chan, data);
 	else if (!strcasecmp(value, "off"))

Modified: team/group/rana-moh-sip-transfer-1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/apps/app_queue.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/apps/app_queue.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/apps/app_queue.c Tue Apr 22 03:27:06 2014
@@ -6952,7 +6952,7 @@
 static int mark_member_dead(void *obj, void *arg, int flags)
 {
 	struct member *member = obj;
-	if (!member->dynamic) {
+	if (!member->dynamic && !member->realtime) {
 		member->delme = 1;
 	}
 	return 0;

Modified: team/group/rana-moh-sip-transfer-1.8/apps/app_readexten.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/apps/app_readexten.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/apps/app_readexten.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/apps/app_readexten.c Tue Apr 22 03:27:06 2014
@@ -289,6 +289,11 @@
 		AST_APP_ARG(priority);
 	);
 
+	if (!chan) {
+		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
+		return -1;
+	}
+
 	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (ast_strlen_zero(args.context))

Modified: team/group/rana-moh-sip-transfer-1.8/apps/app_sms.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/apps/app_sms.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/apps/app_sms.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/apps/app_sms.c Tue Apr 22 03:27:06 2014
@@ -216,6 +216,7 @@
 typedef struct sms_s {
 	unsigned char hangup;        /*!< we are done... */
 	unsigned char err;           /*!< set for any errors */
+	unsigned char sent_rel:1;     /*!< have sent REL message... */
 	unsigned char smsc:1;        /*!< we are SMSC */
 	unsigned char rx:1;          /*!< this is a received message */
 	char queue[30];              /*!< queue name */
@@ -1465,6 +1466,7 @@
 		} else {
 			h->omsg[0] = 0x94;              /* SMS_REL */
 			h->omsg[1] = 0;
+			h->sent_rel = 1;
 		}
 	}
 	sms_messagetx(h);
@@ -1802,8 +1804,12 @@
 				h->iphasep -= 80;
 				if (h->ibitn++ == 9) {      /* end of byte */
 					if (!bit) {             /* bad stop bit */
-						ast_log(LOG_NOTICE, "bad stop bit\n");
-						h->ierr = 0xFF;     /* unknown error */
+						if (h->sent_rel) {
+							h->hangup = 1;
+						} else {
+							ast_log(LOG_NOTICE, "Bad stop bit\n");
+							h->ierr = 0xFF;     /* unknown error */
+						}
 					} else {
 						if (h->ibytep < sizeof(h->imsg)) {
 							h->imsg[h->ibytep] = h->ibytev;
@@ -1865,7 +1871,7 @@
 	int res = -1;
 	sms_t h = { 0 };
 	/* argument parsing support */
-	struct ast_flags flags;
+	struct ast_flags flags = { 0 };
 	char *parse, *sms_opts[OPTION_ARG_ARRAY_SIZE] = { 0, };
 	char *p;
 	AST_DECLARE_APP_ARGS(sms_args,

Modified: team/group/rana-moh-sip-transfer-1.8/apps/app_speech_utils.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/apps/app_speech_utils.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/apps/app_speech_utils.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/apps/app_speech_utils.c Tue Apr 22 03:27:06 2014
@@ -284,7 +284,11 @@
 {
 	struct ast_speech *speech = NULL;
 	struct ast_datastore *datastore = NULL;
-	
+
+	if (!chan) {
+		return NULL;
+	}
+
 	datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL);
 	if (datastore == NULL) {
 		return NULL;

Modified: team/group/rana-moh-sip-transfer-1.8/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/apps/app_stack.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/apps/app_stack.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/apps/app_stack.c Tue Apr 22 03:27:06 2014
@@ -569,6 +569,11 @@
 	struct gosub_stack_frame *frame;
 	struct ast_var_t *variables;
 
+	if (!chan) {
+		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
+		return -1;
+	}
+
 	ast_channel_lock(chan);
 	if (!(stack_store = ast_channel_datastore_find(chan, &stack_info, NULL))) {
 		ast_channel_unlock(chan);
@@ -602,6 +607,11 @@
 	struct ast_datastore *stack_store;
 	AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
 	struct gosub_stack_frame *frame;
+
+	if (!chan) {
+		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
+		return -1;
+	}
 
 	ast_channel_lock(chan);
 	if (!(stack_store = ast_channel_datastore_find(chan, &stack_info, NULL))) {
@@ -724,6 +734,7 @@
 		if (!ast_true(args.suppress)) {
 			ast_log(LOG_ERROR, "Stack peek of '%s' is more stack frames than I have\n", args.n);
 		}
+		AST_LIST_UNLOCK(oldlist);
 		ast_channel_unlock(chan);
 		return -1;
 	}

Modified: team/group/rana-moh-sip-transfer-1.8/build_tools/cflags.xml
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/build_tools/cflags.xml?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/build_tools/cflags.xml (original)
+++ team/group/rana-moh-sip-transfer-1.8/build_tools/cflags.xml Tue Apr 22 03:27:06 2014
@@ -4,6 +4,9 @@
 		</member>
 		<member name="DEBUG_THREADS" displayname="Enable Thread Debugging">
 			<support_level>core</support_level>
+		</member>
+		<member name="REF_DEBUG" displayname="Enable reference count debugging">
+			<support_level>extended</support_level>
 		</member>
 		<member name="STATIC_BUILD" displayname="Build static binaries">
 			<support_level>extended</support_level>

Modified: team/group/rana-moh-sip-transfer-1.8/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/channels/chan_iax2.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/channels/chan_iax2.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/channels/chan_iax2.c Tue Apr 22 03:27:06 2014
@@ -9936,9 +9936,16 @@
 
 static int acf_iaxvar_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
-	struct ast_datastore *variablestore = ast_channel_datastore_find(chan, &iax2_variable_datastore_info, NULL);
+	struct ast_datastore *variablestore;
 	AST_LIST_HEAD(, ast_var_t) *varlist;
 	struct ast_var_t *var;
+
+	if (!chan) {
+		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
+		return -1;
+	}
+
+	variablestore = ast_channel_datastore_find(chan, &iax2_variable_datastore_info, NULL);
 
 	if (!variablestore) {
 		*buf = '\0';
@@ -9959,9 +9966,16 @@
 
 static int acf_iaxvar_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
 {
-	struct ast_datastore *variablestore = ast_channel_datastore_find(chan, &iax2_variable_datastore_info, NULL);
+	struct ast_datastore *variablestore;
 	AST_LIST_HEAD(, ast_var_t) *varlist;
 	struct ast_var_t *var;
+
+	if (!chan) {
+		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
+		return -1;
+	}
+
+	variablestore = ast_channel_datastore_find(chan, &iax2_variable_datastore_info, NULL);
 
 	if (!variablestore) {
 		variablestore = ast_datastore_alloc(&iax2_variable_datastore_info, NULL);
@@ -14127,8 +14141,9 @@
 	/* if our channel, return the IP address of the endpoint of current channel */
 	if (!strcmp(peername,"CURRENTCHANNEL")) {
 	        unsigned short callno;
-		if (chan->tech != &iax2_tech)
+		if (!chan || chan->tech != &iax2_tech) {
 			return -1;
+		}
 		callno = PTR_TO_CALLNO(chan->tech_pvt);	
 		ast_copy_string(buf, iaxs[callno]->addr.sin_addr.s_addr ? ast_inet_ntoa(iaxs[callno]->addr.sin_addr) : "", len);
 		return 0;

Modified: team/group/rana-moh-sip-transfer-1.8/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/channels/chan_oss.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/channels/chan_oss.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/channels/chan_oss.c Tue Apr 22 03:27:06 2014
@@ -48,7 +48,7 @@
 
 #ifdef __linux
 #include <linux/soundcard.h>
-#elif defined(__FreeBSD__) || defined(__CYGWIN__)
+#elif defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__GLIBC__) || defined(__sun)
 #include <sys/soundcard.h>
 #else
 #include <soundcard.h>

Modified: team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c?view=diff&rev=412880&r1=412879&r2=412880
==============================================================================
--- team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c (original)
+++ team/group/rana-moh-sip-transfer-1.8/channels/chan_sip.c Tue Apr 22 03:27:06 2014
@@ -218,18 +218,6 @@
 
 #include "asterisk/network.h"
 #include "asterisk/paths.h"	/* need ast_config_AST_SYSTEM_NAME */
-/*
-   Uncomment the define below,  if you are having refcount related memory leaks.
-   With this uncommented, this module will generate a file, /tmp/refs, which contains
-   a history of the ao2_ref() calls. To be useful, all calls to ao2_* functions should
-   be modified to ao2_t_* calls, and include a tag describing what is happening with
-   enough detail, to make pairing up a reference count increment with its corresponding decrement.
-   The refcounter program in utils/ can be invaluable in highlighting objects that are not
-   balanced, along with the complete history for that object.
-   In normal operation, the macros defined will throw away the tags, so they do not
-   affect the speed of the program at all. They can be considered to be documentation.
-*/
-/* #define  REF_DEBUG 1 */
 #include "asterisk/lock.h"
 #include "asterisk/config.h"
 #include "asterisk/module.h"
@@ -4437,8 +4425,20 @@
 	const char *msg = NULL;
 	struct ast_channel *chan;
 	int res = 0;
+	int old_sched_id = pvt->provisional_keepalive_sched_id;
 
 	chan = sip_pvt_lock_full(pvt);
+	/* Check that nothing has changed while we were waiting for the lock */
+	if (old_sched_id != pvt->provisional_keepalive_sched_id) {
+		/* Keepalive has been cancelled or rescheduled, clean up and leave */
+		if (chan) {
+			ast_channel_unlock(chan);
+			chan = ast_channel_unref(chan);
+		}
+		sip_pvt_unlock(pvt);
+		dialog_unref(pvt, "dialog ref for provisional keepalive");
+		return 0;
+	}
 
 	if (!pvt->last_provisional || !strncasecmp(pvt->last_provisional, "100", 3)) {
 		msg = "183 Session Progress";
@@ -4464,20 +4464,9 @@
 
 	sip_pvt_unlock(pvt);
 
-#if 0
-	/*
-	 * XXX BUG TODO
-	 *
-	 * Without this code, it appears as if this function is leaking its
-	 * reference to the sip_pvt.  However, adding it introduces a crash.
-	 * This points to some sort of reference count imbalance elsewhere,
-	 * but I'm not sure where ...
-	 */
 	if (!res) {
 		dialog_unref(pvt, "dialog ref for provisional keepalive");
 	}
-#endif
-
 	return res;
 }
 
@@ -6674,10 +6663,12 @@
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 		ast_clear_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER);	/* Really hang up next time */
 		p->needdestroy = 0;
-		p->owner->tech_pvt = dialog_unref(p->owner->tech_pvt, "unref p->owner->tech_pvt");
-		sip_pvt_lock(p);
-		p->owner = NULL;  /* Owner will be gone after we return, so take it away */
-		sip_pvt_unlock(p);
+		if (p->owner) {
+			p->owner->tech_pvt = dialog_unref(p->owner->tech_pvt, "unref p->owner->tech_pvt");
+			sip_pvt_lock(p);
+			p->owner = NULL;  /* Owner will be gone after we return, so take it away */
+			sip_pvt_unlock(p);
+		}
 		ast_module_unref(ast_module_info->self);
 		return 0;
 	}
@@ -6706,7 +6697,7 @@
 
 	stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */
 
-	append_history(p, needcancel ? "Cancel" : "Hangup", "Cause %s", p->owner ? ast_cause2str(p->hangupcause) : "Unknown");
+	append_history(p, needcancel ? "Cancel" : "Hangup", "Cause %s", ast_cause2str(p->hangupcause));
 
 	/* Disconnect */
 	disable_dsp_detect(p);
@@ -7206,7 +7197,9 @@
 			AST_SCHED_DEL_UNREF(sched, p->t38id, dialog_unref(p, "when you delete the t38id sched, you should dec the refcount for the stored dialog ptr"));
 			parameters.max_ifp = ast_udptl_get_far_max_ifp(p->udptl);
 			parameters.request_response = AST_T38_REQUEST_NEGOTIATE;
-			ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters));
+			if (p->owner) {
+				ast_queue_control_data(p->owner, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters));
+			}
 			/* we need to return a positive value here, so that applications that
 			 * send this request can determine conclusively whether it was accepted or not...
 			 * older versions of chan_sip would just silently accept it and return zero.
@@ -11398,8 +11391,8 @@
 {
 	struct ast_str *tmp = ast_str_alloca(256);
 	char tmp2[256];
-	char *lid_num = NULL;
-	char *lid_name = NULL;
+	char *lid_num;
+	char *lid_name;
 	int lid_pres;
 	const char *fromdomain;
 	const char *privacy = NULL;
@@ -11410,29 +11403,56 @@
 		return 0;
 	}
 
-	if (p->owner && p->owner->connected.id.number.valid
-		&& p->owner->connected.id.number.str) {
-		lid_num = p->owner->connected.id.number.str;
-	}
-	if (p->owner && p->owner->connected.id.name.valid
-		&& p->owner->connected.id.name.str) {
-		lid_name = p->owner->connected.id.name.str;
-	}
-	lid_pres = (p->owner) ? ast_party_id_presentation(&p->owner->connected.id) : AST_PRES_NUMBER_NOT_AVAILABLE;
-
-	if (ast_strlen_zero(lid_num))
+	if (!p->owner) {
 		return 0;
-	if (ast_strlen_zero(lid_name))
+	}
+	lid_num = S_COR(p->owner->connected.id.number.valid,
+		p->owner->connected.id.number.str,
+		NULL);
+	if (!lid_num) {
+		return 0;
+	}
+	lid_name = S_COR(p->owner->connected.id.name.valid,
+		p->owner->connected.id.name.str,
+		NULL);
+	if (!lid_name) {
 		lid_name = lid_num;
-	fromdomain = S_OR(p->fromdomain, ast_sockaddr_stringify_host_remote(&p->ourip));
+	}
+	lid_pres = ast_party_id_presentation(&p->owner->connected.id);
+
+	if (((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED) &&
+			(ast_test_flag(&p->flags[1], SIP_PAGE2_TRUST_ID_OUTBOUND) == SIP_PAGE2_TRUST_ID_OUTBOUND_NO)) {
+		/* If pres is not allowed and we don't trust the peer, we don't apply an RPID header */
+		return 0;
+	}
+
+	fromdomain = p->fromdomain;
+	if (!fromdomain ||
+			((ast_test_flag(&p->flags[1], SIP_PAGE2_TRUST_ID_OUTBOUND) == SIP_PAGE2_TRUST_ID_OUTBOUND_YES) &&
+			!strcmp("anonymous.invalid", fromdomain))) {
+		/* If the fromdomain is NULL or if it was set to anonymous.invalid due to privacy settings and we trust the peer,
+		 * use the host IP address */
+		fromdomain = ast_sockaddr_stringify_host_remote(&p->ourip);
+	}
 
 	lid_num = ast_uri_encode(lid_num, tmp2, sizeof(tmp2), 0);
 
 	if (ast_test_flag(&p->flags[0], SIP_SENDRPID_PAI)) {
-		if ((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED) {
-			ast_str_set(&tmp, -1, "%s", anonymous_string);
+		if (ast_test_flag(&p->flags[1], SIP_PAGE2_TRUST_ID_OUTBOUND) != SIP_PAGE2_TRUST_ID_OUTBOUND_LEGACY) {
+			/* trust_id_outbound = yes - Always give full information even if it's private, but append a privacy header
+			 * When private data is included */
+			ast_str_set(&tmp, -1, "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
+			if ((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED) {
+				add_header(req, "Privacy", "id");
+			}
 		} else {
-			ast_str_set(&tmp, -1, "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
+			/* trust_id_outbound = legacy - behave in a non RFC-3325 compliant manner and send anonymized data when
+			 * when handling private data. */
+			if ((lid_pres & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) {
+				ast_str_set(&tmp, -1, "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
+			} else {
+				ast_str_set(&tmp, -1, "%s", anonymous_string);
+			}
 		}
 		add_header(req, "P-Asserted-Identity", ast_str_buffer(tmp));
 	} else {
@@ -12013,8 +12033,9 @@
 
 		ast_debug(3, "-- Done with adding codecs to SDP\n");
 
-		if (!p->owner || !ast_internal_timing_enabled(p->owner))
+		if (!p->owner || p->owner->timingfd == -1) {
 			ast_str_append(&a_audio, 0, "a=silenceSupp:off - - - -\r\n");
+		}
 
 		if (min_audio_packet_size)
 			ast_str_append(&a_audio, 0, "a=ptime:%d\r\n", min_audio_packet_size);
@@ -12494,7 +12515,9 @@
 
 	snprintf(p->lastmsg, sizeof(p->lastmsg), "Init: %s", sip_methods[sipmethod].text);
 
-	d = S_OR(p->fromdomain, ast_sockaddr_stringify_host_remote(&p->ourip));
+	if (ast_strlen_zero(p->fromdomain)) {
+		d = ast_sockaddr_stringify_host_remote(&p->ourip);
+	}
 	if (p->owner) {
 		if ((ast_party_id_presentation(&p->owner->connected.id) & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) {
 			l = p->owner->connected.id.number.valid ? p->owner->connected.id.number.str : NULL;
@@ -12533,6 +12556,12 @@
 		n = p->fromname;
 	else /* Save for any further attempts */
 		ast_string_field_set(p, fromname, n);
+
+	/* Allow domain to be overridden */
+	if (!ast_strlen_zero(p->fromdomain))
+		d = p->fromdomain;
+	else /* Save for any further attempts */
+		ast_string_field_set(p, fromdomain, d);
 
 	ast_copy_string(tmp_l, l, sizeof(tmp_l));
 	if (sip_cfg.pedanticsipchecking) {
@@ -16417,13 +16446,15 @@
 	}
 
 	/* Determine transfer context */
-	if (transferer->owner)	/* Mimic behaviour in res_features.c */
+	if (transferer->owner) {
+		/* By default, use the context in the channel sending the REFER */
 		transfer_context = pbx_builtin_getvar_helper(transferer->owner, "TRANSFER_CONTEXT");
-
-	/* By default, use the context in the channel sending the REFER */
+		if (ast_strlen_zero(transfer_context)) {
+			transfer_context = transferer->owner->macrocontext;
+		}
+	}
 	if (ast_strlen_zero(transfer_context)) {
-		transfer_context = S_OR(transferer->owner->macrocontext,
-					S_OR(transferer->context, sip_cfg.default_context));
+		transfer_context = S_OR(transferer->context, sip_cfg.default_context);
 	}
 
 	ast_copy_string(referdata->refer_to_context, transfer_context, sizeof(referdata->refer_to_context));
@@ -16477,14 +16508,18 @@
 	if (sip_debug_test_pvt(p))
 		ast_verbose("Looking for %s in %s\n", c, p->context);
 
-	if (p->owner)	/* Mimic behaviour in res_features.c */
+	/* Determine transfer context */
+	if (p->owner) {
+		/* By default, use the context in the channel sending the REFER */
 		transfer_context = pbx_builtin_getvar_helper(p->owner, "TRANSFER_CONTEXT");
-
-	/* By default, use the context in the channel sending the REFER */
+		if (ast_strlen_zero(transfer_context)) {
+			transfer_context = p->owner->macrocontext;
+		}
+	}
 	if (ast_strlen_zero(transfer_context)) {
-		transfer_context = S_OR(p->owner->macrocontext,
-					S_OR(p->context, sip_cfg.default_context));
-	}
+		transfer_context = S_OR(p->context, sip_cfg.default_context);
+	}
+
 	if (ast_exists_extension(NULL, transfer_context, c, 1, NULL)) {
 		/* This is a blind transfer */
 		ast_debug(1, "SIP Bye-also transfer to Extension %s@%s \n", c, transfer_context);
@@ -17700,6 +17735,18 @@
 static const char *allowoverlap2str(int mode)
 {
 	return map_x_s(allowoverlapstr, mode, "<error>");
+}
+
+static const struct _map_x_s trust_id_outboundstr[] = {
+	{ SIP_PAGE2_TRUST_ID_OUTBOUND_LEGACY,  "Legacy" },
+	{ SIP_PAGE2_TRUST_ID_OUTBOUND_NO,      "No" },
+	{ SIP_PAGE2_TRUST_ID_OUTBOUND_YES,     "Yes" },
+	{ -1,                                  NULL }, /* terminator */
+};
+
+static const char *trust_id_outbound2str(int mode)
+{
+	return map_x_s(trust_id_outboundstr, mode, "<error>");
 }
 
 /*! \brief Destroy disused contexts between reloads
@@ -18253,6 +18300,7 @@
 		ast_cli(fd, "  Ign SDP ver  : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_IGNORESDPVERSION)));
 		ast_cli(fd, "  Trust RPID   : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_TRUSTRPID)));
 		ast_cli(fd, "  Send RPID    : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[0], SIP_SENDRPID)));
+		ast_cli(fd, "  TrustIDOutbnd: %s\n", trust_id_outbound2str(ast_test_flag(&peer->flags[1], SIP_PAGE2_TRUST_ID_OUTBOUND)));
 		ast_cli(fd, "  Subscriptions: %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
 		ast_cli(fd, "  Overlap dial : %s\n", allowoverlap2str(ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWOVERLAP)));
 		if (peer->outboundproxy)
@@ -18292,7 +18340,7 @@
 		print_codec_to_cli(fd, &peer->prefs);
 		ast_cli(fd, ")\n");
 
-		ast_cli(fd, "  Auto-Framing :  %s \n", AST_CLI_YESNO(peer->autoframing));
+		ast_cli(fd, "  Auto-Framing : %s\n", AST_CLI_YESNO(peer->autoframing));
 		ast_cli(fd, "  Status       : ");
 		peer_status(peer, status, sizeof(status));
 		ast_cli(fd, "%s\n", status);
@@ -20103,7 +20151,12 @@
 	);
 	int i, number, start = 0;
 
- 	if (ast_strlen_zero(data)) {
+	if (!chan) {
+		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", function);
+		return -1;
+	}
+
+	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "This function requires a header name.\n");
 		return -1;
 	}
@@ -20276,8 +20329,13 @@
 	static int deprecated = 0;
 
 	*buf = 0;
-	
- 	if (!data) {
+
+	if (!chan) {
+		ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
+		return -1;
+	}
+
+	if (!data) {
 		ast_log(LOG_WARNING, "This function requires a parameter name.\n");
 		return -1;
 	}
@@ -20952,9 +21010,11 @@
 					/* This 200 OK's SDP is not acceptable, so we need to ack, then hangup */
 					/* For re-invites, we try to recover */
 					ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
-					p->owner->hangupcause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
 					p->hangupcause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
-					sip_queue_hangup_cause(p, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL);
+					if (p->owner) {
+						p->owner->hangupcause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
+						sip_queue_hangup_cause(p, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL);
+					}
 				}
 			}
 			ast_rtp_instance_activate(p->rtp);
@@ -22460,7 +22520,9 @@
 
 	if (peera && peerb && peerc && (peerb != peerc)) {
 		ast_quiet_chan(peera);		/* Stop generators */
-		ast_quiet_chan(peerb);	
+		/* no need to quiet peerb since it should be hungup after the
+		   transfer and the masquerade needs to be able to see if MOH is
+		   playing on it */
 		ast_quiet_chan(peerc);
 		if (peerd)
 			ast_quiet_chan(peerd);
@@ -23030,6 +23092,145 @@
 	return 0;
 }
 
+/*
+ * \internal \brief Check Session Timers for an INVITE request
+ *
+ * \retval 0 ok
+ * \retval -1 failure
+ */
+static int handle_request_invite_st(struct sip_pvt *p, struct sip_request *req,
+		const char *required, int reinvite)
+{
+	const char *p_uac_se_hdr;       /* UAC's Session-Expires header string                      */
+	const char *p_uac_min_se;       /* UAC's requested Min-SE interval (char string)            */
+	int uac_max_se = -1;            /* UAC's Session-Expires in integer format                  */
+	int uac_min_se = -1;            /* UAC's Min-SE in integer format                           */
+	int st_active = FALSE;          /* Session-Timer on/off boolean                             */
+	int st_interval = 0;            /* Session-Timer negotiated refresh interval                */
+	enum st_refresher tmp_st_ref = SESSION_TIMER_REFRESHER_AUTO; /* Session-Timer refresher     */
+	int dlg_min_se = -1;
+	int dlg_max_se = global_max_se;
+	int rtn;
+
+	/* Session-Timers */
+	if ((p->sipoptions & SIP_OPT_TIMER)) {
+		enum st_refresher_param st_ref_param = SESSION_TIMER_REFRESHER_PARAM_UNKNOWN;
+
+		/* The UAC has requested session-timers for this session. Negotiate
+		the session refresh interval and who will be the refresher */
+		ast_debug(2, "Incoming INVITE with 'timer' option supported\n");
+
+		/* Allocate Session-Timers struct w/in the dialog */
+		if (!p->stimer) {
+			sip_st_alloc(p);
+		}
+
+		/* Parse the Session-Expires header */
+		p_uac_se_hdr = get_header(req, "Session-Expires");
+		if (!ast_strlen_zero(p_uac_se_hdr)) {
+			ast_debug(2, "INVITE also has \"Session-Expires\" header.\n");
+			rtn = parse_session_expires(p_uac_se_hdr, &uac_max_se, &st_ref_param);
+			tmp_st_ref = (st_ref_param == SESSION_TIMER_REFRESHER_PARAM_UAC) ? SESSION_TIMER_REFRESHER_THEM : SESSION_TIMER_REFRESHER_US;
+			if (rtn != 0) {
+				transmit_response_reliable(p, "400 Session-Expires Invalid Syntax", req);
+				return -1;
+			}
+		}
+
+		/* Parse the Min-SE header */
+		p_uac_min_se = get_header(req, "Min-SE");
+		if (!ast_strlen_zero(p_uac_min_se)) {
+			ast_debug(2, "INVITE also has \"Min-SE\" header.\n");
+			rtn = parse_minse(p_uac_min_se, &uac_min_se);
+			if (rtn != 0) {
+				transmit_response_reliable(p, "400 Min-SE Invalid Syntax", req);
+				return -1;
+			}
+		}
+
+		dlg_min_se = st_get_se(p, FALSE);
+		switch (st_get_mode(p, 1)) {
+		case SESSION_TIMER_MODE_ACCEPT:
+		case SESSION_TIMER_MODE_ORIGINATE:
+			if (uac_max_se > 0 && uac_max_se < dlg_min_se) {
+				transmit_response_with_minse(p, "422 Session Interval Too Small", req, dlg_min_se);
+				return -1;
+			}
+
+			p->stimer->st_active_peer_ua = TRUE;
+			st_active = TRUE;
+			if (st_ref_param == SESSION_TIMER_REFRESHER_PARAM_UNKNOWN) {
+				tmp_st_ref = st_get_refresher(p);
+			}
+
+			dlg_max_se = st_get_se(p, TRUE);
+			if (uac_max_se > 0) {
+				if (dlg_max_se >= uac_min_se) {
+					st_interval = (uac_max_se < dlg_max_se) ? uac_max_se : dlg_max_se;
+				} else {
+					st_interval = uac_max_se;
+				}
+			} else if (uac_min_se > 0) {
+				st_interval = MAX(dlg_max_se, uac_min_se);
+			} else {
+				st_interval = dlg_max_se;
+			}
+			break;
+
+		case SESSION_TIMER_MODE_REFUSE:
+			if (p->reqsipoptions & SIP_OPT_TIMER) {
+				transmit_response_with_unsupported(p, "420 Option Disabled", req, required);
+				ast_log(LOG_WARNING, "Received SIP INVITE with supported but disabled option: %s\n", required);
+				return -1;
+			}
+			break;
+
+		default:
+			ast_log(LOG_ERROR, "Internal Error %d at %s:%d\n", st_get_mode(p, 1), __FILE__, __LINE__);
+			break;
+		}
+	} else {
+		/* The UAC did not request session-timers.  Asterisk (UAS), will now decide
+		(based on session-timer-mode in sip.conf) whether to run session-timers for
+		this session or not. */
+		switch (st_get_mode(p, 1)) {
+		case SESSION_TIMER_MODE_ORIGINATE:
+			st_active = TRUE;
+			st_interval = st_get_se(p, TRUE);
+			tmp_st_ref = SESSION_TIMER_REFRESHER_US;

[... 3090 lines stripped ...]



More information about the asterisk-commits mailing list