diff --git a/modules/dialog/dialog.c b/modules/dialog/dialog.c index 0a2d46736fd..ff2ecedcadc 100644 --- a/modules/dialog/dialog.c +++ b/modules/dialog/dialog.c @@ -433,6 +433,7 @@ static const mi_export_t mi_cmds[] = { {mi_send_sequential_dlg, {"callid", "mode", "body", 0}}, {mi_send_sequential_dlg, {"callid", "method", "body", 0}}, {mi_send_sequential_dlg, {"callid", "method", "body", "mode", 0}}, + {mi_send_sequential_dlg, {"callid", "method", "body", "mode", "headers", 0}}, {EMPTY_MI_RECIPE}} }, {EMPTY_MI_EXPORT} diff --git a/modules/dialog/dlg_req_within.c b/modules/dialog/dlg_req_within.c index 886b1ab8c7f..30ec05ea625 100644 --- a/modules/dialog/dlg_req_within.c +++ b/modules/dialog/dlg_req_within.c @@ -796,7 +796,7 @@ static void dlg_sequential_reply(struct cell* t, int type, struct tmcb_params* p } static mi_response_t *mi_send_sequential(struct dlg_cell *dlg, int sleg, - str *method, str *body, str *ct, int challenge, struct mi_handler *async_hdl) + str *method, str *body, str *headers, str *ct, int challenge, struct mi_handler *async_hdl) { struct dlg_sequential_param *param; int dleg = other_leg(dlg, sleg); @@ -817,7 +817,7 @@ static mi_response_t *mi_send_sequential(struct dlg_cell *dlg, int sleg, param->method.s = (char *)(param + 1); memcpy(param->method.s, method->s, method->len); - if (!dlg_get_leg_hdrs(dlg, sleg, dleg, ct, NULL, &extra_headers)) { + if (!dlg_get_leg_hdrs(dlg, sleg, dleg, ct, headers, &extra_headers)) { LM_ERR("No more pkg for extra headers \n"); shm_free(param); return init_mi_error(500, MI_SSTR("Internal Error")); @@ -953,6 +953,7 @@ mi_response_t *mi_send_sequential_dlg(const mi_params_t *params, str callid; str body; str ct; + str headers; int leg, challenge, body_mode; if (get_mi_string_param(params, "callid", &callid.s, &callid.len) < 0) @@ -966,6 +967,11 @@ mi_response_t *mi_send_sequential_dlg(const mi_params_t *params, method.len = 6; } + if (try_get_mi_string_param(params, "headers", &headers.s, &headers.len) < 0) { + headers.s = ""; + headers.len = 0; + } + if ((body_mode = mi_parse_body_mode(params, &ct, &body)) < 0) return init_mi_error(400, MI_SSTR("Invalid body mode")); @@ -998,7 +1004,7 @@ mi_response_t *mi_send_sequential_dlg(const mi_params_t *params, content = NULL; return mi_send_sequential(dlg, leg, &method, - (body_mode == 0?NULL:&body), content, challenge, async_hdl); + (body_mode == 0?NULL:&body), &headers, content, challenge, async_hdl); } struct dlg_indialog_req_param { diff --git a/modules/dialog/doc/dialog_admin.xml b/modules/dialog/doc/dialog_admin.xml index 8a5b034e2c6..e0cf6e9b412 100644 --- a/modules/dialog/doc/dialog_admin.xml +++ b/modules/dialog/doc/dialog_admin.xml @@ -3132,6 +3132,10 @@ event_route[E_RTPPROXY_DTMF] { + + headers - (optional) can be used to specify some headers for + the initial sequential message. + This functions runs asynchronously and returns the status code and reason @@ -3166,6 +3170,18 @@ event_route[E_RTPPROXY_DTMF] { method=UPDATE + + MI Command used to send REFER to the callee, and add Refer-To header: + + + opensips-cli -x mi dlg_send_sequential \ + callid=usR8FlGOSMfCTAIHebHCOQ.. \ + method=REFER \ + body=none \ + mode=callee \ + headers='Refer-To: sip:user@domain:50060' + +