1
0
Fork 0

MM4 number normalisation

This commit is contained in:
bagyenda 2008-05-13 10:53:01 +00:00
parent 4eb54ddffa
commit 6b472bf22b
6 changed files with 71 additions and 2 deletions

View File

@ -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>
* Normalisation of numbers inside messages as well
* Added strip-prefixes config parameter

View File

@ -2070,6 +2070,47 @@ denied-prefix
</td>
</tr>
<tr>
<td valign=top >
<tt>strip-prefixes
&nbsp; &nbsp;</td>
<td valign=top >
Number list
&nbsp; &nbsp;</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.
&nbsp; &nbsp;</td>
</tr>
<tr>
<td valign=top >
<tt>unified-prefix
&nbsp; &nbsp;</td>
<td valign=top >
Number list
&nbsp; &nbsp;</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 &quot;+256,000256,0;+,000&quot; should
ensure correct UG prefixes. If
there are several unified prefixes, separate their rules with semicolon (';')
&nbsp; &nbsp;</td>
</tr>
</table>
<p>

View File

@ -98,6 +98,8 @@ MULTI_GROUP(mmsproxy,
OCTSTR(allowed-prefix)
OCTSTR(denied-prefix)
OCTSTR(confirmed-delivery)
OCTSTR(unified-prefix)
OCTSTR(strip-prefixes)
)
MULTI_GROUP(mms-vasp,

View File

@ -356,7 +356,8 @@ List *mms_proxy_relays(mCfg *cfg, Octstr *myhostname)
for (i = 0, n = gwlist_len(gl); i < n; i++) {
mCfgGrp *grp = gwlist_get(gl, i);
MmsProxyRelay *m = gw_malloc(sizeof *m);
Octstr *s;
m->host = _mms_cfg_getx(grp, octstr_imm("host"));
m->name = _mms_cfg_getx(grp, octstr_imm("name"));
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)
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)
warning(0, "MMSC Config: Found MM4 Proxy %s with same hostname as local host!",
octstr_get_cstr(m->name));

View File

@ -23,6 +23,10 @@ typedef struct MmsProxyRelay {
Octstr *name;
Octstr *allowed_prefix;
Octstr *denied_prefix;
Octstr *unified_prefix;
List *strip_prefixes;
int confirmed_mm4;
} MmsProxyRelay;

View File

@ -292,13 +292,25 @@ static int sendMsg(MmsEnvelope *e)
if (octstr_compare(mp->host, mmsc) == 0) {
Octstr *xtransid = mms_maketransid(e->xqfname,
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,
octstr_get_cstr(xtransid),
e->msgId, e->expiryt, msg,
mp->confirmed_mm4, &err);
sent = 1;
octstr_destroy(xtransid);
octstr_destroy(xfrom);
octstr_destroy(xto);
break;
}
}