- control the behaviour introduced by 18410da0
- if set to 0, the behaviour is like before the commit referenced above,
tm is attemptime to send suspended 200ok after another final response
that was forwarded while 200ok was suspended
- default is 1 (behave as the patch changed the forwarding policy, not
to overwrite the response buffer)
... | ... |
@@ -109,6 +109,10 @@ extern int tm_remap_503_500; |
109 | 109 |
/* send path and flags in 3xx class reply */ |
110 | 110 |
int tm_rich_redirect = 0; |
111 | 111 |
|
112 |
+/* control if reply should be relayed |
|
113 |
+ * when transaction reply status is RPS_PUSHED_AFTER_COMPLETION */ |
|
114 |
+extern int tm_reply_relay_mode; |
|
115 |
+ |
|
112 | 116 |
/* how to deal with winning branch reply selection in failure_route |
113 | 117 |
* can be overwritten per transaction with t_drop_replies(...) |
114 | 118 |
* Values: |
... | ... |
@@ -2042,7 +2046,8 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, |
2042 | 2046 |
goto error02; |
2043 | 2047 |
} |
2044 | 2048 |
|
2045 |
- if (reply_status != RPS_PUSHED_AFTER_COMPLETION) { |
|
2049 |
+ if (tm_reply_relay_mode == 0 |
|
2050 |
+ || reply_status != RPS_PUSHED_AFTER_COMPLETION) { |
|
2046 | 2051 |
/* attempt to copy the message to UAS's shmem: |
2047 | 2052 |
* - copy to-tag for ACK matching as well |
2048 | 2053 |
* - allocate little a bit more for provisional as |
... | ... |
@@ -2102,7 +2107,9 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, |
2102 | 2107 |
} |
2103 | 2108 |
if (likely(uas_rb->dst.send_sock)) { |
2104 | 2109 |
if (onsend_route_enabled(SIP_REPLY) && p_msg |
2105 |
- && (p_msg != FAKED_REPLY) && (reply_status != RPS_PUSHED_AFTER_COMPLETION)) { |
|
2110 |
+ && (p_msg != FAKED_REPLY) |
|
2111 |
+ && (tm_reply_relay_mode == 0 |
|
2112 |
+ || reply_status != RPS_PUSHED_AFTER_COMPLETION)) { |
|
2106 | 2113 |
if (run_onsend(p_msg, &uas_rb->dst, buf, res_len)==0){ |
2107 | 2114 |
su2ip_addr(&ip, &(uas_rb->dst.to)); |
2108 | 2115 |
LM_ERR("reply to %s:%d(%d) dropped" |
... | ... |
@@ -2118,7 +2125,9 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, |
2118 | 2125 |
if (SEND_PR_BUFFER( uas_rb, buf, res_len ) >= 0){ |
2119 | 2126 |
LM_DBG("reply buffer sent out\n"); |
2120 | 2127 |
if (unlikely(!totag_retr |
2121 |
- && has_tran_tmcbs(t, TMCB_RESPONSE_OUT) && (reply_status != RPS_PUSHED_AFTER_COMPLETION))){ |
|
2128 |
+ && has_tran_tmcbs(t, TMCB_RESPONSE_OUT) |
|
2129 |
+ && (tm_reply_relay_mode == 0 |
|
2130 |
+ || reply_status != RPS_PUSHED_AFTER_COMPLETION))){ |
|
2122 | 2131 |
LOCK_REPLIES( t ); |
2123 | 2132 |
if(relayed_code==uas_rb->rbtype) { |
2124 | 2133 |
run_trans_callbacks_with_buf( TMCB_RESPONSE_OUT, uas_rb, |
... | ... |
@@ -2130,7 +2139,9 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, |
2130 | 2139 |
} |
2131 | 2140 |
UNLOCK_REPLIES( t ); |
2132 | 2141 |
} |
2133 |
- if (unlikely(has_tran_tmcbs(t, TMCB_RESPONSE_SENT) && (reply_status != RPS_PUSHED_AFTER_COMPLETION))){ |
|
2142 |
+ if (unlikely(has_tran_tmcbs(t, TMCB_RESPONSE_SENT) |
|
2143 |
+ && (tm_reply_relay_mode == 0 |
|
2144 |
+ || reply_status != RPS_PUSHED_AFTER_COMPLETION))){ |
|
2134 | 2145 |
INIT_TMCB_ONSEND_PARAMS(onsend_params, t->uas.request, |
2135 | 2146 |
relayed_msg, uas_rb, &uas_rb->dst, buf, |
2136 | 2147 |
res_len, |
... | ... |
@@ -222,6 +222,10 @@ str on_sl_reply_name = {NULL, 0}; |
222 | 222 |
int tm_remap_503_500 = 1; |
223 | 223 |
str _tm_event_callback_lres_sent = {NULL, 0}; |
224 | 224 |
|
225 |
+/* control if reply should be relayed |
|
226 |
+ * when transaction reply status is RPS_PUSHED_AFTER_COMPLETION */ |
|
227 |
+int tm_reply_relay_mode = 1; |
|
228 |
+ |
|
225 | 229 |
unsigned long tm_exec_time_check = 0; /* microseconds */ |
226 | 230 |
int tm_exec_time_check_param = 5000; /* milliseconds */ |
227 | 231 |
|
... | ... |
@@ -480,6 +484,7 @@ static param_export_t params[]={ |
480 | 484 |
{"rich_redirect" , PARAM_INT, &tm_rich_redirect }, |
481 | 485 |
{"event_callback_lres_sent", PARAM_STR, &_tm_event_callback_lres_sent }, |
482 | 486 |
{"exec_time_check" , PARAM_INT, &tm_exec_time_check_param }, |
487 |
+ {"reply_relay_mode", PARAM_INT, &tm_reply_relay_mode }, |
|
483 | 488 |
{0,0,0} |
484 | 489 |
}; |
485 | 490 |
|