Pārlūkot izejas kodu

dialog: use event callback for reply out

Daniel-Constantin Mierla 9 mēneši atpakaļ
vecāks
revīzija
688db50c14
1 mainītis faili ar 17 papildinājumiem un 0 dzēšanām
  1. 17 0
      src/modules/dialog/dialog.c

+ 17 - 0
src/modules/dialog/dialog.c

@@ -70,6 +70,7 @@
 #include "../../modules/tm/tm_load.h"
 #include "../../core/rpc_lookup.h"
 #include "../../core/srapi.h"
+#include "../../core/events.h"
 #include "../rr/api.h"
 #include "dlg_hash.h"
 #include "dlg_timer.h"
@@ -228,6 +229,8 @@ static int fixup_dlg_req_with_headers(void **, int);
 static int fixup_dlg_req_with_content(void **, int);
 static int fixup_dlg_req_with_headers_and_content(void **, int);
 
+static int dlg_sip_reply_out(sr_event_param_t *evp);
+
 /* clang-format off */
 static cmd_export_t cmds[]={
 	{"dlg_manage", (cmd_function)w_dlg_manage,            0,0,
@@ -796,6 +799,9 @@ static int mod_init(void)
 		ksr_module_set_flag(KSRMOD_FLAG_POSTCHILDINIT);
 	}
 
+	if(dlg_process_mode != 0) {
+		sr_event_register_cb(SREV_SIP_REPLY_OUT, dlg_sip_reply_out);
+	}
 	return 0;
 }
 
@@ -871,6 +877,17 @@ static void mod_destroy(void)
 }
 
 
+/**
+ *
+ */
+static int dlg_sip_reply_out(sr_event_param_t *evp)
+{
+	LM_DBG("handling sip response\n");
+	dlg_update_state(evp->rpl);
+	return 0;
+}
+
+
 static int w_set_dlg_profile_helper(
 		sip_msg_t *msg, struct dlg_profile_table *profile, str *value)
 {