diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 934c7da..3e137aa 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2008-12-01 P. A. Bagyenda + * Misc. fixes to number normalisation in mmsbox 2008-11-26 P. A. Bagyenda * Added validityperiod sendmms cgi param * Minor changes to mmsbox CDR logging to improve clarity diff --git a/mbuni/extras/pgsql-queue/mms_pgsql_queue.c b/mbuni/extras/pgsql-queue/mms_pgsql_queue.c index 30bd2ad..d5c84dc 100644 --- a/mbuni/extras/pgsql-queue/mms_pgsql_queue.c +++ b/mbuni/extras/pgsql-queue/mms_pgsql_queue.c @@ -465,8 +465,10 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho e->attempts = num_attempts; if (mms_validate_address(e->from) != 0) { +#if 0 mms_warning(0, "pgsql_queue", NULL, "mms_queueread: Mal-formed address [%s] in queue entry %s/%s! " "Attempting fixup.", octstr_get_cstr(e->from), mms_queuedir, qf); +#endif _mms_fixup_address(&e->from, NULL,NULL,1); } @@ -502,8 +504,10 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho case 'Z': t = octstr_create(res); if (mms_validate_address(t) != 0) { +#if 0 mms_warning(0, "pgsql_queue", NULL, "mms_queueread: Mal-formed address [%s] in queue entry %s/%s! " "Attempting fixup.", res, mms_queuedir, qf); +#endif _mms_fixup_address(&t, NULL,NULL,1); } to = gw_malloc(sizeof *to); diff --git a/mbuni/mmlib/mms_queue.c b/mbuni/mmlib/mms_queue.c index 1f7c4bb..ed8e049 100644 --- a/mbuni/mmlib/mms_queue.c +++ b/mbuni/mmlib/mms_queue.c @@ -268,8 +268,10 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho case 'F': e->from = octstr_create(res); if (mms_validate_address(e->from) != 0) { +#if 0 mms_warning(0, "mms_queueread", NULL, "Mal-formed address [%s] in file %s! " "Attempting fixup.", res, xqf); +#endif _mms_fixup_address(&e->from, NULL, NULL, 1); } break; @@ -277,8 +279,10 @@ static MmsEnvelope *mms_queue_readenvelope(char *qf, char *mms_queuedir, int sho case 'z': t = octstr_create(res); if (mms_validate_address(t) != 0) { +#if 0 mms_warning(0, "mms_queueread", NULL, "Mal-formed address [%s] in file %s! " "Attempting fixup.", res, xqf); +#endif _mms_fixup_address(&t, NULL, NULL, 1); } to = gw_malloc(sizeof *to); diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index 6e1f00a..64a082a 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -875,18 +875,33 @@ void mms_log(char *logmsg, Octstr *from, List *to, { Octstr *xto = octstr_create(""); int i, n = to ? gwlist_len(to) : 0; + Octstr *xfrom = from ? octstr_duplicate(from) : NULL; + int j = xfrom ? octstr_case_search(xfrom, octstr_imm("/TYPE=PLMN"), 0) : -1; - for (i = 0; i < n; i++) + if (j >= 0) + octstr_delete(xfrom, j, octstr_len(xfrom)); + + for (i = 0; i < n; i++) { + void *y; + Octstr *x = (y = gwlist_get(to,i)) ? octstr_duplicate(y) : NULL; + int j = x ? octstr_case_search(x, octstr_imm("/TYPE=PLMN"), 0) : -1; + + if (j >= 0) + octstr_delete(x, j, octstr_len(x)); + octstr_format_append(xto, "%s%S", (i == 0) ? "" : ", ", - gwlist_get(to,i)); + x); + + octstr_destroy(x); + } alog("%s MMS [INT:%s] [ACT:%s] [MMSC:%s] [from:%s] [to:%s] [msgid:%s] [size=%d] [UA:%s] [MMBox:%s]", logmsg, interface, acct ? octstr_get_cstr(acct) : "", viaproxy ? octstr_get_cstr(viaproxy) : "", - from ? octstr_get_cstr(from) : "", + xfrom ? octstr_get_cstr(xfrom) : "", octstr_get_cstr(xto), msgid ? octstr_get_cstr(msgid) : "", msize, @@ -894,6 +909,7 @@ void mms_log(char *logmsg, Octstr *from, List *to, mmboxloc ? octstr_get_cstr(mmboxloc) : ""); octstr_destroy(xto); + octstr_destroy(xfrom); } diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 1f55bac..2697fcf 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -411,11 +411,15 @@ static int queue_dlr(MmscGrp *mmc, Octstr *from, Octstr *to, Octstr *msgid, Octs int ret; Octstr *qf, *rr_uri = NULL; List *rqh = http_create_empty_headers(); + if (errl) http_header_combine(rqh, errl); /* add status stuff. */ + gwlist_append(lto, octstr_duplicate(to)); + + qdir = get_mmsbox_queue_dir(from, lto, mmc, &mmc_id); /* get routing info. */ rr_uri = mmsbox_get_report_info(m, mmc, mmc_id, "delivery-report", status, rqh, NULL, 0, msgid); @@ -444,7 +448,7 @@ static int queue_dlr(MmscGrp *mmc, Octstr *from, Octstr *to, Octstr *msgid, Octs gwlist_destroy(lto, (void *)octstr_destroy); octstr_destroy(mmc_id); mms_destroy(m); - + return ret; } diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index 7d1fa44..79484f2 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -834,8 +834,7 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m, (fto = gwlist_extract_first(to)) != NULL) { /* we route based on first recipient XXX */ Octstr *xto = octstr_duplicate(fto); Octstr *xfrom = octstr_duplicate(from); - - + if (unified_prefix) _mms_fixup_address(&xfrom, octstr_get_cstr(unified_prefix), strip_prefixes, 0); if (unified_prefix) @@ -853,11 +852,12 @@ Octstr *get_mmsbox_queue_dir(Octstr *from, List *to, MmscGrp *m, gwlist_insert(to, 0, fto); octstr_destroy(xto); } - - if (xfrom) { + + if (xfrom) { /* Check if sender address changed */ octstr_delete(from, 0, octstr_len(from)); - octstr_append(from, xfrom); + octstr_append(from, xfrom); } + octstr_destroy(xfrom); } else _mcid = NULL;