1
0
Fork 0

- Added ServiceCode parameter to both sendmms cgi vars, and also to mms-service

This commit is contained in:
bagyenda 2006-08-11 10:05:46 +00:00
parent 3e010fccd4
commit 491a6173a8
8 changed files with 71 additions and 15 deletions

View File

@ -14,11 +14,11 @@ sendmms-port = 10001
group = mmsc group = mmsc
id = local id = local
mmsc-url = http://mbuni:test@localhost:1982/eaif mmsc-url = http://mbuni:test@localhost:1982/soap
incoming-username = user incoming-username = user
incoming-password = pass incoming-password = pass
incoming-port = 12345 incoming-port = 12345
type = eaif type = soap
group = mms-service group = mms-service
name = me name = me
@ -30,6 +30,7 @@ pass-thro-headers = X-NOKIA-MMSC-Charging,X-NOKIA-MMSC-Charged-Party
keyword = test keyword = test
omit-empty = no omit-empty = no
suppress-reply = true suppress-reply = true
service-code = regular
group = mms-service group = mms-service
name = fullmessage name = fullmessage

View File

@ -38,7 +38,7 @@ mms-message-too-large-txt = "You have received a multimedia message from %S that
group = mms-vasp group = mms-vasp
vasp-id = newscorp vasp-id = newscorp
type = eaif type = soap
short-code = 111 short-code = 111
vasp-username = mbuni vasp-username = mbuni
vasp-password = test vasp-password = test

View File

@ -2389,6 +2389,16 @@ faked-sender = 100<br>
</td> </td>
</tr> </tr>
<tr>
<td valign=top >
<tt>servicecode</tt>
</td>
<td valign=top >
This will be passed on the MMC as the ServiceCode parameter in the
MM7/SOAP message. If not provided, this parameter is not sent.
</td>
</tr>
</table> </table>
</p> </p>
@ -2742,6 +2752,21 @@ A detailed list of configuration parameters for MMS Services is given below.
</td> </td>
</tr> </tr>
<tr>
<td valign=top >
<tt>service-code</tt>
</td>
<td valign=top >
string
</td>
<td valign=top >
If set, Mbuni will use this as the <b>ServiceCode</b> parameter to
send back the MMSC (MM7/SOAP only) in a <b>SubmitReq</b> packet. This
paramter overrides the <i>X-Mbuni-ServiceCode</i> header, if set
int the response.
</td>
</tr>
</table> </table>
<br> <br>
Note that only one Note that only one
@ -2921,6 +2946,18 @@ A detailed list of configuration parameters for MMS Services is given below.
for transmitting report status. for transmitting report status.
</td> </td>
</tr> </tr>
<tr>
<td valign=top >
<tt>X-Mbuni-ServiceCode</tt>
</td>
<td valign=top >
<b>ServiceCode</b> 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.
</td>
</tr>
</table> </table>
</p> </p>

View File

@ -146,6 +146,7 @@ MULTI_GROUP(mms-service,
OCTSTR(keyword) OCTSTR(keyword)
OCTSTR(aliases) OCTSTR(aliases)
OCTSTR(http-post-parameters) OCTSTR(http-post-parameters)
OCTSTR(service-code)
) )
#undef OCTSTR #undef OCTSTR
#undef SINGLE_GROUP #undef SINGLE_GROUP

View File

@ -522,6 +522,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to,
Octstr *transid, Octstr *transid,
Octstr *linkedid, Octstr *linkedid,
char *vasid, char *vasid,
Octstr *service_code,
List *hdrs, List *hdrs,
MmsMsg *m, Octstr **error) MmsMsg *m, Octstr **error)
{ {
@ -542,7 +543,7 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to,
list_append(xto, to); list_append(xto, to);
if ((mreq = mm7_mmsmsg_to_soap(m, from, xto, transid, if ((mreq = mm7_mmsmsg_to_soap(m, from, xto, transid,
NULL, service_code,
linkedid, linkedid,
1, octstr_get_cstr(mmc->id), vasid)) == NULL) { 1, octstr_get_cstr(mmc->id), vasid)) == NULL) {
*error = octstr_format("Failed to convert Msg[%s] 2 SOAP message!", *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, static int mms_sendtommsc(MmscGrp *mmc, Octstr *from, Octstr *to, Octstr *transid,
Octstr *linkedid, Octstr *linkedid,
char *vasid, char *vasid,
Octstr *service_code,
MmsMsg *m, MmsMsg *m,
Octstr *dlr_url, Octstr *dlr_url,
Octstr *rr_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. */ mutex_lock(mmc->mutex); { /* Grab a lock on it. */
if (mmc->type == SOAP_MMSC) 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) 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 else
error(0, "MMC[%s] of unknown type, can't send!", error(0, "MMC[%s] of unknown type, can't send!",
mmc->id ? octstr_get_cstr(mmc->id) : ""); mmc->id ? octstr_get_cstr(mmc->id) : "");
@ -849,6 +851,7 @@ static int sendMsg(MmsEnvelope *e)
e->msgId, e->msgId,
e->token, /* token = linkedid */ e->token, /* token = linkedid */
e->vasid ? octstr_get_cstr(e->vasid) : NULL, e->vasid ? octstr_get_cstr(e->vasid) : NULL,
e->vaspid,
msg, msg,
e->url1, e->url2, e->url1, e->url2,
e->hdrs, e->hdrs,

View File

@ -264,7 +264,7 @@ static Octstr *url_path_prefix(Octstr *url, int type);
static Octstr *filename2content_type(char *fname); static Octstr *filename2content_type(char *fname);
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 *base_url, int type, MmsEnvelope *e, 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, int accept_x_headers,
List *passthro_headers, List *passthro_headers,
Octstr **err); Octstr **err);
@ -387,7 +387,7 @@ static int fetch_serviceurl(MmsEnvelope *e,
} 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, 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, ms->accept_x_headers, ms->passthro_headers,
err); 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! */ /* 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 *base_url, int type, MmsEnvelope *e, 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, int accept_x_headers, List *passthro_headers,
Octstr **err) Octstr **err)
{ {
Octstr *from = NULL, *subject = NULL, *turl = get_toplevel_url(base_url); 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; MmsMsg *m = NULL;
MIMEEntity *me = mime_entity_create(); MIMEEntity *me = mime_entity_create();
List *hdrs = NULL; List *hdrs = NULL;
@ -877,7 +877,13 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
else else
from = octstr_imm("anon@anon"); 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) if (from)
_mms_fixup_address(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, e ? e->fromproxy : NULL,
mmc, mmc,
time(NULL), expiryt, m, NULL, 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, dlr_url, rr_url,
hdrs, hdrs,
(dlr_url != NULL), (dlr_url != NULL),
@ -1070,6 +1077,9 @@ done:
list_destroy(xto, (list_item_destructor_t *)octstr_destroy); list_destroy(xto, (list_item_destructor_t *)octstr_destroy);
if (hdrs) if (hdrs)
http_destroy_headers(hdrs); http_destroy_headers(hdrs);
if (xservice_code)
octstr_destroy(xservice_code);
return res; return res;
} }
@ -1119,6 +1129,7 @@ static void sendmms_func(void *unused)
Octstr *rb = NULL, *base_url; Octstr *rb = NULL, *base_url;
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");
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");
@ -1196,7 +1207,7 @@ static void sendmms_func(void *unused)
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, base_url, URL_TYPE, NULL,
vasid ? vasid : octstr_imm("sendmms-user"), vasid ? vasid : octstr_imm("sendmms-user"),
u->faked_sender, u->faked_sender, service_code,
1, NULL, &err); 1, NULL, &err);
if (res < 0) if (res < 0)
rb = octstr_imm("Error in message conversion"); rb = octstr_imm("Error in message conversion");

View File

@ -320,7 +320,9 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
octstr_destroy(s); octstr_destroy(s);
} else } else
m->params = NULL; m->params = NULL;
m->service_code = mms_cfg_get(x, octstr_imm("service-code"));
list_append(mms_services, m); list_append(mms_services, m);
} }
list_destroy(l, NULL); list_destroy(l, NULL);

View File

@ -57,7 +57,8 @@ typedef struct MmsService {
Octstr *faked_sender; Octstr *faked_sender;
List *allowed_mmscs; /* List of MMSCs allowed to access this service (by ID). */ 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; } MmsService;
typedef struct SendMmsUser { typedef struct SendMmsUser {