Browse code

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

lucian balanceanu authored on 21/08/2014 07:02:49
Showing 1 changed files
... ...
@@ -856,6 +856,17 @@ static int do_forward_reply(struct sip_msg* msg, int mode)
856 856
 		STATS_RPL_FWD_DROP();
857 857
 		goto error;
858 858
 	}
859
+	/* call onsend_route */
860
+	if(dst.send_sock == NULL) {
861
+		dst.send_sock=get_send_socket(msg, &dst.to, dst.proto);
862
+		if (dst.send_sock==0){
863
+			LOG(L_ERR, "forward_reply: ERROR: cannot forward reply\n");
864
+			goto done;
865
+		}
866
+	}
867
+	run_onsend(msg, &dst, new_buf, new_len);
868
+
869
+	done:
859 870
 #ifdef STATS
860 871
 	STATS_TX_RESPONSE(  (msg->first_line.u.reply.statuscode/100) );
861 872
 #endif