Skip to content

Commit 953d138

Browse files
Merge pull request #3277 from smititelu/master
dialog: add one more param to dlg_send_sequential mi function
2 parents 1d712c1 + 48bbd31 commit 953d138

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

modules/dialog/dialog.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ static const mi_export_t mi_cmds[] = {
433433
{mi_send_sequential_dlg, {"callid", "mode", "body", 0}},
434434
{mi_send_sequential_dlg, {"callid", "method", "body", 0}},
435435
{mi_send_sequential_dlg, {"callid", "method", "body", "mode", 0}},
436+
{mi_send_sequential_dlg, {"callid", "method", "body", "mode", "headers", 0}},
436437
{EMPTY_MI_RECIPE}}
437438
},
438439
{EMPTY_MI_EXPORT}

modules/dialog/dlg_req_within.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ static void dlg_sequential_reply(struct cell* t, int type, struct tmcb_params* p
796796
}
797797

798798
static mi_response_t *mi_send_sequential(struct dlg_cell *dlg, int sleg,
799-
str *method, str *body, str *ct, int challenge, struct mi_handler *async_hdl)
799+
str *method, str *body, str *headers, str *ct, int challenge, struct mi_handler *async_hdl)
800800
{
801801
struct dlg_sequential_param *param;
802802
int dleg = other_leg(dlg, sleg);
@@ -817,7 +817,7 @@ static mi_response_t *mi_send_sequential(struct dlg_cell *dlg, int sleg,
817817
param->method.s = (char *)(param + 1);
818818
memcpy(param->method.s, method->s, method->len);
819819

820-
if (!dlg_get_leg_hdrs(dlg, sleg, dleg, ct, NULL, &extra_headers)) {
820+
if (!dlg_get_leg_hdrs(dlg, sleg, dleg, ct, headers, &extra_headers)) {
821821
LM_ERR("No more pkg for extra headers \n");
822822
shm_free(param);
823823
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,
953953
str callid;
954954
str body;
955955
str ct;
956+
str headers;
956957
int leg, challenge, body_mode;
957958

958959
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,
966967
method.len = 6;
967968
}
968969

970+
if (try_get_mi_string_param(params, "headers", &headers.s, &headers.len) < 0) {
971+
headers.s = "";
972+
headers.len = 0;
973+
}
974+
969975
if ((body_mode = mi_parse_body_mode(params, &ct, &body)) < 0)
970976
return init_mi_error(400, MI_SSTR("Invalid body mode"));
971977

@@ -998,7 +1004,7 @@ mi_response_t *mi_send_sequential_dlg(const mi_params_t *params,
9981004
content = NULL;
9991005

10001006
return mi_send_sequential(dlg, leg, &method,
1001-
(body_mode == 0?NULL:&body), content, challenge, async_hdl);
1007+
(body_mode == 0?NULL:&body), &headers, content, challenge, async_hdl);
10021008
}
10031009

10041010
struct dlg_indialog_req_param {

modules/dialog/doc/dialog_admin.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3132,6 +3132,10 @@ event_route[E_RTPPROXY_DTMF] {
31323132
</para></listitem>
31333133
</itemizedlist>
31343134
</para></listitem>
3135+
<listitem><para>
3136+
<emphasis>headers</emphasis> - (optional) can be used to specify some headers for
3137+
the initial sequential message.
3138+
</para></listitem>
31353139
</itemizedlist>
31363140
<para>
31373141
This functions runs asynchronously and returns the status code and reason
@@ -3166,6 +3170,18 @@ event_route[E_RTPPROXY_DTMF] {
31663170
method=UPDATE
31673171
</programlisting>
31683172

3173+
<para>
3174+
MI Command used to send REFER to the callee, and add Refer-To header:
3175+
</para>
3176+
<programlisting format="linespecific">
3177+
opensips-cli -x mi dlg_send_sequential \
3178+
callid=usR8FlGOSMfCTAIHebHCOQ.. \
3179+
method=REFER \
3180+
body=none \
3181+
mode=callee \
3182+
headers='Refer-To: sip:user@domain:50060'
3183+
</programlisting>
3184+
31693185
</section>
31703186
</section>
31713187

0 commit comments

Comments
 (0)