[asterisk-commits] kmoore: trunk r366843 - /trunk/main/channel.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 17 11:30:56 CDT 2012
Author: kmoore
Date: Thu May 17 11:30:50 2012
New Revision: 366843
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=366843
Log:
Make the new SIP_CAUSE backend behave more like the original SIP_CAUSE
There was a slight discrepancy in the behaviors of the old SIP_CAUSE and the
new SIP_CAUSE/HANGUPCAUSE when a channel had been originated and had not yet
been answered. This caused the noload_res_srtp_attempt_srtp test to fail since
the SIP_CAUSE variable was never actually set. This behavior has been restored.
Modified:
trunk/main/channel.c
Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=366843&r1=366842&r2=366843
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu May 17 11:30:50 2012
@@ -4201,6 +4201,21 @@
return 0;
}
+/*! \brief Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash
+ * on the given channel */
+static void set_hangupcause_hash(struct ast_channel *chan, const void *data)
+{
+ char causevar[256];
+ const struct ast_control_pvt_cause_code *cause_code = data;
+
+ snprintf(causevar, sizeof(causevar), "HASH(HANGUPCAUSE,%s)", cause_code->chan_name);
+ ast_func_write(chan, causevar, cause_code->code);
+ if (cause_code->emulate_sip_cause) {
+ snprintf(causevar, sizeof(causevar), "HASH(SIP_CAUSE,%s)", cause_code->chan_name);
+ ast_func_write(chan, causevar, cause_code->code);
+ }
+}
+
int ast_indicate_data(struct ast_channel *chan, int _condition,
const void *data, size_t datalen)
{
@@ -4346,20 +4361,9 @@
ts = ast_get_indication_tone(ast_channel_zone(chan), "congestion");
break;
case AST_CONTROL_PVT_CAUSE_CODE:
- {
- char causevar[256];
- const struct ast_control_pvt_cause_code *cause_code = data;
-
- snprintf(causevar, sizeof(causevar), "HASH(HANGUPCAUSE,%s)", cause_code->chan_name);
- ast_func_write(chan, causevar, cause_code->code);
- if (cause_code->emulate_sip_cause) {
- snprintf(causevar, sizeof(causevar), "HASH(SIP_CAUSE,%s)", cause_code->chan_name);
- ast_func_write(chan, causevar, cause_code->code);
- }
-
+ set_hangupcause_hash(chan, data);
res = 0;
break;
- }
case AST_CONTROL_PROGRESS:
case AST_CONTROL_PROCEEDING:
case AST_CONTROL_VIDUPDATE:
@@ -5506,8 +5510,11 @@
timeout = 0; /* trick to force exit from the while() */
break;
+ case AST_CONTROL_PVT_CAUSE_CODE:
+ set_hangupcause_hash(chan, f->data.ptr);
+ break;
+
/* Ignore these */
- case AST_CONTROL_PVT_CAUSE_CODE:
case AST_CONTROL_PROGRESS:
case AST_CONTROL_PROCEEDING:
case AST_CONTROL_HOLD:
More information about the asterisk-commits
mailing list