diff --git a/mbuni/mmlib/mms_mm7soap.c b/mbuni/mmlib/mms_mm7soap.c index e0d0877..ec5b6af 100644 --- a/mbuni/mmlib/mms_mm7soap.c +++ b/mbuni/mmlib/mms_mm7soap.c @@ -922,6 +922,8 @@ MmsMsg *mm7_soap_to_mmsmsg(MSoapMsg_t *m, Octstr *from) void mm7_soap_destroy(MSoapMsg_t *m) { + if (m == NULL) return; + http_destroy_headers(m->envelope); if (m->msg) mime_entity_destroy(m->msg); diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 8165f48..0d6fc55 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -619,45 +619,37 @@ static Octstr *mm7soap_send(MmscGrp *mmc, Octstr *from, Octstr *to, if (!MM7_SOAP_STATUS_OK(tstatus) && tstatus != MM7_SOAP_COMMAND_REJECTED) { Octstr *detail = mm7_soap_header_value(mresp, octstr_imm("Details")); if (detail == NULL) - mm7_soap_header_value(mresp, octstr_imm("faultcode")); + detail = mm7_soap_header_value(mresp, octstr_imm("faultcode")); ret = NULL; info(0, "Send to MMSC[%s], failed, code=[%d=>%s], detail=[%s]", mmc ? octstr_get_cstr(mmc->id) : "", tstatus, mms_soap_status_to_cstr(tstatus), - detail ? octstr_get_cstr(detail) : ""); + detail ? octstr_get_cstr(detail) : "(empty)"); + *error = octstr_format("Failed to deliver to MMC[url=%s, id=%s], status=[%d=>%s]!", octstr_get_cstr(mmc->mmsc_url), octstr_get_cstr(mmc->id), tstatus, mms_soap_status_to_cstr(tstatus)); - if (detail) - octstr_destroy(detail); - - } else - ret = mm7_soap_header_value(mresp, octstr_imm("MessageID")); - - info(0, "Sent to MMC[%s], code=[%d=>%s], msgid=[%s]", octstr_get_cstr(mmc->id), - tstatus, mms_soap_status_to_cstr(tstatus), ret ? octstr_get_cstr(ret) : "(none)"); - + octstr_destroy(detail); + } else { + ret = mm7_soap_header_value(mresp, octstr_imm("MessageID")); + info(0, "Sent to MMC[%s], code=[%d=>%s], msgid=[%s]", octstr_get_cstr(mmc->id), + tstatus, mms_soap_status_to_cstr(tstatus), ret ? octstr_get_cstr(ret) : "(none)"); + } + if (ret) mms_log2("Sent", from, to, -1, ret, NULL, mmc->id, "MMSBox", NULL, NULL); done1: - - if (mreq) - mm7_soap_destroy(mreq); - if (mresp) - mm7_soap_destroy(mresp); - if (rh) - http_destroy_headers(rh); - if (body) - octstr_destroy(body); - if (ph) - http_destroy_headers(ph); - if (rbody) - octstr_destroy(rbody); - if (url) - octstr_destroy(url); + + mm7_soap_destroy(mreq); + mm7_soap_destroy(mresp); + http_destroy_headers(rh); + octstr_destroy(body); + http_destroy_headers(ph); + octstr_destroy(rbody); + octstr_destroy(url); gwlist_destroy(xto, NULL); diff --git a/mbuni/mmsc/mmsfromemail.c b/mbuni/mmsc/mmsfromemail.c index a7af55a..757ae08 100644 --- a/mbuni/mmsc/mmsfromemail.c +++ b/mbuni/mmsc/mmsfromemail.c @@ -603,11 +603,17 @@ static void fixup_addresses(List *headers) static void send_mm4_res(int mtype, Octstr *to, Octstr *sender, Octstr *transid, char *status, Octstr *msgid) { + char tmp[32]; List *h = http_create_empty_headers(); MIMEEntity *m = mime_entity_create(); Octstr *err = NULL; /* Make headers */ - http_header_add(h, "X-Mms-3GPP-MMS-Version", MMS_3GPP_VERSION); + sprintf(tmp, "%d.%d.%d", + MAJOR_VERSION(MMS_3GPP_VERSION), + MINOR1_VERSION(MMS_3GPP_VERSION), + MINOR2_VERSION(MMS_3GPP_VERSION)); + + http_header_add(h, "X-Mms-3GPP-MMS-Version", tmp); http_header_add(h, "X-Mms-Transaction-ID", octstr_get_cstr(transid)); http_header_add(h, "X-Mms-Message-Type", mm4_types[mtype].mm4str); if (msgid)