[sr-dev] git:master: core: call onsend_route for replies

Lucian Balaceanu lucian.balaceanu at 1and1.ro
Thu Aug 21 09:08:00 CEST 2014


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

Author: lucian balanceanu <lucian.balanceanu at 1and1.ro>
Committer: lucian balanceanu <lucian.balanceanu at 1and1.ro>
Date:   Thu Aug 21 10:02:49 2014 +0300

core: call onsend_route for replies

- this feature is aimed at tracing replies with sip_trace; e.g.:
  onsend_route { sip_trace("sip:10.84.1.49:5060"); } would now trace the
  requests passing Kamailio, as well as the replies;
  This patch has been proposed earlier: http://lists.sip-router.org/pipermail/sr-users/2012-May/073250.html

---

 forward.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/forward.c b/forward.c
index e4af439..849325f 100644
--- a/forward.c
+++ b/forward.c
@@ -856,6 +856,17 @@ static int do_forward_reply(struct sip_msg* msg, int mode)
 		STATS_RPL_FWD_DROP();
 		goto error;
 	}
+	/* call onsend_route */
+	if(dst.send_sock == NULL) {
+		dst.send_sock=get_send_socket(msg, &dst.to, dst.proto);
+		if (dst.send_sock==0){
+			LOG(L_ERR, "forward_reply: ERROR: cannot forward reply\n");
+			goto done;
+		}
+	}
+	run_onsend(msg, &dst, new_buf, new_len);
+
+	done:
 #ifdef STATS
 	STATS_TX_RESPONSE(  (msg->first_line.u.reply.statuscode/100) );
 #endif




More information about the sr-dev mailing list