From fd2d1fbc79e1717fe9e4539677ba2eb38c6d4d69 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Wed, 31 Jan 2007 04:44:09 +0000 Subject: [PATCH] allow-adaptations added as cgi var to sendmms interface --- mbuni/ChangeLog | 2 ++ mbuni/doc/userguide.shtml | 13 +++++++++++-- mbuni/mmlib/mms_mm7soap.c | 8 ++++++++ mbuni/mmlib/mms_msg.c | 2 +- mbuni/mmsbox/bearerbox.c | 3 ++- mbuni/mmsbox/mmsbox.c | 15 ++++++++++++++- 6 files changed, 38 insertions(+), 5 deletions(-) diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 8aaf436..ef94304 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2007-01-31 Vincent Chavanis + * Patch to allow controlling content adaptation on mmsbox side from sendmms interface 2007-01-30 Paul A. Bagyenda * Fix for MM4 incoming, thanks to Vincent Chavanis (and Deon van der Merwe for testing) diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml index b873ce2..aa30f35 100644 --- a/mbuni/doc/userguide.shtml +++ b/mbuni/doc/userguide.shtml @@ -2228,8 +2228,7 @@ faked-sender = 100

- The Send MMS service can be invoked using HTTP GET or POST (both - x-www-form-urlencoded and multipart/form-data) requests to the + The Send MMS service can be invoked using HTTP GET or POST requests to the Send MMS port on the VAS Gateway hosts. The interface expects and processes the following CGI paramerters:

@@ -2415,6 +2414,16 @@ faked-sender = 100
+ + + allow-adaptations + + + Should be 1 (yes) or 0 (no). This flag will be passed on to the + operator MMSC (MM7/SOAP only) to turn on/off content adapation. + + +

diff --git a/mbuni/mmlib/mms_mm7soap.c b/mbuni/mmlib/mms_mm7soap.c index de99fa9..6f14b0d 100644 --- a/mbuni/mmlib/mms_mm7soap.c +++ b/mbuni/mmlib/mms_mm7soap.c @@ -966,6 +966,13 @@ MSoapMsg_t *mm7_mmsmsg_to_soap(MmsMsg *msg, Octstr *from, List *xto, http_header_add(m->envelope, "ReadReply", val); octstr_destroy(s); } + /* Track adaptations stuff -- Vincent */ + if ((s = mms_get_header_value(msg, octstr_imm("X-Mms-Allow-Adaptations"))) != NULL) { + char *val = (octstr_case_compare(s, octstr_imm("true")) == 0) ? + "true" : "false"; + http_header_add(m->envelope, "allowAdaptations", val); + octstr_destroy(s); + } } @@ -985,6 +992,7 @@ MSoapMsg_t *mm7_mmsmsg_to_soap(MmsMsg *msg, Octstr *from, List *xto, http_header_remove_all(headers, "Subject"); http_header_remove_all(headers, "X-Mms-Message-Type"); http_header_remove_all(headers, "X-Mms-Message-Version"); + http_header_remove_all(headers, "X-Mms-Allow-Adaptations"); http_header_remove_all(headers, "From"); http_header_remove_all(headers, "To"); http_header_remove_all(headers, "Cc"); diff --git a/mbuni/mmlib/mms_msg.c b/mbuni/mmlib/mms_msg.c index f803cdd..2574c7d 100644 --- a/mbuni/mmlib/mms_msg.c +++ b/mbuni/mmlib/mms_msg.c @@ -278,7 +278,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, ret = wsp_field_value(context, &val); if (parse_error(context)) { - warning(0, "Faulty header [code = %d], skipping remaining headers.", field_type); + warning(0, "Faulty header [code=%d], skipping remaining headers.", field_type); parse_skip_to_limit(context); return -1; } diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 421fd2d..437d423 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -663,7 +663,8 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, Octstr *to, mmc ? octstr_get_cstr(mmc->id) : "", mms_message_type_to_cstr(mtype), octstr_get_cstr(from), octstr_get_cstr(to)); - + + http_header_remove_all(rh, "X-Mms-Allow-Adaptations"); http_header_add(rh, "X-NOKIA-MMSC-To", octstr_get_cstr(to)); http_header_add(rh, "X-NOKIA-MMSC-From", octstr_get_cstr(from)); http_header_add(rh, "X-NOKIA-MMSC-Version", EAIF_VERSION); diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 15e0e24..17442f2 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -894,6 +894,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, { Octstr *from = NULL, *subject = NULL, *turl = get_toplevel_url(base_url); Octstr *dlr_url = NULL, *rr_url = NULL, *mmc = NULL, *xservice_code = NULL; + Octstr *allow_adaptations = NULL; MmsMsg *m = NULL; MIMEEntity *me = mime_entity_create(); List *hdrs = NULL, *xheaders = NULL; @@ -1031,6 +1032,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, } dlr_url = http_header_value(reply_headers, octstr_imm("X-Mbuni-DLR-Url")); rr_url = http_header_value(reply_headers, octstr_imm("X-Mbuni-RR-Url")); + allow_adaptations = http_header_value(reply_headers, octstr_imm("X-Mbuni-Allow-Adaptations")); mmc = http_header_value(reply_headers, octstr_imm("X-Mbuni-MMSC")); } @@ -1058,6 +1060,10 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers, http_header_add(xheaders, "X-Mms-Delivery-Report", "Yes"); if (rr_url) http_header_add(xheaders, "X-Mms-Read-Report", "Yes"); + if (allow_adaptations) + http_header_add(xheaders, "X-Mms-Allow-Adaptations", + (octstr_str_compare(allow_adaptations, "true") == 0) ? "true" : "false"); + if (subject) http_header_add(xheaders, "Subject", octstr_get_cstr(subject)); if (expiryt > 0) { @@ -1128,6 +1134,8 @@ done: if (rr_url) octstr_destroy(rr_url); + if (allow_adaptations) + octstr_destroy(allow_adaptations); if (from) octstr_destroy(from); if (subject) @@ -1187,7 +1195,7 @@ static void sendmms_func(void *unused) if ((u = auth_user(username, password)) != NULL && is_allowed_ip(sendmms_port.allow_ip, sendmms_port.deny_ip, ip)) { Octstr *data, *ctype = NULL, *mmc, *to, *from, *dlr_url; - Octstr *rr_url, *subject = NULL; + Octstr *rr_url, *allow_adaptations, *subject = NULL; List *lto = NULL, *rh = http_create_empty_headers(); Octstr *rb = NULL, *base_url; int i, n, res = 0; @@ -1227,6 +1235,7 @@ static void sendmms_func(void *unused) dlr_url = http_cgi_variable(cgivars, "dlr-url"); rr_url = http_cgi_variable(cgivars, "rr-url"); + allow_adaptations = http_cgi_variable(cgivars, "allow-adaptations"); mmc = http_cgi_variable(cgivars, "mmsc"); subject = http_cgi_variable(cgivars, "subject"); @@ -1260,6 +1269,10 @@ static void sendmms_func(void *unused) if (rr_url) http_header_add(rh, "X-Mbuni-RR-Url", octstr_get_cstr(rr_url)); + if (allow_adaptations) + http_header_add(rh, "X-Mbuni-Allow-Adaptations", + (octstr_str_compare(allow_adaptations, "1") == 0) ? "true" : "false"); + if (mmc) http_header_add(rh, "X-Mbuni-MMSC", octstr_get_cstr(mmc));