Sfoglia il codice sorgente

- fixed TMCB_E2ECANCEL_IN wrong value
- fixed wrong buffer length in some TMCB_RESPONSE_SENT callback calls
- switched TMCB_E2ECANCEL to path the cancel transaction as param. and not
the invite one
(bugs reported by Gergely Kovacs <[email protected]>)

Andrei Pelinescu-Onciul 18 anni fa
parent
commit
6776abcd5a
3 ha cambiato i file con 6 aggiunte e 5 eliminazioni
  1. 1 1
      modules/tm/t_fwd.c
  2. 4 3
      modules/tm/t_hooks.h
  3. 1 1
      modules/tm/t_reply.c

+ 1 - 1
modules/tm/t_fwd.c

@@ -478,7 +478,7 @@ void e2e_cancel( struct sip_msg *cancel_msg,
 	lowest_error=0;
 	lowest_error=0;
 
 
 	if (unlikely(has_tran_tmcbs(t_invite, TMCB_E2ECANCEL_IN)))
 	if (unlikely(has_tran_tmcbs(t_invite, TMCB_E2ECANCEL_IN)))
-		run_trans_callbacks( TMCB_E2ECANCEL_IN, t_invite, cancel_msg, 0,
+		run_trans_callbacks( TMCB_E2ECANCEL_IN, t_cancel, cancel_msg, 0,
 								cancel_msg->REQ_METHOD);
 								cancel_msg->REQ_METHOD);
 	/* first check if there are any branches */
 	/* first check if there are any branches */
 	if (t_invite->nr_of_outgoings==0){
 	if (t_invite->nr_of_outgoings==0){

+ 4 - 3
modules/tm/t_hooks.h

@@ -99,7 +99,7 @@ struct cell;
 #define TMCB_LOCAL_REQUEST_IN (1<<TMCB_LOCAL_REQUEST_IN_N)
 #define TMCB_LOCAL_REQUEST_IN (1<<TMCB_LOCAL_REQUEST_IN_N)
 #define TMCB_DLG              (1<<TMCB_DLG_N)
 #define TMCB_DLG              (1<<TMCB_DLG_N)
 #define TMCB_DESTROY          (1<<TMCB_DESTROY_N)
 #define TMCB_DESTROY          (1<<TMCB_DESTROY_N)
-#define TMCB_E2ECANCEL_IN     (1<<TMCB_E2EACK_IN_N)
+#define TMCB_E2ECANCEL_IN     (1<<TMCB_E2ECANCEL_IN_N)
 #ifdef TMCB_ONSEND
 #ifdef TMCB_ONSEND
 #define TMCB_REQUEST_SENT      (1<<TMCB_REQUEST_SENT_N)
 #define TMCB_REQUEST_SENT      (1<<TMCB_REQUEST_SENT_N)
 #define TMCB_RESPONSE_SENT     (1<<TMCB_RESPONSE_SENT_N)
 #define TMCB_RESPONSE_SENT     (1<<TMCB_RESPONSE_SENT_N)
@@ -221,8 +221,9 @@ struct cell;
  *
  *
  *  TMCB_E2ECANCEL_IN -- called when a CANCEL for the INVITE transaction
  *  TMCB_E2ECANCEL_IN -- called when a CANCEL for the INVITE transaction
  *  for which the callback was registered arrives.
  *  for which the callback was registered arrives.
- *   The transaction parameter will point to the invite transaction (and 
- *   not the cancel) and the request parameter to the CANCEL sip msg.
+ *   The transaction parameter will point to the cancel transaction (and 
+ *   not the invite) and the request parameter to the CANCEL sip msg.
+ *   Note: the callback should be registered for an INVITE transaction.
  *
  *
  *  TMCB_REQUEST_FWDED -- request is being forwarded out. It is
  *  TMCB_REQUEST_FWDED -- request is being forwarded out. It is
  *  called before a message is forwarded, when the corresponding branch
  *  called before a message is forwarded, when the corresponding branch

+ 1 - 1
modules/tm/t_reply.c

@@ -500,7 +500,7 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
 		if (SEND_PR_BUFFER( rb, buf, len )>=0)
 		if (SEND_PR_BUFFER( rb, buf, len )>=0)
 			if (unlikely(has_tran_tmcbs(trans, TMCB_RESPONSE_SENT))){
 			if (unlikely(has_tran_tmcbs(trans, TMCB_RESPONSE_SENT))){
 				INIT_TMCB_ONSEND_PARAMS(onsend_params, 0, 0, rb, &rb->dst, 
 				INIT_TMCB_ONSEND_PARAMS(onsend_params, 0, 0, rb, &rb->dst, 
-								buf, buf_len, TMCB_LOCAL_F, rb->branch, code);
+								buf, len, TMCB_LOCAL_F, rb->branch, code);
 				run_onsend_callbacks2(TMCB_RESPONSE_SENT, &onsend_params);
 				run_onsend_callbacks2(TMCB_RESPONSE_SENT, &onsend_params);
 			}
 			}
 #else
 #else