Patch from jacek -- allow-adaptations on a per-MMSC basis
This commit is contained in:
parent
cb989364b8
commit
73955b34cf
|
@ -1,3 +1,5 @@
|
|||
2014-02-11 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Per-mssc allow-adaptations patch, thanks to Jacek Raczkiewicz (jacek at skycore.com)
|
||||
2013-12-16 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Misc speed-ups and patches thanks to Jacek Raczkiewicz (jacek at skycore.com)
|
||||
2012-04-10 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
|
|
|
@ -3272,6 +3272,19 @@ string
|
|||
Optional. Semicolon separated list of HTTP and MM7 statuses that makes MBUNI to retry sending to MMSC.
|
||||
MM7 statuses are checked only when HTTP 200 is received from MMSC (HTTP 200 is always assumed as retry status).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top >
|
||||
<tt>allow-adaptations
|
||||
</tt>
|
||||
</td>
|
||||
|
||||
<td valign=top >
|
||||
Number
|
||||
</td>
|
||||
|
||||
<td valign=top >
|
||||
Optional. 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. If not passed, it is set to yes. This setting can be overwritten by <i>allow-adaptations</i> passed in the sendmms request.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
@ -3606,7 +3619,7 @@ faked-sender = 100<br>
|
|||
</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.
|
||||
operator MMSC (MM7/SOAP only) to turn on/off content adapation. If not passed, then setting in MMSC section in mmsbox.conf will be used.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ MULTI_GROUP(mmsc,
|
|||
OCTSTR(incoming-port-ssl)
|
||||
OCTSTR(max-throughput)
|
||||
OCTSTR(type)
|
||||
OCTSTR(allow-adaptations)
|
||||
OCTSTR(mm7-version)
|
||||
OCTSTR(mm7-soap-xmlns)
|
||||
OCTSTR(use-mm7-soap-namespace-prefix)
|
||||
|
|
|
@ -2975,7 +2975,7 @@ MmsMsg *make_msg_from_sendmms_request(Octstr *from, List *to,
|
|||
int do_multipart,
|
||||
int do_rr,
|
||||
int do_dlr,
|
||||
char *allow_adaptations,
|
||||
Octstr *allow_adaptations,
|
||||
int (*filter)(MIMEEntity **msg, Octstr *loc_url, Octstr *mmc_id),
|
||||
Octstr **err)
|
||||
{
|
||||
|
@ -3125,8 +3125,7 @@ MmsMsg *make_msg_from_sendmms_request(Octstr *from, List *to,
|
|||
if (do_rr)
|
||||
http_header_add(xheaders, "X-Mms-Read-Report", "Yes");
|
||||
if (allow_adaptations)
|
||||
http_header_add(xheaders, "X-Mms-Allow-Adaptations",
|
||||
(strcasecmp(allow_adaptations, "true") == 0) ? "true" : "false");
|
||||
http_header_add(xheaders, "X-Mms-Allow-Adaptations", (octstr_str_compare(allow_adaptations, "true") == 0) ? "true" : "false");
|
||||
|
||||
if (mclass)
|
||||
http_header_add(xheaders, "X-Mms-Message-Class", octstr_get_cstr(mclass));
|
||||
|
|
|
@ -292,7 +292,7 @@ MmsMsg *make_msg_from_sendmms_request(Octstr *from, List *to,
|
|||
int do_multipart,
|
||||
int do_rr,
|
||||
int do_dlr,
|
||||
char *allow_adaptations,
|
||||
Octstr *allow_adaptations,
|
||||
int (*filter)(MIMEEntity **msg, Octstr *loc_url, Octstr *mmc_id),
|
||||
Octstr **err);
|
||||
#define US_ASCII_MIB_VAL 3
|
||||
|
|
|
@ -1747,6 +1747,7 @@ static int sendMsg(MmsEnvelope *e)
|
|||
MMSC_CLEAR_ALARM(NULL, MMSBOX_ALARM_RETRIEVE_MMS_ERROR);
|
||||
|
||||
mlist = gwlist_create_ex(&smtp_h);
|
||||
Octstr *allow_adaptations = mms_get_header_value(msg, octstr_imm("X-Mms-Allow-Adaptations"));
|
||||
|
||||
/* First split by mmc */
|
||||
for (i = 0, n = gwlist_len(e->to); i<n; i++)
|
||||
|
@ -1788,7 +1789,11 @@ static int sendMsg(MmsEnvelope *e)
|
|||
goto done_route;
|
||||
}
|
||||
|
||||
|
||||
if (allow_adaptations == NULL) {
|
||||
http_header_add(e->hdrs, "X-Mbuni-Allow-Adaptations", mmc->allow_adaptations ? "true" : "false");
|
||||
mms_replace_header_value(msg, "X-Mms-Allow-Adaptations", mmc->allow_adaptations ? "true" : "false");
|
||||
}
|
||||
|
||||
/* We know how to route: If mmc is null at this point, means mm4 recipient. */
|
||||
if ((m = gwlist_search(mlist, mmc, (void *)cmp_mrcpt)) == NULL) { /* A new route, add recipient zone */
|
||||
m = gw_malloc(sizeof *m);
|
||||
|
@ -1807,6 +1812,7 @@ static int sendMsg(MmsEnvelope *e)
|
|||
octstr_destroy(err);
|
||||
octstr_destroy(requested_mmsc);
|
||||
}
|
||||
octstr_destroy(allow_adaptations);
|
||||
|
||||
for (i = 0, n = gwlist_len(mlist); i<n && (e != NULL); i++) { /* Pass through MMSCs, delivering to one at a time. */
|
||||
MRcpt_t *m = gwlist_get(mlist, i);
|
||||
|
|
|
@ -931,8 +931,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
|||
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");
|
||||
http_header_add(xheaders, "X-Mms-Allow-Adaptations", (octstr_str_compare(allow_adaptations, "true") == 0) ? "true" : "false");
|
||||
|
||||
if (mclass)
|
||||
http_header_add(xheaders, "X-Mms-Message-Class", octstr_get_cstr(mclass));
|
||||
|
@ -965,8 +964,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
|
|||
mt_multipart,
|
||||
rr_url != NULL,
|
||||
dlr_url != NULL,
|
||||
allow_adaptations ?
|
||||
octstr_get_cstr(allow_adaptations) : "true",
|
||||
allow_adaptations,
|
||||
mt_filter ? mt_filter->filter : NULL,
|
||||
err);
|
||||
if (m == NULL)
|
||||
|
@ -1218,9 +1216,7 @@ static void dispatch_sendmms_recv(List *rl)
|
|||
HTTP_REPLACE_HEADER(rh, "X-Mbuni-RR-Url", octstr_get_cstr(rr_url));
|
||||
|
||||
if (allow_adaptations)
|
||||
HTTP_REPLACE_HEADER(rh, "X-Mbuni-Allow-Adaptations",
|
||||
(octstr_str_compare(allow_adaptations, "1") == 0) ?
|
||||
"true" : "false");
|
||||
HTTP_REPLACE_HEADER(rh, "X-Mbuni-Allow-Adaptations", (octstr_str_compare(allow_adaptations, "0") == 0) ? "false" : "true");
|
||||
if (mmc)
|
||||
HTTP_REPLACE_HEADER(rh, "X-Mbuni-MMSC", octstr_get_cstr(mmc));
|
||||
|
||||
|
|
|
@ -666,6 +666,8 @@ static MmscGrp *start_mmsc_from_conf(mCfg *cfg, mCfgGrp *x, List *warnings, List
|
|||
m->throughput, octstr_get_cstr(m->id));
|
||||
octstr_destroy(tmp);
|
||||
}
|
||||
if (mms_cfg_get_int(cfg, x, octstr_imm("allow-adaptations"), &m->allow_adaptations) <0 || m->allow_adaptations !=0)
|
||||
m->allow_adaptations = 1;
|
||||
|
||||
type = _mms_cfg_getx(cfg, x, octstr_imm("type"));
|
||||
if (octstr_case_compare(type, octstr_imm("eaif")) == 0)
|
||||
|
|
|
@ -53,6 +53,7 @@ typedef struct MmscGrp {
|
|||
Octstr *carrier_id_header; /* http header that has carrier id */
|
||||
enum {UNKNOWN_MMSC = -1, CUSTOM_MMSC, SOAP_MMSC, EAIF_MMSC, MM4_MMSC, HTTP_MMSC, MM1_MMSC} type; /* type of connection. */
|
||||
double throughput; /* Max send rate. */
|
||||
int allow_adaptations; /* turns ON/OFF allow-adaptations in MM7 SOAP XML */
|
||||
long threadid; /* handler thread. */
|
||||
|
||||
int reroute; /* whether messages from this mmsc are re-routed outwards. */
|
||||
|
|
Loading…
Reference in New Issue