1
0
Fork 0

- Misc. fixes for MM4 inter-operability

- Allow adapatation fixes
This commit is contained in:
bagyenda 2007-03-06 07:43:08 +00:00
parent fd2d1fbc79
commit 222cf4487a
4 changed files with 18 additions and 57 deletions

View File

@ -485,6 +485,7 @@ Octstr *headers_to_soapxml(List *hdrs)
case MM7_TAG_StatusText:
case MM7_TAG_Details:
case MM7_TAG_SenderAddress:
case MM7_TAG_allowAdaptations:
skip = 1;
break;
case MM7_TAG_Sender:

View File

@ -307,6 +307,7 @@ VNSTRING(MM7_5, "MessageType",MM7_TAG_MessageType)
VNSTRING(MM7_5, "replyChargingSize", MM7_TAG_replyChargingSize)
VNSTRING(MM7_5, "replyDeadline", MM7_TAG_replyDeadline)
VNSTRING(MM7_5, "DeliveryReport", MM7_TAG_DeliveryReport)
VNSTRING(MM7_5, "allowAdaptations", MM7_TAG_allowAdaptations)
)
NUMBERED(soap_status,

View File

@ -465,10 +465,9 @@ static void addmmscname(Octstr *s, Octstr *myhostname)
return; /* Nothing to do. */
j = octstr_case_search(s, octstr_imm("/TYPE=PLMN"), 0);
if (j > 0 && j - 1 + sizeof "/TYPE=PLMN" == len) { /* A proper number. */
octstr_delete(s, j, -1 + sizeof "/TYPE=PLMN"); /* XXX We strip off /TYPE=PLMN, should we ? */
if (j > 0 && j - 1 + sizeof "/TYPE=PLMN" == len) /* A proper number. */
octstr_format_append(s, "@%S", myhostname);
}
}
static int send2email(Octstr *to, Octstr *from, Octstr *subject,
@ -483,11 +482,8 @@ static int send2email(Octstr *to, Octstr *from, Octstr *subject,
List *headers = mime_entity_headers(m); /* we don't want the mime version header removed. */
if (append_hostname) { /* Add our hostname to all phone numbers. */
int i, n;
List *l = http_create_empty_headers();
Octstr *xfrom = http_header_value(headers, octstr_imm("From"));
List *lto = http_header_find_all(headers, "To");
List *lcc = http_header_find_all(headers, "Cc");
if (xfrom) {
addmmscname(xfrom, myhostname);
@ -495,44 +491,6 @@ static int send2email(Octstr *to, Octstr *from, Octstr *subject,
octstr_destroy(xfrom);
}
http_header_remove_all(headers, "From");
for (i = 0, n = gwlist_len(lto); i < n; i++) {
Octstr *name, *value;
http_header_get(lto, i, &name, &value);
if (!value || !name ||
octstr_case_compare(name, octstr_imm("To")) != 0)
goto loop;
addmmscname(value, myhostname);
http_header_add(l, "To", octstr_get_cstr(value));
loop:
if (value) octstr_destroy(value);
if (name) octstr_destroy(name);
}
http_destroy_headers(lto);
http_header_remove_all(headers, "To");
for (i = 0, n = gwlist_len(lcc); i < n; i++) {
Octstr *name, *value;
http_header_get(lcc, i, &name, &value);
if (!value || !name ||
octstr_case_compare(name, octstr_imm("Cc")) != 0)
goto loop2;
addmmscname(value, myhostname);
http_header_add(l, "Cc", octstr_get_cstr(value));
loop2:
if (value) octstr_destroy(value);
if (name) octstr_destroy(name);
}
http_destroy_headers(lcc);
http_header_remove_all(headers, "Cc");
http_append_headers(headers, l); /* combine old with new. */
http_destroy_headers(l);
@ -674,15 +632,23 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
base64_mimeparts(m); /* make sure parts are base64 formatted. */
headers = mime_entity_headers(m);
/* Before we send it, we insert some email friendly headers if they are missing. */
http_header_add(newhdrs, "Subject", subject ? octstr_get_cstr(subject) : "MMS Message");
http_header_remove_all(headers, "From");
http_header_add(newhdrs, "From", octstr_get_cstr(from));
http_header_remove_all(headers, "To");
http_header_add(newhdrs, "To", octstr_get_cstr(to));
http_header_add(newhdrs, "Message-ID", msgid ? octstr_get_cstr(msgid) : "");
http_header_add(newhdrs, "X-Mms-Message-ID", msgid ? octstr_get_cstr(msgid) : "");
http_header_add(newhdrs, "MIME-Version", "1.0");
headers = mime_entity_headers(m);
http_header_add(newhdrs, "X-Mms-3GPP-MMS-Version", "5.5.0");
http_header_add(newhdrs, "X-Mms-Originator-System", myhostname ? octstr_get_cstr(myhostname) : "none");
http_header_remove_all(headers, "X-Mms-Message-Type");
http_header_add(newhdrs, "X-Mms-Message-Type", "MM4_forward.REQ");
http_header_combine(headers, newhdrs);
mime_replace_headers(m, headers);

View File

@ -461,12 +461,9 @@ static int mms_sendtoproxy(Octstr *from, Octstr *to,
Octstr *msgid, time_t expires, MmsMsg *msg, int dlr, Octstr **error)
{
Octstr *pto;
Octstr *pto;
int x;
if (!to ||
octstr_search_char(to, '@', 0) >= 0) {
*error = octstr_format("Bad recipient address sent to MM4 interface, addresss is %S!", to);
@ -492,21 +489,17 @@ static int mms_sendtoproxy(Octstr *from, Octstr *to,
octstr_destroy(ret);
}
pto = octstr_format("%S@%S", to, proxy);
x = mms_sendtoemail(from, pto,
subject ? subject : settings->mms_email_subject,
msgid, msg, 0,
error, sendmail_cmd,
settings->hostname, 0, 0,NULL,NULL,0);
mms_log2("Sent", from, to,
-1, msgid, NULL, proxy, "MM4", NULL,NULL);
octstr_destroy(pto);
mms_log2("Sent", from, pto,
-1, msgid, NULL, proxy, "MM4", NULL,NULL);
octstr_destroy(pto);
return x;
}