added send-dlr-on-fetch config param
This commit is contained in:
parent
8124439d44
commit
9cbf72f5f1
|
@ -1,3 +1,5 @@
|
|||
2007-08-09 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Added send-dlr-on-fetch config param to MMC settings
|
||||
2007-08-08 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Added User-Agent and UAProf URL arguments to call to prov-notify script in MMC.
|
||||
2007-08-06 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
|
|
|
@ -1184,6 +1184,27 @@ lists all the configuration directives. The column <b>Mode</b>
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td valign=top >
|
||||
<tt>send-dlr-on-fetch</tt>
|
||||
</td>
|
||||
|
||||
<td valign=top >
|
||||
<i>MMSC</i>
|
||||
|
||||
</td>
|
||||
|
||||
<td valign=top >
|
||||
Boolean
|
||||
</td>
|
||||
<td valign=top >
|
||||
The MMSC sends a confirmation delivery report to the sender only
|
||||
when the recipient confirms receipt on the MM1 interface. If you
|
||||
want a report as soon as the recipient fetches the message (before
|
||||
receipt of the acknowledge-ind MM1 packet) set this to true. Default: false
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr >
|
||||
<td valign=top >
|
||||
<tt>email2mms-relay-hosts</tt>
|
||||
|
|
|
@ -81,7 +81,7 @@ SINGLE_GROUP(mbuni,
|
|||
OCTSTR(allow-ip-type)
|
||||
OCTSTR(optimize-notification-size)
|
||||
OCTSTR(content-adaptation)
|
||||
|
||||
OCTSTR(send-dlr-on-fetch)
|
||||
OCTSTR(sendmms-port)
|
||||
OCTSTR(sendmms-port-ssl)
|
||||
|
||||
|
|
|
@ -892,7 +892,7 @@ MmsMsg *mm7_soap_to_mmsmsg(MSoapMsg_t *m, Octstr *from)
|
|||
if ((s = http_header_value(m->envelope, octstr_imm("ReadReply"))) != NULL) {
|
||||
long x = mms_string_to_boolean_flag(s);
|
||||
if (x >= 0)
|
||||
mms_replace_header_value(msg, "X-Mms-Read-Reply",
|
||||
mms_replace_header_value(msg, "X-Mms-Read-Report",
|
||||
(char *)mms_reports_to_cstr(x));
|
||||
octstr_destroy(s);
|
||||
}
|
||||
|
@ -1070,7 +1070,7 @@ MSoapMsg_t *mm7_mmsmsg_to_soap(MmsMsg *msg, Octstr *from, List *xto,
|
|||
octstr_destroy(s);
|
||||
}
|
||||
|
||||
if ((s = mms_get_header_value(msg, octstr_imm("X-Mms-Read-Reply"))) != NULL) {
|
||||
if ((s = mms_get_header_value(msg, octstr_imm("X-Mms-Read-Report"))) != NULL) {
|
||||
char *val = (octstr_case_compare(s, octstr_imm("Yes")) == 0) ?
|
||||
"true" : "false";
|
||||
http_header_add(m->envelope, "ReadReply", val);
|
||||
|
|
|
@ -276,6 +276,9 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
|
|||
|
||||
if (mms_cfg_get_bool(grp, octstr_imm("content-adaptation"), &m->content_adaptation) < 0)
|
||||
m->content_adaptation = 1;
|
||||
|
||||
if (mms_cfg_get_bool(grp, octstr_imm("send-dlr-on-fetch"), &m->dlr_on_fetch) < 0)
|
||||
m->dlr_on_fetch = 0;
|
||||
|
||||
if (qdir)
|
||||
octstr_destroy(qdir);
|
||||
|
|
|
@ -78,7 +78,8 @@ typedef struct MmscSettings {
|
|||
|
||||
int optimize_notification_size;
|
||||
int content_adaptation;
|
||||
|
||||
int dlr_on_fetch;
|
||||
|
||||
Octstr *prov_notify;
|
||||
|
||||
Octstr *prov_getstatus;
|
||||
|
|
|
@ -237,6 +237,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
void fetchmms_proxy(MmsHTTPClientInfo *h)
|
||||
{
|
||||
Octstr *dlr_flag = NULL;
|
||||
Octstr *qf = NULL, *token = NULL, *s = NULL, *transid = NULL;
|
||||
MmsEnvelope *e = NULL;
|
||||
MmsMsg *m = NULL, *mr = NULL;
|
||||
|
@ -301,6 +302,7 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
|
|||
}
|
||||
/* Adapt content, if turned on. */
|
||||
transid = mms_maketransid(octstr_get_cstr(qf), settings->host_alias);
|
||||
dlr_flag = mms_get_header_value(m, octstr_imm("X-Mms-Delivery-Report"));
|
||||
if (settings->content_adaptation) {
|
||||
MmsMsg *outmsg = NULL;
|
||||
int x = mms_transform_msg(m, prof, &outmsg);
|
||||
|
@ -365,6 +367,40 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
|
|||
|
||||
notify_cmd = "fetched";
|
||||
|
||||
if (settings->dlr_on_fetch &&
|
||||
dlr_flag && octstr_str_case_compare(dlr_flag, "Yes") == 0 &&
|
||||
e != NULL) {
|
||||
char tbuf[64];
|
||||
Octstr *x, *from = h->client_addr ? h->client_addr : settings->system_user;
|
||||
List *l = gwlist_create(), *qh = gwlist_create();
|
||||
MmsMsg *mrpt = mms_deliveryreport(e->msgId, h->client_addr, time(NULL), octstr_imm("Retrieved"));
|
||||
|
||||
gwlist_append(l, octstr_duplicate(e->from));
|
||||
|
||||
/* Record user agent and profile url. */
|
||||
if (h->ua)
|
||||
http_header_add(qh, "X-Mbuni-User-Agent", octstr_get_cstr(h->ua));
|
||||
if (h->profile_url)
|
||||
http_header_add(qh, "X-Mbuni-Profile-Url", octstr_get_cstr(h->profile_url));
|
||||
sprintf(tbuf, "%ld", time(NULL));
|
||||
http_header_add(qh, "X-Mbuni-Timestamp", tbuf); /* record time of message. */
|
||||
|
||||
x = mms_queue_add(from, l, NULL, NULL, NULL, 0,
|
||||
time(NULL) + settings->default_msgexpiry, mrpt, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
qh,
|
||||
0,
|
||||
octstr_get_cstr(settings->global_queuedir),
|
||||
settings->host_alias);
|
||||
|
||||
octstr_destroy(x);
|
||||
|
||||
gwlist_destroy(l, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
http_destroy_headers(qh);
|
||||
mms_destroy(mrpt);
|
||||
}
|
||||
|
||||
if (e) {
|
||||
e->lastaccess = time(NULL); /* No more notifications requests. */
|
||||
e->sendt = e->expiryt + 3600*24*30*12;
|
||||
|
@ -430,7 +466,7 @@ void fetchmms_proxy(MmsHTTPClientInfo *h)
|
|||
octstr_destroy(qf);
|
||||
octstr_destroy(token);
|
||||
octstr_destroy(transid);
|
||||
|
||||
octstr_destroy(dlr_flag);
|
||||
free_clientInfo(h,1);
|
||||
}
|
||||
|
||||
|
@ -870,36 +906,19 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
e = NULL;
|
||||
}
|
||||
|
||||
if (qf)
|
||||
octstr_destroy(qf);
|
||||
|
||||
if (token)
|
||||
octstr_destroy(token);
|
||||
if (from)
|
||||
octstr_destroy(from);
|
||||
if (subject)
|
||||
octstr_destroy(subject);
|
||||
if (mh)
|
||||
http_destroy_headers(mh);
|
||||
if (to)
|
||||
gwlist_destroy(to, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
if (otransid)
|
||||
octstr_destroy(otransid);
|
||||
if (url)
|
||||
octstr_destroy(url);
|
||||
|
||||
if (read_report)
|
||||
octstr_destroy(read_report);
|
||||
if (allow_report)
|
||||
octstr_destroy(allow_report);
|
||||
if (delivery_report)
|
||||
octstr_destroy(delivery_report);
|
||||
|
||||
if (mmbox_loc)
|
||||
octstr_destroy(mmbox_loc);
|
||||
|
||||
if (sdf)
|
||||
octstr_destroy(sdf);
|
||||
octstr_destroy(qf);
|
||||
octstr_destroy(token);
|
||||
octstr_destroy(from);
|
||||
octstr_destroy(subject);
|
||||
http_destroy_headers(mh);
|
||||
gwlist_destroy(to, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
octstr_destroy(otransid);
|
||||
octstr_destroy(url);
|
||||
octstr_destroy(read_report);
|
||||
octstr_destroy(allow_report);
|
||||
octstr_destroy(delivery_report);
|
||||
octstr_destroy(mmbox_loc);
|
||||
octstr_destroy(sdf);
|
||||
|
||||
reply_body = mms_tobinary(mresp);
|
||||
notify_cmd = "fetched";
|
||||
|
@ -963,8 +982,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
0,
|
||||
octstr_get_cstr(settings->global_queuedir),
|
||||
settings->host_alias);
|
||||
if (x)
|
||||
octstr_destroy(x);
|
||||
octstr_destroy(x);
|
||||
|
||||
gwlist_destroy(l, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
mms_destroy(mrpt);
|
||||
|
@ -980,14 +998,10 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
mms_queue_update(e) != 1) /* Should be freed. */
|
||||
mms_queue_free_env(e);
|
||||
|
||||
if (qf)
|
||||
octstr_destroy(qf);
|
||||
if (transid)
|
||||
octstr_destroy(transid);
|
||||
if (allow_report)
|
||||
octstr_destroy(allow_report);
|
||||
if (status)
|
||||
octstr_destroy(status);
|
||||
octstr_destroy(qf);
|
||||
octstr_destroy(transid);
|
||||
octstr_destroy(allow_report);
|
||||
octstr_destroy(status);
|
||||
http_header_add(rh, "Content-Type", "text/plain");
|
||||
ctype_set = 1;
|
||||
reply_body = octstr_imm("Received");
|
||||
|
@ -1021,14 +1035,11 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
settings->host_alias);
|
||||
|
||||
/* Log to access log */
|
||||
mms_log("ReadReport", h->client_addr, NULL, msize, NULL, NULL, NULL, "MM1", h->ua,NULL);
|
||||
|
||||
if (x)
|
||||
octstr_destroy(x);
|
||||
mms_log("ReadReport", h->client_addr, NULL, msize, NULL, NULL, NULL, "MM1", h->ua,NULL);
|
||||
octstr_destroy(x);
|
||||
|
||||
mdone2:
|
||||
if (mh)
|
||||
http_destroy_headers(mh);
|
||||
http_destroy_headers(mh);
|
||||
|
||||
gwlist_destroy(to, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
http_header_add(rh, "Content-Type", "text/plain");
|
||||
|
@ -1217,25 +1228,15 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
}
|
||||
|
||||
upload_done:
|
||||
if (mstore)
|
||||
mms_destroy(mstore);
|
||||
|
||||
if (mh)
|
||||
http_destroy_headers(mh);
|
||||
if (otransid)
|
||||
octstr_destroy(otransid);
|
||||
if (s)
|
||||
octstr_destroy(s);
|
||||
|
||||
if (ctype)
|
||||
octstr_destroy(ctype);
|
||||
if (mmbox_loc)
|
||||
octstr_destroy(mmbox_loc);
|
||||
mms_destroy(mstore);
|
||||
http_destroy_headers(mh);
|
||||
octstr_destroy(otransid);
|
||||
octstr_destroy(s);
|
||||
octstr_destroy(ctype);
|
||||
octstr_destroy(mmbox_loc);
|
||||
octstr_destroy(sdf);
|
||||
|
||||
if (sdf)
|
||||
octstr_destroy(sdf);
|
||||
|
||||
|
||||
reply_body = mms_tobinary(mresp);
|
||||
notify_cmd = "uploaded";
|
||||
}
|
||||
|
@ -1319,9 +1320,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
gwlist_destroy(rss, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
gwlist_destroy(lh, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
|
||||
if (otransid)
|
||||
octstr_destroy(otransid);
|
||||
|
||||
octstr_destroy(otransid);
|
||||
|
||||
reply_body = mms_tobinary(mresp);
|
||||
notify_cmd = "deleted";
|
||||
|
@ -1479,7 +1478,7 @@ static void sendmms_proxy(MmsHTTPClientInfo *h)
|
|||
|
||||
done:
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
if (mresp)
|
||||
mms_msgdump(mresp, 0);
|
||||
#endif
|
||||
|
@ -1531,12 +1530,10 @@ static MmsVasp *find_mm7sender(List *headers, List *vasps)
|
|||
/* if it can't authenticate, returns NULL. */
|
||||
|
||||
done:
|
||||
if (v)
|
||||
octstr_destroy(v);
|
||||
if (p)
|
||||
octstr_destroy(p);
|
||||
if (q)
|
||||
octstr_destroy(q);
|
||||
octstr_destroy(v);
|
||||
octstr_destroy(p);
|
||||
octstr_destroy(q);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -1724,38 +1721,19 @@ static void mm7soap_dispatch(MmsHTTPClientInfo *h)
|
|||
mresp ? "ok" : "(null)",
|
||||
reply_body ? "ok" : "(null)");
|
||||
|
||||
if (e)
|
||||
mms_queue_free_env(e);
|
||||
|
||||
if (sender)
|
||||
octstr_destroy(sender);
|
||||
|
||||
if (from)
|
||||
octstr_destroy(from);
|
||||
|
||||
if (subject)
|
||||
octstr_destroy(subject);
|
||||
if (vasid)
|
||||
octstr_destroy(vasid);
|
||||
if (msgid)
|
||||
octstr_destroy(msgid);
|
||||
|
||||
if (qf)
|
||||
octstr_destroy(qf);
|
||||
if (m)
|
||||
mms_destroy(m);
|
||||
if (rh)
|
||||
http_destroy_headers(rh);
|
||||
if (reply_body)
|
||||
octstr_destroy(reply_body);
|
||||
|
||||
if (mresp)
|
||||
mm7_soap_destroy(mresp);
|
||||
if (mreq)
|
||||
mm7_soap_destroy(mreq);
|
||||
|
||||
if (to)
|
||||
gwlist_destroy(to, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
mms_queue_free_env(e);
|
||||
octstr_destroy(sender);
|
||||
octstr_destroy(from);
|
||||
octstr_destroy(subject);
|
||||
octstr_destroy(vasid);
|
||||
octstr_destroy(msgid);
|
||||
octstr_destroy(qf);
|
||||
mms_destroy(m);
|
||||
http_destroy_headers(rh);
|
||||
octstr_destroy(reply_body);
|
||||
mm7_soap_destroy(mresp);
|
||||
mm7_soap_destroy(mreq);
|
||||
gwlist_destroy(to, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
|
||||
free_clientInfo(h,1);
|
||||
}
|
||||
|
@ -1880,22 +1858,14 @@ static void mm7eaif_dispatch(MmsHTTPClientInfo *h)
|
|||
|
||||
http_send_reply(h->client, hstatus, rh, octstr_imm(""));
|
||||
|
||||
if (hto)
|
||||
http_destroy_headers(hto);
|
||||
if (to)
|
||||
gwlist_destroy(to, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
if (hfrom)
|
||||
octstr_destroy(hfrom);
|
||||
if (subject)
|
||||
octstr_destroy(subject);
|
||||
if (otransid)
|
||||
octstr_destroy(otransid);
|
||||
if (msgid)
|
||||
octstr_destroy(msgid);
|
||||
if (mh)
|
||||
http_destroy_headers(mh);
|
||||
|
||||
if (m) mms_destroy(m);
|
||||
http_destroy_headers(hto);
|
||||
gwlist_destroy(to, (gwlist_item_destructor_t *)octstr_destroy);
|
||||
octstr_destroy(hfrom);
|
||||
octstr_destroy(subject);
|
||||
octstr_destroy(otransid);
|
||||
octstr_destroy(msgid);
|
||||
http_destroy_headers(mh);
|
||||
mms_destroy(m);
|
||||
}
|
||||
|
||||
static void mm7proxy(void *unused)
|
||||
|
@ -1956,32 +1926,15 @@ static void free_clientInfo(MmsHTTPClientInfo *h, int freeh)
|
|||
debug("free info", 0,
|
||||
" entered free_clientinfo %d, ip=%ld", freeh, (long)h->ip);
|
||||
|
||||
if (h->ip)
|
||||
octstr_destroy(h->ip);
|
||||
|
||||
|
||||
if (h->url)
|
||||
octstr_destroy(h->url);
|
||||
if (h->ua) octstr_destroy(h->ua);
|
||||
|
||||
|
||||
if (h->body) octstr_destroy(h->body);
|
||||
|
||||
|
||||
if (h->base_client_addr)
|
||||
octstr_destroy(h->base_client_addr);
|
||||
|
||||
if (h->client_addr)
|
||||
octstr_destroy(h->client_addr);
|
||||
|
||||
if (h->cgivars)
|
||||
http_destroy_cgiargs(h->cgivars);
|
||||
|
||||
if (h->headers)
|
||||
http_destroy_headers(h->headers);
|
||||
|
||||
if (h->profile_url)
|
||||
octstr_destroy(h->profile_url);
|
||||
octstr_destroy(h->ip);
|
||||
octstr_destroy(h->url);
|
||||
octstr_destroy(h->ua);
|
||||
octstr_destroy(h->body);
|
||||
octstr_destroy(h->base_client_addr);
|
||||
octstr_destroy(h->client_addr);
|
||||
http_destroy_cgiargs(h->cgivars);
|
||||
http_destroy_headers(h->headers);
|
||||
octstr_destroy(h->profile_url);
|
||||
|
||||
if (freeh)
|
||||
gw_free(h);
|
||||
|
|
Loading…
Reference in New Issue