diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 248d9854361..ad88faa03d6 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -820,7 +820,9 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int run_initial_cbs) return 0; } dlg_release(dlg); - } + } + /* lock the slot - dlg found, but in dlg_state_deleted, do a new one */ + dlg_hash_lock(&callid); } spiral_detected = 0; diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c index 420caea74de..b1639f1b5cf 100644 --- a/modules/dialog/dlg_hash.c +++ b/modules/dialog/dlg_hash.c @@ -749,6 +749,21 @@ dlg_cell_t* search_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir) } +/*! + * \brief Lock hash table slot by call-id + * \param callid call-id value + */ +void dlg_hash_lock(str *callid) +{ + unsigned int he; + struct dlg_entry *d_entry; + + he = core_hash(callid, 0, d_table->size); + d_entry = &(d_table->entries[he]); + dlg_lock(d_table, d_entry); +} + + /*! * \brief Release hash table slot by call-id * \param callid call-id value @@ -764,7 +779,6 @@ void dlg_hash_release(str *callid) } - /*! * \brief Link a dialog structure * \param dlg dialog diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h index b09fe381e6c..bacc21a53a5 100644 --- a/modules/dialog/dlg_hash.h +++ b/modules/dialog/dlg_hash.h @@ -346,6 +346,13 @@ dlg_cell_t* get_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir); dlg_cell_t* search_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir); +/*! + * \brief Lock hash table slot by call-id + * \param callid call-id value + */ +void dlg_hash_lock(str *callid); + + /*! * \brief Release hash table slot by call-id * \param callid call-id value