minor fixes re filtering
This commit is contained in:
parent
e6a0b2d72c
commit
cc3a502516
|
@ -1587,9 +1587,10 @@ Boolean
|
||||||
|
|
||||||
<td valign=top >
|
<td valign=top >
|
||||||
Optional library to be used for filtering/transforming all content (except
|
Optional library to be used for filtering/transforming all content (except
|
||||||
SMIL), while building the MT MMS from a SMIL file. This is useful if say you want
|
SMIL), while building the MT MMS from a SMIL file (or from a
|
||||||
to implement custom filtering/transformation of content (e.g. DRM
|
file). This is useful if say you want to implement custom
|
||||||
wrappers around selected content). Note that only elements
|
filtering/transformation of content (e.g. DRM wrappers around
|
||||||
|
selected content). Note that only elements
|
||||||
referenced within the returned SMIL are filtered. See
|
referenced within the returned SMIL are filtered. See
|
||||||
<tt>mmsbox_mt_filter.h</tt> for details. Also see
|
<tt>mmsbox_mt_filter.h</tt> for details. Also see
|
||||||
<tt>mm7-mt-filter-params</tt> config variable in the <a href="#mmsc_vasp">VAS specific
|
<tt>mm7-mt-filter-params</tt> config variable in the <a href="#mmsc_vasp">VAS specific
|
||||||
|
@ -2568,6 +2569,24 @@ faked-sender = 100<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign=top >
|
||||||
|
<tt>mclass</tt>
|
||||||
|
</td>
|
||||||
|
<td valign=top>
|
||||||
|
Message Class. (e.g. Personal)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign=top >
|
||||||
|
<tt>priority</tt>
|
||||||
|
</td>
|
||||||
|
<td valign=top>
|
||||||
|
Message Priority. (e.g. Normal)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
@ -3127,6 +3146,24 @@ A detailed list of configuration parameters for MMS Services is given below.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign=top >
|
||||||
|
<tt>X-Mbuni-MessageClass</tt>
|
||||||
|
</td>
|
||||||
|
<td valign=top >
|
||||||
|
<b>Message Class</b> parameter for message.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign=top >
|
||||||
|
<tt>X-Mbuni-Priority</tt>
|
||||||
|
</td>
|
||||||
|
<td valign=top >
|
||||||
|
MMS message priority
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -1385,7 +1385,6 @@ MmsMsg *mms_frommime(MIMEEntity *mime)
|
||||||
m = gw_malloc(sizeof *m);
|
m = gw_malloc(sizeof *m);
|
||||||
memset(m, 0, sizeof *m);
|
memset(m, 0, sizeof *m);
|
||||||
|
|
||||||
n = mime_entity_num_parts(mime);
|
|
||||||
mx = mime_entity_duplicate(mime);
|
mx = mime_entity_duplicate(mime);
|
||||||
|
|
||||||
unconvert_mime_msg(mx); /* Fix-up content type issues. */
|
unconvert_mime_msg(mx); /* Fix-up content type issues. */
|
||||||
|
@ -1393,7 +1392,7 @@ MmsMsg *mms_frommime(MIMEEntity *mime)
|
||||||
unbase64_mimeparts(mx);
|
unbase64_mimeparts(mx);
|
||||||
|
|
||||||
m->headers = mime_entity_headers(mx);
|
m->headers = mime_entity_headers(mx);
|
||||||
if (n > 0) {
|
if ((n = mime_entity_num_parts(mx)) > 0) {
|
||||||
m->ismultipart = 1;
|
m->ismultipart = 1;
|
||||||
m->body.l = gwlist_create();
|
m->body.l = gwlist_create();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
|
|
|
@ -295,11 +295,11 @@ enum _xurltype {FILE_TYPE, URL_TYPE};
|
||||||
static Octstr *url_path_prefix(Octstr *url, int type);
|
static Octstr *url_path_prefix(Octstr *url, int type);
|
||||||
|
|
||||||
static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
||||||
|
Octstr *msg_url,
|
||||||
Octstr *base_url, int type, MmsEnvelope *e,
|
Octstr *base_url, int type, MmsEnvelope *e,
|
||||||
Octstr *svc_name, Octstr *faked_sender, Octstr *service_code,
|
Octstr *svc_name, Octstr *faked_sender, Octstr *service_code,
|
||||||
int accept_x_headers,
|
int accept_x_headers,
|
||||||
List *passthro_headers,
|
List *passthro_headers,
|
||||||
Octstr *mmc_id,
|
|
||||||
Octstr **err);
|
Octstr **err);
|
||||||
static int fetch_serviceurl(MmsEnvelope *e,
|
static int fetch_serviceurl(MmsEnvelope *e,
|
||||||
MmsService *ms, MmsMsg *m,
|
MmsService *ms, MmsMsg *m,
|
||||||
|
@ -422,10 +422,12 @@ static int fetch_serviceurl(MmsEnvelope *e,
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
Octstr *base_url = url_path_prefix(ms->url, typ);
|
Octstr *base_url = url_path_prefix(ms->url, typ);
|
||||||
res = make_and_queue_msg(rb, ctype, rph, base_url,
|
res = make_and_queue_msg(rb, ctype, rph,
|
||||||
|
ms->url,
|
||||||
|
base_url,
|
||||||
typ, e, ms->name, ms->faked_sender, ms->service_code,
|
typ, e, ms->name, ms->faked_sender, ms->service_code,
|
||||||
ms->accept_x_headers, ms->passthro_headers,
|
ms->accept_x_headers, ms->passthro_headers,
|
||||||
e->fromproxy, err);
|
err);
|
||||||
|
|
||||||
if (base_url)
|
if (base_url)
|
||||||
octstr_destroy(base_url);
|
octstr_destroy(base_url);
|
||||||
|
@ -795,15 +797,15 @@ static void add_msg_parts(MIMEEntity *res, xmlNodePtr node, Octstr *base_url,
|
||||||
|
|
||||||
/* Given content, make a message. We'll also use this for send-mms-user! */
|
/* Given content, make a message. We'll also use this for send-mms-user! */
|
||||||
static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
||||||
|
Octstr *msg_url,
|
||||||
Octstr *base_url, int type, MmsEnvelope *e,
|
Octstr *base_url, int type, MmsEnvelope *e,
|
||||||
Octstr *svc_name, Octstr *faked_sender, Octstr *service_code,
|
Octstr *svc_name, Octstr *faked_sender, Octstr *service_code,
|
||||||
int accept_x_headers, List *passthro_headers,
|
int accept_x_headers, List *passthro_headers,
|
||||||
Octstr *mmc_id,
|
|
||||||
Octstr **err)
|
Octstr **err)
|
||||||
{
|
{
|
||||||
Octstr *from = NULL, *subject = NULL, *turl = get_toplevel_url(base_url);
|
Octstr *from = NULL, *xfrom = NULL, *subject = NULL, *turl = get_toplevel_url(base_url);
|
||||||
Octstr *dlr_url = NULL, *rr_url = NULL, *mmc = NULL, *xservice_code = NULL;
|
Octstr *dlr_url = NULL, *rr_url = NULL, *mmc = NULL, *xservice_code = NULL, *hsvc_code = NULL;
|
||||||
Octstr *allow_adaptations = NULL;
|
Octstr *allow_adaptations = NULL, *mclass = NULL, *prio = NULL;
|
||||||
MmsMsg *m = NULL;
|
MmsMsg *m = NULL;
|
||||||
MIMEEntity *me = mime_entity_create();
|
MIMEEntity *me = mime_entity_create();
|
||||||
List *hdrs = NULL, *xheaders = NULL;
|
List *hdrs = NULL, *xheaders = NULL;
|
||||||
|
@ -815,32 +817,83 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
||||||
int i, n, res = -1;
|
int i, n, res = -1;
|
||||||
|
|
||||||
gw_assert(svc_name);
|
gw_assert(svc_name);
|
||||||
|
|
||||||
|
/* Get headers needed, if we are allowed to do so. */
|
||||||
|
if (accept_x_headers && reply_headers) {
|
||||||
|
Octstr *x = NULL;
|
||||||
|
List *l = NULL;
|
||||||
|
subject = http_header_value(reply_headers, octstr_imm("X-Mbuni-Subject"));
|
||||||
|
|
||||||
|
if ((x = http_header_value(reply_headers, octstr_imm("X-Mbuni-Expiry"))) != NULL)
|
||||||
|
expiryt = date_parse_http(x);
|
||||||
|
|
||||||
|
if ((l = http_header_find_all(reply_headers, "X-Mbuni-To")) != NULL) {
|
||||||
|
int i, n;
|
||||||
|
for (i = 0, n = gwlist_len(l); i<n; i++) {
|
||||||
|
Octstr *h = NULL, *v = NULL;
|
||||||
|
List *hv = NULL;
|
||||||
|
int j;
|
||||||
|
http_header_get(l, i, &h, &v);
|
||||||
|
|
||||||
|
hv = http_header_split_value(v);
|
||||||
|
|
||||||
|
for (j = 0; j < gwlist_len(hv); j++) {
|
||||||
|
Octstr *v = gwlist_get(hv, j);
|
||||||
|
/* Fix the address. */
|
||||||
|
_mms_fixup_address(v, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL);
|
||||||
|
gwlist_append(xto, v);
|
||||||
|
}
|
||||||
|
octstr_destroy(v);
|
||||||
|
octstr_destroy(h);
|
||||||
|
gwlist_destroy(hv, NULL); /* Don't kill strings since we added them to xto above! */
|
||||||
|
}
|
||||||
|
http_destroy_headers(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
xfrom = http_header_value(reply_headers, octstr_imm("X-Mbuni-From"));
|
||||||
|
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"));
|
||||||
|
mclass = http_header_value(reply_headers, octstr_imm("X-Mbuni-MessageClass"));
|
||||||
|
prio = http_header_value(reply_headers, octstr_imm("X-Mbuni-Priority"));
|
||||||
|
hsvc_code = http_header_value(reply_headers, octstr_imm("X-Mbuni-ServiceCode"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gwlist_len(xto) == 0 && e && e->from)
|
||||||
|
gwlist_append(xto, octstr_duplicate(e->from));
|
||||||
|
|
||||||
|
if (!subject && e && e->subject)
|
||||||
|
subject = octstr_duplicate(e->subject);
|
||||||
|
|
||||||
|
if (!mmc && e)
|
||||||
|
mmc = e->fromproxy;
|
||||||
|
|
||||||
/* Get the from address. */
|
/* Get the from address. */
|
||||||
if (faked_sender)
|
if (faked_sender)
|
||||||
from = octstr_duplicate(faked_sender);
|
from = octstr_duplicate(faked_sender);
|
||||||
else if (accept_x_headers && reply_headers &&
|
else if (xfrom != NULL)
|
||||||
(from = http_header_value(reply_headers, octstr_imm("X-Mbuni-From"))) != NULL)
|
from = octstr_duplicate(xfrom); /* all done above. */
|
||||||
(void)0; /* all done above. */
|
|
||||||
else {
|
else {
|
||||||
/* get first recipient, set that as sender. */
|
/* get first recipient, set that as sender. */
|
||||||
MmsEnvelopeTo *r = (e) ? gwlist_get(e->to, 0) : NULL;
|
MmsEnvelopeTo *r = (e) ? gwlist_get(e->to, 0) : NULL;
|
||||||
if (r)
|
if (r)
|
||||||
from = octstr_duplicate(r->rcpt);
|
from = octstr_duplicate(r->rcpt);
|
||||||
else
|
else
|
||||||
from = octstr_imm("anon@anon");
|
from = octstr_create("anon@anon");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get service code. */
|
/* Get service code. */
|
||||||
if (service_code)
|
if (service_code)
|
||||||
xservice_code = octstr_duplicate(service_code);
|
xservice_code = octstr_duplicate(service_code);
|
||||||
else if (accept_x_headers && reply_headers)
|
else if (hsvc_code)
|
||||||
xservice_code = http_header_value(reply_headers, octstr_imm("X-Mbuni-ServiceCode"));
|
xservice_code = octstr_duplicate(hsvc_code);
|
||||||
|
|
||||||
if (from)
|
if (from)
|
||||||
_mms_fixup_address(from, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL);
|
_mms_fixup_address(from, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL);
|
||||||
|
|
||||||
/* start with the easy one... */
|
/* Now get the data. */
|
||||||
if (octstr_case_compare(ctype, octstr_imm("application/vnd.wap.mms-message")) == 0)
|
if (octstr_case_compare(ctype, octstr_imm("application/vnd.wap.mms-message")) == 0)
|
||||||
m = mms_frombinary(data, from);
|
m = mms_frombinary(data, from);
|
||||||
else if (octstr_case_compare(ctype, octstr_imm("application/smil")) == 0) {
|
else if (octstr_case_compare(ctype, octstr_imm("application/smil")) == 0) {
|
||||||
|
@ -868,7 +921,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
||||||
|
|
||||||
add_msg_parts(me, smil->xmlChildrenNode,
|
add_msg_parts(me, smil->xmlChildrenNode,
|
||||||
base_url, turl, type, svc_name,
|
base_url, turl, type, svc_name,
|
||||||
mmc_id, url_map);
|
mmc, url_map);
|
||||||
|
|
||||||
dict_destroy(url_map);
|
dict_destroy(url_map);
|
||||||
/* SMIL has been modified, convert it to text, put it in. */
|
/* SMIL has been modified, convert it to text, put it in. */
|
||||||
|
@ -908,54 +961,11 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
||||||
|
|
||||||
http_destroy_headers(xh);
|
http_destroy_headers(xh);
|
||||||
mime_entity_set_body(me, data);
|
mime_entity_set_body(me, data);
|
||||||
|
|
||||||
|
if (mt_filter && mmc) /* filter it too. */
|
||||||
|
mt_filter->filter(&me, msg_url, mmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get headers needed, if we are allowed to do so. */
|
|
||||||
if (accept_x_headers && reply_headers) {
|
|
||||||
Octstr *x = NULL;
|
|
||||||
List *l = NULL;
|
|
||||||
subject = http_header_value(reply_headers, octstr_imm("X-Mbuni-Subject"));
|
|
||||||
|
|
||||||
if ((x = http_header_value(reply_headers, octstr_imm("X-Mbuni-Expiry"))) != NULL)
|
|
||||||
expiryt = date_parse_http(x);
|
|
||||||
|
|
||||||
if ((l = http_header_find_all(reply_headers, "X-Mbuni-To")) != NULL) {
|
|
||||||
int i, n;
|
|
||||||
for (i = 0, n = gwlist_len(l); i<n; i++) {
|
|
||||||
Octstr *h = NULL, *v = NULL;
|
|
||||||
List *hv = NULL;
|
|
||||||
int j;
|
|
||||||
http_header_get(l, i, &h, &v);
|
|
||||||
|
|
||||||
hv = http_header_split_value(v);
|
|
||||||
|
|
||||||
for (j = 0; j < gwlist_len(hv); j++) {
|
|
||||||
Octstr *v = gwlist_get(hv, j);
|
|
||||||
/* Fix the address. */
|
|
||||||
_mms_fixup_address(v, unified_prefix ? octstr_get_cstr(unified_prefix) : NULL);
|
|
||||||
gwlist_append(xto, v);
|
|
||||||
}
|
|
||||||
octstr_destroy(v);
|
|
||||||
octstr_destroy(h);
|
|
||||||
gwlist_destroy(hv, NULL); /* Don't kill strings since we added them to xto above! */
|
|
||||||
}
|
|
||||||
http_destroy_headers(l);
|
|
||||||
}
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gwlist_len(xto) == 0 && e && e->from)
|
|
||||||
gwlist_append(xto, octstr_duplicate(e->from));
|
|
||||||
|
|
||||||
if (!subject && e && e->subject)
|
|
||||||
subject = octstr_duplicate(e->subject);
|
|
||||||
|
|
||||||
if (!mmc && e)
|
|
||||||
mmc = e->fromproxy;
|
|
||||||
|
|
||||||
/* Add some nice headers. */
|
/* Add some nice headers. */
|
||||||
xheaders = mime_entity_headers(me);
|
xheaders = mime_entity_headers(me);
|
||||||
|
@ -974,7 +984,13 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
||||||
if (allow_adaptations)
|
if (allow_adaptations)
|
||||||
http_header_add(xheaders, "X-Mms-Allow-Adaptations",
|
http_header_add(xheaders, "X-Mms-Allow-Adaptations",
|
||||||
(octstr_str_compare(allow_adaptations, "true") == 0) ? "true" : "false");
|
(octstr_str_compare(allow_adaptations, "true") == 0) ? "true" : "false");
|
||||||
|
|
||||||
|
if (mclass)
|
||||||
|
http_header_add(xheaders, "X-Mms-Message-Class", octstr_get_cstr(mclass));
|
||||||
|
|
||||||
|
if (prio)
|
||||||
|
http_header_add(xheaders, "X-Mms-Priority", octstr_get_cstr(prio));
|
||||||
|
|
||||||
if (subject)
|
if (subject)
|
||||||
http_header_add(xheaders, "Subject", octstr_get_cstr(subject));
|
http_header_add(xheaders, "Subject", octstr_get_cstr(subject));
|
||||||
if (expiryt > 0) {
|
if (expiryt > 0) {
|
||||||
|
@ -1039,17 +1055,13 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
||||||
res = 0;
|
res = 0;
|
||||||
done:
|
done:
|
||||||
|
|
||||||
if (dlr_url)
|
octstr_destroy(dlr_url);
|
||||||
octstr_destroy(dlr_url);
|
octstr_destroy(rr_url);
|
||||||
|
octstr_destroy(mclass);
|
||||||
if (rr_url)
|
octstr_destroy(prio);
|
||||||
octstr_destroy(rr_url);
|
octstr_destroy(allow_adaptations);
|
||||||
|
octstr_destroy(from);
|
||||||
if (allow_adaptations)
|
octstr_destroy(xfrom);
|
||||||
octstr_destroy(allow_adaptations);
|
|
||||||
if (from)
|
|
||||||
octstr_destroy(from);
|
|
||||||
if (subject)
|
|
||||||
octstr_destroy(subject);
|
octstr_destroy(subject);
|
||||||
if (me)
|
if (me)
|
||||||
mime_entity_destroy(me);
|
mime_entity_destroy(me);
|
||||||
|
@ -1059,9 +1071,9 @@ done:
|
||||||
gwlist_destroy(xto, (gwlist_item_destructor_t *)octstr_destroy);
|
gwlist_destroy(xto, (gwlist_item_destructor_t *)octstr_destroy);
|
||||||
if (hdrs)
|
if (hdrs)
|
||||||
http_destroy_headers(hdrs);
|
http_destroy_headers(hdrs);
|
||||||
|
|
||||||
if (xservice_code)
|
octstr_destroy(xservice_code);
|
||||||
octstr_destroy(xservice_code);
|
octstr_destroy(hsvc_code);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1112,12 +1124,23 @@ static void sendmms_func(void *unused)
|
||||||
int i, n, res = 0;
|
int i, n, res = 0;
|
||||||
Octstr *vasid = http_cgi_variable(cgivars, "vasid");
|
Octstr *vasid = http_cgi_variable(cgivars, "vasid");
|
||||||
Octstr *service_code = http_cgi_variable(cgivars, "servicecode");
|
Octstr *service_code = http_cgi_variable(cgivars, "servicecode");
|
||||||
|
Octstr *mclass = http_cgi_variable(cgivars, "mclass");
|
||||||
|
Octstr *prio = http_cgi_variable(cgivars, "priority");
|
||||||
|
Octstr *distro = http_cgi_variable(cgivars, "distribution");
|
||||||
|
Octstr *data_url = NULL;
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
if ((base_url = http_cgi_variable(cgivars, "base-url")) == NULL)
|
if ((base_url = http_cgi_variable(cgivars, "base-url")) == NULL)
|
||||||
base_url = octstr_imm("http://localhost");
|
base_url = octstr_imm("http://localhost");
|
||||||
else
|
else
|
||||||
base_url = octstr_duplicate(base_url); /* because we need to delete it below. */
|
base_url = octstr_duplicate(base_url); /* because we need to delete it below. */
|
||||||
|
|
||||||
|
/* Now get the data. */
|
||||||
if ((data = http_cgi_variable(cgivars, "text")) != NULL) { /* text. */
|
if ((data = http_cgi_variable(cgivars, "text")) != NULL) { /* text. */
|
||||||
Octstr *charset = http_cgi_variable(cgivars, "charset");
|
Octstr *charset = http_cgi_variable(cgivars, "charset");
|
||||||
|
|
||||||
|
@ -1138,6 +1161,7 @@ static void sendmms_func(void *unused)
|
||||||
rb = octstr_format("failed to fetch content from url [%S]!", data);
|
rb = octstr_format("failed to fetch content from url [%S]!", data);
|
||||||
base_url = url_path_prefix(data, URL_TYPE);
|
base_url = url_path_prefix(data, URL_TYPE);
|
||||||
|
|
||||||
|
data_url = octstr_duplicate(data); /* the URL of the message. */
|
||||||
data = reply;
|
data = reply;
|
||||||
|
|
||||||
http_destroy_headers(rh);
|
http_destroy_headers(rh);
|
||||||
|
@ -1162,11 +1186,6 @@ static void sendmms_func(void *unused)
|
||||||
} else
|
} else
|
||||||
rb = octstr_imm("Missing content");
|
rb = octstr_imm("Missing content");
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
if ((to = http_cgi_variable(cgivars, "to")) == NULL)
|
if ((to = http_cgi_variable(cgivars, "to")) == NULL)
|
||||||
rb = octstr_imm("Missing recipient!");
|
rb = octstr_imm("Missing recipient!");
|
||||||
|
@ -1200,21 +1219,29 @@ static void sendmms_func(void *unused)
|
||||||
|
|
||||||
if (allow_adaptations)
|
if (allow_adaptations)
|
||||||
http_header_add(rh, "X-Mbuni-Allow-Adaptations",
|
http_header_add(rh, "X-Mbuni-Allow-Adaptations",
|
||||||
(octstr_str_compare(allow_adaptations, "1") == 0) ? "true" : "false");
|
(octstr_str_compare(allow_adaptations, "1") == 0) ?
|
||||||
|
"true" : "false");
|
||||||
if (mmc)
|
if (mmc)
|
||||||
http_header_add(rh, "X-Mbuni-MMSC", octstr_get_cstr(mmc));
|
http_header_add(rh, "X-Mbuni-MMSC", octstr_get_cstr(mmc));
|
||||||
|
|
||||||
if (subject)
|
if (subject)
|
||||||
http_header_add(rh, "X-Mbuni-Subject", octstr_get_cstr(subject));
|
http_header_add(rh, "X-Mbuni-Subject", octstr_get_cstr(subject));
|
||||||
|
|
||||||
|
if (mclass)
|
||||||
|
http_header_add(rh, "X-Mbuni-MessageClass", octstr_get_cstr(mclass));
|
||||||
|
if (prio)
|
||||||
|
http_header_add(rh, "X-Mbuni-Priority", octstr_get_cstr(prio));
|
||||||
|
if (distro)
|
||||||
|
http_header_add(rh, "X-Mbuni-DistributionIndicator", octstr_get_cstr(distro));
|
||||||
|
|
||||||
/* Requests to make_and_queue below can block, but for now we don't care. */
|
/* Requests to make_and_queue below can block, but for now we don't care. */
|
||||||
if (ctype && data && !rb) { /* only send if no error. */
|
if (ctype && data && !rb) { /* only send if no error. */
|
||||||
res = make_and_queue_msg(data, ctype, rh, base_url, URL_TYPE, NULL,
|
res = make_and_queue_msg(data, ctype, rh,
|
||||||
|
data_url ? data_url : base_url,
|
||||||
|
base_url, URL_TYPE, NULL,
|
||||||
vasid ? vasid : octstr_imm("sendmms-user"),
|
vasid ? vasid : octstr_imm("sendmms-user"),
|
||||||
u->faked_sender, service_code,
|
u->faked_sender, service_code,
|
||||||
1, NULL,
|
1, NULL,
|
||||||
mmc,
|
|
||||||
&err);
|
&err);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
rb = octstr_imm("Error in message conversion");
|
rb = octstr_imm("Error in message conversion");
|
||||||
|
@ -1225,13 +1252,14 @@ static void sendmms_func(void *unused)
|
||||||
info(0, "MMSBox.mmssend: u=%s, %s",
|
info(0, "MMSBox.mmssend: u=%s, %s",
|
||||||
u ? octstr_get_cstr(u->user) : "none",
|
u ? octstr_get_cstr(u->user) : "none",
|
||||||
(res == 0) ? "Sent" : "Not Sent");
|
(res == 0) ? "Sent" : "Not Sent");
|
||||||
|
|
||||||
if (rh)
|
if (rh)
|
||||||
http_destroy_headers(rh);
|
http_destroy_headers(rh);
|
||||||
|
|
||||||
octstr_destroy(ctype);
|
octstr_destroy(ctype);
|
||||||
octstr_destroy(rb);
|
octstr_destroy(rb);
|
||||||
octstr_destroy(base_url);
|
octstr_destroy(base_url);
|
||||||
|
octstr_destroy(data_url);
|
||||||
} else {
|
} else {
|
||||||
http_send_reply(client, HTTP_UNAUTHORIZED, hh,
|
http_send_reply(client, HTTP_UNAUTHORIZED, hh,
|
||||||
octstr_imm("Authentication failed"));
|
octstr_imm("Authentication failed"));
|
||||||
|
|
Loading…
Reference in New Issue