From 720f81d04f8ea7fb157837c7116c088a2d4302e5 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Fri, 22 Apr 2005 14:27:50 +0000 Subject: [PATCH] Changes to config file: All queue-directory directives replaced by single 'storage-directory' directive. --- mbuni/doc/examples/mmsc.conf | 6 +- mbuni/doc/userguide.shtml | 71 ++++------------------ mbuni/misc-patches/mbuni-kannel-patch-full | 10 +-- mbuni/mmlib/mms_queue.h | 2 +- mbuni/mmlib/mms_util.c | 43 +++++++++---- 5 files changed, 47 insertions(+), 85 deletions(-) diff --git a/mbuni/doc/examples/mmsc.conf b/mbuni/doc/examples/mmsc.conf index f003bb3..8d89034 100644 --- a/mbuni/doc/examples/mmsc.conf +++ b/mbuni/doc/examples/mmsc.conf @@ -9,10 +9,7 @@ hostname = ds.co.ug host-alias = mmsc local-mmsc-domains = dsmagic.com local-prefixes = 037;+25637;25637 -send-queue-directory = /tmp/spool/global -mm1-queue-directory = /tmp/spool/mm1 -mm4-queue-directory = /tmp/spool/mm4 -mmbox-root-directory = /tmp/spool/mmbox +storage-directory = /tmp/spool max-send-threads = 5 send-mail-prog = /usr/sbin/sendmail -f '%f' '%t' unified-prefix = "+25637,037,37" @@ -27,7 +24,6 @@ mms-port = 1981 mm7-port = 1982 #allow-ip = 192.168.129.11 email2mms-relay-prefixes = "037;035;25637" -ua-profile-cache-directory = /tmp/misc/profiles billing-module-parameters = "/tmp/log/cdr.log" # billing-library = billdemo.so #prov-server-notify-script = ~/src/mmprov/provnotify.sh diff --git a/mbuni/doc/userguide.shtml b/mbuni/doc/userguide.shtml index 941e1a7..84e265d 100644 --- a/mbuni/doc/userguide.shtml +++ b/mbuni/doc/userguide.shtml @@ -579,14 +579,8 @@ mbuni.org,service.com
local-prefixes = 075;+25675;25675
-send-queue-directory -= spool/global
- -mm1-queue-directory -= spool/mm1
- -mm4-queue-directory -= spool/mm4
+directory-store += spool
max-send-threads = 5
@@ -691,12 +685,12 @@ lists all the configuration directives

Number prefixes that should be considered local. Messages to numbers that match these - prefixes will be delivered locally (via mmsmobilesender) + prefixes will be delivered locally (via mmsrelay)     - send-queue-directory + storage-directory     @@ -704,54 +698,11 @@ lists all the configuration directives

(string)     - Global Queue directory: - Used by mmsglobalsender to store out-going messages. - All messages will be stored here until they can be delivered + Directory where Mbuni creates message queues, MMBoxes, and the + User Agent profiles cache. Mbuni creates a set of sub-directories in here + for each function     - - - mm1-queue-directory - -     - - Directory name - (string) -     - - Queue directory - for messages destined to (local) MMS clients. Used by mmsmobilesender -     - - - - mm4-queue-directory - -     - - Directory name - (string) -     - - Queue directory - for messages destined to or coming from foreign MMS - gateways. mmsglobalsenderfromemail manages this queue -     - - - - mmbox-root-directory - -     - - Directory name - (string) -     - - Directory where all user/subscriber MMboxes will be stored. This - directory will contain a set of sub-directories under which user - MMboxes will be stored. Each user MMbox has a maildir-like structure     - max-send-threads @@ -848,8 +799,8 @@ lists all the configuration directives

Integer     - mmsmobilesender uses a form of exponential back-off - when sending notifications to phones. This figure provides the starting + mmsrelay uses a form of exponential back-off + when sending notifications to MMS clients. This figure provides the starting back-off value (in seconds).     @@ -1170,12 +1121,12 @@ lists all the configuration directives

Subscriber database interface script 2: This script is called - by mmsmobilesender to determine whether the recipient's + by mmsrelay to determine whether the recipient's device supports MMS. The script should exit with a value of 0 to indicate that the device does not support receipt of MMS notifications; 1 to indicate that the device supports MMS; -1 if the subscriber is not known or not provisioned for MMS. The return value determines how - mmsmobilesender will deliver the message (see below). + mmsrelay will deliver the message (see below).     diff --git a/mbuni/misc-patches/mbuni-kannel-patch-full b/mbuni/misc-patches/mbuni-kannel-patch-full index 1fdd1a7..5dc75d7 100644 --- a/mbuni/misc-patches/mbuni-kannel-patch-full +++ b/mbuni/misc-patches/mbuni-kannel-patch-full @@ -717,8 +717,8 @@ diff -Naur gateway-1.4.0/gw/xml_shared.h gateway-1.4.0-patched/gw/xml_shared.h /* diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def --- gateway-1.4.0/gwlib/cfg.def Mon Jun 28 18:18:35 2004 -+++ gateway-1.4.0-patched/gwlib/cfg.def Tue Apr 12 11:50:00 2005 -@@ -544,6 +544,73 @@ ++++ gateway-1.4.0-patched/gwlib/cfg.def Fri Apr 22 17:11:25 2005 +@@ -544,6 +544,69 @@ OCTSTR(unified-prefix) ) @@ -728,9 +728,7 @@ diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def + OCTSTR(host-alias) + OCTSTR(local-mmsc-domains) + OCTSTR(local-prefixes) -+ OCTSTR(send-queue-directory) -+ OCTSTR(mm1-queue-directory) -+ OCTSTR(mm4-queue-directory) ++ OCTSTR(storage-directory) + OCTSTR(max-send-threads) + OCTSTR(send-mail-prog) + OCTSTR(unified-prefix) @@ -747,7 +745,6 @@ diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def + OCTSTR(allow-ip) + OCTSTR(deny-ip) + OCTSTR(email2mms-relay-prefixes) -+ OCTSTR(ua-profile-cache-directory) + OCTSTR(billing-module-parameters) + OCTSTR(billing-library) + OCTSTR(resolver-module-parameters) @@ -768,7 +765,6 @@ diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def + OCTSTR(mms-client-ip-header) + OCTSTR(allow-ip-type) + OCTSTR(optimize-notification-size) -+ OCTSTR(mmbox-root-directory) +) + +MULTI_GROUP(mmsproxy, diff --git a/mbuni/mmlib/mms_queue.h b/mbuni/mmlib/mms_queue.h index f7f9c4a..594c41a 100644 --- a/mbuni/mmlib/mms_queue.h +++ b/mbuni/mmlib/mms_queue.h @@ -60,7 +60,7 @@ typedef struct MmsEnvelope { Octstr *mdata; /* Generic string data used by any interface. */ Octstr *fromproxy; /* Which proxy sent us this message.*/ Octstr *viaproxy; /* Which proxy must we send this message through. */ - struct { /* Name of the queue file, pointer to it (locked). DO NOT USE WITH THESE! */ + struct { /* Name of the queue file, pointer to it (locked). DO NOT USE THESE! */ char name[QFNAMEMAX]; /* Name of the file. */ char dir[QFNAMEMAX]; /* Directory in which file is .*/ char subdir[64]; /* and the sub-directory. */ diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index 4655bff..697fa64 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -81,6 +81,7 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg) MmsBoxSettings *m = gw_malloc(sizeof *m); long port = -1; Octstr *user, *pass, *from; + Octstr *qdir = NULL; int i, n; memset(m, 0, sizeof *m); @@ -109,9 +110,17 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg) m->sendmail = cfg_getx(grp, octstr_imm("send-mail-prog")); - m->global_queuedir = cfg_getx(grp, octstr_imm("send-queue-directory")); - m->mm1_queuedir = cfg_getx(grp, octstr_imm("mm1-queue-directory")); - m->mm4_queuedir = cfg_getx(grp, octstr_imm("mm4-queue-directory")); + qdir = cfg_getx(grp, octstr_imm("storage-directory")); + + if (mkdir(octstr_get_cstr(qdir), + S_IRWXU|S_IRWXG) < 0 && + errno != EEXIST) + panic(0, "Failed to create queue directory: %s - %s!", + octstr_get_cstr(qdir), strerror(errno)); + + m->global_queuedir = octstr_format("%S/global", qdir); + m->mm1_queuedir = octstr_format("%S/mm1", qdir); + m->mm4_queuedir = octstr_format("%S/mm4", qdir); if (mms_init_queuedir(m->mm1_queuedir) < 0) @@ -120,10 +129,24 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg) else if (mms_init_queuedir(m->global_queuedir) < 0) panic(0, "Failed to initialise global queue directory: %s - %s!", octstr_get_cstr(m->global_queuedir), strerror(errno)); + else if (mms_init_queuedir(m->mm4_queuedir) < 0) + panic(0, "Failed to initialise global queue directory: %s - %s!", + octstr_get_cstr(m->mm4_queuedir), strerror(errno)); - - m->mmbox_rootdir = cfg_getx(grp, octstr_imm("mmbox-root-directory")); + m->mmbox_rootdir = octstr_format("%S/mmbox", qdir); + if (mmbox_root_init(octstr_get_cstr(m->mmbox_rootdir)) != 0) + panic(0, "Failed to initialise mmbox root directory, error: %s!", + strerror(errno)); + + m->ua_profile_cache_dir = octstr_format("%S/UserAgent_Profiles", qdir); + + if (mkdir(octstr_get_cstr(m->ua_profile_cache_dir), + S_IRWXU|S_IRWXG) < 0 && + errno != EEXIST) + panic(0, "Failed to initialise UA Profile directory, error: %s!", + strerror(errno)); + if (cfg_get_integer(&m->maxsendattempts, grp, octstr_imm("maximum-send-attempts")) == -1) m->maxsendattempts = MAXQTRIES; @@ -177,9 +200,7 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg) m->email2mmsrelay_prefixes = cfg_getx(grp, octstr_imm("email2mms-relay-prefixes")); - m->ua_profile_cache_dir = cfg_getx(grp, - octstr_imm("ua-profile-cache-directory")); - + m->prov_notify = cfg_getx(grp,octstr_imm("prov-server-notify-script")); m->prov_notify_arg = cfg_getx(grp,octstr_imm("prov-server-notify-script-arg")); @@ -248,10 +269,8 @@ MmsBoxSettings *mms_load_mmsbox_settings(Cfg *cfg) m->allow_ip_type = 1; cfg_get_bool(&m->optimize_notification_size, grp, octstr_imm("optimize-notification-size")); - if (mmbox_root_init(octstr_get_cstr(m->mmbox_rootdir)) != 0) - warning(0, "Failed to initialise mmbox root directory, error: %s!", - strerror(errno)); - + if (qdir) + octstr_destroy(qdir); /* Now load the VASP list. */ l = cfg_get_multi_group(cfg, octstr_imm("mms-vasp"));