... | ... |
@@ -232,7 +232,7 @@ static mi_export_t mi_cmds[] = { |
232 | 232 |
{ "dlg_list", mi_print_dlgs, 0, 0, 0}, |
233 | 233 |
{ "dlg_list_ctx", mi_print_dlgs_ctx, 0, 0, 0}, |
234 | 234 |
{ "dlg_end_dlg", mi_terminate_dlg, 0, 0, 0}, |
235 |
- { "dlg_terminate_dlgs", mi_terminate_dlgs, 0, 0, 0}, |
|
235 |
+ { "dlg_terminate_dlg", mi_terminate_dlgs, 0, 0, 0}, |
|
236 | 236 |
{ "profile_get_size", mi_get_profile, 0, 0, 0}, |
237 | 237 |
{ "profile_list_dlgs", mi_profile_list, 0, 0, 0}, |
238 | 238 |
{ "dlg_bridge", mi_dlg_bridge, 0, 0, 0}, |
... | ... |
@@ -1200,7 +1200,7 @@ static void internal_rpc_print_single_dlg(rpc_t *rpc, void *c, int with_context) |
1200 | 1200 |
|
1201 | 1201 |
if (rpc->scan(c, ".S.S", &callid, &from_tag) < 2) return; |
1202 | 1202 |
|
1203 |
- h_entry = core_hash( &callid, &from_tag, d_table->size); |
|
1203 |
+ h_entry = core_hash( &callid, 0, d_table->size); |
|
1204 | 1204 |
d_entry = &(d_table->entries[h_entry]); |
1205 | 1205 |
dlg_lock( d_table, d_entry); |
1206 | 1206 |
for( dlg = d_entry->first ; dlg ; dlg = dlg->next ) { |
... | ... |
@@ -240,7 +240,7 @@ struct dlg_cell* build_new_dlg( str *callid, str *from_uri, str *to_uri, |
240 | 240 |
memset( dlg, 0, len); |
241 | 241 |
dlg->state = DLG_STATE_UNCONFIRMED; |
242 | 242 |
|
243 |
- dlg->h_entry = core_hash( callid, from_tag->len?from_tag:0, d_table->size); |
|
243 |
+ dlg->h_entry = core_hash( callid, 0, d_table->size); |
|
244 | 244 |
LM_DBG("new dialog on hash %u\n",dlg->h_entry); |
245 | 245 |
|
246 | 246 |
p = (char*)(dlg+1); |
... | ... |
@@ -470,7 +470,7 @@ struct dlg_cell* get_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir, |
470 | 470 |
{ |
471 | 471 |
struct dlg_cell *dlg; |
472 | 472 |
|
473 |
- if ((dlg = internal_get_dlg(core_hash(callid, ftag->len?ftag:0, |
|
473 |
+ if ((dlg = internal_get_dlg(core_hash(callid, 0, |
|
474 | 474 |
d_table->size), callid, ftag, ttag, dir, del)) == 0 && |
475 | 475 |
(dlg = internal_get_dlg(core_hash(callid, ttag->len |
476 | 476 |
?ttag:0, d_table->size), callid, ftag, ttag, dir, del)) == 0) { |
... | ... |
@@ -971,7 +971,7 @@ static inline struct mi_root* process_mi_params(struct mi_root *cmd_tree, |
971 | 971 |
return init_mi_tree( 400, MI_SSTR(MI_MISSING_PARM)); |
972 | 972 |
} |
973 | 973 |
|
974 |
- h_entry = core_hash( callid, from_tag, d_table->size); |
|
974 |
+ h_entry = core_hash( callid, 0, d_table->size); |
|
975 | 975 |
|
976 | 976 |
d_entry = &(d_table->entries[h_entry]); |
977 | 977 |
dlg_lock( d_table, d_entry); |
... | ... |
@@ -1084,32 +1084,15 @@ struct mi_root * mi_terminate_dlgs(struct mi_root *cmd_tree, void *param ) |
1084 | 1084 |
if (rpl_tree) |
1085 | 1085 |
/* param error */ |
1086 | 1086 |
return rpl_tree; |
1087 |
+ if (dlg==NULL) |
|
1088 |
+ return init_mi_tree( 400, MI_SSTR(MI_MISSING_PARM)); |
|
1087 | 1089 |
|
1088 | 1090 |
rpl_tree = init_mi_tree( 200, MI_SSTR(MI_OK)); |
1089 | 1091 |
if (rpl_tree==0) |
1090 | 1092 |
return 0; |
1091 |
- |
|
1092 |
- if (dlg==NULL) { |
|
1093 |
- LM_DBG("terminating %i dialogs\n", d_table->size); |
|
1094 |
- |
|
1095 |
- for( i=0 ; i<d_table->size ; i++ ) { |
|
1096 |
- dlg_lock( d_table, &(d_table->entries[i]) ); |
|
1097 |
- |
|
1098 |
- for( dlg=d_table->entries[i].first ; dlg ; dlg=dlg->next ) { |
|
1099 |
- if (dlg_bye_all(dlg, &headers)!=0) |
|
1100 |
- goto error_all; |
|
1101 |
- } |
|
1102 |
- dlg_unlock( d_table, &(d_table->entries[i]) ); |
|
1103 |
- } |
|
1104 |
- } else { |
|
1105 |
- if (dlg_bye_all(dlg, &headers)!=0) |
|
1106 |
- goto error; |
|
1107 |
- } |
|
1093 |
+ if (dlg_bye_all(dlg, &headers)!=0) |
|
1094 |
+ goto error; |
|
1108 | 1095 |
return rpl_tree; |
1109 |
-error_all: |
|
1110 |
- dlg_unlock( d_table, &(d_table->entries[i]) ); |
|
1111 |
- free_mi_tree(rpl_tree); |
|
1112 |
- return NULL; |
|
1113 | 1096 |
error: |
1114 | 1097 |
free_mi_tree(rpl_tree); |
1115 | 1098 |
return NULL; |
... | ... |
@@ -328,7 +328,7 @@ struct mi_root * mi_print_dlgs(struct mi_root *cmd, void *param ); |
328 | 328 |
struct mi_root * mi_print_dlgs_ctx(struct mi_root *cmd, void *param ); |
329 | 329 |
|
330 | 330 |
/*! |
331 |
- * \brief Terminate all or selected dialogs via the MI interface |
|
331 |
+ * \brief Terminate selected dialogs via the MI interface |
|
332 | 332 |
* \param cmd_tree MI command tree |
333 | 333 |
* \param param unused |
334 | 334 |
* \return mi node with the dialog information, or NULL on failure |
... | ... |
@@ -435,13 +435,19 @@ static inline int match_dialog(struct dlg_cell *dlg, str *callid, |
435 | 435 |
*/ |
436 | 436 |
static inline int match_downstream_dialog(struct dlg_cell *dlg, str *callid, str *ftag) |
437 | 437 |
{ |
438 |
- if(dlg==NULL || callid==NULL || ftag==NULL) |
|
439 |
- return 0; |
|
440 |
- if (dlg->callid.len!=callid->len || |
|
441 |
- dlg->tag[DLG_CALLER_LEG].len!=ftag->len || |
|
442 |
- strncmp(dlg->callid.s,callid->s,callid->len)!=0 || |
|
443 |
- strncmp(dlg->tag[DLG_CALLER_LEG].s,ftag->s,ftag->len)!=0) |
|
438 |
+ if(dlg==NULL || callid==NULL) |
|
444 | 439 |
return 0; |
440 |
+ if (ftag==NULL) { |
|
441 |
+ if (dlg->callid.len!=callid->len || |
|
442 |
+ strncmp(dlg->callid.s,callid->s,callid->len)!=0) |
|
443 |
+ return 0; |
|
444 |
+ } else { |
|
445 |
+ if (dlg->callid.len!=callid->len || |
|
446 |
+ dlg->tag[DLG_CALLER_LEG].len!=ftag->len || |
|
447 |
+ strncmp(dlg->callid.s,callid->s,callid->len)!=0 || |
|
448 |
+ strncmp(dlg->tag[DLG_CALLER_LEG].s,ftag->s,ftag->len)!=0) |
|
449 |
+ return 0; |
|
450 |
+ } |
|
445 | 451 |
return 1; |
446 | 452 |
} |
447 | 453 |
|
... | ... |
@@ -1532,9 +1532,7 @@ if(dlg_get("abcdef", "123", "456")) |
1532 | 1532 |
<section> |
1533 | 1533 |
<title><varname>dlg_terminate_dlgs</varname></title> |
1534 | 1534 |
<para> |
1535 |
- Terminates a dialog or of all dialogs (calls). If only |
|
1536 |
- one dialogs is to be terminated, the dialog identifiers are to be passed |
|
1537 |
- as parameter (callid and fromtag). |
|
1535 |
+ Terminates a singe dialog, identified by a Call-ID. |
|
1538 | 1536 |
</para> |
1539 | 1537 |
<para> |
1540 | 1538 |
Name: <emphasis>dlg_terminate_dlgs</emphasis> |
... | ... |
@@ -1542,8 +1540,7 @@ if(dlg_get("abcdef", "123", "456")) |
1542 | 1540 |
<para>Parameters:</para> |
1543 | 1541 |
<itemizedlist> |
1544 | 1542 |
<listitem><para> |
1545 |
- <emphasis>callid</emphasis> (optional) - callid if a single |
|
1546 |
- dialog to be terminated. |
|
1543 |
+ <emphasis>callid</emphasis> - callid of the dialog to be terminated. |
|
1547 | 1544 |
</para></listitem> |
1548 | 1545 |
<listitem><para> |
1549 | 1546 |
<emphasis>from_tag</emphasis> (optional, but cannot be present |
... | ... |
@@ -1559,10 +1556,6 @@ if(dlg_get("abcdef", "123", "456")) |
1559 | 1556 |
</para> |
1560 | 1557 |
<programlisting format="linespecific"> |
1561 | 1558 |
:dlg_terminate_dlgs:_reply_fifo_file_ |
1562 |
- _empty_line_ |
|
1563 |
- </programlisting> |
|
1564 |
- <programlisting format="linespecific"> |
|
1565 |
- :dlg_terminate_dlgs:_reply_fifo_file_ |
|
1566 | 1559 |
abcdrssfrs122444@192.168.1.1 |
1567 | 1560 |
AAdfeEFF33 |
1568 | 1561 |
</programlisting> |