[asterisk-commits] oej: branch 1.8 r336501 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 19 08:33:52 CDT 2011


Author: oej
Date: Mon Sep 19 08:33:50 2011
New Revision: 336501

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=336501
Log:
Add diversion header to a 302 redirect response if we have diversion data 

(closes issue ASTERISK-18143)
	patch by oej

Modified:
    branches/1.8/channels/chan_sip.c

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=336501&r1=336500&r2=336501
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Mon Sep 19 08:33:50 2011
@@ -1323,6 +1323,7 @@
 /*--- Misc functions */
 static void check_rtp_timeout(struct sip_pvt *dialog, time_t t);
 static int reload_config(enum channelreloadreason reason);
+static void add_diversion_header(struct sip_request *req, struct sip_pvt *pvt);
 static int expire_register(const void *data);
 static void *do_monitor(void *data);
 static int restart_monitor(void);
@@ -10140,6 +10141,11 @@
 	}
 	if (ast_test_flag(&p->flags[0], SIP_OFFER_CC)) {
 		add_cc_call_info_to_response(p, &resp);
+	}
+
+	/* If we are sending a 302 Redirect we can add a diversion header if the redirect information is set */
+	if (!strncmp(msg, "302", 3)) {
+		add_diversion_header(&resp, p);
 	}
 
 	/* If we are cancelling an incoming invite for some reason, add information




More information about the asterisk-commits mailing list