|
@@ -60,6 +60,7 @@
|
|
#include "dlg_timer.h"
|
|
#include "dlg_timer.h"
|
|
#include "dlg_hash.h"
|
|
#include "dlg_hash.h"
|
|
#include "dlg_profile.h"
|
|
#include "dlg_profile.h"
|
|
|
|
+#include "dlg_req_within.h"
|
|
|
|
|
|
#define MAX_LDG_LOCKS 2048
|
|
#define MAX_LDG_LOCKS 2048
|
|
#define MIN_LDG_LOCKS 2
|
|
#define MIN_LDG_LOCKS 2
|
|
@@ -239,7 +240,7 @@ struct dlg_cell* build_new_dlg( str *callid, str *from_uri, str *to_uri,
|
|
memset( dlg, 0, len);
|
|
memset( dlg, 0, len);
|
|
dlg->state = DLG_STATE_UNCONFIRMED;
|
|
dlg->state = DLG_STATE_UNCONFIRMED;
|
|
|
|
|
|
- dlg->h_entry = core_hash( callid, from_tag->len?from_tag:0, d_table->size);
|
|
|
|
|
|
+ dlg->h_entry = core_hash( callid, 0, d_table->size);
|
|
LM_DBG("new dialog on hash %u\n",dlg->h_entry);
|
|
LM_DBG("new dialog on hash %u\n",dlg->h_entry);
|
|
|
|
|
|
p = (char*)(dlg+1);
|
|
p = (char*)(dlg+1);
|
|
@@ -469,7 +470,7 @@ struct dlg_cell* get_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir,
|
|
{
|
|
{
|
|
struct dlg_cell *dlg;
|
|
struct dlg_cell *dlg;
|
|
|
|
|
|
- if ((dlg = internal_get_dlg(core_hash(callid, ftag->len?ftag:0,
|
|
|
|
|
|
+ if ((dlg = internal_get_dlg(core_hash(callid, 0,
|
|
d_table->size), callid, ftag, ttag, dir, del)) == 0 &&
|
|
d_table->size), callid, ftag, ttag, dir, del)) == 0 &&
|
|
(dlg = internal_get_dlg(core_hash(callid, ttag->len
|
|
(dlg = internal_get_dlg(core_hash(callid, ttag->len
|
|
?ttag:0, d_table->size), callid, ftag, ttag, dir, del)) == 0) {
|
|
?ttag:0, d_table->size), callid, ftag, ttag, dir, del)) == 0) {
|
|
@@ -970,7 +971,7 @@ static inline struct mi_root* process_mi_params(struct mi_root *cmd_tree,
|
|
return init_mi_tree( 400, MI_SSTR(MI_MISSING_PARM));
|
|
return init_mi_tree( 400, MI_SSTR(MI_MISSING_PARM));
|
|
}
|
|
}
|
|
|
|
|
|
- h_entry = core_hash( callid, from_tag, d_table->size);
|
|
|
|
|
|
+ h_entry = core_hash( callid, 0, d_table->size);
|
|
|
|
|
|
d_entry = &(d_table->entries[h_entry]);
|
|
d_entry = &(d_table->entries[h_entry]);
|
|
dlg_lock( d_table, d_entry);
|
|
dlg_lock( d_table, d_entry);
|
|
@@ -1065,3 +1066,35 @@ error:
|
|
free_mi_tree(rpl_tree);
|
|
free_mi_tree(rpl_tree);
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/*!
|
|
|
|
+ * \brief Terminate all or selected dialogs via the MI interface
|
|
|
|
+ * \param cmd_tree MI command tree
|
|
|
|
+ * \param param unused
|
|
|
|
+ * \return mi node with the dialog information, or NULL on failure
|
|
|
|
+ */
|
|
|
|
+struct mi_root * mi_terminate_dlgs(struct mi_root *cmd_tree, void *param )
|
|
|
|
+{
|
|
|
|
+ struct mi_root* rpl_tree= NULL;
|
|
|
|
+ struct dlg_cell* dlg = NULL;
|
|
|
|
+ str headers = {0, 0};
|
|
|
|
+ unsigned int i;
|
|
|
|
+
|
|
|
|
+ rpl_tree = process_mi_params( cmd_tree, &dlg);
|
|
|
|
+ if (rpl_tree)
|
|
|
|
+ /* param error */
|
|
|
|
+ return rpl_tree;
|
|
|
|
+ if (dlg==NULL)
|
|
|
|
+ return init_mi_tree( 400, MI_SSTR(MI_MISSING_PARM));
|
|
|
|
+
|
|
|
|
+ rpl_tree = init_mi_tree( 200, MI_SSTR(MI_OK));
|
|
|
|
+ if (rpl_tree==0)
|
|
|
|
+ return 0;
|
|
|
|
+ if (dlg_bye_all(dlg, &headers)!=0)
|
|
|
|
+ goto error;
|
|
|
|
+ return rpl_tree;
|
|
|
|
+error:
|
|
|
|
+ free_mi_tree(rpl_tree);
|
|
|
|
+ return NULL;
|
|
|
|
+}
|
|
|
|
+
|