diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index b3d1a7b..18e87bc 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2014-02-11 P. A. Bagyenda + * Per-mssc allow-adaptations patch, thanks to Jacek Raczkiewicz (jacek at skycore.com) 2013-12-16 P. A. Bagyenda * Misc speed-ups and patches thanks to Jacek Raczkiewicz (jacek at skycore.com) 2012-04-10 P. A. Bagyenda diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml index 1693dd9..e77815d 100644 --- a/mbuni/doc/userguide.shtml +++ b/mbuni/doc/userguide.shtml @@ -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). + + + allow-adaptations + +     + + + Number + + + + 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 allow-adaptations passed in the sendmms request. + @@ -3606,7 +3619,7 @@ faked-sender = 100
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. diff --git a/mbuni/mmlib/mms_cfg.def b/mbuni/mmlib/mms_cfg.def index 2b47891..cdd4703 100644 --- a/mbuni/mmlib/mms_cfg.def +++ b/mbuni/mmlib/mms_cfg.def @@ -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) diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index c931d60..7f9c7c3 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -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)); diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h index 6cf76c5..5c16735 100644 --- a/mbuni/mmlib/mms_util.h +++ b/mbuni/mmlib/mms_util.h @@ -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 diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 2cbd46d..f84b0a3 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -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); ihdrs, "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); ifilter : 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)); diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index 1d38697..1397dc3 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -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) diff --git a/mbuni/mmsbox/mmsbox_cfg.h b/mbuni/mmsbox/mmsbox_cfg.h index 86857cb..587ba81 100644 --- a/mbuni/mmsbox/mmsbox_cfg.h +++ b/mbuni/mmsbox/mmsbox_cfg.h @@ -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. */