[sr-dev] git:master: tm: support for changing the reply status in the script

Miklos Tirpak miklos at iptel.org
Wed May 26 11:38:43 CEST 2010


Module: sip-router
Branch: master
Commit: 4cca625ce8229c5513451d135c09d9701c80dcd7
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4cca625ce8229c5513451d135c09d9701c80dcd7

Author: Miklos Tirpak <miklos at iptel.org>
Committer: Miklos Tirpak <miklos at iptel.org>
Date:   Wed May 26 11:31:51 2010 +0200

tm: support for changing the reply status in the script

The reply status code is re-read after the onreply_route block
is executed which makes possile to change the status code from the script.
The status code shall be rewritten directly in the message buffer
and in the parsed structure, and the class of provisional and
positive final replies cannot be changed.

---

 modules/tm/t_reply.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 9ad1d0e..2e6fd55 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -2129,6 +2129,17 @@ int reply_received( struct sip_msg  *p_msg )
 			stop_rb_timers(&uac->request);
 	 	}
 #endif /* TM_ONREPLY_FINAL_DROP_OK */
+		/* Re-read the status code, it can be changed in the route block. */
+#ifdef EXTRA_DEBUG
+		/* The class of provisional and positive final replies cannot be changed. */
+		if (((msg_status < 300) || (p_msg->REPLY_STATUS < 300))
+			&& (msg_status/100 != p_msg->REPLY_STATUS/100)
+		) {
+			LOG(L_ERR, "ERROR: The class of provisional and "
+				"positive final replies should not be changed!\n");
+		}
+#endif /* EXTRA_DEBUG */
+		msg_status=p_msg->REPLY_STATUS;
 	}
 #ifdef USE_DST_BLACKLIST
 		/* add temporary to the blacklist the source of a 503 reply */




More information about the sr-dev mailing list