fix for DLR in MM4
This commit is contained in:
parent
f7fa35d3ea
commit
0cb6626339
|
@ -1,3 +1,5 @@
|
||||||
|
2008-07-09 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
* Fix for FROM address in MM4_delivery_report.REQ packet
|
||||||
2008-07-07 P. A. Bagyenda <bagyenda@dsmagic.com>
|
2008-07-07 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
* Move to compile against Kannel-CVS
|
* Move to compile against Kannel-CVS
|
||||||
2008-07-07 P. A. Bagyenda <bagyenda@dsmagic.com>
|
2008-07-07 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
|
|
@ -60,6 +60,7 @@ static int pgq_cleanup_module(void)
|
||||||
gw_assert(free_conns);
|
gw_assert(free_conns);
|
||||||
|
|
||||||
gwlist_remove_producer(free_conns);
|
gwlist_remove_producer(free_conns);
|
||||||
|
sleep(2);
|
||||||
gwlist_destroy(free_conns, (void *)PQfinish);
|
gwlist_destroy(free_conns, (void *)PQfinish);
|
||||||
free_conns = NULL;
|
free_conns = NULL;
|
||||||
|
|
||||||
|
@ -71,19 +72,22 @@ static PGconn *get_conn(void)
|
||||||
{
|
{
|
||||||
PGconn *c;
|
PGconn *c;
|
||||||
PGresult *r;
|
PGresult *r;
|
||||||
gw_assert(free_conns);
|
|
||||||
|
if (free_conns == NULL) return NULL;
|
||||||
|
|
||||||
c = gwlist_consume(free_conns);
|
c = gwlist_consume(free_conns);
|
||||||
|
if (c) { /* might fail if we are shutting down. */
|
||||||
r = PQexec(c, "BEGIN"); /* start a transaction. */
|
r = PQexec(c, "BEGIN"); /* start a transaction. */
|
||||||
PQclear(r);
|
PQclear(r);
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void return_conn(PGconn *c)
|
static void return_conn(PGconn *c)
|
||||||
{
|
{
|
||||||
PGresult *r;
|
PGresult *r;
|
||||||
gw_assert(free_conns);
|
|
||||||
|
if (free_conns == NULL) return;
|
||||||
|
|
||||||
/* commit or destroy transaction. */
|
/* commit or destroy transaction. */
|
||||||
if (PQtransactionStatus(c) == PQTRANS_INERROR)
|
if (PQtransactionStatus(c) == PQTRANS_INERROR)
|
||||||
|
@ -432,7 +436,7 @@ static int _puthdr(PGconn *c, int64_t qid, char *hname, char *val)
|
||||||
static int writeenvelope(MmsEnvelope *e, int newenv)
|
static int writeenvelope(MmsEnvelope *e, int newenv)
|
||||||
{
|
{
|
||||||
char *s, buf[512], cmd[QFNAMEMAX*4 + 1], lastt[128], sendt[128], expiryt[128], *xfrom;
|
char *s, buf[512], cmd[QFNAMEMAX*4 + 1], lastt[128], sendt[128], expiryt[128], *xfrom;
|
||||||
int i, n, res = 0;
|
int i, n;
|
||||||
struct pgfile_t *qfs = e ? e->qfs_data : NULL;
|
struct pgfile_t *qfs = e ? e->qfs_data : NULL;
|
||||||
PGresult *r;
|
PGresult *r;
|
||||||
|
|
||||||
|
@ -573,7 +577,7 @@ static int writeenvelope(MmsEnvelope *e, int newenv)
|
||||||
_puthdr(qfs->conn, qfs->qid,"b", buf);
|
_puthdr(qfs->conn, qfs->qid,"b", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -751,7 +751,6 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
|
||||||
} else {
|
} else {
|
||||||
char *x, tmp[32];
|
char *x, tmp[32];
|
||||||
Octstr *xsender = octstr_format("system-user@%S", myhostname);
|
Octstr *xsender = octstr_format("system-user@%S", myhostname);
|
||||||
|
|
||||||
Octstr *y;
|
Octstr *y;
|
||||||
|
|
||||||
if (msgid) {
|
if (msgid) {
|
||||||
|
@ -788,6 +787,8 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
|
||||||
Octstr *s = http_header_value(headers, octstr_imm("X-Mms-Status"));
|
Octstr *s = http_header_value(headers, octstr_imm("X-Mms-Status"));
|
||||||
x = "MM4_delivery_report.REQ";
|
x = "MM4_delivery_report.REQ";
|
||||||
|
|
||||||
|
/* insert FROM address as recipient as per spec */
|
||||||
|
http_header_add(newhdrs, "From", octstr_get_cstr(to));
|
||||||
/* rename status header. */
|
/* rename status header. */
|
||||||
http_header_remove_all(headers, "X-Mms-Status");
|
http_header_remove_all(headers, "X-Mms-Status");
|
||||||
http_header_add(newhdrs, "X-Mms-MM-Status-Code",
|
http_header_add(newhdrs, "X-Mms-MM-Status-Code",
|
||||||
|
@ -795,9 +796,11 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
|
||||||
if (!s)
|
if (!s)
|
||||||
warning(0, "MMS Delivery report with missing Status!");
|
warning(0, "MMS Delivery report with missing Status!");
|
||||||
octstr_destroy(s);
|
octstr_destroy(s);
|
||||||
} else if (mtype == MMS_MSGTYPE_READ_REC_IND)
|
} else if (mtype == MMS_MSGTYPE_READ_REC_IND) {
|
||||||
x = "MM4_read_reply_report.REQ";
|
x = "MM4_read_reply_report.REQ";
|
||||||
else {
|
/* insert FROM address as recipient as per spec */
|
||||||
|
http_header_add(newhdrs, "From", octstr_get_cstr(to));
|
||||||
|
} else {
|
||||||
*error = octstr_format("Invalid message type %s on MM4 outgoing interface!",
|
*error = octstr_format("Invalid message type %s on MM4 outgoing interface!",
|
||||||
mms_message_type_to_cstr(mtype));
|
mms_message_type_to_cstr(mtype));
|
||||||
x = "";
|
x = "";
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
* the GNU General Public License, with a few exceptions granted (see LICENSE)
|
* the GNU General Public License, with a few exceptions granted (see LICENSE)
|
||||||
*/
|
*/
|
||||||
#include "mmsrelay.h"
|
#include "mmsrelay.h"
|
||||||
|
#include <errno.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
#define WAPPUSH_PORT 2948
|
#define WAPPUSH_PORT 2948
|
||||||
|
|
||||||
|
@ -138,7 +140,7 @@ static void start_push(Octstr *rcpt_to, int isphonenum, MmsEnvelope *e, MmsMsg *
|
||||||
e = update_env_success(e, xto);
|
e = update_env_success(e, xto);
|
||||||
} else {
|
} else {
|
||||||
e = update_env_failed(e);
|
e = update_env_failed(e);
|
||||||
error(0, "push to %s:%d failed, no reason found", octstr_get_cstr(to), WAPPUSH_PORT);
|
error(0, "push to %s:%d failed: %s", octstr_get_cstr(to), WAPPUSH_PORT, strerror(errno));
|
||||||
}
|
}
|
||||||
octstr_destroy(addr);
|
octstr_destroy(addr);
|
||||||
if (e)
|
if (e)
|
||||||
|
@ -462,15 +464,15 @@ static int sendNotify(MmsEnvelope *e)
|
||||||
e ? e->msgId : NULL, NULL, NULL);
|
e ? e->msgId : NULL, NULL, NULL);
|
||||||
|
|
||||||
if (msg) mms_destroy(msg);
|
if (msg) mms_destroy(msg);
|
||||||
if (phonenum)
|
|
||||||
octstr_destroy(phonenum);
|
octstr_destroy(phonenum);
|
||||||
if (rcpt_ip)
|
|
||||||
octstr_destroy(rcpt_ip);
|
octstr_destroy(rcpt_ip);
|
||||||
octstr_destroy(to);
|
octstr_destroy(to);
|
||||||
if (msgId) octstr_destroy(msgId);
|
octstr_destroy(msgId);
|
||||||
if (fromproxy) octstr_destroy(fromproxy);
|
octstr_destroy(fromproxy);
|
||||||
octstr_destroy(from);
|
octstr_destroy(from);
|
||||||
if (err) octstr_destroy(err);
|
octstr_destroy(err);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue