better mm7 namespace handling
This commit is contained in:
parent
824b57f35f
commit
eef6e9b967
|
@ -1,3 +1,5 @@
|
|||
2007-06-21 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Better configurability of MM7/SOAP namespace URI and MM7 version.
|
||||
2007-06-12 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Improved DLR reporting over MM4 interface - set receipient as from address
|
||||
2007-05-08 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
|
|
|
@ -1697,13 +1697,27 @@ vasp-url
|
|||
String
|
||||
</td>
|
||||
<td valign=top >
|
||||
Optional. The MM7 version to use on this interface. (defaults are "5.1.0" for
|
||||
Optional. The MM7 version to use on this interface. (defaults are "5.3.0" for
|
||||
XML/SOAP, "3.0" for EAIF.) For SOAP, this is
|
||||
used primarily to build the XML Namespace URL. For EAIF it is
|
||||
used as the value for the MM7Version XML node. For EAIF it is
|
||||
reported in the HTTP headers.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top >
|
||||
<tt>mm7-soap-xmlns</tt>
|
||||
</td>
|
||||
<td valign=top >
|
||||
String
|
||||
</td>
|
||||
<td valign=top >
|
||||
Optional. The namespace URI for the "mm7:" XML
|
||||
namespace. Only valid for MM7/SOAP, and is used in the SOAP message
|
||||
to identify the namespace for all MM7/SOAP specific elements. Default value is <i>http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign=top >
|
||||
|
@ -2030,13 +2044,27 @@ Supported configuration parameters are:
|
|||
String
|
||||
</td>
|
||||
<td valign=top >
|
||||
Optional. The MM7 version to use on this interface. (defaults are "5.1.0" for
|
||||
XML/SOAP, "3.0" for EAIF.) For SOAP, this is
|
||||
used primarily to build the XML Namespace URL. For EAIF it is
|
||||
Optional. The MM7 version to use on this interface. (defaults are "5.3.0" for
|
||||
MM7/SOAP, "3.0" for EAIF.) For SOAP, this is
|
||||
used in the MM7Version tag. For EAIF it is
|
||||
reported in the HTTP headers.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top >
|
||||
<tt>mm7-soap-xmlns</tt>
|
||||
</td>
|
||||
<td valign=top >
|
||||
String
|
||||
</td>
|
||||
<td valign=top >
|
||||
Optional. The namespace URI for the "mm7:" XML
|
||||
namespace. Only valid for MM7/SOAP, and is used in the SOAP message
|
||||
to identify the namespace for all MM7/SOAP specific elements. Default value is <i>http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign=top >
|
||||
<tt>mmsc-url</tt>
|
||||
|
|
|
@ -98,6 +98,7 @@ MULTI_GROUP(mms-vasp,
|
|||
OCTSTR(vasp-id)
|
||||
OCTSTR(type)
|
||||
OCTSTR(mm7-version)
|
||||
OCTSTR(mm7-soap-xmlns)
|
||||
OCTSTR(short-code)
|
||||
OCTSTR(vasp-username)
|
||||
OCTSTR(vasp-password)
|
||||
|
@ -129,6 +130,7 @@ MULTI_GROUP(mmsc,
|
|||
OCTSTR(max-throughput)
|
||||
OCTSTR(type)
|
||||
OCTSTR(mm7-version)
|
||||
OCTSTR(mm7-soap-xmlns)
|
||||
)
|
||||
|
||||
MULTI_GROUP(mms-service,
|
||||
|
|
|
@ -393,14 +393,14 @@ static int ver_compare(MM7Version_t *v1, MM7Version_t *v2)
|
|||
}
|
||||
|
||||
|
||||
#define XMLNSMM7 "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-%d-MM7-%d-%d"
|
||||
#define XMLNSMM7 "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0"
|
||||
#define SOAP_ENV "SOAP-ENV"
|
||||
|
||||
/* Construct by hand. */
|
||||
static Octstr *headers_to_soapxml(List *hdrs, MM7Version_t *ver)
|
||||
{
|
||||
Octstr *s = octstr_create("<?xml version='1.0' encoding='UTF-8'?>\n");
|
||||
Octstr *xmlns = octstr_format(XMLNSMM7, ver->major, ver->minor1, ver->minor2);
|
||||
Octstr *xmlns = octstr_create((ver->xmlns[0]) ? ver->xmlns : XMLNSMM7);
|
||||
Octstr *p, *q, *r, *fault, *mtype;
|
||||
int i, n, mtag;
|
||||
time_t t;
|
||||
|
@ -448,7 +448,8 @@ static Octstr *headers_to_soapxml(List *hdrs, MM7Version_t *ver)
|
|||
octstr_format_append(s, "<mm7:MM7Version>%S</mm7:MM7Version>\n", p);
|
||||
octstr_destroy(p);
|
||||
} else
|
||||
octstr_format_append(s, "<mm7:MM7Version>%s</mm7:MM7Version>\n", MM7_VERSION);
|
||||
octstr_format_append(s, "<mm7:MM7Version>%d.%d.%d</mm7:MM7Version>\n",
|
||||
ver->major, ver->minor1, ver->minor2);
|
||||
|
||||
p = http_header_value(hdrs, octstr_imm("VASPID"));
|
||||
q = http_header_value(hdrs, octstr_imm("VASID"));
|
||||
|
|
|
@ -19,14 +19,19 @@
|
|||
#define MM7_SOAP_COMMAND_REJECTED 3005
|
||||
#define MM7_SOAP_UNSUPPORTED_OPERATION 4003
|
||||
#define MM7_SOAP_STATUS_OK(e) ((e) / 1000 == 1)
|
||||
#define MM7_DEFAULT_VERSION MMS_3GPP_VERSION
|
||||
|
||||
#if 0
|
||||
#define MM7_DEFAULT_VERSION MMS_3GPP_VERSION
|
||||
#define MM7_VERSION "5.3.0"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_MM7_VERSION MAKE_VERSION(5,3,0)
|
||||
|
||||
typedef struct MSoapMsg_t MSoapMsg_t;
|
||||
|
||||
typedef struct MM7Version_t {
|
||||
int major, minor1, minor2; /* e.g. 5.1.0. */
|
||||
char xmlns[128];
|
||||
} MM7Version_t;
|
||||
|
||||
/* Parse SOAP message given http headers and body. */
|
||||
|
|
|
@ -695,11 +695,15 @@ int mms_sendtoemail(Octstr *from, Octstr *to,
|
|||
http_header_add(newhdrs, "Message-ID", msgid ? octstr_get_cstr(msgid) : "");
|
||||
http_header_add(newhdrs, "MIME-Version", "1.0");
|
||||
} else {
|
||||
char *x;
|
||||
char *x, tmp[32];
|
||||
Octstr *xsender = octstr_format("system-user@%S", myhostname);
|
||||
http_header_add(newhdrs, "X-Mms-Message-ID", msgid ? octstr_get_cstr(msgid) : "");
|
||||
|
||||
http_header_add(newhdrs, "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(newhdrs, "X-Mms-3GPP-MMS-Version", tmp);
|
||||
http_header_add(newhdrs, "X-Mms-Originator-System",
|
||||
octstr_get_cstr(xsender));
|
||||
http_header_remove_all(headers, "X-Mms-Message-Type");
|
||||
|
|
|
@ -24,7 +24,13 @@
|
|||
#include "mms_mmbox.h"
|
||||
|
||||
/* supported 3GPP MMS version */
|
||||
#define MMS_3GPP_VERSION "5.5.0"
|
||||
#define MAKE_VERSION(a,b,c) ((a)<<16 | (b)<<8 | (c))
|
||||
|
||||
#define MAJOR_VERSION(v) (((v)>>16)&0xF)
|
||||
#define MINOR1_VERSION(v) (((v)>>8)&0xF)
|
||||
#define MINOR2_VERSION(v) ((v)&0xF)
|
||||
|
||||
#define MMS_3GPP_VERSION MAKE_VERSION(5,5,0)
|
||||
|
||||
/* Send errors */
|
||||
#define MMS_SEND_OK 0
|
||||
|
|
|
@ -142,6 +142,7 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
|
|||
int ssl = 0;
|
||||
Octstr *type;
|
||||
Octstr *xver;
|
||||
Octstr *s;
|
||||
|
||||
memset(m, 0, sizeof *m);
|
||||
|
||||
|
@ -188,16 +189,23 @@ int mms_load_mmsbox_settings(mCfg *cfg, gwthread_func_t *mmsc_handler_func)
|
|||
"%d.%d.%d",
|
||||
&m->ver.major, &m->ver.minor1, &m->ver.minor2);
|
||||
else { /* Put in some defaults. */
|
||||
if (m->type == SOAP_MMSC) {
|
||||
m->ver.major = 5;
|
||||
m->ver.minor1 = 1;
|
||||
m->ver.minor2 = 2;
|
||||
if (m->type == SOAP_MMSC) {
|
||||
m->ver.major = MAJOR_VERSION(DEFAULT_MM7_VERSION);
|
||||
m->ver.minor1 = MINOR1_VERSION(DEFAULT_MM7_VERSION);
|
||||
m->ver.minor2 = MINOR2_VERSION(DEFAULT_MM7_VERSION);
|
||||
} else if (m->type == EAIF_MMSC) {
|
||||
m->ver.major = 3;
|
||||
m->ver.minor1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((s = mms_cfg_get(x, octstr_imm("mm7-soap-xmlns"))) != NULL) {
|
||||
strncpy(m->ver.xmlns, octstr_get_cstr(s), sizeof m->ver.xmlns);
|
||||
m->ver.xmlns[-1 + sizeof m->ver.xmlns] = 0; /* NULL terminate, just in case. */
|
||||
octstr_destroy(s);
|
||||
} else
|
||||
m->ver.xmlns[0] = 0;
|
||||
|
||||
octstr_destroy(xver);
|
||||
octstr_destroy(type);
|
||||
|
||||
|
|
|
@ -314,9 +314,9 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
|
|||
sscanf(octstr_get_cstr(s), "%d.%d.%d", &mv->ver.major, &mv->ver.minor1, &mv->ver.minor2);
|
||||
else {
|
||||
if (mv->type == SOAP_VASP) {
|
||||
mv->ver.major = 5;
|
||||
mv->ver.minor1 = 1;
|
||||
mv->ver.minor2 = 2;
|
||||
mv->ver.major = MAJOR_VERSION(DEFAULT_MM7_VERSION);
|
||||
mv->ver.minor1 = MINOR1_VERSION(DEFAULT_MM7_VERSION);
|
||||
mv->ver.minor2 = MINOR2_VERSION(DEFAULT_MM7_VERSION);
|
||||
} else if (mv->type == EAIF_VASP) {
|
||||
mv->ver.major = 3;
|
||||
mv->ver.minor1 = 0;
|
||||
|
@ -324,6 +324,14 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
|
|||
}
|
||||
octstr_destroy(s);
|
||||
|
||||
if ((s = mms_cfg_get(grp, octstr_imm("mm7-soap-xmlns"))) != NULL) {
|
||||
strncpy(mv->ver.xmlns, octstr_get_cstr(s), sizeof mv->ver.xmlns);
|
||||
|
||||
mv->ver.xmlns[-1 + sizeof mv->ver.xmlns] = 0; /* NULL terminate, just in case. */
|
||||
octstr_destroy(s);
|
||||
} else
|
||||
mv->ver.xmlns[0] = 0;
|
||||
|
||||
/* Set the handler vasp accounts. */
|
||||
if (mms_cfg_get_bool(grp, octstr_imm("mms-to-email-handler"), &ibool) == 0 &&
|
||||
ibool) {
|
||||
|
|
Loading…
Reference in New Issue