Module: sip-router
Branch: master
Commit: bc384ddb1ddb1ec32ae115548d2dee93d4ebf74d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bc384dd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Jan Janak <jan(a)iptel.org>
Date: Fri Mar 20 17:42:53 2009 +0100
New function to return the To tag for local reply
Added t_get_reply_totag() to access the to-tag value for generated
replies. This is needed by sl to cope with presence modules
Signed-off-by: Jan Janak <jan(a)iptel.org>
---
modules/tm/t_reply.c | 13 +++++++++++++
modules/tm/t_reply.h | 3 +++
modules/tm/tm_load.c | 2 ++
modules/tm/tm_load.h | 1 +
4 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index c774d84..a72f134 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -170,6 +170,19 @@ static unsigned short resp_class_prio[]={
};
+int t_get_reply_totag(struct sip_msg *msg, str *totag)
+{
+ if(msg==NULL || totag==NULL) {
+ return -1;
+ }
+
+ calc_crc_suffix(msg, tm_tag_suffix);
+ *totag = tm_tag;
+
+ return 1;
+}
+
+
/* we store the reply_route # in private memory which is
then processed during t_relay; we cannot set this value
diff --git a/modules/tm/t_reply.h b/modules/tm/t_reply.h
index 054272e..fa9324d 100644
--- a/modules/tm/t_reply.h
+++ b/modules/tm/t_reply.h
@@ -73,6 +73,9 @@ typedef int (*treply_wb_f)( struct cell* trans,
/* wrapper function needed after changes in w_t_reply */
int w_t_reply_wrp(struct sip_msg *m, unsigned int code, char *txt);
+typedef int (*tget_reply_totag_f)(struct sip_msg *, str *);
+int t_get_reply_totag(struct sip_msg *msg, str *totag);
+
#define LOCK_REPLIES(_t) lock(&(_t)->reply_mutex )
#define UNLOCK_REPLIES(_t) unlock(&(_t)->reply_mutex )
diff --git a/modules/tm/tm_load.c b/modules/tm/tm_load.c
index 26bf700..c61d39d 100644
--- a/modules/tm/tm_load.c
+++ b/modules/tm/tm_load.c
@@ -225,5 +225,7 @@ int load_tm( struct tm_binds *tmb)
LOG( L_ERR, LOAD_ERROR "'t_continue' not found\n");
return -1;
}
+
+ tmb->t_get_reply_totag = t_get_reply_totag;
return 1;
}
diff --git a/modules/tm/tm_load.h b/modules/tm/tm_load.h
index dc00a91..98b9ff2 100644
--- a/modules/tm/tm_load.h
+++ b/modules/tm/tm_load.h
@@ -132,6 +132,7 @@ struct tm_binds {
#endif
t_suspend_f t_suspend;
t_continue_f t_continue;
+ tget_reply_totag_f t_get_reply_totag;
};
extern int tm_init;