From 572d4c8e886b7b7d0bbc975ecf1a4d20bf9e18b9 Mon Sep 17 00:00:00 2001 From: jaybeepee Date: Wed, 15 Apr 2015 21:35:36 +0200 Subject: [PATCH] modules/dialog_ng: add release_dlg api function --- modules/dialog_ng/dialog.c | 1 + modules/dialog_ng/dlg_hash.c | 12 ++++++++++++ modules/dialog_ng/dlg_hash.h | 2 ++ modules/dialog_ng/dlg_load.h | 9 ++++++--- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/modules/dialog_ng/dialog.c b/modules/dialog_ng/dialog.c index 412ef71dd89..77e97ebcddf 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 763b2254dba..38c623be97a 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 9efc3a00434..2a5fe5d6308 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 cbdf94ed612..8de4c438c39 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; };