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 202
 			REQUEST_ROUTE| FAILURE_ROUTE },
203 203
 	{"lookup_branches",  (cmd_function)w_lookup_branches, 1,  domain_uri_fixup, 0,
204 204
 			REQUEST_ROUTE | FAILURE_ROUTE },
205
+	{"reg_send_reply",   (cmd_function)w_reg_send_reply,  0, 0, 0,
206
+			REQUEST_ROUTE | FAILURE_ROUTE },
205 207
 	{"bind_registrar",  (cmd_function)bind_registrar,  0,
206 208
 		0, 0, 0},
207 209
 	{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 674
 	return unregister(_m, d, _uri, _ruid);
675 675
 }
676 676
 
677
+/*!
678
+ *
679
+ */
680
+static int ki_reg_send_reply(sip_msg_t* _m)
681
+{
682
+	int ret;
683
+	ret = reg_send_reply(_m);
684
+	return (ret==0)?1:ret;
685
+}
686
+
687
+/*!
688
+ *
689
+ */
690
+static int w_reg_send_reply(sip_msg_t* _m, char* _p1, char* _p2)
691
+{
692
+	return ki_reg_send_reply(_m);
693
+}
694
+
677 695
 /*! \brief
678 696
  * Convert char* parameter to udomain_t* pointer
679 697
  */
... ...
@@ -971,6 +992,11 @@ static sr_kemi_t sr_kemi_registrar_exports[] = {
971 971
 		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
972 972
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
973 973
 	},
974
+	{ str_init("registrar"), str_init("reg_send_reply"),
975
+		SR_KEMIP_INT, ki_reg_send_reply,
976
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
977
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
978
+	},
974 979
 	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
975 980
 };
976 981