1
0
Fork 0

added strip-prefixes option for mmsc

This commit is contained in:
bagyenda 2011-01-05 05:53:14 +00:00
parent 67d8049f1b
commit fedce613cf
6 changed files with 36 additions and 3 deletions

View File

@ -1,3 +1,5 @@
2011-01-05 P. A. Bagyenda <bagyenda@dsmagic.com>
* Added strip-prefixes option for each mmsc connection (mmsbox)
2011-01-04 P. A. Bagyenda <bagyenda@dsmagic.com>
* mm1 mmsbox plugin fix Thanks to Piotr Isajew (pki at ex.com.pl)
2011-01-03 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -906,7 +906,7 @@ lists all the configuration directives. The column <b>Mode</b>
&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
found) be stripped off the phone number <i>prior</i> to number
normalisation as described below. Only the first prefix that matches
will be stripped.
&nbsp; &nbsp;</td>
@ -2771,6 +2771,22 @@ string
</td>
</tr>
<tr>
<td valign=top >
<tt>strip-prefixes</tt>
&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 off the phone number prior to sending message. Only the first prefix that matches
will be stripped.
&nbsp; &nbsp;</td>
</tr>
<tr>
<td valign=top >
<tt>reroute</tt>

View File

@ -196,6 +196,8 @@ MULTI_GROUP(mmsc,
OCTSTR(strip-domain)
OCTSTR(max-recipients)
OCTSTR(strip-prefixes)
)
MULTI_GROUP(mms-service,

View File

@ -1790,6 +1790,10 @@ static int sendMsg(MmsEnvelope *e)
octstr_format_append(x, "@%S",
mmc && octstr_str_compare(mmc->mmsc_url, "*") != 0 ? mmc->mmsc_url :
octstr_imm("unknown"));
if (mmc && mmc->strip_prefixes) /* strip prefixes */
_mms_fixup_address(&x, NULL, mmc->strip_prefixes, 1);
if (x)
gwlist_append(xto, x);
}
@ -1857,13 +1861,13 @@ static int sendMsg(MmsEnvelope *e)
octstr_destroy(new_msgid);
octstr_destroy(err);
http_destroy_headers(errl);
gwlist_destroy(lto, NULL);
e->lasttry = tnow;
if (qfs->mms_queue_update(e) == 1) {
e = NULL;
break; /* Queue entry gone. */
}
gwlist_destroy(lto, NULL);
}
}

View File

@ -667,6 +667,12 @@ static MmscGrp *start_mmsc_from_conf(mCfg *cfg, mCfgGrp *x, List *warnings, List
m->max_recipients <= 0)
m->max_recipients = 1;
if ((s = mms_cfg_get(cfg, x, octstr_imm("strip-prefixes"))) != NULL) {
m->strip_prefixes = octstr_split(s, octstr_imm(";"));
octstr_destroy(s);
} else
m->strip_prefixes = NULL;
if (mms_cfg_get_int(cfg,x, octstr_imm("maximum-request-size"), &m->max_pkt_size) < 0 ||
m->max_pkt_size <= 0)
m->max_pkt_size = DEFAULT_MAX_PKT_SIZE;
@ -1310,6 +1316,7 @@ static void free_mmsc_struct (MmscGrp *m)
octstr_destroy(m->settings);
mutex_destroy(m->mutex);
gwlist_destroy(m->strip_prefixes, (void *)octstr_destroy);
gw_free(m);
}

View File

@ -84,6 +84,8 @@ typedef struct MmscGrp {
int strip_domain; /* MM4 only */
long max_recipients; /* Max recpients per transaction */
List *strip_prefixes; /* List of prefixes to be stripped before sending out*/
} MmscGrp;
#define DEFAULT_MAX_PKT_SIZE 1024*1024