From be06cd60cedf5c5254701cace929d5fd306df6e4 Mon Sep 17 00:00:00 2001
From: bagyenda <>
Date: Fri, 15 Jul 2005 05:44:23 +0000
Subject: [PATCH] Added content-adpatation config param to turn on/off content
adaptation
---
mbuni/doc/examples/mmsc.conf | 1 +
mbuni/doc/userguide.shtml | 13 +++++++++++++
mbuni/misc-patches/mbuni-kannel-patch-full | 5 +++--
mbuni/mmlib/mms_util.c | 6 +++++-
mbuni/mmlib/mms_util.h | 1 +
mbuni/mmsc/mmsproxy.c | 17 ++++++++++-------
6 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/mbuni/doc/examples/mmsc.conf b/mbuni/doc/examples/mmsc.conf
index 8d89034..7569c29 100644
--- a/mbuni/doc/examples/mmsc.conf
+++ b/mbuni/doc/examples/mmsc.conf
@@ -28,6 +28,7 @@ billing-module-parameters = "/tmp/log/cdr.log"
# billing-library = billdemo.so
#prov-server-notify-script = ~/src/mmprov/provnotify.sh
#prov-server-sub-status-script = ~/src/mmprov/rcptstatus.sh
+content-adaptation = yes
notify-unprovisioned = yes
mms-notify-text = "You have received a multimedia message from %S, go to XXX to view it"
mm-box-host = local.ds.co.ug
diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml
index 3ec9b7b..0792609 100644
--- a/mbuni/doc/userguide.shtml
+++ b/mbuni/doc/userguide.shtml
@@ -961,6 +961,19 @@ lists all the configuration directives
fields. Default: false
+
diff --git a/mbuni/misc-patches/mbuni-kannel-patch-full b/mbuni/misc-patches/mbuni-kannel-patch-full
index 1dda485..995a90d 100644
--- a/mbuni/misc-patches/mbuni-kannel-patch-full
+++ b/mbuni/misc-patches/mbuni-kannel-patch-full
@@ -717,8 +717,8 @@ diff -Naur gateway-1.4.0/gw/xml_shared.h gateway-1.4.0-patched/gw/xml_shared.h
/*
diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def
--- gateway-1.4.0/gwlib/cfg.def 2004-06-28 18:18:35.000000000 +0300
-+++ gateway-1.4.0-patched/gwlib/cfg.def 2005-07-04 10:58:15.000000000 +0300
-@@ -544,6 +544,68 @@
++++ gateway-1.4.0-patched/gwlib/cfg.def 2005-07-15 08:08:36.000000000 +0300
+@@ -544,6 +544,69 @@
OCTSTR(unified-prefix)
)
@@ -764,6 +764,7 @@ diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def
+ OCTSTR(mms-client-ip-header)
+ OCTSTR(allow-ip-type)
+ OCTSTR(optimize-notification-size)
++ OCTSTR(content-adaptation)
+)
+
+MULTI_GROUP(mmsproxy,
diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c
index 63d2c98..0e93d96 100644
--- a/mbuni/mmlib/mms_util.c
+++ b/mbuni/mmlib/mms_util.c
@@ -311,11 +311,15 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg, List **proxyrelays)
if (cfg_get_bool(&m->allow_ip_type, grp, octstr_imm("allow-ip-type")) < 0)
m->allow_ip_type = 1;
+
cfg_get_bool(&m->optimize_notification_size, grp, octstr_imm("optimize-notification-size"));
+ if (cfg_get_bool(&m->content_adaptation, grp, octstr_imm("content-adaptation")) < 0)
+ m->content_adaptation = 1;
+
if (qdir)
octstr_destroy(qdir);
-
+
/* Now load the VASP list. */
l = cfg_get_multi_group(cfg, octstr_imm("mms-vasp"));
m->vasp_list = list_create();
diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h
index f1b9f18..fb00752 100644
--- a/mbuni/mmlib/mms_util.h
+++ b/mbuni/mmlib/mms_util.h
@@ -100,6 +100,7 @@ typedef struct MmsBoxSettings {
int allow_ip_type;
int optimize_notification_size;
+ int content_adaptation;
Octstr *prov_notify;
diff --git a/mbuni/mmsc/mmsproxy.c b/mbuni/mmsc/mmsproxy.c
index f8debf6..90f79aa 100644
--- a/mbuni/mmsc/mmsproxy.c
+++ b/mbuni/mmsc/mmsproxy.c
@@ -280,20 +280,22 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
}
menc = MS_1_2;
}
- /* Adapt content. */
+ /* Adapt content, if turned on. */
transid = mms_maketransid(octstr_get_cstr(qf), settings->host_alias);
- if (h->prof) {
+ if (settings->content_adaptation) {
MmsMsg *outmsg = NULL;
int x = mms_transform_msg(m, h->prof, &outmsg);
-
+
if (x == -1) { /* Temporary failure, we need to fetch profile. */
- mr = mms_retrieveconf(NULL, transid, "Error-transient-failure", "Mobile MMS Settings not found",
+ mr = mms_retrieveconf(NULL, transid, "Error-transient-failure",
+ "Mobile MMS Settings not found",
settings->system_user,MS_1_1);
s = mms_tobinary(mr);
goto failed;
} else if (x < 0) { /* Doesn't support MMS */
mr = mms_retrieveconf(NULL, transid,
- "Error-permanent-content-unsupported", "No MMS Support",
+ "Error-permanent-content-unsupported",
+ "No MMS Support",
settings->system_user,MS_1_1);
s = mms_tobinary(mr);
notify_cmd = "fetchfailed";
@@ -301,7 +303,8 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
goto failed;
} else if (x == 0) {
if (outmsg == NULL) { /* Too large so truncated. */
- Octstr *xx = octstr_format(octstr_get_cstr(settings->mms_toolarge), (e) ? e->from : h->client_addr);
+ Octstr *xx = octstr_format(octstr_get_cstr(settings->mms_toolarge),
+ (e) ? e->from : h->client_addr);
mr = mms_retrieveconf(NULL, transid,
#if 0
@@ -321,7 +324,7 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
mms_destroy(m);
m = outmsg;
}
- }
+ }
}
mr = mms_retrieveconf(m, transid, "Error-permanent-message-not-found", NULL,
|