Browse Source

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 <[email protected]>
Daniel-Constantin Mierla 16 years ago
parent
commit
bc384ddb1d
4 changed files with 19 additions and 0 deletions
  1. 13 0
      modules/tm/t_reply.c
  2. 3 0
      modules/tm/t_reply.h
  3. 2 0
      modules/tm/tm_load.c
  4. 1 0
      modules/tm/tm_load.h

+ 13 - 0
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

+ 3 - 0
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 )
 

+ 2 - 0
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;
 }

+ 1 - 0
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;