Browse code

registrar: export reg_send_reply() to scripting languages

- useful with save(location, 0x2) to send later same reply like save(...)
without flag 0x2

Daniel-Constantin Mierla authored on 10/07/2019 06:56:39
Showing 1 changed files
... ...
@@ -76,6 +76,7 @@ static int w_unregister2(struct sip_msg* _m, char* _d, char* _uri, char *_ruid);
76 76
 static int w_registered3(struct sip_msg* _m, char* _d, char* _uri, char* _flags);
77 77
 static int w_registered4(struct sip_msg* _m, char* _d, char* _uri, char* _flags,
78 78
 		char* _actionflags);
79
+static int w_reg_send_reply(sip_msg_t* _m, char* _p1, char* _p2);
79 80
 
80 81
 /*! \brief Fixup functions */
81 82
 static int domain_fixup(void** param, int param_no);
... ...
@@ -202,6 +203,8 @@ static cmd_export_t cmds[] = {
202 203
 			REQUEST_ROUTE| FAILURE_ROUTE },
203 204
 	{"lookup_branches",  (cmd_function)w_lookup_branches, 1,  domain_uri_fixup, 0,
204 205
 			REQUEST_ROUTE | FAILURE_ROUTE },
206
+	{"reg_send_reply",   (cmd_function)w_reg_send_reply,  0, 0, 0,
207
+			REQUEST_ROUTE | FAILURE_ROUTE },
205 208
 	{"bind_registrar",  (cmd_function)bind_registrar,  0,
206 209
 		0, 0, 0},
207 210
 	{0, 0, 0, 0, 0, 0}
... ...
@@ -674,6 +677,24 @@ static int ki_unregister_ruid(sip_msg_t* _m, str* _dtable, str* _uri, str *_ruid
674 677
 	return unregister(_m, d, _uri, _ruid);
675 678
 }
676 679
 
680
+/*!
681
+ *
682
+ */
683
+static int ki_reg_send_reply(sip_msg_t* _m)
684
+{
685
+	int ret;
686
+	ret = reg_send_reply(_m);
687
+	return (ret==0)?1:ret;
688
+}
689
+
690
+/*!
691
+ *
692
+ */
693
+static int w_reg_send_reply(sip_msg_t* _m, char* _p1, char* _p2)
694
+{
695
+	return ki_reg_send_reply(_m);
696
+}
697
+
677 698
 /*! \brief
678 699
  * Convert char* parameter to udomain_t* pointer
679 700
  */
... ...
@@ -971,6 +992,11 @@ static sr_kemi_t sr_kemi_registrar_exports[] = {
971 992
 		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
972 993
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
973 994
 	},
995
+	{ str_init("registrar"), str_init("reg_send_reply"),
996
+		SR_KEMIP_INT, ki_reg_send_reply,
997
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
998
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
999
+	},
974 1000
 	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
975 1001
 };
976 1002