|
@@ -564,9 +564,7 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
|
|
|
struct retr_buf *rb;
|
|
|
unsigned int buf_len;
|
|
|
struct cancel_info cancel_data;
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
struct tmcb_params onsend_params;
|
|
|
-#endif
|
|
|
|
|
|
init_cancel_info(&cancel_data);
|
|
|
if (!buf)
|
|
@@ -619,7 +617,7 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
|
|
|
0, FAKED_REPLY, code);
|
|
|
} else {
|
|
|
if(unlikely(has_tran_tmcbs(trans, TMCB_RESPONSE_READY))) {
|
|
|
- run_trans_callbacks(TMCB_RESPONSE_READY, trans,
|
|
|
+ run_trans_callbacks_with_buf(TMCB_RESPONSE_READY, rb,
|
|
|
trans->uas.request, FAKED_REPLY, code);
|
|
|
}
|
|
|
}
|
|
@@ -634,6 +632,12 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
|
|
|
start_final_repl_retr( trans );
|
|
|
}
|
|
|
|
|
|
+ if (code==100) {
|
|
|
+ if(unlikely(has_tran_tmcbs(trans, TMCB_REQUEST_PENDING)))
|
|
|
+ run_trans_callbacks_with_buf(TMCB_REQUEST_PENDING, rb,
|
|
|
+ trans->uas.request, FAKED_REPLY, code);
|
|
|
+ }
|
|
|
+
|
|
|
/* send it out */
|
|
|
/* first check if we managed to resolve topmost Via -- if
|
|
|
not yet, don't try to retransmit
|
|
@@ -650,18 +654,20 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
|
|
|
} else {
|
|
|
if (likely(SEND_PR_BUFFER( rb, buf, len )>=0)){
|
|
|
if (unlikely(code>=200 && !is_local(trans) &&
|
|
|
- has_tran_tmcbs(trans, TMCB_RESPONSE_OUT)) )
|
|
|
- run_trans_callbacks(TMCB_RESPONSE_OUT, trans,
|
|
|
- trans->uas.request, FAKED_REPLY, code);
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
+ has_tran_tmcbs(trans, TMCB_RESPONSE_OUT)) ){
|
|
|
+ INIT_TMCB_ONSEND_PARAMS(onsend_params, trans->uas.request,
|
|
|
+ FAKED_REPLY, rb, &rb->dst,
|
|
|
+ buf, len, TMCB_LOCAL_F, rb->branch, code);
|
|
|
+ run_trans_callbacks_off_params(TMCB_RESPONSE_OUT, trans,
|
|
|
+ &onsend_params);
|
|
|
+ }
|
|
|
if (unlikely(has_tran_tmcbs(trans, TMCB_RESPONSE_SENT))){
|
|
|
INIT_TMCB_ONSEND_PARAMS(onsend_params, trans->uas.request,
|
|
|
FAKED_REPLY, rb, &rb->dst,
|
|
|
buf, len, TMCB_LOCAL_F, rb->branch, code);
|
|
|
- run_onsend_callbacks2(TMCB_RESPONSE_SENT, trans,
|
|
|
- &onsend_params);
|
|
|
+ run_trans_callbacks_off_params(TMCB_RESPONSE_SENT, trans,
|
|
|
+ &onsend_params);
|
|
|
}
|
|
|
-#endif /* TMCB_ONSEND */
|
|
|
}
|
|
|
DBG("DEBUG: reply sent out. buf=%p: %.20s..., shmem=%p: %.20s\n",
|
|
|
buf, buf, rb->buffer, rb->buffer );
|
|
@@ -1457,14 +1463,12 @@ int t_retransmit_reply( struct cell *t )
|
|
|
memcpy( b, t->uas.response.buffer, len );
|
|
|
UNLOCK_REPLIES( t );
|
|
|
SEND_PR_BUFFER( & t->uas.response, b, len );
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
if (unlikely(has_tran_tmcbs(t, TMCB_RESPONSE_SENT))){
|
|
|
/* we don't know if it's a retransmission of a local reply or a
|
|
|
* forwarded reply */
|
|
|
- run_onsend_callbacks(TMCB_RESPONSE_SENT, &t->uas.response, 0, 0,
|
|
|
- TMCB_RETR_F);
|
|
|
+ run_trans_callbacks_with_buf(TMCB_RESPONSE_SENT, &t->uas.response, 0, 0,
|
|
|
+ TMCB_RETR_F);
|
|
|
}
|
|
|
-#endif
|
|
|
DBG("DEBUG: reply retransmitted. buf=%p: %.9s..., shmem=%p: %.9s\n",
|
|
|
b, b, t->uas.response.buffer, t->uas.response.buffer );
|
|
|
return 1;
|
|
@@ -1648,9 +1652,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
|
|
|
struct retr_buf *uas_rb;
|
|
|
str* to_tag;
|
|
|
str reason;
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
struct tmcb_params onsend_params;
|
|
|
-#endif
|
|
|
|
|
|
/* keep compiler warnings about use of uninit vars silent */
|
|
|
res_len=0;
|
|
@@ -1824,7 +1826,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
|
|
|
/* send it now (from the private buffer) */
|
|
|
if (relay >= 0) {
|
|
|
if (unlikely(!totag_retr && has_tran_tmcbs(t, TMCB_RESPONSE_READY))){
|
|
|
- run_trans_callbacks(TMCB_RESPONSE_READY, t,
|
|
|
+ run_trans_callbacks_with_buf(TMCB_RESPONSE_READY, uas_rb,
|
|
|
t->uas.request, relayed_msg, relayed_code);
|
|
|
}
|
|
|
/* Set retransmission timer before the reply is sent out to avoid
|
|
@@ -1841,19 +1843,17 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
|
|
|
if (likely(uas_rb->dst.send_sock &&
|
|
|
SEND_PR_BUFFER( uas_rb, buf, res_len ) >= 0)){
|
|
|
if (unlikely(!totag_retr && has_tran_tmcbs(t, TMCB_RESPONSE_OUT))){
|
|
|
- run_trans_callbacks( TMCB_RESPONSE_OUT, t, t->uas.request,
|
|
|
- relayed_msg, relayed_code);
|
|
|
+ run_trans_callbacks_with_buf( TMCB_RESPONSE_OUT, uas_rb, t->uas.request,
|
|
|
+ relayed_msg, relayed_code);
|
|
|
}
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
if (unlikely(has_tran_tmcbs(t, TMCB_RESPONSE_SENT))){
|
|
|
INIT_TMCB_ONSEND_PARAMS(onsend_params, t->uas.request,
|
|
|
relayed_msg, uas_rb, &uas_rb->dst, buf,
|
|
|
res_len,
|
|
|
(relayed_msg==FAKED_REPLY)?TMCB_LOCAL_F:0,
|
|
|
uas_rb->branch, relayed_code);
|
|
|
- run_onsend_callbacks2(TMCB_RESPONSE_SENT, t, &onsend_params);
|
|
|
+ run_trans_callbacks_off_params(TMCB_RESPONSE_SENT, t, &onsend_params);
|
|
|
}
|
|
|
-#endif
|
|
|
} else if (unlikely(uas_rb->dst.send_sock == 0))
|
|
|
ERR("no resolved dst to send reply to\n");
|
|
|
/* Call put_on_wait() only if we really send out
|
|
@@ -2026,9 +2026,7 @@ int reply_received( struct sip_msg *p_msg )
|
|
|
int blst_503_timeout;
|
|
|
struct hdr_field* hf;
|
|
|
#endif
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
struct tmcb_params onsend_params;
|
|
|
-#endif
|
|
|
struct run_act_ctx ctx;
|
|
|
|
|
|
/* make sure we know the associated transaction ... */
|
|
@@ -2087,19 +2085,23 @@ int reply_received( struct sip_msg *p_msg )
|
|
|
if (msg_status >= 300) {
|
|
|
ack = build_ack(p_msg, t, branch, &ack_len);
|
|
|
if (ack) {
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
if (SEND_PR_BUFFER(&uac->request, ack, ack_len)>=0)
|
|
|
if (unlikely(has_tran_tmcbs(t, TMCB_REQUEST_SENT))){
|
|
|
INIT_TMCB_ONSEND_PARAMS(onsend_params,
|
|
|
t->uas.request, p_msg, &uac->request,
|
|
|
&uac->request.dst, ack, ack_len,
|
|
|
TMCB_LOCAL_F, branch, TYPE_LOCAL_ACK);
|
|
|
- run_onsend_callbacks2(TMCB_REQUEST_SENT, t,
|
|
|
- &onsend_params);
|
|
|
+ run_trans_callbacks_off_params(TMCB_REQUEST_SENT, t,
|
|
|
+ &onsend_params);
|
|
|
+ }
|
|
|
+ if (unlikely(has_tran_tmcbs(t, TMCB_ACK_NEG_IN))){
|
|
|
+ INIT_TMCB_ONSEND_PARAMS(onsend_params,
|
|
|
+ t->uas.request, p_msg, &uac->request,
|
|
|
+ &uac->request.dst, ack, ack_len,
|
|
|
+ TMCB_LOCAL_F, branch, TYPE_LOCAL_ACK);
|
|
|
+ run_trans_callbacks_off_params(TMCB_ACK_NEG_IN, t,
|
|
|
+ &onsend_params);
|
|
|
}
|
|
|
-#else
|
|
|
- SEND_PR_BUFFER(&uac->request, ack, ack_len);
|
|
|
-#endif
|
|
|
shm_free(ack);
|
|
|
}
|
|
|
} else if (is_local(t) /*&& 200 <= msg_status < 300*/) {
|
|
@@ -2107,16 +2109,14 @@ int reply_received( struct sip_msg *p_msg )
|
|
|
if (ack) {
|
|
|
if (msg_send(&lack_dst, ack, ack_len)<0)
|
|
|
LOG(L_ERR, "Error while sending local ACK\n");
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
else if (unlikely(has_tran_tmcbs(t, TMCB_REQUEST_SENT))){
|
|
|
INIT_TMCB_ONSEND_PARAMS(onsend_params,
|
|
|
t->uas.request, p_msg, &uac->request,
|
|
|
&lack_dst, ack, ack_len, TMCB_LOCAL_F,
|
|
|
branch, TYPE_LOCAL_ACK);
|
|
|
- run_onsend_callbacks2(TMCB_REQUEST_SENT, t,
|
|
|
- &onsend_params);
|
|
|
+ run_trans_callbacks_off_params(TMCB_REQUEST_SENT, t,
|
|
|
+ &onsend_params);
|
|
|
}
|
|
|
-#endif
|
|
|
#ifndef WITH_AS_SUPPORT
|
|
|
shm_free(ack);
|
|
|
#endif
|
|
@@ -2132,16 +2132,12 @@ int reply_received( struct sip_msg *p_msg )
|
|
|
local_cancel */
|
|
|
/* re-transmit if cancel already built */
|
|
|
DBG("tm: reply_received: branch CANCEL retransmit\n");
|
|
|
-#ifdef TMCB_ONSEND
|
|
|
if (SEND_BUFFER( &uac->local_cancel)>=0){
|
|
|
if (unlikely (has_tran_tmcbs(t, TMCB_REQUEST_SENT)))
|
|
|
- run_onsend_callbacks(TMCB_REQUEST_SENT,
|
|
|
- &uac->local_cancel,
|
|
|
- 0, 0, TMCB_LOCAL_F);
|
|
|
+ run_trans_callbacks_with_buf(TMCB_REQUEST_SENT,
|
|
|
+ &uac->local_cancel,
|
|
|
+ 0, 0, TMCB_LOCAL_F);
|
|
|
}
|
|
|
-#else
|
|
|
- SEND_BUFFER( &uac->local_cancel );
|
|
|
-#endif
|
|
|
/* retrs. should be already started so do nothing */
|
|
|
}else if (atomic_cmpxchg_long((void*)&uac->local_cancel.buffer, 0,
|
|
|
(long)BUSY_BUFFER)==0){
|