Module: kamailio
Branch: master
Commit: 4b2d6dd7ce1a61c964f7d996c2db4428010dd478
URL:
https://github.com/kamailio/kamailio/commit/4b2d6dd7ce1a61c964f7d996c2db442…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-09-07T16:35:10+02:00
tm: enable drop in onsend_route for tm replies
- skip sending out the reply by resetting the send_socket
---
Modified: modules/tm/t_reply.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4b2d6dd7ce1a61c964f7d996c2db442…
Patch:
https://github.com/kamailio/kamailio/commit/4b2d6dd7ce1a61c964f7d996c2db442…
---
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 213e8a6..8240ced 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -1922,16 +1922,19 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int
branch,
start_final_repl_retr(t);
}
if (likely(uas_rb->dst.send_sock)) {
-
if (onsend_route_enabled(SIP_REPLY) && p_msg && (p_msg !=
FAKED_REPLY)) {
if (run_onsend(p_msg, &uas_rb->dst, buf, res_len)==0){
su2ip_addr(&ip, &(uas_rb->dst.to));
LOG(L_ERR, "forward_reply: reply to %s:%d(%d) dropped"
" (onsend_route)\n", ip_addr2a(&ip),
su_getport(&(uas_rb->dst.to)), uas_rb->dst.proto);
+ /* workaround for drop - reset send_sock to skip sending out */
+ uas_rb->dst.send_sock = 0;
}
}
+ }
+ if (likely(uas_rb->dst.send_sock)) {
if (SEND_PR_BUFFER( uas_rb, buf, res_len ) >= 0){
if (unlikely(!totag_retr && has_tran_tmcbs(t, TMCB_RESPONSE_OUT))){
LOCK_REPLIES( t );
@@ -1950,8 +1953,9 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int
branch,
UNLOCK_REPLIES( t );
}
}
- } else if (unlikely(uas_rb->dst.send_sock == 0))
- ERR("no resolved dst to send reply to\n");
+ } else {
+ LM_NOTICE("dst no longer set - skiped sending the reply out\n");
+ }
/* Call put_on_wait() only if we really send out
* the reply. It can happen that the reply has been already sent from
* failure_route or from a callback and the timer has been already