]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add diversion header to a 302 redirect response if we have diversion data
authorOlle Johansson <oej@edvina.net>
Mon, 19 Sep 2011 13:33:50 +0000 (13:33 +0000)
committerOlle Johansson <oej@edvina.net>
Mon, 19 Sep 2011 13:33:50 +0000 (13:33 +0000)
(closes issue ASTERISK-18143)
patch by oej

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@336501 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 0c110fbbf07f469452e2731c186caf8146c61bd3..066bb19434e69b929574e5d692c6de5d77b8b12c 100644 (file)
@@ -1323,6 +1323,7 @@ static struct sip_auth *find_realm_authentication(struct sip_auth_container *cre
 /*--- 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);
@@ -10142,6 +10143,11 @@ static int __transmit_response(struct sip_pvt *p, const char *msg, const struct
                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
                about the reason why we are doing this in clear text */
        if (p->method == SIP_INVITE && msg[0] != '1') {