MM4 number normalisation
This commit is contained in:
parent
4eb54ddffa
commit
6b472bf22b
|
@ -1,3 +1,5 @@
|
||||||
|
2008-05-13 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
* Separate number normalisation for each MM4 connection.
|
||||||
2008-05-05 P. A. Bagyenda <bagyenda@dsmagic.com>
|
2008-05-05 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
* Normalisation of numbers inside messages as well
|
* Normalisation of numbers inside messages as well
|
||||||
* Added strip-prefixes config parameter
|
* Added strip-prefixes config parameter
|
||||||
|
|
|
@ -2070,6 +2070,47 @@ denied-prefix
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign=top >
|
||||||
|
<tt>strip-prefixes
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td valign=top >
|
||||||
|
Number list
|
||||||
|
</td>
|
||||||
|
<td valign=top >
|
||||||
|
A semi-colon (;) separated string of prefixes that should (if
|
||||||
|
found) be stripped of the phone number <i>prior</i> to number
|
||||||
|
normalisation and message sending, as described below. Only the first prefix that matches
|
||||||
|
will be stripped.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign=top >
|
||||||
|
<tt>unified-prefix
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td valign=top >
|
||||||
|
Number list
|
||||||
|
</td>
|
||||||
|
<td valign=top >
|
||||||
|
A string to
|
||||||
|
unify received phone numbers, so that routing works correctly. Format is that
|
||||||
|
first comes the unified prefix,
|
||||||
|
then all prefixes which are replaced by the unified prefix, separated with
|
||||||
|
comma (','). For example "+256,000256,0;+,000" should
|
||||||
|
ensure correct UG prefixes. If
|
||||||
|
there are several unified prefixes, separate their rules with semicolon (';')
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -98,6 +98,8 @@ MULTI_GROUP(mmsproxy,
|
||||||
OCTSTR(allowed-prefix)
|
OCTSTR(allowed-prefix)
|
||||||
OCTSTR(denied-prefix)
|
OCTSTR(denied-prefix)
|
||||||
OCTSTR(confirmed-delivery)
|
OCTSTR(confirmed-delivery)
|
||||||
|
OCTSTR(unified-prefix)
|
||||||
|
OCTSTR(strip-prefixes)
|
||||||
)
|
)
|
||||||
|
|
||||||
MULTI_GROUP(mms-vasp,
|
MULTI_GROUP(mms-vasp,
|
||||||
|
|
|
@ -356,7 +356,8 @@ List *mms_proxy_relays(mCfg *cfg, Octstr *myhostname)
|
||||||
for (i = 0, n = gwlist_len(gl); i < n; i++) {
|
for (i = 0, n = gwlist_len(gl); i < n; i++) {
|
||||||
mCfgGrp *grp = gwlist_get(gl, i);
|
mCfgGrp *grp = gwlist_get(gl, i);
|
||||||
MmsProxyRelay *m = gw_malloc(sizeof *m);
|
MmsProxyRelay *m = gw_malloc(sizeof *m);
|
||||||
|
Octstr *s;
|
||||||
|
|
||||||
m->host = _mms_cfg_getx(grp, octstr_imm("host"));
|
m->host = _mms_cfg_getx(grp, octstr_imm("host"));
|
||||||
m->name = _mms_cfg_getx(grp, octstr_imm("name"));
|
m->name = _mms_cfg_getx(grp, octstr_imm("name"));
|
||||||
m->allowed_prefix = _mms_cfg_getx(grp, octstr_imm("allowed-prefix"));
|
m->allowed_prefix = _mms_cfg_getx(grp, octstr_imm("allowed-prefix"));
|
||||||
|
@ -364,6 +365,13 @@ List *mms_proxy_relays(mCfg *cfg, Octstr *myhostname)
|
||||||
if (mms_cfg_get_bool(grp, octstr_imm("confirmed-delivery"), &m->confirmed_mm4) < 0)
|
if (mms_cfg_get_bool(grp, octstr_imm("confirmed-delivery"), &m->confirmed_mm4) < 0)
|
||||||
m->confirmed_mm4 = 1;
|
m->confirmed_mm4 = 1;
|
||||||
|
|
||||||
|
m->unified_prefix = mms_cfg_get(grp, octstr_imm("unified-prefix"));
|
||||||
|
if ((s = mms_cfg_get(grp, octstr_imm("strip-prefixes"))) != NULL) {
|
||||||
|
m->strip_prefixes = octstr_split(s, octstr_imm(";"));
|
||||||
|
octstr_destroy(s);
|
||||||
|
} else
|
||||||
|
m->strip_prefixes = NULL;
|
||||||
|
|
||||||
if (octstr_compare(m->host, myhostname) == 0)
|
if (octstr_compare(m->host, myhostname) == 0)
|
||||||
warning(0, "MMSC Config: Found MM4 Proxy %s with same hostname as local host!",
|
warning(0, "MMSC Config: Found MM4 Proxy %s with same hostname as local host!",
|
||||||
octstr_get_cstr(m->name));
|
octstr_get_cstr(m->name));
|
||||||
|
|
|
@ -23,6 +23,10 @@ typedef struct MmsProxyRelay {
|
||||||
Octstr *name;
|
Octstr *name;
|
||||||
Octstr *allowed_prefix;
|
Octstr *allowed_prefix;
|
||||||
Octstr *denied_prefix;
|
Octstr *denied_prefix;
|
||||||
|
|
||||||
|
Octstr *unified_prefix;
|
||||||
|
List *strip_prefixes;
|
||||||
|
|
||||||
int confirmed_mm4;
|
int confirmed_mm4;
|
||||||
} MmsProxyRelay;
|
} MmsProxyRelay;
|
||||||
|
|
||||||
|
|
|
@ -292,13 +292,25 @@ static int sendMsg(MmsEnvelope *e)
|
||||||
if (octstr_compare(mp->host, mmsc) == 0) {
|
if (octstr_compare(mp->host, mmsc) == 0) {
|
||||||
Octstr *xtransid = mms_maketransid(e->xqfname,
|
Octstr *xtransid = mms_maketransid(e->xqfname,
|
||||||
settings->host_alias);
|
settings->host_alias);
|
||||||
res = mms_sendtoproxy(e->from, to->rcpt,
|
Octstr *xfrom = e->from ? octstr_duplicate(e->from) : octstr_create("anon@anon");
|
||||||
|
Octstr *xto = octstr_duplicate(to->rcpt);
|
||||||
|
|
||||||
|
_mms_fixup_address(&xfrom,
|
||||||
|
mp->unified_prefix ? octstr_get_cstr(mp->unified_prefix) : NULL,
|
||||||
|
mp->strip_prefixes, 1);
|
||||||
|
|
||||||
|
_mms_fixup_address(&xto,
|
||||||
|
mp->unified_prefix ? octstr_get_cstr(mp->unified_prefix) : NULL,
|
||||||
|
mp->strip_prefixes, 1);
|
||||||
|
res = mms_sendtoproxy(xfrom, xto,
|
||||||
e->subject, mp->host,
|
e->subject, mp->host,
|
||||||
octstr_get_cstr(xtransid),
|
octstr_get_cstr(xtransid),
|
||||||
e->msgId, e->expiryt, msg,
|
e->msgId, e->expiryt, msg,
|
||||||
mp->confirmed_mm4, &err);
|
mp->confirmed_mm4, &err);
|
||||||
sent = 1;
|
sent = 1;
|
||||||
octstr_destroy(xtransid);
|
octstr_destroy(xtransid);
|
||||||
|
octstr_destroy(xfrom);
|
||||||
|
octstr_destroy(xto);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue