diff --git a/mbuni/doc/examples/mmsbox.conf b/mbuni/doc/examples/mmsbox.conf
index 475e565..7a99d02 100644
--- a/mbuni/doc/examples/mmsbox.conf
+++ b/mbuni/doc/examples/mmsbox.conf
@@ -14,11 +14,11 @@ sendmms-port = 10001
group = mmsc
id = local
-mmsc-url = http://mbuni:test@localhost:1982/eaif
+mmsc-url = http://mbuni:test@localhost:1982/soap
incoming-username = user
incoming-password = pass
incoming-port = 12345
-type = eaif
+type = soap
group = mms-service
name = me
@@ -30,6 +30,7 @@ pass-thro-headers = X-NOKIA-MMSC-Charging,X-NOKIA-MMSC-Charged-Party
keyword = test
omit-empty = no
suppress-reply = true
+service-code = regular
group = mms-service
name = fullmessage
diff --git a/mbuni/doc/examples/mmsc.conf b/mbuni/doc/examples/mmsc.conf
index 8fc507e..198d765 100644
--- a/mbuni/doc/examples/mmsc.conf
+++ b/mbuni/doc/examples/mmsc.conf
@@ -38,7 +38,7 @@ mms-message-too-large-txt = "You have received a multimedia message from %S that
group = mms-vasp
vasp-id = newscorp
-type = eaif
+type = soap
short-code = 111
vasp-username = mbuni
vasp-password = test
diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml
index 848cc85..6c34ef0 100644
--- a/mbuni/doc/userguide.shtml
+++ b/mbuni/doc/userguide.shtml
@@ -2389,6 +2389,16 @@ faked-sender = 100
+
+
+ servicecode
+ |
+
+ This will be passed on the MMC as the ServiceCode parameter in the
+ MM7/SOAP message. If not provided, this parameter is not sent.
+ |
+
+
@@ -2742,6 +2752,21 @@ A detailed list of configuration parameters for MMS Services is given below.
+
+
+ service-code
+ |
+
+ string
+ |
+
+ If set, Mbuni will use this as the ServiceCode parameter to
+ send back the MMSC (MM7/SOAP only) in a SubmitReq packet. This
+ paramter overrides the X-Mbuni-ServiceCode header, if set
+ int the response.
+ |
+
+
Note that only one
@@ -2921,6 +2946,18 @@ A detailed list of configuration parameters for MMS Services is given below.
for transmitting report status.
+
+
+
+ X-Mbuni-ServiceCode
+ |
+
+ ServiceCode parameter for MM7/SOAP response packet. If set,
+ its value is sent to the MMSC as the value of the ServiceCode
+ element in the MM7/SOAP message body.
+ |
+
+
diff --git a/mbuni/mmlib/mms_cfg.def b/mbuni/mmlib/mms_cfg.def
index 293b5fd..53a4cf7 100644
--- a/mbuni/mmlib/mms_cfg.def
+++ b/mbuni/mmlib/mms_cfg.def
@@ -146,6 +146,7 @@ MULTI_GROUP(mms-service,
OCTSTR(keyword)
OCTSTR(aliases)
OCTSTR(http-post-parameters)
+ OCTSTR(service-code)
)
#undef OCTSTR
#undef SINGLE_GROUP
diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c
index 839d9a8..e2923c8 100644
--- a/mbuni/mmsbox/bearerbox.c
+++ b/mbuni/mmsbox/bearerbox.c
@@ -522,6 +522,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to,
Octstr *transid,
Octstr *linkedid,
char *vasid,
+ Octstr *service_code,
List *hdrs,
MmsMsg *m, Octstr **error)
{
@@ -542,7 +543,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to,
list_append(xto, to);
if ((mreq = mm7_mmsmsg_to_soap(m, from, xto, transid,
- NULL,
+ service_code,
linkedid,
1, octstr_get_cstr(mmc->id), vasid)) == NULL) {
*error = octstr_format("Failed to convert Msg[%s] 2 SOAP message!",
@@ -731,6 +732,7 @@ static Octstr *mm7eaif_send(MmscGrp *mmc, Octstr *from, Octstr *to,
static int mms_sendtommsc(MmscGrp *mmc, Octstr *from, Octstr *to, Octstr *transid,
Octstr *linkedid,
char *vasid,
+ Octstr *service_code,
MmsMsg *m,
Octstr *dlr_url,
Octstr *rr_url,
@@ -742,9 +744,9 @@ static int mms_sendtommsc(MmscGrp *mmc, Octstr *from, Octstr *to, Octstr *transi
mutex_lock(mmc->mutex); { /* Grab a lock on it. */
if (mmc->type == SOAP_MMSC)
- id = mm7soap_send(mmc, from, to, transid, linkedid, vasid, hdrs, m, err);
+ id = mm7soap_send(mmc, from, to, transid, linkedid, vasid, service_code, hdrs, m, err);
else if (mmc->type == EAIF_MMSC)
- id = mm7eaif_send(mmc, from, to, transid, vasid, hdrs, m, err);
+ id = mm7eaif_send(mmc, from, to, transid, vasid, hdrs, m, err);
else
error(0, "MMC[%s] of unknown type, can't send!",
mmc->id ? octstr_get_cstr(mmc->id) : "");
@@ -849,6 +851,7 @@ static int sendMsg(MmsEnvelope *e)
e->msgId,
e->token, /* token = linkedid */
e->vasid ? octstr_get_cstr(e->vasid) : NULL,
+ e->vaspid,
msg,
e->url1, e->url2,
e->hdrs,
diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c
index ef86db7..3719fa7 100644
--- a/mbuni/mmsbox/mmsbox.c
+++ b/mbuni/mmsbox/mmsbox.c
@@ -264,7 +264,7 @@ static Octstr *url_path_prefix(Octstr *url, int type);
static Octstr *filename2content_type(char *fname);
static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
Octstr *base_url, int type, MmsEnvelope *e,
- Octstr *svc_name, Octstr *faked_sender,
+ Octstr *svc_name, Octstr *faked_sender, Octstr *service_code,
int accept_x_headers,
List *passthro_headers,
Octstr **err);
@@ -387,7 +387,7 @@ static int fetch_serviceurl(MmsEnvelope *e,
} else {
Octstr *base_url = url_path_prefix(ms->url, typ);
res = make_and_queue_msg(rb, ctype, rph, base_url,
- typ, e, ms->name, ms->faked_sender,
+ typ, e, ms->name, ms->faked_sender, ms->service_code,
ms->accept_x_headers, ms->passthro_headers,
err);
@@ -846,12 +846,12 @@ 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! */
static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
Octstr *base_url, int type, MmsEnvelope *e,
- Octstr *svc_name, Octstr *faked_sender,
+ Octstr *svc_name, Octstr *faked_sender, Octstr *service_code,
int accept_x_headers, List *passthro_headers,
Octstr **err)
{
Octstr *from = NULL, *subject = NULL, *turl = get_toplevel_url(base_url);
- Octstr *dlr_url = NULL, *rr_url = NULL, *mmc = NULL;
+ Octstr *dlr_url = NULL, *rr_url = NULL, *mmc = NULL, *xservice_code = NULL;
MmsMsg *m = NULL;
MIMEEntity *me = mime_entity_create();
List *hdrs = NULL;
@@ -877,7 +877,13 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
else
from = octstr_imm("anon@anon");
}
-
+
+ /* Get service code. */
+ if (service_code)
+ xservice_code = octstr_duplicate(service_code);
+ else if (accept_x_headers && reply_headers)
+ xservice_code = http_header_value(reply_headers, octstr_imm("X-Mbuni-ServiceCode"));
+
if (from)
_mms_fixup_address(from);
@@ -1040,7 +1046,8 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
e ? e->fromproxy : NULL,
mmc,
time(NULL), expiryt, m, NULL,
- NULL, svc_name,
+ xservice_code, /* Send service code as vasp id XXX - not very nice, but */
+ svc_name,
dlr_url, rr_url,
hdrs,
(dlr_url != NULL),
@@ -1070,6 +1077,9 @@ done:
list_destroy(xto, (list_item_destructor_t *)octstr_destroy);
if (hdrs)
http_destroy_headers(hdrs);
+
+ if (xservice_code)
+ octstr_destroy(xservice_code);
return res;
}
@@ -1119,6 +1129,7 @@ static void sendmms_func(void *unused)
Octstr *rb = NULL, *base_url;
int i, n, res = 0;
Octstr *vasid = http_cgi_variable(cgivars, "vasid");
+ Octstr *service_code = http_cgi_variable(cgivars, "servicecode");
if ((base_url = http_cgi_variable(cgivars, "base-url")) == NULL)
base_url = octstr_imm("http://localhost");
@@ -1196,7 +1207,7 @@ static void sendmms_func(void *unused)
if (ctype && data && !rb) { /* only send if no error. */
res = make_and_queue_msg(data, ctype, rh, base_url, URL_TYPE, NULL,
vasid ? vasid : octstr_imm("sendmms-user"),
- u->faked_sender,
+ u->faked_sender, service_code,
1, NULL, &err);
if (res < 0)
rb = octstr_imm("Error in message conversion");
diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c
index 7060a14..ce2acb3 100644
--- a/mbuni/mmsbox/mmsbox_cfg.c
+++ b/mbuni/mmsbox/mmsbox_cfg.c
@@ -320,7 +320,9 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
octstr_destroy(s);
} else
m->params = NULL;
-
+
+ m->service_code = mms_cfg_get(x, octstr_imm("service-code"));
+
list_append(mms_services, m);
}
list_destroy(l, NULL);
diff --git a/mbuni/mmsbox/mmsbox_cfg.h b/mbuni/mmsbox/mmsbox_cfg.h
index 65b2d83..d01a31b 100644
--- a/mbuni/mmsbox/mmsbox_cfg.h
+++ b/mbuni/mmsbox/mmsbox_cfg.h
@@ -57,7 +57,8 @@ typedef struct MmsService {
Octstr *faked_sender;
List *allowed_mmscs; /* List of MMSCs allowed to access this service (by ID). */
- List *denied_mmscs; /* List of MMSCs allowed to access this service (by ID). */
+ List *denied_mmscs; /* List of MMSCs allowed to access this service (by ID). */
+ Octstr *service_code; /* Service code (MM7/SOAP only) */
} MmsService;
typedef struct SendMmsUser {