1
0
Fork 0

allow-adaptations added as cgi var to sendmms interface

This commit is contained in:
bagyenda 2007-01-31 04:44:09 +00:00
parent 869a6d3eed
commit fd2d1fbc79
6 changed files with 38 additions and 5 deletions

View File

@ -1,3 +1,5 @@
2007-01-31 Vincent Chavanis <vincent@telemaque.fr>
* Patch to allow controlling content adaptation on mmsbox side from sendmms interface
2007-01-30 Paul A. Bagyenda <bagyenda@dsmagic.com>
* Fix for MM4 incoming, thanks to Vincent Chavanis <vincent@telemaque.fr> (and
Deon van der Merwe <deonvandermerwe@gmail.com> for testing)

View File

@ -2228,8 +2228,7 @@ faked-sender = 100<br>
</p>
<p>
The Send MMS service can be invoked using HTTP GET or POST (both
<i>x-www-form-urlencoded</i> and <i>multipart/form-data</i>) 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:
</p>
@ -2415,6 +2414,16 @@ faked-sender = 100<br>
</td>
</tr>
<tr>
<td valign=top >
<tt>allow-adaptations</tt>
</td>
<td valign=top >
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.
</td>
</tr>
</table>
</p>

View File

@ -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");

View File

@ -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;
}

View File

@ -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);

View File

@ -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));