[asterisk-commits] kharwell: branch kharwell/pimp_sip_diversion r386394 - /team/kharwell/pimp_si...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 23 16:55:10 CDT 2013


Author: kharwell
Date: Tue Apr 23 16:55:07 2013
New Revision: 386394

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386394
Log:
if the session contains a caller id it now updates the diversion header appropriately

Modified:
    team/kharwell/pimp_sip_diversion/res/res_sip_diversion.c

Modified: team/kharwell/pimp_sip_diversion/res/res_sip_diversion.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_diversion/res/res_sip_diversion.c?view=diff&rev=386394&r1=386393&r2=386394
==============================================================================
--- team/kharwell/pimp_sip_diversion/res/res_sip_diversion.c (original)
+++ team/kharwell/pimp_sip_diversion/res/res_sip_diversion.c Tue Apr 23 16:55:07 2013
@@ -34,8 +34,6 @@
 #include "asterisk/channel.h"
 #include "asterisk/module.h"
 #include "asterisk/strings.h"
-
-#define DIV_HDR_MAX_SIZE 256
 
 static const pj_str_t diversion_name = { "Diversion", 9 };
 
@@ -148,6 +146,20 @@
 	}
 }
 
+static void copy_redirecting_id(struct ast_party_id *dst, const struct ast_party_id *src,
+				struct ast_set_party_id *update)
+{
+	ast_party_id_copy(dst, src);
+
+	if (dst->number.valid) {
+		update->number = 1;
+	}
+
+	if (dst->name.valid) {
+		update->name = 1;
+	}
+}
+
 static void set_redirecting_reason(pjsip_name_addr *uri,
 				   struct ast_party_redirecting_reason *data)
 {
@@ -182,7 +194,7 @@
 
 	/* give priority to the session id */
 	if (session->id.number.valid) {
-		ast_party_id_copy(&data.to, &session->id);
+		copy_redirecting_id(&data.to, &session->id, &update.to);
 	} else {
 		set_redirecting_id(to_uri, &data.to, &update.to);
 	}




More information about the asterisk-commits mailing list