Module: sip-router Branch: treimann/master_tm-extend-callbacks Commit: d21983e8625a504a918af2b9acc9134cef89f0b2 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d21983e8...
Author: Timo Reimann timo.reimann@1und1.de Committer: Timo Reimann timo.reimann@1und1.de Date: Wed Oct 5 18:39:59 2011 +0200
tm: Add tm callback TMCB_REQUEST_PENDING, triggered when a 100/Trying is sent out.
---
modules/tm/t_hooks.h | 44 +++++++++++++++++++++++--------------------- modules/tm/t_reply.c | 6 ++++++ 2 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/modules/tm/t_hooks.h b/modules/tm/t_hooks.h index b31558e..37ae4b8 100644 --- a/modules/tm/t_hooks.h +++ b/modules/tm/t_hooks.h @@ -59,34 +59,36 @@ struct cell; #define TMCB_REQUEST_IN_N 0 #define TMCB_RESPONSE_IN_N 1 #define TMCB_E2EACK_IN_N 2 -#define TMCB_REQUEST_FWDED_N 3 -#define TMCB_RESPONSE_FWDED_N 4 -#define TMCB_ON_FAILURE_RO_N 5 -#define TMCB_ON_FAILURE_N 6 -#define TMCB_REQUEST_OUT_N 7 -#define TMCB_RESPONSE_OUT_N 8 -#define TMCB_LOCAL_COMPLETED_N 9 -#define TMCB_LOCAL_RESPONSE_OUT_N 10 -#define TMCB_ACK_NEG_IN_N 11 -#define TMCB_REQ_RETR_IN_N 12 -#define TMCB_LOCAL_RESPONSE_IN_N 13 -#define TMCB_LOCAL_REQUEST_IN_N 14 -#define TMCB_DLG_N 15 -#define TMCB_DESTROY_N 16 /* called on transaction destroy */ -#define TMCB_E2ECANCEL_IN_N 17 -#define TMCB_E2EACK_RETR_IN_N 18 -#define TMCB_RESPONSE_READY_N 19 +#define TMCB_REQUEST_PENDING_N 3 +#define TMCB_REQUEST_FWDED_N 4 +#define TMCB_RESPONSE_FWDED_N 5 +#define TMCB_ON_FAILURE_RO_N 6 +#define TMCB_ON_FAILURE_N 7 +#define TMCB_REQUEST_OUT_N 8 +#define TMCB_RESPONSE_OUT_N 9 +#define TMCB_LOCAL_COMPLETED_N 10 +#define TMCB_LOCAL_RESPONSE_OUT_N 11 +#define TMCB_ACK_NEG_IN_N 12 +#define TMCB_REQ_RETR_IN_N 13 +#define TMCB_LOCAL_RESPONSE_IN_N 14 +#define TMCB_LOCAL_REQUEST_IN_N 15 +#define TMCB_DLG_N 16 +#define TMCB_DESTROY_N 17 /* called on transaction destroy */ +#define TMCB_E2ECANCEL_IN_N 18 +#define TMCB_E2EACK_RETR_IN_N 19 +#define TMCB_RESPONSE_READY_N 20 #ifdef WITH_AS_SUPPORT -#define TMCB_DONT_ACK_N 20 /* TM shoudn't ACK a local UAC */ +#define TMCB_DONT_ACK_N 21 /* TM shoudn't ACK a local UAC */ #endif -#define TMCB_REQUEST_SENT_N 21 -#define TMCB_RESPONSE_SENT_N 22 -#define TMCB_MAX_N 22 +#define TMCB_REQUEST_SENT_N 22 +#define TMCB_RESPONSE_SENT_N 23 +#define TMCB_MAX_N 23
#define TMCB_REQUEST_IN (1<<TMCB_REQUEST_IN_N) #define TMCB_RESPONSE_IN (1<<TMCB_RESPONSE_IN_N) #define TMCB_E2EACK_IN (1<<TMCB_E2EACK_IN_N) +#define TMCB_REQUEST_PENDING (1<<TMCB_REQUEST_PENDING_N) #define TMCB_REQUEST_FWDED (1<<TMCB_REQUEST_FWDED_N) #define TMCB_RESPONSE_FWDED (1<<TMCB_RESPONSE_FWDED_N) #define TMCB_ON_FAILURE_RO (1<<TMCB_ON_FAILURE_RO_N) diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index fef5e0a..c2021e7 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -632,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