[asterisk-commits] kmoore: trunk r369190 - /trunk/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 22 10:57:06 CDT 2012


Author: kmoore
Date: Fri Jun 22 10:57:02 2012
New Revision: 369190

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369190
Log:
Add HANGUPCAUSE hash implementation for DAHDI MFC/R2 subtech

This adds a minimal implementation of the "Who Hung Up?" Asterisk 11
work to chan_dahdi.c for the MFC/R2 DAHDI subtech.  Given the way that
OpenR2 interfaces with chan_dahdi, it is much harder to expose the
type of protocol information that is available in PRI, SS7, or other
channel technologies.

Modified:
    trunk/channels/chan_dahdi.c

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=369190&r1=369189&r2=369190
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Fri Jun 22 10:57:02 2012
@@ -4125,6 +4125,10 @@
 static void dahdi_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_disconnect_cause_t cause)
 {
 	struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
+	char cause_str[20];
+	struct ast_control_pvt_cause_code *cause_code;
+	int datalen = sizeof(*cause_code);
+
 	ast_verbose("MFC/R2 call disconnected on channel %d\n", openr2_chan_get_number(r2chan));
 	ast_mutex_lock(&p->lock);
 	if (!p->owner) {
@@ -4133,6 +4137,14 @@
 		dahdi_r2_disconnect_call(p, OR2_CAUSE_NORMAL_CLEARING);
 		return;
 	}
+
+	snprintf(cause_str, sizeof(cause_str), "R2 DISCONNECT (%d)", dahdi_r2_cause_to_ast_cause(cause));
+	datalen += strlen(cause_str);
+	cause_code = alloca(datalen);
+	ast_copy_string(cause_code->chan_name, ast_channel_name(chan), AST_CHANNEL_NAME);
+	ast_copy_string(cause_code->code, cause_str, datalen + 1 - sizeof(*cause_code));
+	ast_queue_control_data(chan, AST_CONTROL_PVT_CAUSE_CODE, cause_code, datalen);
+
 	/* when we have an owner we don't call dahdi_r2_disconnect_call here, that will
 	   be done in dahdi_hangup */
 	if (ast_channel_state(p->owner) == AST_STATE_UP) {




More information about the asterisk-commits mailing list