[sr-dev] git:master:572d4c8e: modules/dialog_ng: add release_dlg api function

jaybeepee jason.penton at gmail.com
Wed Apr 15 21:36:25 CEST 2015


Module: kamailio
Branch: master
Commit: 572d4c8e886b7b7d0bbc975ecf1a4d20bf9e18b9
URL: https://github.com/kamailio/kamailio/commit/572d4c8e886b7b7d0bbc975ecf1a4d20bf9e18b9

Author: jaybeepee <jason.penton at gmail.com>
Committer: jaybeepee <jason.penton at gmail.com>
Date: 2015-04-15T21:35:36+02:00

modules/dialog_ng: add release_dlg api function

---

Modified: modules/dialog_ng/dialog.c
Modified: modules/dialog_ng/dlg_hash.c
Modified: modules/dialog_ng/dlg_hash.h
Modified: modules/dialog_ng/dlg_load.h

---

Diff:  https://github.com/kamailio/kamailio/commit/572d4c8e886b7b7d0bbc975ecf1a4d20bf9e18b9.diff
Patch: https://github.com/kamailio/kamailio/commit/572d4c8e886b7b7d0bbc975ecf1a4d20bf9e18b9.patch

---

diff --git a/modules/dialog_ng/dialog.c b/modules/dialog_ng/dialog.c
index 412ef71..77e97ebc 100644
--- a/modules/dialog_ng/dialog.c
+++ b/modules/dialog_ng/dialog.c
@@ -343,6 +343,7 @@ int load_dlg(struct dlg_binds *dlgb) {
     dlgb->lookup_terminate_dlg = w_api_lookup_terminate_dlg;
     dlgb->get_dlg_expires = api_get_dlg_expires;
     dlgb->get_dlg = dlg_get_msg_dialog;
+    dlgb->release_dlg = dlg_release;
 
     return 1;
 }
diff --git a/modules/dialog_ng/dlg_hash.c b/modules/dialog_ng/dlg_hash.c
index 763b225..38c623b 100644
--- a/modules/dialog_ng/dlg_hash.c
+++ b/modules/dialog_ng/dlg_hash.c
@@ -1716,6 +1716,18 @@ struct mi_root * mi_print_dlgs_ctx(struct mi_root *cmd_tree, void *param) {
     return NULL;
 }
 
+/*!
+ * \brief decrement dialog ref counter by 1
+ * \see dlg_unref
+ * \param dlg dialog
+ */
+void dlg_release(struct dlg_cell *dlg)
+{
+	if(dlg==NULL)
+		return;
+	unref_dlg(dlg, 1);
+}
+
 time_t api_get_dlg_expires(str *callid, str *ftag, str *ttag) {
     struct dlg_cell *dlg;
     time_t expires = 0;
diff --git a/modules/dialog_ng/dlg_hash.h b/modules/dialog_ng/dlg_hash.h
index 9efc3a0..2a5fe5d 100644
--- a/modules/dialog_ng/dlg_hash.h
+++ b/modules/dialog_ng/dlg_hash.h
@@ -610,6 +610,8 @@ int update_dlg_did(struct dlg_cell *dlg, str *new_did);
 
 time_t api_get_dlg_expires(str *callid, str *ftag, str *ttag);
 
+void dlg_release(struct dlg_cell *dlg);
+
 char* state_to_char(unsigned int state);
 
 #endif
diff --git a/modules/dialog_ng/dlg_load.h b/modules/dialog_ng/dlg_load.h
index cbdf94e..8de4c43 100644
--- a/modules/dialog_ng/dlg_load.h
+++ b/modules/dialog_ng/dlg_load.h
@@ -43,15 +43,18 @@ typedef struct dlg_cell *(*get_dlg_f)(struct sip_msg *msg);
 /* get_dlg_lifetime function prototype */
 typedef time_t (*get_dlg_expires_f)(str *callid, str *ftag, str *ttag);
 
+typedef void (*release_dlg_f)(struct dlg_cell *dlg);
+
 struct dlg_binds {
 	register_dlgcb_f  		register_dlgcb;
-	register_dlgcb_nodlg_f 	register_dlgcb_nodlg;
+	register_dlgcb_nodlg_f          register_dlgcb_nodlg;
 	terminate_dlg_f 		terminate_dlg;
-	lookup_terminate_dlg_f 	lookup_terminate_dlg;
+	lookup_terminate_dlg_f          lookup_terminate_dlg;
 	set_dlg_variable_f 		set_dlg_var;
 	get_dlg_variable_f 		get_dlg_var;
 	get_dlg_expires_f 		get_dlg_expires;
-	get_dlg_f				get_dlg;
+	get_dlg_f			get_dlg;
+        release_dlg_f                   release_dlg;
 };
 
 




More information about the sr-dev mailing list