[asterisk-commits] oej: branch oej/darjeeling-prack-1.8 r402875 - in /team/oej/darjeeling-prack-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 18 07:16:53 CST 2013


Author: oej
Date: Mon Nov 18 07:16:37 2013
New Revision: 402875

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402875
Log:
Resetting

Modified:
    team/oej/darjeeling-prack-1.8/   (props changed)
    team/oej/darjeeling-prack-1.8/Makefile
    team/oej/darjeeling-prack-1.8/UPGRADE.txt
    team/oej/darjeeling-prack-1.8/apps/app_meetme.c
    team/oej/darjeeling-prack-1.8/apps/app_queue.c
    team/oej/darjeeling-prack-1.8/apps/app_voicemail.c
    team/oej/darjeeling-prack-1.8/build_tools/prep_tarball
    team/oej/darjeeling-prack-1.8/cdr/cdr_adaptive_odbc.c
    team/oej/darjeeling-prack-1.8/channels/chan_dahdi.c
    team/oej/darjeeling-prack-1.8/channels/chan_iax2.c
    team/oej/darjeeling-prack-1.8/channels/chan_mgcp.c
    team/oej/darjeeling-prack-1.8/channels/chan_sip.c
    team/oej/darjeeling-prack-1.8/channels/sig_analog.c
    team/oej/darjeeling-prack-1.8/channels/sig_ss7.c
    team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h
    team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c
    team/oej/darjeeling-prack-1.8/codecs/ilbc/doCPLC.c
    team/oej/darjeeling-prack-1.8/configs/chan_dahdi.conf.sample
    team/oej/darjeeling-prack-1.8/configs/sip.conf.sample
    team/oej/darjeeling-prack-1.8/configure
    team/oej/darjeeling-prack-1.8/configure.ac
    team/oej/darjeeling-prack-1.8/funcs/func_config.c
    team/oej/darjeeling-prack-1.8/funcs/func_math.c
    team/oej/darjeeling-prack-1.8/include/asterisk/pbx.h
    team/oej/darjeeling-prack-1.8/include/asterisk/rtp_engine.h
    team/oej/darjeeling-prack-1.8/main/abstract_jb.c
    team/oej/darjeeling-prack-1.8/main/app.c
    team/oej/darjeeling-prack-1.8/main/asterisk.c
    team/oej/darjeeling-prack-1.8/main/astobj2.c
    team/oej/darjeeling-prack-1.8/main/channel.c
    team/oej/darjeeling-prack-1.8/main/data.c
    team/oej/darjeeling-prack-1.8/main/editline/readline.c
    team/oej/darjeeling-prack-1.8/main/editline/term.c
    team/oej/darjeeling-prack-1.8/main/features.c
    team/oej/darjeeling-prack-1.8/main/jitterbuf.c
    team/oej/darjeeling-prack-1.8/main/loader.c
    team/oej/darjeeling-prack-1.8/main/pbx.c
    team/oej/darjeeling-prack-1.8/main/rtp_engine.c
    team/oej/darjeeling-prack-1.8/main/test.c
    team/oej/darjeeling-prack-1.8/main/translate.c
    team/oej/darjeeling-prack-1.8/main/utils.c
    team/oej/darjeeling-prack-1.8/main/xmldoc.c
    team/oej/darjeeling-prack-1.8/makeopts.in
    team/oej/darjeeling-prack-1.8/res/res_jabber.c
    team/oej/darjeeling-prack-1.8/res/res_musiconhold.c
    team/oej/darjeeling-prack-1.8/res/res_rtp_asterisk.c
    team/oej/darjeeling-prack-1.8/res/res_rtp_multicast.c
    team/oej/darjeeling-prack-1.8/sounds/Makefile
    team/oej/darjeeling-prack-1.8/tests/test_dlinklists.c
    team/oej/darjeeling-prack-1.8/tests/test_linkedlists.c
    team/oej/darjeeling-prack-1.8/utils/clicompat.c

Propchange: team/oej/darjeeling-prack-1.8/
------------------------------------------------------------------------------
    automerge = Is-there-life-off-net?

Propchange: team/oej/darjeeling-prack-1.8/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Nov 18 07:16:37 2013
@@ -1,1 +1,1 @@
-/branches/1.8:1-398774
+/branches/1.8:1-402874

Modified: team/oej/darjeeling-prack-1.8/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/Makefile?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/Makefile (original)
+++ team/oej/darjeeling-prack-1.8/Makefile Mon Nov 18 07:16:37 2013
@@ -170,7 +170,7 @@
   _ASTCFLAGS+=-Wall
 endif
 
-_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
+_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_NESTED_FUNCTIONS) $(DEBUG)
 
 ifeq ($(AST_DEVMODE),yes)
   _ASTCFLAGS+=-Werror

Modified: team/oej/darjeeling-prack-1.8/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/UPGRADE.txt?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/UPGRADE.txt (original)
+++ team/oej/darjeeling-prack-1.8/UPGRADE.txt Mon Nov 18 07:16:37 2013
@@ -23,6 +23,10 @@
   the function will be RESULT_FAILURE instead of the prior behavior of always
   returning RESULT_SUCCESS even if there was an error. 
 
+* The option "register_retry_403" has been added to chan_sip to work around
+  servers that are known to erroneously send 403 in response to valid
+  REGISTER requests and allows Asterisk to continue attepmting to connect.
+
 from 1.8.22.0 to 1.8.23.0:
 * The default settings for chan_sip are now overriden properly by the general
   settings in sip.conf.  Please look over your settings upon upgrading.

Modified: team/oej/darjeeling-prack-1.8/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/apps/app_meetme.c?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/apps/app_meetme.c (original)
+++ team/oej/darjeeling-prack-1.8/apps/app_meetme.c Mon Nov 18 07:16:37 2013
@@ -4838,6 +4838,23 @@
 			res = -2;
 			goto usernotfound;
 		}
+	} else {
+		/* fail for commands that require a user */
+		switch (*args.command) {
+		case 'm': /* Unmute */
+		case 'M': /* Mute */
+		case 't': /* Lower user's talk volume */
+		case 'T': /* Raise user's talk volume */
+		case 'u': /* Lower user's listen volume */
+		case 'U': /* Raise user's listen volume */
+		case 'r': /* Reset user's volume level */
+		case 'k': /* Kick user */
+			res = -2;
+			ast_log(LOG_NOTICE, "No user specified!\n");
+			goto usernotfound;
+		default:
+			break;
+		}
 	}
 
 	switch (*args.command) {
@@ -4853,21 +4870,24 @@
 	case 101: /* e: Eject last user*/
 	{
 		int max_no = 0;
-
-		/* If they passed in a user, disregard it */
-		if (user) {
-			ao2_ref(user, -1);
-		}
+		struct ast_conf_user *eject_user;
 
 		ao2_callback(cnf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no);
-		user = ao2_find(cnf->usercontainer, &max_no, 0);
-		if (!ast_test_flag64(&user->userflags, CONFFLAG_ADMIN))
-			user->adminflags |= ADMINFLAG_KICKME;
-		else {
+		eject_user = ao2_find(cnf->usercontainer, &max_no, 0);
+		if (!eject_user) {
+			res = -1;
+			ast_log(LOG_NOTICE, "No last user to kick!\n");
+			break;
+		}
+
+		if (!ast_test_flag64(&eject_user->userflags, CONFFLAG_ADMIN)) {
+			eject_user->adminflags |= ADMINFLAG_KICKME;
+		} else {
 			res = -1;
 			ast_log(LOG_NOTICE, "Not kicking last user, is an Admin!\n");
 		}
-		ao2_ref(user, -1);
+
+		ao2_ref(eject_user, -1);
 		break;
 	}
 	case 77: /* M: Mute */ 

Modified: team/oej/darjeeling-prack-1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/apps/app_queue.c?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/apps/app_queue.c (original)
+++ team/oej/darjeeling-prack-1.8/apps/app_queue.c Mon Nov 18 07:16:37 2013
@@ -1406,7 +1406,7 @@
 	ao2_lock(q);
 	mem_iter = ao2_iterator_init(q->members, 0);
 	for (; (member = ao2_iterator_next(&mem_iter)); ao2_ref(member, -1)) {
-		if ((max_penalty && (member->penalty > max_penalty)) || (min_penalty && (member->penalty < min_penalty))) {
+		if ((max_penalty != INT_MAX && member->penalty > max_penalty) || (min_penalty != INT_MAX && member->penalty < min_penalty)) {
 			if (conditions & QUEUE_EMPTY_PENALTY) {
 				ast_debug(4, "%s is unavailable because his penalty is not between %d and %d\n", member->membername, min_penalty, max_penalty);
 				continue;
@@ -4173,23 +4173,54 @@
 */
 static void update_qe_rule(struct queue_ent *qe)
 {
-	int max_penalty = qe->pr->max_relative ? qe->max_penalty + qe->pr->max_value : qe->pr->max_value;
-	int min_penalty = qe->pr->min_relative ? qe->min_penalty + qe->pr->min_value : qe->pr->min_value;
-	char max_penalty_str[20], min_penalty_str[20]; 
-	/* a relative change to the penalty could put it below 0 */
-	if (max_penalty < 0)
-		max_penalty = 0;
-	if (min_penalty < 0)
-		min_penalty = 0;
-	if (min_penalty > max_penalty)
-		min_penalty = max_penalty;
-	snprintf(max_penalty_str, sizeof(max_penalty_str), "%d", max_penalty);
-	snprintf(min_penalty_str, sizeof(min_penalty_str), "%d", min_penalty);
-	pbx_builtin_setvar_helper(qe->chan, "QUEUE_MAX_PENALTY", max_penalty_str);
-	pbx_builtin_setvar_helper(qe->chan, "QUEUE_MIN_PENALTY", min_penalty_str);
-	qe->max_penalty = max_penalty;
-	qe->min_penalty = min_penalty;
-	ast_debug(3, "Setting max penalty to %d and min penalty to %d for caller %s since %d seconds have elapsed\n", qe->max_penalty, qe->min_penalty, qe->chan->name, qe->pr->time);
+	int max_penalty = INT_MAX;
+
+	if (qe->max_penalty != INT_MAX) {
+		char max_penalty_str[20];
+
+		if (qe->pr->max_relative) {
+			max_penalty = qe->max_penalty + qe->pr->max_value;
+		} else {
+			max_penalty = qe->pr->max_value;
+		}
+
+		/* a relative change to the penalty could put it below 0 */
+		if (max_penalty < 0) {
+			max_penalty = 0;
+		}
+
+		snprintf(max_penalty_str, sizeof(max_penalty_str), "%d", max_penalty);
+		pbx_builtin_setvar_helper(qe->chan, "QUEUE_MAX_PENALTY", max_penalty_str);
+		qe->max_penalty = max_penalty;
+		ast_debug(3, "Setting max penalty to %d for caller %s since %d seconds have elapsed\n",
+			qe->max_penalty, qe->chan->name, qe->pr->time);
+	}
+
+	if (qe->min_penalty != INT_MAX) {
+		char min_penalty_str[20];
+		int min_penalty;
+
+		if (qe->pr->min_relative) {
+			min_penalty = qe->min_penalty + qe->pr->min_value;
+		} else {
+			min_penalty = qe->pr->min_value;
+		}
+
+		if (min_penalty < 0) {
+			min_penalty = 0;
+		}
+
+		if (max_penalty != INT_MAX && min_penalty > max_penalty) {
+			min_penalty = max_penalty;
+		}
+
+		snprintf(min_penalty_str, sizeof(min_penalty_str), "%d", min_penalty);
+		pbx_builtin_setvar_helper(qe->chan, "QUEUE_MIN_PENALTY", min_penalty_str);
+		qe->min_penalty = min_penalty;
+		ast_debug(3, "Setting min penalty to %d for caller %s since %d seconds have elapsed\n",
+			qe->min_penalty, qe->chan->name, qe->pr->time);
+	}
+
 	qe->pr = AST_LIST_NEXT(qe->pr, list);
 }
 
@@ -4334,8 +4365,8 @@
 	unsigned char usepenalty = (membercount <= q->penaltymemberslimit) ? 0 : 1;
 
 	if (usepenalty) {
-		if ((qe->max_penalty && (mem->penalty > qe->max_penalty)) ||
-			(qe->min_penalty && (mem->penalty < qe->min_penalty))) {
+		if ((qe->max_penalty != INT_MAX && mem->penalty > qe->max_penalty) ||
+			(qe->min_penalty != INT_MAX && mem->penalty < qe->min_penalty)) {
 			return -1;
 		}
 	} else {
@@ -6163,10 +6194,10 @@
 		} else {
 			ast_log(LOG_WARNING, "${QUEUE_MAX_PENALTY}: Invalid value (%s), channel %s.\n",
 				max_penalty_str, chan->name);
-			max_penalty = 0;
+			max_penalty = INT_MAX;
 		}
 	} else {
-		max_penalty = 0;
+		max_penalty = INT_MAX;
 	}
 
 	if ((min_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MIN_PENALTY"))) {
@@ -6175,10 +6206,10 @@
 		} else {
 			ast_log(LOG_WARNING, "${QUEUE_MIN_PENALTY}: Invalid value (%s), channel %s.\n",
 				min_penalty_str, chan->name);
-			min_penalty = 0;
+			min_penalty = INT_MAX;
 		}
 	} else {
-		min_penalty = 0;
+		min_penalty = INT_MAX;
 	}
 	ast_channel_unlock(chan);
 
@@ -6352,7 +6383,7 @@
 			}
 		} else if (qe.valid_digits) {
 			ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY",
-				"%s|%d", qe.digits, qe.pos);
+				"%s|%d|%d|%ld", qe.digits, qe.pos, qe.opos, (long) time(NULL) - qe.start);
 		}
 	}
 
@@ -7261,9 +7292,10 @@
 		ao2_lock(q);
 		/* This check is to make sure we don't print information for realtime
 		 * queues which have been deleted from realtime but which have not yet
-		 * been deleted from the in-core container
+		 * been deleted from the in-core container. Only do this if we're not
+		 * looking for a specific queue.
 		 */
-		if (q->realtime) {
+		if (argc < 3 && q->realtime) {
 			realtime_queue = load_realtime_queue(q->name);
 			if (!realtime_queue) {
 				ao2_unlock(q);
@@ -7950,8 +7982,8 @@
 	case CLI_INIT:
 		e->command = "queue add member";
 		e->usage =
-			"Usage: queue add member <channel> to <queue> [[[penalty <penalty>] as <membername>] state_interface <interface>]\n"
-			"       Add a channel to a queue with optionally:  a penalty, membername and a state_interface\n";
+			"Usage: queue add member <dial string> to <queue> [[[penalty <penalty>] as <membername>] state_interface <interface>]\n"
+			"       Add a dial string (Such as a channel,e.g. SIP/6001) to a queue with optionally:  a penalty, membername and a state_interface\n";
 		return NULL;
 	case CLI_GENERATE:
 		return complete_queue_add_member(a->line, a->word, a->pos, a->n);

Modified: team/oej/darjeeling-prack-1.8/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/apps/app_voicemail.c?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/apps/app_voicemail.c (original)
+++ team/oej/darjeeling-prack-1.8/apps/app_voicemail.c Mon Nov 18 07:16:37 2013
@@ -12758,6 +12758,7 @@
 {
 	int i, j, res = AST_TEST_PASS, syserr;
 	struct ast_vm_user *vmu;
+	struct ast_vm_user svm;
 	struct vm_state vms;
 #ifdef IMAP_STORAGE
 	struct ast_channel *chan = NULL;
@@ -12810,7 +12811,7 @@
 	}
 #endif
 
-	if (!(vmu = find_user(NULL, testcontext, testmailbox)) &&
+	if (!(vmu = find_user(&svm, testcontext, testmailbox)) &&
 		!(vmu = find_or_create(testcontext, testmailbox))) {
 		ast_test_status_update(test, "Cannot create vmu structure\n");
 		ast_unreplace_sigchld();

Modified: team/oej/darjeeling-prack-1.8/build_tools/prep_tarball
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/build_tools/prep_tarball?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/build_tools/prep_tarball (original)
+++ team/oej/darjeeling-prack-1.8/build_tools/prep_tarball Mon Nov 18 07:16:37 2013
@@ -19,11 +19,11 @@
 
 cd doc
 echo "Downloading the PDF and HTML documentation from the Asterisk wiki (this will take a minute) ..."
-wget https://wiki.asterisk.org/wiki/download/attachments/19005471/Asterisk-Admin-Guide-$branch.pdf
+wget https://wiki.asterisk.org/wiki/download/attachments/19005471/Asterisk-$branch-Reference.pdf
+wget https://wiki.asterisk.org/wiki/download/attachments/19005471/Asterisk-Admin-Guide.pdf
 wget https://wiki.asterisk.org/wiki/download/attachments/19005471/Asterisk-Admin-Guide-$branch.html.zip
 echo "Extracting HTML Admin Guide"
 unzip Asterisk-Admin-Guide-$branch.html.zip
 mv AST/ Asterisk-Admin-Guide/
-mv Asterisk-Admin-Guide-$branch.pdf Asterisk-Admin-Guide.pdf
 rm -f Asterisk-Admin-Guide-$branch.html.zip
 echo "Documentation downloaded. Goodbye!"

Modified: team/oej/darjeeling-prack-1.8/cdr/cdr_adaptive_odbc.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/cdr/cdr_adaptive_odbc.c?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/cdr/cdr_adaptive_odbc.c (original)
+++ team/oej/darjeeling-prack-1.8/cdr/cdr_adaptive_odbc.c Mon Nov 18 07:16:37 2013
@@ -683,6 +683,11 @@
 					continue;
 				}
 				first = 0;
+			} else if (entry->filtervalue && entry->filtervalue[0] != '\0') {
+				ast_verb(4, "CDR column '%s' was not set and does not match filter of"
+					" '%s'.  Cancelling this CDR.\n",
+					entry->cdrname, entry->filtervalue);
+				goto early_release;
 			}
 		}
 

Modified: team/oej/darjeeling-prack-1.8/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_dahdi.c?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_dahdi.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_dahdi.c Mon Nov 18 07:16:37 2013
@@ -718,9 +718,9 @@
 	struct dahdi_pvt *oprpeer;				/*!< "Operator Services" peer tech_pvt ptr */
 	/*! \brief Amount of gain to increase during caller id */
 	float cid_rxgain;
-	/*! \brief Rx gain set by chan_dahdi.conf */
+	/*! \brief Software Rx gain set by chan_dahdi.conf */
 	float rxgain;
-	/*! \brief Tx gain set by chan_dahdi.conf */
+	/*! \brief Software Tx gain set by chan_dahdi.conf */
 	float txgain;
 
 	float txdrc; /*!< Dynamic Range Compression factor. a number between 1 and 6ish */
@@ -1747,11 +1747,8 @@
 		 * a failure and die, and returning 2 means no event was received. */
 		res = read(p->subs[index].dfd, buf, sizeof(buf));
 		if (res < 0) {
-			if (errno != ELAST) {
-				ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
-				callerid_free(p->cs);
-				return -1;
-			}
+			ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
+			return -1;
 		}
 
 		if (analog_p->ringt > 0) {
@@ -11709,6 +11706,11 @@
 	return NULL;
 }
 
+static void monitor_pfds_clean(void *arg) {
+	struct pollfd **pfds = arg;
+	ast_free(*pfds);
+}
+
 static void *do_monitor(void *data)
 {
 	int count, res, res2, spoint, pollres=0;
@@ -11732,6 +11734,7 @@
 #endif
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
 
+	pthread_cleanup_push(monitor_pfds_clean, &pfds);
 	for (;;) {
 		/* Lock the interface list */
 		ast_mutex_lock(&iflock);
@@ -11988,6 +11991,7 @@
 		ast_mutex_unlock(&iflock);
 	}
 	/* Never reached */
+	pthread_cleanup_pop(1);
 	return NULL;
 
 }
@@ -15690,12 +15694,87 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "dahdi set hwgain";
+		e->command = "dahdi set hwgain {rx|tx}";
 		e->usage =
 			"Usage: dahdi set hwgain <rx|tx> <chan#> <gain>\n"
-			"	Sets the hardware gain on a a given channel, overriding the\n"
-			"   value provided at module loadtime, whether the channel is in\n"
-			"   use or not.  Changes take effect immediately.\n"
+			"   Sets the hardware gain on a given channel.  Changes take effect\n"
+			"   immediately whether the channel is in use or not.\n"
+			"\n"
+			"   <rx|tx> which direction do you want to change (relative to our module)\n"
+			"   <chan num> is the channel number relative to the device\n"
+			"   <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n"
+			"\n"
+			"   Please note:\n"
+			"   * This is currently the only way to set hwgain by the channel driver.\n"
+			"   * hwgain is only supportable by hardware with analog ports because\n"
+			"     hwgain works on the analog side of an analog-digital conversion.\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc != 6)
+		return CLI_SHOWUSAGE;
+
+	if (!strcasecmp("rx", a->argv[3]))
+		tx = 0; /* rx */
+	else if (!strcasecmp("tx", a->argv[3]))
+		tx = 1; /* tx */
+	else
+		return CLI_SHOWUSAGE;
+
+	channel = atoi(a->argv[4]);
+	gain = atof(a->argv[5])*10.0;
+
+	ast_mutex_lock(&iflock);
+
+	for (tmp = iflist; tmp; tmp = tmp->next) {
+
+		if (tmp->channel != channel)
+			continue;
+
+		if (tmp->subs[SUB_REAL].dfd == -1)
+			break;
+
+		hwgain.newgain = gain;
+		hwgain.tx = tx;
+		if (ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_SET_HWGAIN, &hwgain) < 0) {
+			ast_cli(a->fd, "Unable to set the hardware gain for channel %d: %s\n", channel, strerror(errno));
+			ast_mutex_unlock(&iflock);
+			return CLI_FAILURE;
+		}
+		ast_cli(a->fd, "hardware %s gain set to %d (%.1f dB) on channel %d\n",
+			tx ? "tx" : "rx", gain, (float)gain/10.0, channel);
+		break;
+	}
+
+	ast_mutex_unlock(&iflock);
+
+	if (tmp)
+		return CLI_SUCCESS;
+
+	ast_cli(a->fd, "Unable to find given channel %d\n", channel);
+	return CLI_FAILURE;
+
+}
+
+static char *dahdi_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	int channel;
+	float gain;
+	int tx;
+	int res;
+	struct dahdi_pvt *tmp = NULL;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "dahdi set swgain {rx|tx}";
+		e->usage =
+			"Usage: dahdi set swgain <rx|tx> <chan#> <gain>\n"
+			"   Sets the software gain on a given channel and overrides the\n"
+			"   value provided at module loadtime.  Changes take effect\n"
+			"   immediately whether the channel is in use or not.\n"
+			"\n"
 			"   <rx|tx> which direction do you want to change (relative to our module)\n"
 			"   <chan num> is the channel number relative to the device\n"
 			"   <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n";
@@ -15715,75 +15794,6 @@
 		return CLI_SHOWUSAGE;
 
 	channel = atoi(a->argv[4]);
-	gain = atof(a->argv[5])*10.0;
-
-	ast_mutex_lock(&iflock);
-
-	for (tmp = iflist; tmp; tmp = tmp->next) {
-
-		if (tmp->channel != channel)
-			continue;
-
-		if (tmp->subs[SUB_REAL].dfd == -1)
-			break;
-
-		hwgain.newgain = gain;
-		hwgain.tx = tx;
-		if (ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_SET_HWGAIN, &hwgain) < 0) {
-			ast_cli(a->fd, "Unable to set the hardware gain for channel %d: %s\n", channel, strerror(errno));
-			ast_mutex_unlock(&iflock);
-			return CLI_FAILURE;
-		}
-		ast_cli(a->fd, "hardware %s gain set to %d (%.1f dB) on channel %d\n",
-			tx ? "tx" : "rx", gain, (float)gain/10.0, channel);
-		break;
-	}
-
-	ast_mutex_unlock(&iflock);
-
-	if (tmp)
-		return CLI_SUCCESS;
-
-	ast_cli(a->fd, "Unable to find given channel %d\n", channel);
-	return CLI_FAILURE;
-
-}
-
-static char *dahdi_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	int channel;
-	float gain;
-	int tx;
-	int res;
-	struct dahdi_pvt *tmp = NULL;
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "dahdi set swgain";
-		e->usage =
-			"Usage: dahdi set swgain <rx|tx> <chan#> <gain>\n"
-			"	Sets the software gain on a a given channel, overriding the\n"
-			"   value provided at module loadtime, whether the channel is in\n"
-			"   use or not.  Changes take effect immediately.\n"
-			"   <rx|tx> which direction do you want to change (relative to our module)\n"
-			"   <chan num> is the channel number relative to the device\n"
-			"   <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc != 6)
-		return CLI_SHOWUSAGE;
-
-	if (!strcasecmp("rx", a->argv[3]))
-		tx = 0; /* rx */
-	else if (!strcasecmp("tx", a->argv[3]))
-		tx = 1; /* tx */
-	else
-		return CLI_SHOWUSAGE;
-
-	channel = atoi(a->argv[4]);
 	gain = atof(a->argv[5]);
 
 	ast_mutex_lock(&iflock);
@@ -15808,6 +15818,12 @@
 
 		ast_cli(a->fd, "software %s gain set to %.1f on channel %d\n",
 			tx ? "tx" : "rx", gain, channel);
+
+		if (tx) {
+			tmp->txgain = gain;
+		} else {
+			tmp->rxgain = gain;
+		}
 		break;
 	}
 	ast_mutex_unlock(&iflock);
@@ -16722,8 +16738,10 @@
 
 #ifdef HAVE_PRI
 	for (i = 0; i < NUM_SPANS; i++) {
-		if (pris[i].pri.master != AST_PTHREADT_NULL)
+		if (pris[i].pri.master != AST_PTHREADT_NULL) {
 			pthread_cancel(pris[i].pri.master);
+			pthread_kill(pris[i].pri.master, SIGURG);
+		}
 	}
 	ast_cli_unregister_multiple(dahdi_pri_cli, ARRAY_LEN(dahdi_pri_cli));
 	ast_unregister_application(dahdi_send_keypad_facility_app);
@@ -16733,9 +16751,11 @@
 #endif
 #if defined(HAVE_SS7)
 	for (i = 0; i < NUM_SPANS; i++) {
-		if (linksets[i].ss7.master != AST_PTHREADT_NULL)
+		if (linksets[i].ss7.master != AST_PTHREADT_NULL) {
 			pthread_cancel(linksets[i].ss7.master);
-		}
+			pthread_kill(linksets[i].ss7.master, SIGURG);
+		}
+	}
 	ast_cli_unregister_multiple(dahdi_ss7_cli, ARRAY_LEN(dahdi_ss7_cli));
 #endif	/* defined(HAVE_SS7) */
 #if defined(HAVE_OPENR2)
@@ -16776,8 +16796,9 @@
 
 #if defined(HAVE_PRI)
 	for (i = 0; i < NUM_SPANS; i++) {
-		if (pris[i].pri.master && (pris[i].pri.master != AST_PTHREADT_NULL))
+		if (pris[i].pri.master && (pris[i].pri.master != AST_PTHREADT_NULL)) {
 			pthread_join(pris[i].pri.master, NULL);
+		}
 		for (j = 0; j < SIG_PRI_NUM_DCHANS; j++) {
 			dahdi_close_pri_fd(&(pris[i]), j);
 		}
@@ -16792,8 +16813,9 @@
 
 #if defined(HAVE_SS7)
 	for (i = 0; i < NUM_SPANS; i++) {
-		if (linksets[i].ss7.master && (linksets[i].ss7.master != AST_PTHREADT_NULL))
+		if (linksets[i].ss7.master && (linksets[i].ss7.master != AST_PTHREADT_NULL)) {
 			pthread_join(linksets[i].ss7.master, NULL);
+		}
 		for (j = 0; j < SIG_SS7_NUM_DCHANS; j++) {
 			dahdi_close_ss7_fd(&(linksets[i]), j);
 		}

Modified: team/oej/darjeeling-prack-1.8/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_iax2.c?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_iax2.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_iax2.c Mon Nov 18 07:16:37 2013
@@ -5593,31 +5593,42 @@
 			res = AST_BRIDGE_COMPLETE;
 			break;
 		}
-		if ((f->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS) && (f->subclass.integer != AST_CONTROL_SRCUPDATE)) {
-			*fo = f;
-			*rc = who;
-			res =  AST_BRIDGE_COMPLETE;
-			break;
-		}
 		other = (who == c0) ? c1 : c0;  /* the 'other' channel */
-		if ((f->frametype == AST_FRAME_VOICE) ||
-			(f->frametype == AST_FRAME_TEXT) ||
-			(f->frametype == AST_FRAME_VIDEO) || 
-			(f->frametype == AST_FRAME_IMAGE) ||
-			(f->frametype == AST_FRAME_DTMF) ||
-			(f->frametype == AST_FRAME_CONTROL)) {
+		if (f->frametype == AST_FRAME_CONTROL && !(flags & AST_BRIDGE_IGNORE_SIGS)) {
+			switch (f->subclass.integer) {
+			case AST_CONTROL_VIDUPDATE:
+			case AST_CONTROL_SRCUPDATE:
+			case AST_CONTROL_SRCCHANGE:
+			case AST_CONTROL_T38_PARAMETERS:
+				ast_write(other, f);
+				break;
+			default:
+				*fo = f;
+				*rc = who;
+				res = AST_BRIDGE_COMPLETE;
+				break;
+			}
+			if (res == AST_BRIDGE_COMPLETE) {
+				break;
+			}
+		} else if (f->frametype == AST_FRAME_VOICE
+			|| f->frametype == AST_FRAME_TEXT
+			|| f->frametype == AST_FRAME_VIDEO
+			|| f->frametype == AST_FRAME_IMAGE) {
+			ast_write(other, f);
+		} else if (f->frametype == AST_FRAME_DTMF) {
 			/* monitored dtmf take out of the bridge.
 			 * check if we monitor the specific source.
 			 */
 			int monitored_source = (who == c0) ? AST_BRIDGE_DTMF_CHANNEL_0 : AST_BRIDGE_DTMF_CHANNEL_1;
-			if (f->frametype == AST_FRAME_DTMF && (flags & monitored_source)) {
+
+			if (flags & monitored_source) {
 				*rc = who;
 				*fo = f;
 				res = AST_BRIDGE_COMPLETE;
 				/* Remove from native mode */
 				break;
 			}
-			/* everything else goes to the other side */
 			ast_write(other, f);
 		}
 		ast_frfree(f);
@@ -8641,7 +8652,7 @@
 		realtime_update_peer(peer->name, &peer->addr, 0);
 	manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n", peer->name);
 	/* modify entry in peercnts table as _not_ registered */
-	peercnt_modify(0, 0, &peer->addr);
+	peercnt_modify((unsigned char) 0, 0, &peer->addr);
 	/* Reset the address */
 	memset(&peer->addr, 0, sizeof(peer->addr));
 	/* Reset expiry value */
@@ -8761,13 +8772,29 @@
 		}
 	}
 
+	/* treat an unspecified refresh interval as the minimum */
+	if (!refresh) {
+		refresh = min_reg_expire;
+	}
+	if (refresh > max_reg_expire) {
+		ast_log(LOG_NOTICE, "Restricting registration for peer '%s' to %d seconds (requested %d)\n",
+			p->name, max_reg_expire, refresh);
+		p->expiry = max_reg_expire;
+	} else if (refresh < min_reg_expire) {
+		ast_log(LOG_NOTICE, "Restricting registration for peer '%s' to %d seconds (requested %d)\n",
+			p->name, min_reg_expire, refresh);
+		p->expiry = min_reg_expire;
+	} else {
+		p->expiry = refresh;
+	}
+
 	if (ast_sockaddr_cmp(&p->addr, &sockaddr)) {
 		if (iax2_regfunk) {
 			iax2_regfunk(p->name, 1);
 		}
 
 		/* modify entry in peercnts table as _not_ registered */
-		peercnt_modify(0, 0, &p->addr);
+		peercnt_modify((unsigned char) 0, 0, &p->addr);
 
 		/* Stash the IP address from which they registered */
 		ast_sockaddr_from_sin(&p->addr, sin);
@@ -8795,7 +8822,7 @@
 
 	/* modify entry in peercnts table as registered */
 	if (p->maxcallno) {
-		peercnt_modify(1, p->maxcallno, &p->addr);
+		peercnt_modify((unsigned char) 1, p->maxcallno, &p->addr);
 	}
 
 	/* Make sure our call still exists, an INVAL at the right point may make it go away */
@@ -8813,20 +8840,7 @@
 			peer_unref(p);
 		}
 	}
-	/* treat an unspecified refresh interval as the minimum */
-	if (!refresh)
-		refresh = min_reg_expire;
-	if (refresh > max_reg_expire) {
-		ast_log(LOG_NOTICE, "Restricting registration for peer '%s' to %d seconds (requested %d)\n",
-			p->name, max_reg_expire, refresh);
-		p->expiry = max_reg_expire;
-	} else if (refresh < min_reg_expire) {
-		ast_log(LOG_NOTICE, "Restricting registration for peer '%s' to %d seconds (requested %d)\n",
-			p->name, min_reg_expire, refresh);
-		p->expiry = min_reg_expire;
-	} else {
-		p->expiry = refresh;
-	}
+
 	if (p->expiry && sin->sin_addr.s_addr) {
 		p->expire = iax2_sched_add(sched, (p->expiry + 10) * 1000, expire_registry, peer_ref(p));
 		if (p->expire == -1)
@@ -12512,7 +12526,7 @@
 			peer->pokefreqok = DEFAULT_FREQ_OK;
 			peer->pokefreqnotok = DEFAULT_FREQ_NOTOK;
 			peer->maxcallno = 0;
-			peercnt_modify(0, 0, &peer->addr);
+			peercnt_modify((unsigned char) 0, 0, &peer->addr);
 			peer->calltoken_required = CALLTOKEN_DEFAULT;
 			ast_string_field_set(peer,context,"");
 			ast_string_field_set(peer,peercontext,"");
@@ -12697,7 +12711,7 @@
 				if (sscanf(v->value, "%10hu", &peer->maxcallno) != 1) {
 					ast_log(LOG_WARNING, "maxcallnumbers must be set to a valid number. %s is not valid at line %d.\n", v->value, v->lineno);
 				} else {
-					peercnt_modify(1, peer->maxcallno, &peer->addr);
+					peercnt_modify((unsigned char) 1, peer->maxcallno, &peer->addr);
 				}
 			} else if (!strcasecmp(v->name, "requirecalltoken")) {
 				/* default is required unless in optional ip list */

Modified: team/oej/darjeeling-prack-1.8/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_mgcp.c?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_mgcp.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_mgcp.c Mon Nov 18 07:16:37 2013
@@ -1958,7 +1958,7 @@
 	char *c;
 	char *a;
 	char host[258];
-	int len;
+	int len = 0;
 	int portno;
 	format_t peercapability;
 	int peerNonCodecCapability;
@@ -1988,8 +1988,8 @@
 		ast_log(LOG_WARNING, "Unable to lookup host in c= line, '%s'\n", c);
 		return -1;
 	}
-	if (sscanf(m, "audio %30d RTP/AVP %n", &portno, &len) != 1) {
-		ast_log(LOG_WARNING, "Unable to determine port number for RTP in '%s'\n", m);
+	if (sscanf(m, "audio %30d RTP/AVP %n", &portno, &len) != 1 || !len) {
+		ast_log(LOG_WARNING, "Malformed media stream descriptor: %s\n", m);
 		return -1;
 	}
 	sin.sin_family = AF_INET;

Modified: team/oej/darjeeling-prack-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_sip.c?view=diff&rev=402875&r1=402874&r2=402875
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_sip.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_sip.c Mon Nov 18 07:16:37 2013
@@ -714,6 +714,7 @@
 static int global_rtpkeepalive;     /*!< Send RTP keepalives */
 static int global_reg_timeout;      /*!< Global time between attempts for outbound registrations */
 static int global_regattempts_max;  /*!< Registration attempts before giving up */
+static int global_reg_retry_403;    /*!< Treat 403 responses to registrations as 401 responses */
 static int global_shrinkcallerid;   /*!< enable or disable shrinking of caller id  */
 static int global_callcounter;      /*!< Enable call counters for all devices. This is currently enabled by setting the peer
                                      *   call-limit to INT_MAX. When we remove the call-limit from the code, we can make it
@@ -1527,6 +1528,7 @@
 static void build_callid_pvt(struct sip_pvt *pvt);
 static void change_callid_pvt(struct sip_pvt *pvt, const char *callid);
 static void build_callid_registry(struct sip_registry *reg, const struct ast_sockaddr *ourip, const char *fromdomain);
+static void build_localtag_registry(struct sip_registry *reg);
 static void make_our_tag(struct sip_pvt *pvt);
 static int add_header(struct sip_request *req, const char *var, const char *value);
 static int add_header_max_forwards(struct sip_pvt *dialog, struct sip_request *req);
@@ -5805,6 +5807,7 @@
 	dialog->chanvars = copy_vars(peer->chanvars);
 	if (peer->fromdomainport)
 		dialog->fromdomainport = peer->fromdomainport;
+	dialog->callingpres = peer->callingpres;
 
 	return 0;
 }
@@ -6916,6 +6919,7 @@
 {
 	int res = 0;
 	struct sip_pvt *p = ast->tech_pvt;
+	int oldsdp = FALSE;
 
 	if (!p) {
 		ast_debug(1, "Asked to answer channel %s without tech pvt; ignoring\n",
@@ -6932,10 +6936,14 @@
 	if (ast->_state != AST_STATE_UP || ast_test_flag(&p->flags[2], SIP_PAGE3_INVITE_WAIT_FOR_PRACK)) {
 		try_suggested_sip_codec(p);	
 
+		if (ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT)) {
+			oldsdp = TRUE;
+		}
+
 		ast_setstate(ast, AST_STATE_UP);
 		ast_debug(1, "SIP answering channel: %s\n", ast->name);
 		ast_rtp_instance_update_source(p->rtp);
-		res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, FALSE, TRUE);
+		res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, oldsdp, TRUE);
 		ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
 	}
 	sip_pvt_unlock(p);
@@ -8106,6 +8114,12 @@
 	const char *host = S_OR(fromdomain, ast_sockaddr_stringify_host_remote(ourip));
 
 	ast_string_field_build(reg, callid, "%s@%s", generate_random_string(buf, sizeof(buf)), host);
+}
+
+/*! \brief Build SIP From tag value for REGISTER */
+static void build_localtag_registry(struct sip_registry *reg)
+{
+	ast_string_field_build(reg, localtag, "as%08lx", ast_random());
 }
 
 /*! \brief Make our SIP dialog tag */
@@ -12003,7 +12017,7 @@
 		/* Prefer the audio codec we were requested to use, first, no matter what
 		   Note that p->prefcodec can include video codecs, so mask them out
 		*/
-		if (capability & p->prefcodec) {
+		if ((capability & p->prefcodec) & AST_FORMAT_AUDIO_MASK) {
 			format_t codec = p->prefcodec & AST_FORMAT_AUDIO_MASK;
 
 			add_codec_to_sdp(p, codec, &m_audio, &a_audio, debug, &min_audio_packet_size);
@@ -12077,13 +12091,9 @@
 		/* Our T.38 end is */
 		ast_udptl_get_us(p->udptl, &udptladdr);
 
-		/* Determine T.38 UDPTL destination */
-		if (!ast_sockaddr_isnull(&p->udptlredirip)) {
-			ast_sockaddr_copy(&udptldest, &p->udptlredirip);
-		} else {
-			ast_sockaddr_copy(&udptldest, &p->ourip);
-			ast_sockaddr_set_port(&udptldest, ast_sockaddr_port(&udptladdr));
-		}
+		/* We don't use directmedia for T.38, so keep the destination the same as our IP address. */
+		ast_sockaddr_copy(&udptldest, &p->ourip);
+		ast_sockaddr_set_port(&udptldest, ast_sockaddr_port(&udptladdr));
 
 		if (debug) {
 			ast_debug(1, "T.38 UDPTL is at %s port %d\n", ast_sockaddr_stringify_addr(&p->ourip), ast_sockaddr_port(&udptladdr));
@@ -12094,9 +12104,9 @@
 
 		ast_str_append(&m_modem, 0, "m=image %d udptl t38\r\n", ast_sockaddr_port(&udptldest));
 
-		if (!ast_sockaddr_cmp(&udptldest, &dest)) {
+		if (ast_sockaddr_cmp(&udptldest, &dest)) {
 			ast_str_append(&m_modem, 0, "c=IN %s %s\r\n",
-					(ast_sockaddr_is_ipv6(&dest) && !ast_sockaddr_is_ipv4_mapped(&dest)) ?
+					(ast_sockaddr_is_ipv6(&udptldest) && !ast_sockaddr_is_ipv4_mapped(&udptldest)) ?
 					"IP6" : "IP4", ast_sockaddr_stringify_addr_remote(&udptldest));
 		}
 
@@ -12877,7 +12887,6 @@
 		snprintf(buf, sizeof(buf), "%d", p->expiry);
 		add_header(&req, "Expires", buf);
 	} else if (sipmethod == SIP_PRACK) {
-		/* Place holder */
 		/* Add headers for PRACK */
 		char buf[SIPBUFSIZE/2];
 		snprintf(buf, sizeof(buf), "%u %u %s", p->irseq, p->lastinvite, "INVITE");
@@ -13304,6 +13313,7 @@
 	case DIALOG_INFO_XML: /* SNOM subscribes in this format */
 		ast_str_append(tmp, 0, "<?xml version=\"1.0\"?>\n");
 		ast_str_append(tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%u\" state=\"%s\" entity=\"%s\">\n", p->dialogver, full ? "full" : "partial", mto);
+
 		if ((state & AST_EXTENSION_RINGING) && sip_cfg.notifyringing) {
 			/* Twice the extension length should be enough for XML encoding */
 			char local_display[AST_MAX_EXTENSION * 2];
@@ -13329,29 +13339,51 @@
 				struct ast_channel *caller;
 
 				if ((caller = ast_channel_callback(find_calling_channel, NULL, p, 0))) {
+					static char *anonymous = "anonymous";
+					static char *invalid = "anonymous.invalid";
 					char *cid_num;
 					char *connected_num;
 					int need;
+					int cid_num_restricted, connected_num_restricted;
 
 					ast_channel_lock(caller);
+
+					cid_num_restricted = (caller->caller.id.number.presentation &
+								   AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED;
 					cid_num = S_COR(caller->caller.id.number.valid,
-						caller->caller.id.number.str, "");
-					need = strlen(cid_num) + strlen(p->fromdomain) + sizeof("sip:@");
+							S_COR(cid_num_restricted, anonymous,
+							      caller->caller.id.number.str), "");
+
+					need = strlen(cid_num) + (cid_num_restricted ? strlen(invalid) :
+								  strlen(p->fromdomain)) + sizeof("sip:@");
+
 					remote_target = ast_alloca(need);
-					snprintf(remote_target, need, "sip:%s@%s", cid_num, p->fromdomain);
+					snprintf(remote_target, need, "sip:%s@%s", cid_num,
+						 cid_num_restricted ? invalid : p->fromdomain);
 
 					ast_xml_escape(S_COR(caller->caller.id.name.valid,
-							     caller->caller.id.name.str, ""),
+							     S_COR((caller->caller.id.name.presentation &
+								     AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED, anonymous,
+								   caller->caller.id.name.str), ""),
 						       remote_display, sizeof(remote_display));
 
+					connected_num_restricted = (caller->connected.id.number.presentation &
+								    AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED;
 					connected_num = S_COR(caller->connected.id.number.valid,
-						caller->connected.id.number.str, "");
-					need = strlen(connected_num) + strlen(p->fromdomain) + sizeof("sip:@");
+							      S_COR(connected_num_restricted, anonymous,
+								    caller->connected.id.number.str), "");
+
+					need = strlen(connected_num) + (connected_num_restricted ? strlen(invalid) :
+									strlen(p->fromdomain)) + sizeof("sip:@");
 					local_target = ast_alloca(need);
-					snprintf(local_target, need, "sip:%s@%s", connected_num, p->fromdomain);
+
+					snprintf(local_target, need, "sip:%s@%s", connected_num,
+						 connected_num_restricted ? invalid : p->fromdomain);
 
 					ast_xml_escape(S_COR(caller->connected.id.name.valid,
-							     caller->connected.id.name.str, ""),
+							     S_COR((caller->connected.id.name.presentation &
+								     AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED, anonymous,
+								    caller->connected.id.name.str), ""),
 						       local_display, sizeof(local_display));
 
 					ast_channel_unlock(caller);
@@ -13940,13 +13972,13 @@
 			return 0;
 		} else {
 			p = dialog_ref(r->call, "getting a copy of the r->call dialog in transmit_register");
-			make_our_tag(p);	/* create a new local tag for every register attempt */
 			ast_string_field_set(p, theirtag, NULL);	/* forget their old tag, so we don't match tags when getting response */
 		}
 	} else {
 		/* Build callid for registration if we haven't registered before */
 		if (!r->callid_valid) {
 			build_callid_registry(r, &internip, default_fromdomain);
+			build_localtag_registry(r);
 			r->callid_valid = TRUE;
 		}
 		/* Allocate SIP dialog for registration */
@@ -13954,6 +13986,9 @@

[... 1722 lines stripped ...]



More information about the asterisk-commits mailing list