瀏覽代碼

sca: exported functions to kemi framework

Daniel-Constantin Mierla 7 年之前
父節點
當前提交
73e9139c52
共有 3 個文件被更改,包括 62 次插入1 次删除
  1. 55 0
      src/modules/sca/sca.c
  2. 6 1
      src/modules/sca/sca_subscribe.c
  3. 1 0
      src/modules/sca/sca_subscribe.h

+ 55 - 0
src/modules/sca/sca.c

@@ -41,6 +41,7 @@
 #include "../../core/timer.h"
 #include "../../core/timer_proc.h"
 #include "../../core/mod_fix.h"
+#include "../../core/kemi.h"
 
 #include "sca.h"
 #include "sca_appearance.h"
@@ -479,6 +480,19 @@ static int sca_call_info_update_3_f(sip_msg_t* msg,
 	return sca_call_info_update(msg, update_mask, &uri_to, &uri_from);
 }
 
+int ki_sca_call_info_update_default(sip_msg_t *msg)
+{
+	return sca_call_info_update(msg, SCA_CALL_INFO_SHARED_BOTH, NULL, NULL);
+}
+int ki_sca_call_info_update_mask(sip_msg_t *msg, int umask)
+{
+	return sca_call_info_update(msg, umask, NULL, NULL);
+}
+int ki_sca_call_info_update_turi(sip_msg_t *msg, int umask, str *sto)
+{
+	return sca_call_info_update(msg, umask, sto, NULL);
+}
+
 int fixup_ciu(void **param, int param_no)
 {
 	switch (param_no) {
@@ -504,3 +518,44 @@ int fixup_free_ciu(void **param, int param_no)
 			return E_UNSPEC;
 	}
 }
+
+/**
+ *
+ */
+/* clang-format off */
+static sr_kemi_t sr_kemi_sca_exports[] = {
+	{ str_init("sca"), str_init("handle_subscribe"),
+		SR_KEMIP_INT, ki_sca_handle_subscribe,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("sca"), str_init("call_info_update_default"),
+		SR_KEMIP_INT, ki_sca_call_info_update_default,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("sca"), str_init("call_info_update_mask"),
+		SR_KEMIP_INT, ki_sca_call_info_update_mask,
+		{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("sca"), str_init("call_info_update_turi"),
+		SR_KEMIP_INT, ki_sca_call_info_update_turi,
+		{ SR_KEMIP_INT, SR_KEMIP_STR, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("sca"), str_init("call_info_update"),
+		SR_KEMIP_INT, sca_call_info_update,
+		{ SR_KEMIP_INT, SR_KEMIP_STR, SR_KEMIP_STR,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+
+	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
+};
+/* clang-format on */
+
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+	sr_kemi_modules_add(sr_kemi_sca_exports);
+	return 0;
+}

+ 6 - 1
src/modules/sca/sca_subscribe.c

@@ -1135,7 +1135,7 @@ int sca_subscription_from_request(sca_mod *scam, sip_msg_t *msg, int event_type,
 	return (-1);
 }
 
-int sca_handle_subscribe(sip_msg_t *msg, char *p1, char *p2)
+int ki_sca_handle_subscribe(sip_msg_t *msg)
 {
 	sca_subscription req_sub;
 	sca_subscription *sub = NULL;
@@ -1354,6 +1354,11 @@ int sca_handle_subscribe(sip_msg_t *msg, char *p1, char *p2)
 	return (rc);
 }
 
+int sca_handle_subscribe(sip_msg_t *msg, char *p1, char *p2)
+{
+	return ki_sca_handle_subscribe(msg);
+}
+
 int sca_subscription_reply(sca_mod *scam, int status_code, char *status_msg,
 		int event_type, int expires, sip_msg_t *msg)
 {

+ 1 - 0
src/modules/sca/sca_subscribe.h

@@ -88,5 +88,6 @@ void sca_subscription_state_to_str(int, str *);
 int sca_subscription_aor_has_subscribers(int, str *);
 int sca_subscription_delete_subscriber_for_event(sca_mod *, str *, str *, str *);
 int sca_subscription_terminate(sca_mod *, str *, int, str *, int, int);
+int ki_sca_handle_subscribe(sip_msg_t *msg);
 
 #endif // SCA_SUBSCRIBE_H