Skip to content

Commit

Permalink
msrp_ua: add ability to explicitly request MSRP Reports
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlad-patrascu committed Jan 6, 2023
1 parent 7dfe285 commit d4a7ded
Show file tree
Hide file tree
Showing 5 changed files with 365 additions and 53 deletions.
4 changes: 2 additions & 2 deletions modules/msrp_gateway/msrp_gateway.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ int msrpua_notify_cb(struct msrp_ua_notify_params *params, void *hdl_param)
list_del(&msg->list);

if (msrpua_api.send_message(&sess->msrpua_sess_id,
&msg->content_type, &msg->body) < 0)
&msg->content_type, &msg->body, MSRP_FAILURE_REPORT_NO, 0) < 0)
LM_ERR("Failed to send queued message to MSRP side\n");

shm_free(msg);
Expand Down Expand Up @@ -669,7 +669,7 @@ static int msg_to_msrp(struct sip_msg *msg, str *key, str *content_types)

if (sess->msrpua_sess_id.s) {
if (msrpua_api.send_message(&sess->msrpua_sess_id,
&msg->content_type->body, &body) < 0) {
&msg->content_type->body, &body, MSRP_FAILURE_REPORT_NO, 0) < 0) {
LM_ERR("Failed to send message to MSRP side\n");
goto error;
}
Expand Down
9 changes: 8 additions & 1 deletion modules/msrp_ua/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ typedef int (*init_uac_f)(str *accept_types, str *from_uri, str *to_uri,

typedef int (*end_session_f)(str *session_id);

typedef int (*send_message_f)(str *session_id, str *mime, str *body);
enum msrp_failure_report_type {
MSRP_FAILURE_REPORT_YES,
MSRP_FAILURE_REPORT_PARTIAL,
MSRP_FAILURE_REPORT_NO
};

typedef int (*send_message_f)(str *session_id, str *mime, str *body,
enum msrp_failure_report_type failure_report, int success_report);

struct msrp_ua_binds {
init_uas_f init_uas;
Expand Down
64 changes: 59 additions & 5 deletions modules/msrp_ua/doc/msrp_ua_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,31 @@ if (!has_totag() &amp;&amp; is_method("INVITE")) {
<emphasis>body</emphasis> (string, optional) - actual message
body. If missing, an empty message will be sent.
</para></listitem>
<listitem><para>
<emphasis>success_report</emphasis> (string, optional) - string
indicating whether to request an MSRP Success Report. Possible
values are <emphasis>yes</emphasis> or <emphasis>no</emphasis>.
If the parameter is missing or is set to "no" the SEND request
will not include a Success-Report header.
</para></listitem>
<listitem><para>
<emphasis>failure_report</emphasis> (string, optional) - string
indicating whether to request an MSRP Failure Report. Possible
values are <emphasis>yes</emphasis>, <emphasis>no</emphasis> or
<emphasis>partial</emphasis>, as specified in MSRP.
If the parameter is missing or is set to "yes" the SEND request
will not include a Failure-Report header. Note that if the header
field is not present, the receving MSRP endpoint must treat it the
same as a Failure-Report header with a value of "yes".
</para></listitem>
</itemizedlist>
<para>
MI FIFO Command Format:
</para>
<programlisting format="linespecific">
opensips-cli -x mi msrp_ua_send_message \
5addd9e7b74fa44fbace68a4fc562293 \
text/plain \
Hello
session_id=5addd9e7b74fa44fbace68a4fc562293 \
mime=text/plain body=Hello success_report=yes
</programlisting>
</section>

Expand Down Expand Up @@ -418,8 +434,8 @@ opensips-cli -x mi msrp_ua_end_session \
<function moreinfo="none">E_MSRP_MSG_RECEIVED</function>
</title>
<para>
This event is triggered when receiving a new, non-empty MSRP message
from the peer.
This event is triggered when receiving a new, non-empty MSRP SEND
request from the peer.
</para>
<para>Parameters:</para>
<itemizedlist>
Expand All @@ -434,6 +450,44 @@ opensips-cli -x mi msrp_ua_end_session \
<emphasis>body</emphasis> - The actual message body.
</para></listitem>
</itemizedlist>
</section>

<section id="event_E_MSRP_REPORT_RECEIVED" xreflabel="E_MSRP_REPORT_RECEIVED">
<title>
<function moreinfo="none">E_MSRP_REPORT_RECEIVED</function>
</title>
<para>
This event is triggered when:
<itemizedlist>
<listitem><para>
a MSRP REPORT request is received
</para></listitem>
<listitem><para>
a failure transaction response is received
</para></listitem>
<listitem><para>
a local timeout for a SEND request occured.
</para></listitem>
</itemizedlist>
</para>
<para>Parameters:</para>
<itemizedlist>
<listitem><para>
<emphasis>session_id</emphasis> - The MSRP session identifier
("session-id" part of the MSRP URI).
</para></listitem>
<listitem><para>
<emphasis>message_id</emphasis> - The value of the Message-ID
header field.
</para></listitem>
<listitem><para>
<emphasis>status</emphasis> - The value of the Status header field.
</para></listitem>
<listitem><para>
<emphasis>byte_range</emphasis> - The value of the Byte-Range header
field.
</para></listitem>
</itemizedlist>
</section>

</section>
Expand Down

0 comments on commit d4a7ded

Please sign in to comment.