Browse Source

tm: exported load contacts functions to kemi framework

Daniel-Constantin Mierla 8 years ago
parent
commit
ae081b252e
3 changed files with 44 additions and 3 deletions
  1. 18 3
      src/modules/tm/t_serial.c
  2. 11 0
      src/modules/tm/t_serial.h
  3. 15 0
      src/modules/tm/tm.c

+ 18 - 3
src/modules/tm/t_serial.c

@@ -172,7 +172,7 @@ void add_contacts_avp(str *uri, str *dst_uri, str *path, str *sock_str,
  * contact is the last one in its priority class.  Finally, removes
  * all branches from destination set.
  */
-int t_load_contacts(struct sip_msg* msg, char* key, char* value)
+int ki_t_load_contacts(struct sip_msg* msg)
 {
 	branch_t *branch;
 	str *ruri, sock_str;
@@ -357,6 +357,11 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value)
 	return 1;
 }
 
+int t_load_contacts(struct sip_msg* msg, char* key, char* value)
+{
+	return ki_t_load_contacts(msg);
+}
+
 void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
 		unsigned int flags, str *instance, str *ruid,
 		str *location_ua, sr_xavp_t *ulattrs_xavp)
@@ -431,7 +436,7 @@ void add_contact_flows_avp(str *uri, str *dst_uri, str *path, str *sock_str,
  * Returns 1, if contacts_avp was not empty and a destination set was
  * successfully added.  Returns -2, if contacts_avp was empty and thus
  * there was nothing to do. Returns -1 in case of an error. */
-int t_next_contacts(struct sip_msg* msg, char* key, char* value)
+int ki_t_next_contacts(struct sip_msg* msg)
 {
 	str uri, dst_uri, path, instance, host, sock_str, ruid, location_ua;
 	struct socket_info *sock;
@@ -732,6 +737,11 @@ check_q_flag:
 	return 1;
 }
 
+int t_next_contacts(struct sip_msg* msg, char* key, char* value)
+{
+	return ki_t_next_contacts(msg);
+}
+
 /*
  * Adds to request a new destination set that includes contacts
  * from contact_flows_avp.  Only one contact with same +sip.instance
@@ -742,7 +752,7 @@ check_q_flag:
  * Returns 1, if contact_flows_avp was not empty and a destination set was
  * successfully added.  Returns -2, if contact_flows_avp was empty and thus
  * there was nothing to do. Returns -1 in case of an error. */
-int t_next_contact_flow(struct sip_msg* msg, char* key, char* value)
+int ki_t_next_contact_flow(struct sip_msg* msg)
 {
 	str uri, dst_uri, path, instance, host, ruid, location_ua;
 	str this_instance;
@@ -866,3 +876,8 @@ next_xavp:
 
 	return -1;
 }
+
+int t_next_contact_flow(struct sip_msg* msg, char* key, char* value)
+{
+	return ki_t_next_contact_flow(msg);
+}

+ 11 - 0
src/modules/tm/t_serial.h

@@ -25,6 +25,9 @@
  *
  */
 
+#ifndef _T_SERIAL_H_
+#define _T_SERIAL_H_
+
 extern int fr_inv_timer_next;
 
 int t_load_contacts(struct sip_msg* msg, char* key, char* value);
@@ -32,3 +35,11 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value);
 int t_next_contacts(struct sip_msg* msg, char* key, char* value);
 
 int t_next_contact_flow(struct sip_msg* msg, char* key, char* value);
+
+int ki_t_load_contacts(struct sip_msg* msg);
+
+int ki_t_next_contacts(struct sip_msg* msg);
+
+int ki_t_next_contact_flow(struct sip_msg* msg);
+
+#endif

+ 15 - 0
src/modules/tm/tm.c

@@ -2680,6 +2680,21 @@ static sr_kemi_t tm_kemi_exports[] = {
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
 			SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR }
 	},
+	{ str_init("tm"), str_init("t_load_contacts"),
+		SR_KEMIP_INT, ki_t_load_contacts,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("tm"), str_init("t_next_contacts"),
+		SR_KEMIP_INT, ki_t_next_contacts,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("tm"), str_init("t_next_contact_flow"),
+		SR_KEMIP_INT, ki_t_next_contact_flow,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
 
 	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };