Module: kamailio
Branch: master
Commit: c9ecbe97af96e20312f1f2daa0afe3b5121cb0c0
URL:
https://github.com/kamailio/kamailio/commit/c9ecbe97af96e20312f1f2daa0afe3b…
Author: jaybeepee <jason.penton(a)gmail.com>
Committer: jaybeepee <jason.penton(a)gmail.com>
Date: 2016-02-29T14:13:03+02:00
modules/ims_dialog: add default reason headers for mi-terminated dlgs
---
Modified: modules/ims_dialog/dlg_req_within.c
Modified: modules/ims_dialog/ims_dialog.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c9ecbe97af96e20312f1f2daa0afe3b…
Patch:
https://github.com/kamailio/kamailio/commit/c9ecbe97af96e20312f1f2daa0afe3b…
---
diff --git a/modules/ims_dialog/dlg_req_within.c b/modules/ims_dialog/dlg_req_within.c
index 2de823d..e8b3ffd 100644
--- a/modules/ims_dialog/dlg_req_within.c
+++ b/modules/ims_dialog/dlg_req_within.c
@@ -403,13 +403,14 @@ struct mi_root * mi_terminate_dlg(struct mi_root *cmd_tree, void
*param) {
struct mi_node* node;
struct dlg_cell * dlg = NULL;
- str mi_extra_hdrs = {NULL, 0};
+ str mi_extra_hdrs = {"Reason: mi_terminated\r\n", 23};
int status, msg_len;
char *msg;
str callid = {NULL, 0};
str ftag = {NULL, 0};
str ttag = {NULL, 0};
+ str reason = {"mi_terminated", 13};
if (d_table == NULL)
goto end;
@@ -448,9 +449,9 @@ struct mi_root * mi_terminate_dlg(struct mi_root *cmd_tree, void
*param) {
dlg = get_dlg(&callid, &ftag, &ttag, &dir); //increments ref count!
if (dlg) {
- LM_DBG("Found dialog to terminate and it is in state [%i]\n",
dlg->state);
+ LM_DBG("Found dialog to terminate and it is in state [%i] [%.*s]\n",
dlg->state, mi_extra_hdrs.len, mi_extra_hdrs.s);
- if (dlg_terminate(dlg, 0, NULL/*reson*/, /* all sides of a dialog*/ 2,
&mi_extra_hdrs) < 0) {
+ if (dlg_terminate(dlg, 0, &reason/*reson*/, /* all sides of a dialog*/ 2,
&mi_extra_hdrs) < 0) {
status = 500;
msg = MI_DLG_OPERATION_ERR;
msg_len = MI_DLG_OPERATION_ERR_LEN;
diff --git a/modules/ims_dialog/ims_dialog.c b/modules/ims_dialog/ims_dialog.c
index 6d4732a..94c84e6 100644
--- a/modules/ims_dialog/ims_dialog.c
+++ b/modules/ims_dialog/ims_dialog.c
@@ -929,7 +929,9 @@ static const char *rpc_end_dlg_entry_id_doc[2] = {
static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
unsigned int h_entry, h_id;
struct dlg_cell * dlg = NULL;
- str rpc_extra_hdrs = {NULL,0};
+ str rpc_extra_hdrs = {0,0};
+ str dfl_rpc_extra_hdrs = {"Reason: mi_terminated\r\n",23};
+ str reason = {"mi_terminated", 12};
int n;
n = rpc->scan(c, "dd", &h_entry, &h_id);
@@ -940,7 +942,7 @@ static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
}
if(rpc->scan(c, "*S", &rpc_extra_hdrs)<1)
{
- rpc_extra_hdrs.s = NULL;
+ rpc_extra_hdrs = dfl_rpc_extra_hdrs;
rpc_extra_hdrs.len = 0;
}
@@ -951,8 +953,8 @@ static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
}
unref_dlg(dlg, 1);
-
- dlg_terminate(dlg, NULL, NULL/*reason*/, 2, NULL);
+ LM_DBG("Setting reason to [%.*s] and extra headers to [%.*s]\n",
reason.len, reason.s, rpc_extra_hdrs.len, rpc_extra_hdrs.s);
+ dlg_terminate(dlg, NULL, &reason/*reason*/, 2, &rpc_extra_hdrs);
}