Module: kamailio Branch: master Commit: 309565b08f6294fdbd3d31163a73bd75a680a7e0 URL: https://github.com/kamailio/kamailio/commit/309565b08f6294fdbd3d31163a73bd75...
Author: Morten Tryfoss morten@tryfoss.no Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2023-10-24T14:55:49+02:00
ims_dialog: Add function to get dialog by hash entry and id
---
Modified: src/modules/ims_dialog/dlg_handlers.c Modified: src/modules/ims_dialog/dlg_handlers.h Modified: src/modules/ims_dialog/dlg_load.h Modified: src/modules/ims_dialog/ims_dialog.c
---
Diff: https://github.com/kamailio/kamailio/commit/309565b08f6294fdbd3d31163a73bd75... Patch: https://github.com/kamailio/kamailio/commit/309565b08f6294fdbd3d31163a73bd75...
---
diff --git a/src/modules/ims_dialog/dlg_handlers.c b/src/modules/ims_dialog/dlg_handlers.c index 0ba5857c2d5..3487d7f4c2a 100644 --- a/src/modules/ims_dialog/dlg_handlers.c +++ b/src/modules/ims_dialog/dlg_handlers.c @@ -2101,3 +2101,22 @@ struct dlg_cell *dlg_get_msg_dialog(sip_msg_t *msg) } return dlg; } + +/*! + * \brief Get dialog based on hash entry and id + * \param h_entry number of the hash table entry + * \param h_id id of the hash table entry + * \return dialog structure on success, NULL on failure + */ + +struct dlg_cell *dlg_get_hash_dialog(unsigned int h_entry, unsigned int h_id) +{ + struct dlg_cell *dlg = NULL; + + dlg = lookup_dlg(h_entry, h_id); + if(dlg == NULL) { + LM_ERR("Unable to find dlg\n"); + return NULL; + } + return dlg; +} diff --git a/src/modules/ims_dialog/dlg_handlers.h b/src/modules/ims_dialog/dlg_handlers.h index 0e61d5dc825..5e5538ebf99 100644 --- a/src/modules/ims_dialog/dlg_handlers.h +++ b/src/modules/ims_dialog/dlg_handlers.h @@ -210,4 +210,12 @@ void internal_print_all_dlg(struct dlg_cell *dlg); */ struct dlg_cell *dlg_get_msg_dialog(sip_msg_t *msg);
+/*! + * \brief Get dialog based on hash entry and id + * \param h_entry number of the hash table entry + * \param h_id id of the hash table entry + * \return dialog structure on success, NULL on failure + */ +struct dlg_cell *dlg_get_hash_dialog(unsigned int h_entry, unsigned int h_id); + #endif diff --git a/src/modules/ims_dialog/dlg_load.h b/src/modules/ims_dialog/dlg_load.h index be2d5f61ca3..4f62e5acc30 100644 --- a/src/modules/ims_dialog/dlg_load.h +++ b/src/modules/ims_dialog/dlg_load.h @@ -42,6 +42,10 @@ typedef int (*ims_lookup_terminate_dlg_f)( /* get the current dialog based on message function prototype */ typedef struct dlg_cell *(*ims_get_dlg_f)(struct sip_msg *msg);
+/* get dialog based on hash entry and id */ +typedef struct dlg_cell *(*ims_get_dlg_hash_f)( + unsigned int h_entry, unsigned int h_id); + /* get_dlg_lifetime function prototype */ typedef time_t (*ims_get_dlg_expires_f)(str *callid, str *ftag, str *ttag);
@@ -57,6 +61,7 @@ typedef struct ims_dlg_binds ims_get_dlg_variable_f get_dlg_var; ims_get_dlg_expires_f get_dlg_expires; ims_get_dlg_f get_dlg; + ims_get_dlg_hash_f get_dlg_hash; ims_release_dlg_f release_dlg; } ims_dlg_api_t;
diff --git a/src/modules/ims_dialog/ims_dialog.c b/src/modules/ims_dialog/ims_dialog.c index a9fd0aecebf..23b3160b14e 100644 --- a/src/modules/ims_dialog/ims_dialog.c +++ b/src/modules/ims_dialog/ims_dialog.c @@ -355,6 +355,7 @@ int load_ims_dlg(ims_dlg_api_t *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->get_dlg_hash = dlg_get_hash_dialog; dlgb->release_dlg = dlg_release;
return 1;