[asterisk-commits] trunk r20931 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Apr 17 07:07:54 MST 2006


Author: oej
Date: Mon Apr 17 09:07:50 2006
New Revision: 20931

URL: http://svn.digium.com/view/asterisk?rev=20931&view=rev
Log:
Change transmit_invite(). SIP Transfers are now broken officially, while
waiting for the rest of the patches... This is the dev branch, after all.

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=20931&r1=20930&r2=20931&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Apr 17 09:07:50 2006
@@ -5209,13 +5209,24 @@
 		add_header(&req, p->options->authheader, p->options->auth);
 	append_date(&req);
 	if (sipmethod == SIP_REFER) {	/* Call transfer */
-		if (!ast_strlen_zero(p->refer_to))
-			add_header(&req, "Refer-To", p->refer_to);
-		if (!ast_strlen_zero(p->referred_by))
-			add_header(&req, "Referred-By", p->referred_by);
-	}
-	if (p->options && !ast_strlen_zero(p->options->distinctive_ring))
-	{
+		if (p->refer) {
+			char buf[BUFSIZ];
+			if (!ast_strlen_zero(p->refer->refer_to))
+				add_header(&req, "Refer-To", p->refer->refer_to);
+			if (!ast_strlen_zero(p->refer->referred_by)) {
+				sprintf(buf, "%s <%s>", p->refer->referred_by_name, p->refer->referred_by);
+				add_header(&req, "Referred-By", buf);
+			}
+		}
+	}
+	/* This new INVITE is part of an attended transfer. Make sure that the
+	other end knows and replace the current call with this new call */
+	if (p->options && p->options->replaces && !ast_strlen_zero(p->options->replaces)) {
+		add_header(&req, "Replaces", p->options->replaces);
+		add_header(&req, "Required", "replaces");
+	}
+
+	if (p->options && !ast_strlen_zero(p->options->distinctive_ring)) {
 		add_header(&req, "Alert-Info", p->options->distinctive_ring);
 	}
 	add_header(&req, "Allow", ALLOWED_METHODS);



More information about the asterisk-commits mailing list