1
0
Fork 0

Added mms2email functionality to mmsbox

This commit is contained in:
bagyenda 2008-08-14 11:44:58 +00:00
parent f7bc48d88d
commit 3b1371f55f
5 changed files with 56 additions and 16 deletions

View File

@ -1,3 +1,5 @@
2008-08-14 P. A. Bagyenda <bagyenda@dsmagic.com>
* Mmsbox will now queue message to email (outgoing) if recipient looks like an email address
2008-08-08 P. A. Bagyenda <bagyenda@dsmagic.com>
* Fix to content adaptation: Better handling of supported image types
thanks to George Barros <gbarros@ipcomsa.com>

View File

@ -698,7 +698,7 @@ lists all the configuration directives. The column <b>Mode</b>
</tt>
&nbsp; &nbsp;</td>
<td valign=top >
<i>MMSC</i>
<i>ALL</i>
&nbsp; &nbsp;
</td>
@ -804,7 +804,7 @@ lists all the configuration directives. The column <b>Mode</b>
&nbsp; &nbsp;</td>
<td valign=top >
<i>MMSC</i>
<i>ALL</i>
&nbsp; &nbsp;
</td>

View File

@ -206,7 +206,7 @@ static void mm7soap_receive(MmsBoxHTTPClientInfo *h)
http_header_add(qh, "X-Mbuni-Timestamp", octstr_get_cstr(sx));
octstr_destroy(sx);
}
MOD_SUBJECT(m, h->m, from);
qf = qfs->mms_queue_add(from, to, subject,
@ -946,24 +946,50 @@ static int sendMsg(MmsEnvelope *e)
goto done;
}
res = mms_sendtommsc(mmc, e->from, to->rcpt,
e->msgId,
otransid,
e->token, /* token = linkedid */
e->vasid ? octstr_get_cstr(e->vasid) : NULL,
e->vaspid,
msg,
e->url1, e->url2,
e->hdrs,
&new_msgid,
&err);
if (octstr_search_char(to->rcpt, '@', 0) > 0) {
int j = octstr_case_search(e->from, octstr_imm("/TYPE=PLMN"), 0);
int k = octstr_case_search(e->from, octstr_imm("/TYPE=IPv"), 0);
int len = octstr_len(e->from);
Octstr *pfrom;
if (j > 0 && j - 1 + sizeof "/TYPE=PLMN" == len)
pfrom = octstr_copy(e->from, 0, j);
else if (k > 0 && k + sizeof "/TYPE=IPv" == len)
pfrom = octstr_copy(e->from, 0, k);
else
pfrom = octstr_duplicate(e->from);
if (octstr_search_char(e->from, '@', 0) < 0)
octstr_format_append(pfrom,"@%S", myhostname);
res = mms_sendtoemail(pfrom, to->rcpt,
e->subject ? e->subject : octstr_imm(""),
e->msgId, msg, 0, &err, octstr_get_cstr(sendmail_cmd),
myhostname, 0, 0,
"",
"", 0,
e->xqfname,
e->hdrs);
octstr_destroy(pfrom);
} else
res = mms_sendtommsc(mmc, e->from, to->rcpt,
e->msgId,
otransid,
e->token, /* token = linkedid */
e->vasid ? octstr_get_cstr(e->vasid) : NULL,
e->vaspid,
msg,
e->url1, e->url2,
e->hdrs,
&new_msgid,
&err);
done:
if (res == MMS_SEND_OK) {
if (res == MMS_SEND_OK || res == MMS_SEND_QUEUED) {
to->process = 0;
mmsbox_send_report(to->rcpt, "delivery-report", e->url1,
octstr_imm("Sent"), new_msgid, mmc->id, mmc->group_id, otransid, NULL, -1);
} else if (res == MMS_SEND_ERROR_FATAL && mmc)
mmsbox_send_report(to->rcpt, "delivery-report",
e->url1,

View File

@ -33,6 +33,8 @@ long maxthreads = 0;
double queue_interval = -1;
Octstr *unified_prefix = NULL;
List *strip_prefixes = NULL;
Octstr *sendmail_cmd = NULL;
Octstr *myhostname = NULL;
int mt_multipart = 0;
MmsQueueHandlerFuncs *qfs; /* queue functions. */
@ -79,12 +81,20 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
maxthreads = 10;
s = mms_cfg_get(grp, octstr_imm("queue-run-interval"));
if (s) {
queue_interval = atof(octstr_get_cstr(s));
octstr_destroy(s);
}
if (queue_interval <= 0)
queue_interval = QUEUERUN_INTERVAL;
if ((sendmail_cmd = mms_cfg_get(grp, octstr_imm("send-mail-prog"))) == NULL)
sendmail_cmd = octstr_imm("/usr/sbin/sendmail -f '%f' '%t'");
if ((myhostname = mms_cfg_get(grp, octstr_imm("hostname"))) == NULL)
myhostname = octstr_imm("localhost");
gdir = mms_cfg_get(grp, octstr_imm("storage-directory"));

View File

@ -94,6 +94,8 @@ extern List *mms_services; /* list of MMS Services */
extern List *mmscs; /* MMSC list. Perhaps turn into a Dict instead? */
extern Octstr *incoming_qdir, *outgoing_qdir, *dlr_dir;
extern Octstr *unified_prefix;
extern Octstr *sendmail_cmd;
extern Octstr *myhostname;
extern List *strip_prefixes;
extern long mmsbox_maxsendattempts, mmsbox_send_back_off, default_msgexpiry;
extern long maxthreads;