Added mms-to-email and local mms handler VASP
This commit is contained in:
parent
068ebd9a9c
commit
9b672030a1
|
@ -279,6 +279,8 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays)
|
|||
CfgGroup *grp = list_get(l, i);
|
||||
MmsVasp *mv = gw_malloc(sizeof *mv);
|
||||
Octstr *s;
|
||||
int ibool = 0;
|
||||
|
||||
mv->id = _mms_cfg_getx(grp, octstr_imm("vasp-id"));
|
||||
mv->short_code = -1;
|
||||
cfg_get_integer(&mv->short_code, grp, octstr_imm("short-code"));
|
||||
|
@ -301,6 +303,19 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays)
|
|||
mv->type = NONE_VASP;
|
||||
octstr_destroy(s);
|
||||
|
||||
/* Set the handler vasp accounts. */
|
||||
if (cfg_get_bool(&ibool, grp, octstr_imm("mms-to-email-handler")) == 0 &&
|
||||
ibool) {
|
||||
if (m->mms2email)
|
||||
warning(0, "mms-to-email handler VASP specified more than once! Only last config taken.");
|
||||
m->mms2email = mv;
|
||||
}
|
||||
if (cfg_get_bool(&ibool, grp, octstr_imm("mms-to-local-copy-handler")) == 0 &&
|
||||
ibool) {
|
||||
if (m->mms2mobile)
|
||||
warning(0, "mms-to-mobile copy handler VASP specified more than once! Only last config taken.");
|
||||
m->mms2mobile = mv;
|
||||
}
|
||||
list_append(m->vasp_list, mv);
|
||||
}
|
||||
list_destroy(l, NULL);
|
||||
|
|
|
@ -92,6 +92,9 @@ typedef struct MmscSettings {
|
|||
Octstr *wap_gw_ip_header;
|
||||
|
||||
List *vasp_list; /* of MmsVasp * */
|
||||
|
||||
MmsVasp *mms2email, *mms2mobile;
|
||||
|
||||
} MmscSettings;
|
||||
|
||||
/* Returns mmsc settings. */
|
||||
|
|
|
@ -147,15 +147,22 @@ static int sendMsg(MmsEnvelope *e)
|
|||
*/
|
||||
|
||||
if (octstr_search_char(to->rcpt, '@', 0) > 0) {
|
||||
res = mms_sendtoemail(e->from, to->rcpt,
|
||||
e->subject,
|
||||
e->msgId, msg, e->dlr, &err, sendmail_cmd,
|
||||
settings->hostname, 1, 1, octstr_get_cstr(settings->mms_email_txt),
|
||||
octstr_get_cstr(settings->mms_email_html), 1);
|
||||
mms_log2("Sent", e->from, to->rcpt,
|
||||
-1, e->msgId, NULL, NULL, "MM3", NULL,NULL);
|
||||
|
||||
} else if (e->viaproxy && octstr_len(e->viaproxy) > 0)
|
||||
if (settings->mms2email)
|
||||
res = mms_sendtovasp(settings->mms2email,
|
||||
e->from, to->rcpt,
|
||||
e->msgId,
|
||||
msg, &err);
|
||||
else
|
||||
res = mms_sendtoemail(e->from, to->rcpt,
|
||||
e->subject,
|
||||
e->msgId, msg, e->dlr, &err, sendmail_cmd,
|
||||
settings->hostname, 1, 1,
|
||||
octstr_get_cstr(settings->mms_email_txt),
|
||||
octstr_get_cstr(settings->mms_email_html), 1);
|
||||
if (res == MMS_SEND_OK)
|
||||
mms_log2("Sent", e->from, to->rcpt,
|
||||
-1, e->msgId, NULL, NULL, "MM3", NULL,NULL);
|
||||
} else if (e->viaproxy && octstr_len(e->viaproxy) > 0)
|
||||
res = mms_sendtoproxy(e->from,
|
||||
to->rcpt, e->subject, e->viaproxy,
|
||||
e->msgId, e->expiryt, msg, e->dlr, &err);
|
||||
|
@ -172,6 +179,21 @@ static int sendMsg(MmsEnvelope *e)
|
|||
if (j > 0 && j - 1 + sizeof "/TYPE=PLMN" == len)
|
||||
phonenum = octstr_copy(to->rcpt, 0, j);
|
||||
else if (k > 0 && k + sizeof "/TYPE=IPv" == len) {
|
||||
if (settings->mms2mobile) { /* Send a copy to this VASP. */
|
||||
Octstr *xerr = NULL;
|
||||
int res = mms_sendtovasp(settings->mms2mobile,
|
||||
e->from, to->rcpt,
|
||||
e->msgId,
|
||||
msg, &err);
|
||||
info(0, "%s Global Queue MMS Send: Local Msg copy to VASP (%s) - "
|
||||
"From %s, to %s, msgsize=%ld: err=%s",
|
||||
SEND_ERROR_STR(res),
|
||||
octstr_get_cstr(settings->mms2mobile->id),
|
||||
octstr_get_cstr(e->from), octstr_get_cstr(to->rcpt), e->msize,
|
||||
xerr ? octstr_get_cstr(xerr) : "(null)");
|
||||
if (xerr)
|
||||
octstr_destroy(xerr);
|
||||
}
|
||||
res = mms_sendtomobile(e->from,
|
||||
to->rcpt, e->subject, e->fromproxy,
|
||||
e->msgId, e->expiryt, msg, e->dlr, &err);
|
||||
|
|
Loading…
Reference in New Issue