From fedce613cfcaf369384c4d19defc7cf34916aa3d Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Wed, 5 Jan 2011 05:53:14 +0000 Subject: [PATCH] added strip-prefixes option for mmsc --- mbuni/ChangeLog | 2 ++ mbuni/doc/userguide.shtml | 18 +++++++++++++++++- mbuni/mmlib/mms_cfg.def | 2 ++ mbuni/mmsbox/bearerbox.c | 8 ++++++-- mbuni/mmsbox/mmsbox_cfg.c | 7 +++++++ mbuni/mmsbox/mmsbox_cfg.h | 2 ++ 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/mbuni/ChangeLog b/mbuni/ChangeLog index 1184ae3..bc502a3 100644 --- a/mbuni/ChangeLog +++ b/mbuni/ChangeLog @@ -1,3 +1,5 @@ +2011-01-05 P. A. Bagyenda + * Added strip-prefixes option for each mmsc connection (mmsbox) 2011-01-04 P. A. Bagyenda * mm1 mmsbox plugin fix Thanks to Piotr Isajew (pki at ex.com.pl) 2011-01-03 P. A. Bagyenda diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml index 1d0f94c..484c038 100644 --- a/mbuni/doc/userguide.shtml +++ b/mbuni/doc/userguide.shtml @@ -906,7 +906,7 @@ lists all the configuration directives. The column Mode     A semi-colon (;) separated string of prefixes that should (if - found) be stripped of the phone number prior to number + found) be stripped off the phone number prior to number normalisation as described below. Only the first prefix that matches will be stripped.     @@ -2771,6 +2771,22 @@ string + + + strip-prefixes +     + + + + Number list +     + + 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. +     + + reroute diff --git a/mbuni/mmlib/mms_cfg.def b/mbuni/mmlib/mms_cfg.def index 8eededd..09ead54 100644 --- a/mbuni/mmlib/mms_cfg.def +++ b/mbuni/mmlib/mms_cfg.def @@ -196,6 +196,8 @@ MULTI_GROUP(mmsc, OCTSTR(strip-domain) OCTSTR(max-recipients) + + OCTSTR(strip-prefixes) ) MULTI_GROUP(mms-service, diff --git a/mbuni/mmsbox/bearerbox.c b/mbuni/mmsbox/bearerbox.c index 71f41d5..1f36175 100644 --- a/mbuni/mmsbox/bearerbox.c +++ b/mbuni/mmsbox/bearerbox.c @@ -1790,7 +1790,11 @@ static int sendMsg(MmsEnvelope *e) octstr_format_append(x, "@%S", mmc && octstr_str_compare(mmc->mmsc_url, "*") != 0 ? mmc->mmsc_url : octstr_imm("unknown")); - gwlist_append(xto, x); + + if (mmc && mmc->strip_prefixes) /* strip prefixes */ + _mms_fixup_address(&x, NULL, mmc->strip_prefixes, 1); + if (x) + gwlist_append(xto, x); } LINEARISE_STR_LIST(zto,xto,", "); @@ -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); } } diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c index 11a05eb..8d4f68c 100644 --- a/mbuni/mmsbox/mmsbox_cfg.c +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -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); } diff --git a/mbuni/mmsbox/mmsbox_cfg.h b/mbuni/mmsbox/mmsbox_cfg.h index 5fc91da..19c2790 100644 --- a/mbuni/mmsbox/mmsbox_cfg.h +++ b/mbuni/mmsbox/mmsbox_cfg.h @@ -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