rendered paste bodyIndex: include/openpbx/features.h
===================================================================
--- include/openpbx/features.h (revision 578)
+++ include/openpbx/features.h (working copy)
@@ -56,7 +56,7 @@
\param timeout is a timeout in milliseconds
\param extout is a parameter to an int that will hold the parked location, or NULL if you want
*/
-extern int opbx_park_call(struct opbx_channel *chan, struct opbx_channel *host, int timeout, int *extout);
+extern int (*opbx_park_call)(struct opbx_channel *chan, struct opbx_channel *host, int timeout, int *extout);
/*! Park a call via a masqueraded channel */
/*! \param rchan the real channel to be parked
\param host the channel to have the parking read to
@@ -65,28 +65,28 @@
\param timeout is a timeout in milliseconds
\param extout is a parameter to an int that will hold the parked location, or NULL if you want
*/
-extern int opbx_masq_park_call(struct opbx_channel *rchan, struct opbx_channel *host, int timeout, int *extout);
+extern int (*opbx_masq_park_call)(struct opbx_channel *rchan, struct opbx_channel *host, int timeout, int *extout);
/*! Determine system parking extension */
/*! Returns the call parking extension for drivers that provide special
call parking help */
-extern char *opbx_parking_ext(void);
-extern char *opbx_pickup_ext(void);
+extern char *(*opbx_parking_ext)(void);
+extern char *(*opbx_pickup_ext)(void);
/*! Bridge a call, optionally allowing redirection */
-extern int opbx_bridge_call(struct opbx_channel *chan, struct opbx_channel *peer,struct opbx_bridge_config *config);
+extern int (*opbx_bridge_call)(struct opbx_channel *chan, struct opbx_channel *peer,struct opbx_bridge_config *config);
-extern int opbx_pickup_call(struct opbx_channel *chan);
+extern int (*opbx_pickup_call)(struct opbx_channel *chan);
/*! register new feature into feature_set
\param feature an opbx_call_feature object which contains a keysequence
and a callback function which is called when this keysequence is pressed
during a call. */
-extern void opbx_register_feature(struct opbx_call_feature *feature);
+extern void (*opbx_register_feature)(struct opbx_call_feature *feature);
/*! unregister feature from feature_set
\param feature the opbx_call_feature object which was registered before*/
-extern void opbx_unregister_feature(struct opbx_call_feature *feature);
+extern void (*opbx_unregister_feature)(struct opbx_call_feature *feature);
#endif /* _OPBX_FEATURES_H */
Index: res/res_features.c
===================================================================
--- res/res_features.c (revision 578)
+++ res/res_features.c (working copy)
@@ -163,12 +163,12 @@
LOCAL_USER_DECL;
-char *opbx_parking_ext(void)
+static char *__opbx_parking_ext(void)
{
return parking_ext;
}
-char *opbx_pickup_ext(void)
+char *__opbx_pickup_ext(void)
{
return pickup_ext;
}
@@ -217,7 +217,7 @@
static struct opbx_channel *opbx_feature_request_and_dial(struct opbx_channel *caller, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name);
-static void *opbx_bridge_call_thread(void *data)
+static void *__opbx_bridge_call_thread(void *data)
{
struct opbx_bridge_thread_obj *tobj = data;
tobj->chan->appl = "Transferred Call";
@@ -234,7 +234,7 @@
}
- opbx_bridge_call(tobj->peer, tobj->chan, &tobj->bconfig);
+ __opbx_bridge_call(tobj->peer, tobj->chan, &tobj->bconfig);
opbx_hangup(tobj->chan);
opbx_hangup(tobj->peer);
tobj->chan = tobj->peer = NULL;
@@ -243,7 +243,7 @@
return NULL;
}
-static void opbx_bridge_call_thread_launch(void *data)
+static void __opbx_bridge_call_thread_launch(void *data)
{
pthread_t thread;
pthread_attr_t attr;
@@ -252,7 +252,7 @@
result = pthread_attr_init(&attr);
pthread_attr_setschedpolicy(&attr, SCHED_RR);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- result = opbx_pthread_create(&thread, &attr,opbx_bridge_call_thread, data);
+ result = opbx_pthread_create(&thread, &attr,__opbx_bridge_call_thread, data);
result = pthread_attr_destroy(&attr);
}
@@ -277,7 +277,7 @@
/*--- opbx_park_call: Park a call */
/* We put the user in the parking list, then wake up the parking thread to be sure it looks
after these channels too */
-int opbx_park_call(struct opbx_channel *chan, struct opbx_channel *peer, int timeout, int *extout)
+static int __opbx_park_call(struct opbx_channel *chan, struct opbx_channel *peer, int timeout, int *extout)
{
struct parkeduser *pu, *cur;
int i,x,parking_range;
@@ -400,7 +400,7 @@
return 0;
}
-int opbx_masq_park_call(struct opbx_channel *rchan, struct opbx_channel *peer, int timeout, int *extout)
+static int __opbx_masq_park_call(struct opbx_channel *rchan, struct opbx_channel *peer, int timeout, int *extout)
{
struct opbx_channel *chan;
struct opbx_frame *f;
@@ -425,7 +425,7 @@
f = opbx_read(chan);
if (f)
opbx_frfree(f);
- opbx_park_call(chan, peer, timeout, extout);
+ __opbx_park_call(chan, peer, timeout, extout);
} else {
opbx_log(LOG_WARNING, "Unable to create parked channel\n");
return -1;
@@ -595,14 +595,14 @@
opbx_indicate(transferee, OPBX_CONTROL_UNHOLD);
return res;
}
- if (!strcmp(newext, opbx_parking_ext())) {
+ if (!strcmp(newext, __opbx_parking_ext())) {
opbx_moh_stop(transferee);
res = opbx_autoservice_stop(transferee);
opbx_indicate(transferee, OPBX_CONTROL_UNHOLD);
if (res)
res = -1;
- else if (!opbx_park_call(transferee, transferer, 0, NULL)) {
+ else if (!__opbx_park_call(transferee, transferer, 0, NULL)) {
/* We return non-zero, but tell the PBX not to hang the channel when
the thread dies -- We have to be careful now though. We are responsible for
hanging up the channel, else it will never be hung up! */
@@ -735,7 +735,7 @@
memset(&bconfig,0,sizeof(struct opbx_bridge_config));
opbx_set_flag(&(bconfig.features_caller), OPBX_FEATURE_DISCONNECT);
opbx_set_flag(&(bconfig.features_callee), OPBX_FEATURE_DISCONNECT);
- res = opbx_bridge_call(transferer,newchan,&bconfig);
+ res = __opbx_bridge_call(transferer,newchan,&bconfig);
if (newchan->_softhangup || newchan->_state != OPBX_STATE_UP || !transferer->_softhangup) {
opbx_hangup(newchan);
if (f) {
@@ -811,7 +811,7 @@
opbx_log(LOG_WARNING, "Failed to play courtesy tone!\n");
}
}
- opbx_bridge_call_thread_launch(tobj);
+ __opbx_bridge_call_thread_launch(tobj);
} else {
opbx_log(LOG_WARNING, "Out of memory!\n");
opbx_hangup(xferchan);
@@ -871,7 +871,7 @@
static OPBX_LIST_HEAD(feature_list,opbx_call_feature) feature_list;
/* register new feature into feature_list*/
-void opbx_register_feature(struct opbx_call_feature *feature)
+static void __opbx_register_feature(struct opbx_call_feature *feature)
{
if (!feature) {
opbx_log(LOG_NOTICE,"You didn't pass a feature!\n");
@@ -887,7 +887,7 @@
}
/* unregister feature from feature_list */
-void opbx_unregister_feature(struct opbx_call_feature *feature)
+void __opbx_unregister_feature(struct opbx_call_feature *feature)
{
if (!feature) return;
@@ -897,7 +897,7 @@
free(feature);
}
-static void opbx_unregister_features(void)
+static void __opbx_unregister_features(void)
{
struct opbx_call_feature *feature;
@@ -1248,7 +1248,7 @@
return chan;
}
-int opbx_bridge_call(struct opbx_channel *chan,struct opbx_channel *peer,struct opbx_bridge_config *config)
+static int __opbx_bridge_call(struct opbx_channel *chan,struct opbx_channel *peer,struct opbx_bridge_config *config)
{
/* Copy voice back and forth between the two channels. Give the peer
the ability to transfer calls with '#<extension' syntax. */
@@ -1667,7 +1667,7 @@
if (!res)
res = opbx_safe_sleep(chan, 1000);
if (!res)
- res = opbx_park_call(chan, chan, 0, NULL);
+ res = __opbx_park_call(chan, chan, 0, NULL);
LOCAL_USER_REMOVE(u);
if (!res)
res = OPBX_PBX_KEEPALIVE;
@@ -1766,7 +1766,7 @@
config.play_warning = 0;
config.warning_freq = 0;
config.warning_sound=NULL;
- res = opbx_bridge_call(chan, peer, &config);
+ res = __opbx_bridge_call(chan, peer, &config);
/* Simulate the PBX hanging up */
if (res != OPBX_PBX_NO_HANGUP_PEER)
@@ -1799,7 +1799,7 @@
opbx_cli(fd, format, "Builtin Feature", "Default", "Current");
opbx_cli(fd, format, "---------------", "-------", "-------");
- opbx_cli(fd, format, "Pickup", "*8", opbx_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
+ opbx_cli(fd, format, "Pickup", "*8", __opbx_pickup_ext()); /* default hardcoded above, so we'll hardcode it here */
fcount = sizeof(builtin_features) / sizeof(builtin_features[0]);
@@ -1908,7 +1908,7 @@
}
-int opbx_pickup_call(struct opbx_channel *chan)
+int __opbx_pickup_call(struct opbx_channel *chan)
{
struct opbx_channel *cur = NULL;
int res = -1;
@@ -2015,7 +2015,7 @@
}
/* Map a key combination to an application*/
- opbx_unregister_features();
+ __opbx_unregister_features();
var = opbx_variable_browse(cfg, "applicationmap");
while(var) {
char *tmp_val=strdup(var->value);
@@ -2078,7 +2078,7 @@
continue;
}
- opbx_register_feature(feature);
+ __opbx_register_feature(feature);
if (option_verbose >=1) opbx_verbose(VERBOSE_PREFIX_2 "Mapping Feature '%s' to app '%s' with code '%s'\n", var->name, app, exten);
}
@@ -2089,7 +2089,7 @@
if (con)
- opbx_context_remove_extension2(con, opbx_parking_ext(), 1, registrar);
+ opbx_context_remove_extension2(con, __opbx_parking_ext(), 1, registrar);
if (!(con = opbx_context_find(parking_con))) {
if (!(con = opbx_context_create(NULL, parking_con, registrar))) {
@@ -2097,7 +2097,7 @@
return -1;
}
}
- return opbx_add_extension2(con, 1, opbx_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), FREE, registrar);
+ return opbx_add_extension2(con, 1, __opbx_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), FREE, registrar);
}
int reload(void) {
@@ -2121,6 +2121,16 @@
if (!res) {
opbx_manager_register("ParkedCalls", 0, manager_parking_status, "List parked calls" );
}
+ /* Install our functions into stubs */
+ opbx_park_call = __opbx_park_call;
+ opbx_masq_park_call = __opbx_masq_park_call;
+ opbx_parking_ext = __opbx_parking_ext;
+ opbx_pickup_ext = __opbx_pickup_ext;
+ opbx_bridge_call = __opbx_bridge_call;
+ opbx_pickup_call = __opbx_pickup_call;
+ opbx_register_feature = __opbx_register_feature;
+ opbx_unregister_feature = __opbx_unregister_feature;
+
return res;
}
Index: featuresstub.c
===================================================================
--- featuresstub.c (revision 0)
+++ featuresstub.c (revision 0)
@@ -0,0 +1,93 @@
+/*
+ * OpenPBX -- An open source telephony toolkit.
+ *
+ *
+ * See http://www.openpbx.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#include <openpbx/features.h>
+
+
+statuc int stub_opbx_park_call(struct opbx_channel *chan, struct opbx_channel *host, int timeout, int *extout);
+{
+ opbx_log(LOG_NOTICE, "res_features not loaded!\n");
+ return -1;
+}
+
+static int stub_opbx_masq_park_call(struct opbx_channel *rchan, struct opbx_channel *host, int timeout, int *extout);
+{
+ opbx_log(LOG_NOTICE, "res_features not loaded!\n");
+ return -1;
+}
+
+static char *stub_opbx_parking_ext(void);
+{
+ opbx_log(LOG_NOTICE, "res_features not loaded!\n");
+ return -1;
+}
+
+static char *stub_opbx_pickup_ext(void);
+{
+ opbx_log(LOG_NOTICE, "res_features not loaded!\n");
+ return -1;
+}
+
+static int stub_opbx_bridge_call(struct opbx_channel *chan, struct opbx_channel *peer,struct opbx_bridge_config *config);
+{
+ opbx_log(LOG_NOTICE, "res_features not loaded!\n");
+ return -1;
+}
+
+static int stub_opbx_pickup_call(struct opbx_channel *chan);
+{
+ opbx_log(LOG_NOTICE, "res_features not loaded!\n");
+ return -1;
+}
+
+static void stub_opbx_register_feature(struct opbx_call_feature *feature);
+{
+ opbx_log(LOG_NOTICE, "res_features not loaded!\n");
+ return -1;
+}
+
+static void stub_opbx_unregister_feature(struct opbx_call_feature *feature);
+{
+ opbx_log(LOG_NOTICE, "res_features not loaded!\n");
+ return -1;
+}
+
+
+
+
+int (*opbx_park_call)(struct opbx_channel *chan, struct opbx_channel *host, int timeout, int *extout) =
+ stub_opbx_park_call;
+
+int (*opbx_masq_park_call)(struct opbx_channel *rchan, struct opbx_channel *host, int timeout, int *extout) =
+ stub_opbx_masq_park_call;
+
+char *(*opbx_parking_ext)(void) =
+ stub_opbx_parking_ext;
+
+char *(*opbx_pickup_ext)(void) =
+ stub_opbx_pickup_ext;
+
+int (*opbx_bridge_call)(struct opbx_channel *chan, struct opbx_channel *peer,struct opbx_bridge_config *config) =
+ stub_opbx_bridge_call;
+
+int (*opbx_pickup_call)(struct opbx_channel *chan) =
+ stub_opbx_pickup_call;
+
+void (*opbx_register_feature)(struct opbx_call_feature *feature) =
+ stub_opbx_register_feature;
+
+void (*opbx_unregister_feature)(struct opbx_call_feature *feature) =
+ stub_opbx_unregister_feature;
+