...
|
...
|
@@ -2042,40 +2042,42 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
|
2042
|
2042
|
goto error02;
|
2043
|
2043
|
}
|
2044
|
2044
|
|
2045
|
|
- /* attempt to copy the message to UAS's shmem:
|
2046
|
|
- * - copy to-tag for ACK matching as well
|
2047
|
|
- * - allocate little a bit more for provisional as
|
2048
|
|
- * larger messages are likely to follow and we will be
|
2049
|
|
- * able to reuse the memory frag
|
2050
|
|
- */
|
2051
|
|
- if (res_len<=0) {
|
2052
|
|
- LM_ERR("invalid new buffer len\n");
|
2053
|
|
- goto error03;
|
2054
|
|
- }
|
2055
|
|
- uas_rb->buffer = (char*)shm_resize( uas_rb->buffer, res_len +
|
2056
|
|
- (msg_status<200 ? REPLY_OVERBUFFER_LEN : 0));
|
2057
|
|
- if (!uas_rb->buffer) {
|
2058
|
|
- LM_ERR("cannot alloc reply shmem\n");
|
2059
|
|
- goto error03;
|
2060
|
|
- }
|
2061
|
|
- uas_rb->rbtype = relayed_code;
|
2062
|
|
- uas_rb->buffer_len = res_len;
|
2063
|
|
- memcpy( uas_rb->buffer, buf, res_len );
|
2064
|
|
- if (relayed_msg==FAKED_REPLY) { /* to-tags for local replies */
|
2065
|
|
- update_local_tags(t, &bm, uas_rb->buffer, buf);
|
2066
|
|
- t_stats_rpl_generated();
|
2067
|
|
- }
|
|
2045
|
+ if (reply_status != RPS_PUSHED_AFTER_COMPLETION) {
|
|
2046
|
+ /* attempt to copy the message to UAS's shmem:
|
|
2047
|
+ * - copy to-tag for ACK matching as well
|
|
2048
|
+ * - allocate little a bit more for provisional as
|
|
2049
|
+ * larger messages are likely to follow and we will be
|
|
2050
|
+ * able to reuse the memory frag
|
|
2051
|
+ */
|
|
2052
|
+ if (res_len<=0) {
|
|
2053
|
+ LM_ERR("invalid new buffer len\n");
|
|
2054
|
+ goto error03;
|
|
2055
|
+ }
|
|
2056
|
+ uas_rb->buffer = (char*)shm_resize( uas_rb->buffer, res_len +
|
|
2057
|
+ (msg_status<200 ? REPLY_OVERBUFFER_LEN : 0));
|
|
2058
|
+ if (!uas_rb->buffer) {
|
|
2059
|
+ LM_ERR("cannot alloc reply shmem\n");
|
|
2060
|
+ goto error03;
|
|
2061
|
+ }
|
|
2062
|
+ uas_rb->rbtype = relayed_code;
|
|
2063
|
+ uas_rb->buffer_len = res_len;
|
|
2064
|
+ memcpy( uas_rb->buffer, buf, res_len );
|
|
2065
|
+ if (relayed_msg==FAKED_REPLY) { /* to-tags for local replies */
|
|
2066
|
+ update_local_tags(t, &bm, uas_rb->buffer, buf);
|
|
2067
|
+ t_stats_rpl_generated();
|
|
2068
|
+ }
|
2068
|
2069
|
|
2069
|
|
- /* update the status ... */
|
2070
|
|
- t->uas.status = relayed_code;
|
2071
|
|
- t->relayed_reply_branch = relay;
|
|
2070
|
+ /* update the status ... */
|
|
2071
|
+ t->uas.status = relayed_code;
|
|
2072
|
+ t->relayed_reply_branch = relay;
|
2072
|
2073
|
|
2073
|
|
- if ( unlikely(is_invite(t) && relayed_msg!=FAKED_REPLY
|
2074
|
|
- && relayed_code>=200 && relayed_code < 300
|
2075
|
|
- && has_tran_tmcbs( t,
|
2076
|
|
- TMCB_RESPONSE_OUT|TMCB_RESPONSE_READY
|
2077
|
|
- |TMCB_E2EACK_IN|TMCB_E2EACK_RETR_IN))) {
|
2078
|
|
- totag_retr=update_totag_set(t, relayed_msg);
|
|
2074
|
+ if ( unlikely(is_invite(t) && relayed_msg!=FAKED_REPLY
|
|
2075
|
+ && relayed_code>=200 && relayed_code < 300
|
|
2076
|
+ && has_tran_tmcbs( t,
|
|
2077
|
+ TMCB_RESPONSE_OUT|TMCB_RESPONSE_READY
|
|
2078
|
+ |TMCB_E2EACK_IN|TMCB_E2EACK_RETR_IN))) {
|
|
2079
|
+ totag_retr=update_totag_set(t, relayed_msg);
|
|
2080
|
+ }
|
2079
|
2081
|
}
|
2080
|
2082
|
} /* if relay ... */
|
2081
|
2083
|
|
...
|
...
|
@@ -2100,7 +2102,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
|
2100
|
2102
|
}
|
2101
|
2103
|
if (likely(uas_rb->dst.send_sock)) {
|
2102
|
2104
|
if (onsend_route_enabled(SIP_REPLY) && p_msg
|
2103
|
|
- && (p_msg != FAKED_REPLY)) {
|
|
2105
|
+ && (p_msg != FAKED_REPLY) && (reply_status != RPS_PUSHED_AFTER_COMPLETION)) {
|
2104
|
2106
|
if (run_onsend(p_msg, &uas_rb->dst, buf, res_len)==0){
|
2105
|
2107
|
su2ip_addr(&ip, &(uas_rb->dst.to));
|
2106
|
2108
|
LM_ERR("reply to %s:%d(%d) dropped"
|
...
|
...
|
@@ -2116,7 +2118,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
|
2116
|
2118
|
if (SEND_PR_BUFFER( uas_rb, buf, res_len ) >= 0){
|
2117
|
2119
|
LM_DBG("reply buffer sent out\n");
|
2118
|
2120
|
if (unlikely(!totag_retr
|
2119
|
|
- && has_tran_tmcbs(t, TMCB_RESPONSE_OUT))){
|
|
2121
|
+ && has_tran_tmcbs(t, TMCB_RESPONSE_OUT) && (reply_status != RPS_PUSHED_AFTER_COMPLETION))){
|
2120
|
2122
|
LOCK_REPLIES( t );
|
2121
|
2123
|
if(relayed_code==uas_rb->rbtype) {
|
2122
|
2124
|
run_trans_callbacks_with_buf( TMCB_RESPONSE_OUT, uas_rb,
|
...
|
...
|
@@ -2128,7 +2130,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
|
2128
|
2130
|
}
|
2129
|
2131
|
UNLOCK_REPLIES( t );
|
2130
|
2132
|
}
|
2131
|
|
- if (unlikely(has_tran_tmcbs(t, TMCB_RESPONSE_SENT))){
|
|
2133
|
+ if (unlikely(has_tran_tmcbs(t, TMCB_RESPONSE_SENT) && (reply_status != RPS_PUSHED_AFTER_COMPLETION))){
|
2132
|
2134
|
INIT_TMCB_ONSEND_PARAMS(onsend_params, t->uas.request,
|
2133
|
2135
|
relayed_msg, uas_rb, &uas_rb->dst, buf,
|
2134
|
2136
|
res_len,
|