1
0
Fork 0

minor fix with mmsc message routing

This commit is contained in:
bagyenda 2007-08-25 04:49:44 +00:00
parent 21f1188c4e
commit b3f9f30919
1 changed files with 29 additions and 17 deletions

View File

@ -263,13 +263,15 @@ static int sendMsg(MmsEnvelope *e)
e->msgId, e->expiryt, msg, e->dlr, e->msgId, e->expiryt, msg, e->dlr,
&err); &err);
sent = 1; sent = 1;
} else if (proxyrelays && gwlist_len(proxyrelays) > 0) } else {
/* else, step through proxies, look for one that matches. */ /* else, step through proxies, look for one that matches. */
for (j = 0, m = gwlist_len(proxyrelays); j<m; j++) { for (j = 0, m = proxyrelays ? gwlist_len(proxyrelays) : 0; j<m; j++) {
MmsProxyRelay *mp = gwlist_get(proxyrelays, j); MmsProxyRelay *mp = gwlist_get(proxyrelays, j);
if (!octstr_compare(mp->host, mmsc)) { if (octstr_compare(mp->host, mmsc) == 0) {
Octstr *xtransid = mms_maketransid(e->xqfname, settings->host_alias); Octstr *xtransid = mms_maketransid(e->xqfname,
settings->host_alias);
res = mms_sendtoproxy(e->from, to->rcpt, res = mms_sendtoproxy(e->from, to->rcpt,
e->subject, mp->host, e->subject, mp->host,
octstr_get_cstr(xtransid), octstr_get_cstr(xtransid),
@ -280,6 +282,20 @@ static int sendMsg(MmsEnvelope *e)
break; break;
} }
} }
if (sent != 1) /* try mm7 delivery. Again. */
for (j = 0, m = gwlist_len(settings->vasp_list); j < m; j++)
if ((vasp = gwlist_get(settings->vasp_list, j)) != NULL &&
vasp->id &&
octstr_compare(vasp->id, mmsc) == 0) {
res = mms_sendtovasp(vasp, e->from, to->rcpt,
e->msgId,
e->hdrs,
msg, &err);
sent = 1;
break;
}
}
octstr_destroy(mmsc); octstr_destroy(mmsc);
} }
} }
@ -288,7 +304,7 @@ static int sendMsg(MmsEnvelope *e)
err = octstr_format("MMSC error: Don't know how to deliver to %S !", to->rcpt); err = octstr_format("MMSC error: Don't know how to deliver to %S !", to->rcpt);
} }
if (phonenum) octstr_destroy(phonenum); octstr_destroy(phonenum);
} }
done: done:
@ -362,8 +378,8 @@ static int sendMsg(MmsEnvelope *e)
} }
done2: done2:
if (msg)
mms_destroy(msg); mms_destroy(msg);
if (e) { /* Update the queue if it is still valid (e.g. recipients not handled) XXX can this happen here??... */ if (e) { /* Update the queue if it is still valid (e.g. recipients not handled) XXX can this happen here??... */
e->lasttry = time(NULL); e->lasttry = time(NULL);
@ -693,16 +709,12 @@ static int mm7eaif_send(MmsVasp *vasp, Octstr *from, Octstr *to, Octstr *msgid,
ret = MMS_SEND_OK; ret = MMS_SEND_OK;
} }
if (rh)
http_destroy_headers(rh); http_destroy_headers(rh);
if (body) octstr_destroy(body);
octstr_destroy(body); http_destroy_headers(ph);
if (ph) octstr_destroy(rbody);
http_destroy_headers(ph); octstr_destroy(url);
if (rbody)
octstr_destroy(rbody);
if (url)
octstr_destroy(url);
return ret; return ret;
} }