[Asterisk-code-review] res pjsip messaging: Allow application/* for in-dialog MESS... (asterisk[15])

George Joseph asteriskteam at digium.com
Mon Jun 25 07:44:46 CDT 2018


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/9291


Change subject: res_pjsip_messaging:  Allow application/* for in-dialog MESSAGEs
......................................................................

res_pjsip_messaging:  Allow application/* for in-dialog MESSAGEs

In addition to text/* content types, incoming_in_dialog_request now
accepts application/* content types.

ASTERISK-27942

Change-Id: I4e54d8cc6158dc47eb8fdd6ba0108c6fd53f2818
---
M res/res_pjsip_messaging.c
1 file changed, 6 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/91/9291/1

diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
index 38d0813..8afb8bc 100644
--- a/res/res_pjsip_messaging.c
+++ b/res/res_pjsip_messaging.c
@@ -80,19 +80,21 @@
  * \internal
  * \brief Checks to make sure the request has the correct content type.
  *
- * \details This module supports the following media types: "text/\*".
+ * \details This module supports the following media types: "text/\*", "application/\*".
  * Return unsupported otherwise.
  *
  * \param rdata The SIP request
  */
-static enum pjsip_status_code check_content_type_any_text(const pjsip_rx_data *rdata)
+static enum pjsip_status_code check_content_type_in_dialog(const pjsip_rx_data *rdata)
 {
 	int res = PJSIP_SC_UNSUPPORTED_MEDIA_TYPE;
 	pj_str_t text = { "text", 4};
+	pj_str_t application = { "application", 11};
 
 	/* We'll accept any text/ content type */
 	if (rdata->msg_info.msg->body && rdata->msg_info.msg->body->len
-		&& pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0) {
+		&& (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0
+			|| pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &application) == 0)) {
 		res = PJSIP_SC_OK;
 	} else if (rdata->msg_info.ctype
 		&& pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0) {
@@ -800,7 +802,7 @@
 		return 0;
 	}
 
-	code = check_content_type_any_text(rdata);
+	code = check_content_type_in_dialog(rdata);
 	if (code != PJSIP_SC_OK) {
 		send_response(rdata, code, dlg, tsx);
 		return 0;

-- 
To view, visit https://gerrit.asterisk.org/9291
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e54d8cc6158dc47eb8fdd6ba0108c6fd53f2818
Gerrit-Change-Number: 9291
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180625/e513111a/attachment.html>


More information about the asterisk-code-review mailing list