Minor clean-up: fold *_shell MMSC external modules into main code
This commit is contained in:
parent
ea98a5da35
commit
8e6ecf8a5c
|
@ -1232,7 +1232,8 @@ lists all the configuration directives. The column <b>Mode</b>
|
||||||
Optional
|
Optional
|
||||||
library containing billing and CDR functions. This library is loaded at
|
library containing billing and CDR functions. This library is loaded at
|
||||||
runtime and should contain functions to be called to effect billing and CDR
|
runtime and should contain functions to be called to effect billing and CDR
|
||||||
generation. See <tt>mms_billing.h</tt> for details.
|
generation. See <tt>mms_billing.h</tt> for
|
||||||
|
details. (<a href="#builtin"><tt>builtin:shell</tt></a> supported as a special built-in library.)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr >
|
<tr >
|
||||||
|
@ -1275,7 +1276,9 @@ lists all the configuration directives. The column <b>Mode</b>
|
||||||
over-rides the <tt>local-prefixes</tt> setting given above. If the
|
over-rides the <tt>local-prefixes</tt> setting given above. If the
|
||||||
Proxy-Relay hostname returned by the module is the hostname of the
|
Proxy-Relay hostname returned by the module is the hostname of the
|
||||||
local MMSC, then the recipient is considered local. See
|
local MMSC, then the recipient is considered local. See
|
||||||
<tt>mms_resolve.h</tt> for details.
|
<tt>mms_resolve.h</tt> for details. (<a
|
||||||
|
href="#builtin"><tt>builtin:shell</tt></a> supported as a special
|
||||||
|
built-in library.)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr >
|
<tr >
|
||||||
|
@ -1318,7 +1321,7 @@ lists all the configuration directives. The column <b>Mode</b>
|
||||||
interpreted by the library and transformed into an MSISDN. This libary
|
interpreted by the library and transformed into an MSISDN. This libary
|
||||||
is only a fall-back in case the default sender address resolution
|
is only a fall-back in case the default sender address resolution
|
||||||
fails. See
|
fails. See
|
||||||
<tt>mms_detokenize.h</tt> for details.
|
<tt>mms_detokenize.h</tt> for details. (<a href="#builtin"><tt>builtin:shell</tt></a> supported as a special built-in library.)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr >
|
<tr >
|
||||||
|
@ -1571,7 +1574,37 @@ Boolean
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<br>
|
<br>
|
||||||
|
<a name="builtin"><strong>Built-in billing, resolver and detokenizer
|
||||||
|
modules</strong>:<br><br>
|
||||||
|
Mbuni supports one type of built-in modules: Shell script
|
||||||
|
handlers. Each expect a parameter that is a shell script that is
|
||||||
|
used as follows:
|
||||||
|
<ul>
|
||||||
|
<li> If <tt>billing-library</tt> configuration parameter is set
|
||||||
|
to <tt>builtin:shell</tt>, the <tt>billing-module-parameters</tt>
|
||||||
|
must the path to the shell script to be called by Mbuni to provide
|
||||||
|
billing and CDR handling. For each message, the script will be with invoked
|
||||||
|
each recipient as follows:
|
||||||
|
<br><tt><i>script from_address to_address</i></tt>
|
||||||
|
<br>
|
||||||
|
If the script returns with a non-zero exit status, the message is
|
||||||
|
discarded.
|
||||||
|
<li> If <tt>resolver-library</tt> is set
|
||||||
|
to <tt>builtin:shell</tt>, <tt>resolver-module-parameters</tt> must
|
||||||
|
be set to a the path to the shell script to be invoked for each
|
||||||
|
destination address to determine how to deliver the message. The
|
||||||
|
script is invoked with one command line parameter (the destination
|
||||||
|
address) and should output (on standard output) the hostname of the
|
||||||
|
home MMSC, to which the message should be routed.
|
||||||
|
<li>If <tt>detokenizer-library</tt> is set to <tt>builtin:shell</tt>
|
||||||
|
then <tt>detokenizer-module-parameters</tt> should be set to the
|
||||||
|
script that should be called to resolve the last part of the MM1
|
||||||
|
request URL (the token) or
|
||||||
|
sender IP address to sender number. The shell is called with two
|
||||||
|
arguments: The URL token and the IP address (in that order), and
|
||||||
|
should output (on standard output) the sender number.
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
<a name="mmsc_conf"></a>
|
<a name="mmsc_conf"></a>
|
||||||
<h4>MMSC-specific Configurations</h4>
|
<h4>MMSC-specific Configurations</h4>
|
||||||
This section describes extra configuration sections that should only
|
This section describes extra configuration sections that should only
|
||||||
|
|
|
@ -2,7 +2,7 @@ libmms = $(top_builddir)/mmlib/libmms.la
|
||||||
libmmsc = libmmsc.la
|
libmmsc = libmmsc.la
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libmmsc.la
|
noinst_LTLIBRARIES = libmmsc.la
|
||||||
libmmsc_la_SOURCES = mmsc_cfg.c mms_detokenize.c mms_resolve.c mms_billing.c
|
libmmsc_la_SOURCES = mmsc_cfg.c mms_detokenize.c mms_resolve.c mms_billing.c mms_detokenize_shell.c mms_resolve_shell.c mms_billing_shell.c
|
||||||
|
|
||||||
bin_PROGRAMS = mmsrelay mmsproxy mmsfromemail mmssend
|
bin_PROGRAMS = mmsrelay mmsproxy mmsfromemail mmssend
|
||||||
mmsrelay_SOURCES = mmsglobalsender.c mmsmobilesender.c mmsrelay.c
|
mmsrelay_SOURCES = mmsglobalsender.c mmsmobilesender.c mmsrelay.c
|
||||||
|
@ -11,9 +11,9 @@ mmsproxy_LDADD = $(libmmsc) $(libmms)
|
||||||
mmsfromemail_LDADD = $(libmmsc) $(libmms)
|
mmsfromemail_LDADD = $(libmmsc) $(libmms)
|
||||||
mmssend_LDADD = $(libmmsc) $(libmms)
|
mmssend_LDADD = $(libmmsc) $(libmms)
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = libmmsc_billing_shell.la libmmsc_resolve_shell.la libmmsc_detokenize_shell.la
|
#pkglib_LTLIBRARIES = libmmsc_billing_shell.la libmmsc_resolve_shell.la libmmsc_detokenize_shell.la
|
||||||
libmmsc_billing_shell_la_SOURCES = mms_billing_shell.c
|
#libmmsc_billing_shell_la_SOURCES = mms_billing_shell.c
|
||||||
libmmsc_resolve_shell_la_SOURCES = mms_resolve_shell.c
|
#libmmsc_resolve_shell_la_SOURCES = mms_resolve_shell.c
|
||||||
libmmsc_detokenize_shell_la_SOURCES = mms_detokenize_shell.c
|
#libmmsc_detokenize_shell_la_SOURCES = mms_detokenize_shell.c
|
||||||
|
|
||||||
EXTRA_DIST = mms_billing.h mmsc_cfg.h mms_detokenize.h mmsrelay.h mms_resolve.h
|
EXTRA_DIST = mms_billing.h mmsc_cfg.h mms_detokenize.h mmsrelay.h mms_resolve.h
|
||||||
|
|
|
@ -60,7 +60,7 @@ static int mms_logcdr(MmsCdrStruct *cdr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The function itself. */
|
/* The function itself. */
|
||||||
MmsBillingFuncStruct mms_billfuncs = {
|
MmsBillingFuncStruct mms_billfuncs_shell = {
|
||||||
mms_billingmodule_init,
|
mms_billingmodule_init,
|
||||||
mms_logcdr,
|
mms_logcdr,
|
||||||
mms_billmsg,
|
mms_billmsg,
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Mbuni - Open Source MMS Gateway
|
||||||
|
*
|
||||||
|
* Mbuni billing integration interface (shell)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
|
||||||
|
*
|
||||||
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License, with a few exceptions granted (see LICENSE)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MMS_BILLING_SHELL_INCLUDED__
|
||||||
|
#define __MMS_BILLING_SHELL_INCLUDED__
|
||||||
|
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include "gwlib/gwlib.h"
|
||||||
|
#include "mms_billing.h"
|
||||||
|
|
||||||
|
extern MmsBillingFuncStruct mms_billfuncs_shell;
|
||||||
|
|
||||||
|
#endif
|
|
@ -80,7 +80,7 @@ static Octstr *mms_gettoken(Octstr *msisdn)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The function itself. */
|
/* The function itself. */
|
||||||
MmsDetokenizerFuncStruct mms_detokenizefuncs = {
|
MmsDetokenizerFuncStruct mms_detokenizefuncs_shell = {
|
||||||
mms_detokenizer_init,
|
mms_detokenizer_init,
|
||||||
mms_detokenize,
|
mms_detokenize,
|
||||||
mms_gettoken,
|
mms_gettoken,
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Mbuni - Open Source MMS Gateway
|
||||||
|
*
|
||||||
|
* Mbuni MSISDN mapper interface (shell)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com
|
||||||
|
*
|
||||||
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License, with a few exceptions granted (see LICENSE)
|
||||||
|
*/
|
||||||
|
#ifndef __MMS_DETOKENIZE_SHELL_INCLUDED__
|
||||||
|
#define __MMS_DETOKENIZE_SHELL_INCLUDED__
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include "gwlib/gwlib.h"
|
||||||
|
#include "mms_detokenize.h"
|
||||||
|
|
||||||
|
extern MmsDetokenizerFuncStruct mms_detokenizefuncs_shell;
|
||||||
|
|
||||||
|
#endif
|
|
@ -56,7 +56,7 @@ static Octstr *mms_resolve(Octstr * phonenum, void *module_data, void *settings_
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The function itself. */
|
/* The function itself. */
|
||||||
MmsResolverFuncStruct mms_resolvefuncs = {
|
MmsResolverFuncStruct mms_resolvefuncs_shell = {
|
||||||
mms_resolvermodule_init,
|
mms_resolvermodule_init,
|
||||||
mms_resolve,
|
mms_resolve,
|
||||||
mms_resolvermodule_fini
|
mms_resolvermodule_fini
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Mbuni - Open Source MMS Gateway
|
||||||
|
*
|
||||||
|
* Resolving MSISDNs to local/remote MMSCs - interface (shell)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2003 - 2006, Digital Solutions Ltd. - http://www.dsmagic.com
|
||||||
|
*
|
||||||
|
* Paul Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License, with a few exceptions granted (see LICENSE)
|
||||||
|
*/
|
||||||
|
#ifndef __MMS_RESOLVE_SHELL_INCLUDED__
|
||||||
|
#define __MMS_RESOLVE_SHELL_INCLUDED__
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include "gwlib/gwlib.h"
|
||||||
|
#include "mms_resolve.h"
|
||||||
|
|
||||||
|
extern MmsResolverFuncStruct mms_resolvefuncs_shell;
|
||||||
|
|
||||||
|
#endif
|
|
@ -23,40 +23,52 @@
|
||||||
#include "mmsc_cfg.h"
|
#include "mmsc_cfg.h"
|
||||||
#include "mms_queue.h"
|
#include "mms_queue.h"
|
||||||
|
|
||||||
|
|
||||||
#define MMS_PORT 8191 /* Default content fetch port. */
|
#define MMS_PORT 8191 /* Default content fetch port. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void *load_module(mCfgGrp *grp, char *config_key, char *symbolname)
|
static void *load_module(mCfgGrp *grp, char *config_key, char *symbolname,
|
||||||
|
void *shell_builtin)
|
||||||
{
|
{
|
||||||
Octstr *s;
|
Octstr *s = NULL;
|
||||||
void *retval = NULL;
|
void *retval = NULL;
|
||||||
|
|
||||||
s = mms_cfg_get(grp, octstr_imm(config_key));
|
s = mms_cfg_get(grp, octstr_imm(config_key));
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
void *x = dlopen(octstr_get_cstr(s), RTLD_LAZY);
|
void *x;
|
||||||
void *y = NULL;
|
void *y = NULL;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
char sbuf[512];
|
char sbuf[512];
|
||||||
|
|
||||||
sprintf(sbuf, "_%s", symbolname);
|
|
||||||
#endif
|
#endif
|
||||||
if (x == NULL || ((y = dlsym(x, symbolname)) == NULL
|
/* First look for the builtin: keyword.
|
||||||
|
* For now only builtin:shell is supported.
|
||||||
|
*/
|
||||||
|
if (octstr_case_search(s, octstr_imm("builtin:shell"), 0) >= 0)
|
||||||
|
retval = shell_builtin;
|
||||||
|
else {
|
||||||
|
x = dlopen(octstr_get_cstr(s), RTLD_LAZY);
|
||||||
|
#ifdef __APPLE__
|
||||||
|
sprintf(sbuf, "_%s", symbolname);
|
||||||
|
#endif
|
||||||
|
if (x == NULL || ((y = dlsym(x, symbolname)) == NULL
|
||||||
#ifdef __APPLE__ /* fink version of dlsym has issues it seems. */
|
#ifdef __APPLE__ /* fink version of dlsym has issues it seems. */
|
||||||
&& (y = dlsym(x, sbuf)) == NULL
|
&& (y = dlsym(x, sbuf)) == NULL
|
||||||
#endif
|
#endif
|
||||||
))
|
))
|
||||||
|
|
||||||
panic(0,
|
panic(0,
|
||||||
"Error, unable to load dynamic libary (%s): "
|
"Error, unable to load dynamic libary (%s): "
|
||||||
"libhandle is %s, funcs is %s, err=%s",
|
"libhandle is %s, funcs is %s, err=%s",
|
||||||
octstr_get_cstr(s),
|
octstr_get_cstr(s),
|
||||||
x ? "OK" : "Not OK", y ? "OK" : "Not OK", dlerror());
|
x ? "OK" : "Not OK", y ? "OK" : "Not OK", dlerror());
|
||||||
else
|
else
|
||||||
retval = y;
|
retval = y;
|
||||||
|
}
|
||||||
octstr_destroy(s);
|
octstr_destroy(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +233,8 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
|
||||||
octstr_imm("billing-module-parameters"));
|
octstr_imm("billing-module-parameters"));
|
||||||
/* Get and load the billing lib if any. */
|
/* Get and load the billing lib if any. */
|
||||||
|
|
||||||
if ((m->mms_billfuncs = load_module(grp, "billing-library", "mms_billfuncs"))) {
|
if ((m->mms_billfuncs = load_module(grp, "billing-library", "mms_billfuncs",
|
||||||
|
&mms_billfuncs_shell)) != NULL) {
|
||||||
if (m->mms_billfuncs->mms_billingmodule_init == NULL ||
|
if (m->mms_billfuncs->mms_billingmodule_init == NULL ||
|
||||||
m->mms_billfuncs->mms_billmsg == NULL ||
|
m->mms_billfuncs->mms_billmsg == NULL ||
|
||||||
m->mms_billfuncs->mms_billingmodule_fini == NULL ||
|
m->mms_billfuncs->mms_billingmodule_fini == NULL ||
|
||||||
|
@ -236,7 +249,9 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
|
||||||
octstr_imm("resolver-module-parameters"));
|
octstr_imm("resolver-module-parameters"));
|
||||||
|
|
||||||
/* Get and load the resolver lib if any. */
|
/* Get and load the resolver lib if any. */
|
||||||
if ((m->mms_resolvefuncs = load_module(grp, "resolver-library", "mms_resolvefuncs"))) {
|
if ((m->mms_resolvefuncs = load_module(grp, "resolver-library",
|
||||||
|
"mms_resolvefuncs",
|
||||||
|
&mms_resolvefuncs_shell)) != NULL) {
|
||||||
if (m->mms_resolvefuncs->mms_resolvermodule_init == NULL ||
|
if (m->mms_resolvefuncs->mms_resolvermodule_init == NULL ||
|
||||||
m->mms_resolvefuncs->mms_resolve == NULL ||
|
m->mms_resolvefuncs->mms_resolve == NULL ||
|
||||||
m->mms_resolvefuncs->mms_resolvermodule_fini == NULL)
|
m->mms_resolvefuncs->mms_resolvermodule_fini == NULL)
|
||||||
|
@ -249,7 +264,9 @@ MmscSettings *mms_load_mmsc_settings(mCfg *cfg, List **proxyrelays)
|
||||||
m->detokenizer_params = _mms_cfg_getx(grp, octstr_imm("detokenizer-module-parameters"));
|
m->detokenizer_params = _mms_cfg_getx(grp, octstr_imm("detokenizer-module-parameters"));
|
||||||
|
|
||||||
/* Get and load the detokenizer lib if any. */
|
/* Get and load the detokenizer lib if any. */
|
||||||
if ((m->mms_detokenizefuncs = load_module(grp, "detokenizer-library", "mms_detokenizefuncs"))) {
|
if ((m->mms_detokenizefuncs = load_module(grp, "detokenizer-library",
|
||||||
|
"mms_detokenizefuncs",
|
||||||
|
&mms_detokenizefuncs_shell)) != NULL) {
|
||||||
if (m->mms_detokenizefuncs->mms_detokenizer_init == NULL ||
|
if (m->mms_detokenizefuncs->mms_detokenizer_init == NULL ||
|
||||||
m->mms_detokenizefuncs->mms_detokenize == NULL ||
|
m->mms_detokenizefuncs->mms_detokenize == NULL ||
|
||||||
m->mms_detokenizefuncs->mms_gettoken == NULL ||
|
m->mms_detokenizefuncs->mms_gettoken == NULL ||
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#ifndef __MMSC_CFG__
|
#ifndef __MMSC_CFG__
|
||||||
#define __MMSC_CFG__
|
#define __MMSC_CFG__
|
||||||
#include "mms_util.h"
|
#include "mms_util.h"
|
||||||
#include "mms_resolve.h"
|
#include "mms_resolve_shell.h"
|
||||||
#include "mms_billing.h"
|
#include "mms_billing_shell.h"
|
||||||
#include "mms_detokenize.h"
|
#include "mms_detokenize_shell.h"
|
||||||
|
|
||||||
typedef struct MmsProxyRelay {
|
typedef struct MmsProxyRelay {
|
||||||
Octstr *host;
|
Octstr *host;
|
||||||
|
|
Loading…
Reference in New Issue