[svn-commits] oej: branch oej/sip-max-forwards-1.4 r295359 - /team/oej/sip-max-forwards-1.4...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Nov 17 07:31:01 CST 2010
Author: oej
Date: Wed Nov 17 07:30:54 2010
New Revision: 295359
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=295359
Log:
Backporting patch to forward ported patch makes me dizzy. Forward port dizzyness.
Modified:
team/oej/sip-max-forwards-1.4/channels/chan_sip.c
Modified: team/oej/sip-max-forwards-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/channels/chan_sip.c?view=diff&rev=295359&r1=295358&r2=295359
==============================================================================
--- team/oej/sip-max-forwards-1.4/channels/chan_sip.c (original)
+++ team/oej/sip-max-forwards-1.4/channels/chan_sip.c Wed Nov 17 07:30:54 2010
@@ -3298,6 +3298,9 @@
} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER_REPLACES")) {
/* We're replacing a call. */
p->options->replaces = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "SIP_MAX_FORWards")) {
+ /* The anti-loop variable setting */
+ p->maxforwards = atoi(ast_var_value(current));
}
}
@@ -6237,25 +6240,9 @@
static int add_header_max_forwards(struct sip_pvt *dialog, struct sip_request *req)
{
char clen[10];
- const char *max = NULL;
-
- /* deadlock avoidance */
- while (dialog->owner && ast_channel_trylock(dialog->owner)) {
- ast_mutex_unlock(&dialog->lock);
- usleep(1);
- ast_mutex_lock(&dialog->lock);
- }
-
- if (dialog->owner) {
- max = pbx_builtin_getvar_helper(dialog->owner, "SIP_MAX_FORWARDS");
- ast_channel_unlock(dialog->owner);
- }
-
- /* The channel variable overrides the peer/channel value */
- if (max == NULL) {
- snprintf(clen, sizeof(clen), "%d", dialog->maxforwards);
- }
- return add_header(req, "Max-Forwards", max != NULL ? max : clen);
+
+ snprintf(clen, sizeof(clen), "%d", dialog->maxforwards);
+ return add_header(req, "Max-Forwards", clen);
}
/*! \brief Add 'Content-Length' header to SIP message */
More information about the svn-commits
mailing list