[asterisk-commits] mmichelson: branch group/issue8824 r143888 - in /team/group/issue8824: apps/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 22 11:49:56 CDT 2008


Author: mmichelson
Date: Mon Sep 22 11:49:56 2008
New Revision: 143888

URL: http://svn.digium.com/view/asterisk?view=rev&rev=143888
Log:
This set of changes completes the first draft of SIP
redirecting information. I have looked at the SIP debug
and see a proper 181 response being sent to the caller
when a call-forward occurs. I need to work the kinks out
now, and then finish the alternate method of supporting
connected line info.


Modified:
    team/group/issue8824/apps/app_dial.c
    team/group/issue8824/channels/chan_sip.c

Modified: team/group/issue8824/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/apps/app_dial.c?view=diff&rev=143888&r1=143887&r2=143888
==============================================================================
--- team/group/issue8824/apps/app_dial.c (original)
+++ team/group/issue8824/apps/app_dial.c Mon Sep 22 11:49:56 2008
@@ -471,6 +471,7 @@
 	struct ast_channel *original = o->chan;
 	struct ast_channel *c = o->chan; /* the winner */
 	struct ast_channel *in = num->chan; /* the input channel */
+	struct ast_party_redirecting *apr = &o->chan->redirecting;
 	char *stuff;
 	char *tech;
 	int cause;
@@ -515,11 +516,15 @@
 		ast_string_field_set(c, accountcode, in->accountcode);
 		c->cdrflags = in->cdrflags;
 
+		ast_party_redirecting_copy(&o->chan->redirecting, apr);
+
 		S_REPLACE(c->cid.cid_rdnis, ast_strdup(S_OR(in->macroexten, in->exten)));
 		c->cid.cid_tns = in->cid.cid_tns;
 
 		ast_party_caller_copy(&c->cid, &in->cid);
 		ast_party_connected_line_copy(&c->connected, &in->connected);
+
+		ast_redirecting_update(in, apr);
 
 		if (ast_call(c, tmpchan, 0)) {
 			ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);

Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=143888&r1=143887&r2=143888
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Mon Sep 22 11:49:56 2008
@@ -9113,6 +9113,7 @@
  *
  * \param req The request/response to which we will add the header
  * \param pvt The sip_pvt which represents the call-leg
+ * \param apr Redirecting data used to make the diversion header
  */
 static void add_diversion_header(struct sip_request *req, struct sip_pvt *pvt)
 {
@@ -9125,18 +9126,18 @@
 		return;
 	}
 
-	/* XXX Eventually change this to use pvt->owner->redirecting.from.number */
 	diverting_number = pvt->owner->cid.cid_rdnis;
 	diverting_name = pvt->owner->redirecting.from.name;
 	reason = sip_reason_code_to_str(pvt->owner->redirecting.reason);
 
 	if (ast_strlen_zero(diverting_number)) {
+		ast_log(LOG_NOTICE, "No diverting number??\n");
 		return;
 	}
 
 	/* We at least have a number to place in the Diversion header, which is enough */
 	if (ast_strlen_zero(diverting_name)) {
-		snprintf(header_text, sizeof(header_text), "sip:%s@%s;reason=\"%s\"", diverting_number, pvt->fromdomain, reason);
+		snprintf(header_text, sizeof(header_text), "<sip:%s@%s>;reason=\"%s\"", diverting_number, pvt->fromdomain, reason);
 	} else {
 		snprintf(header_text, sizeof(header_text), "\"%s\" <sip:%s@%s>;\"%s\"", diverting_name, diverting_number, pvt->fromdomain, reason);
 	}
@@ -11337,7 +11338,7 @@
 	if (sip_debug_test_pvt(p))
 		ast_verbose("RDNIS for this call is %s (reason %s)\n", exten, reason ? reason_param : "");
 
-	ast_string_field_set(p, rdnis, rexten);
+	/*ast_string_field_set(p, rdnis, rexten);*/
 
 	if (*tmp == '\"') {
 		char *end_quote;
@@ -15343,15 +15344,12 @@
 		return;
 	}
 
-	/* The only item that is not correctly set here at this point is the
-	 * reason from the Diversion
-	 */
 	if (!ast_strlen_zero(redirecting_from_number)) {
-		if (p->owner->cid.cid_rdnis) {
-			ast_free(p->owner->cid.cid_rdnis);
+		if (p->owner->redirecting.from.number) {
+			ast_free(p->owner->redirecting.from.number);
 		}
 		ast_debug(3, "Got redirecting from number %s\n", redirecting_from_number);
-		p->owner->cid.cid_rdnis = redirecting_from_number;
+		p->owner->redirecting.from.number = redirecting_from_number;
 	}
 	if (!ast_strlen_zero(redirecting_from_name)) {
 		if (p->owner->redirecting.from.name) {




More information about the asterisk-commits mailing list