summaryrefslogtreecommitdiff
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2013-06-06 21:40:35 +0000
committerMark Michelson <mmichelson@digium.com>2013-06-06 21:40:35 +0000
commit2dc8a060064f359a17f5ebcd515d85fe5203c019 (patch)
treefca012b9378a2a005fea30278f7d2a6129251b1f /channels/chan_dahdi.c
parent5f740572d081330fb43462eba5b0f495d8e56df1 (diff)
Refactor the features configuration scheme.
Features configuration is handled in its own API in features_config.h and features_config.c. This way, features configuration is accessible to anything that needs it. In addition, features configuration has been altered to be more channel-oriented. Most callers of features API code will be supplying a channel so that the individual channel's settings will be acquired rather than the global setting. Missing from this commit is XML documentation for the features configuration. That will be handled in a separate commit. Review: https://reviewboard.asterisk.org/r/2578/ (issue ASTERISK-21542) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 00c25b9c1..92de02391 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -130,6 +130,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/paths.h"
#include "asterisk/ccss.h"
#include "asterisk/data.h"
+#include "asterisk/features_config.h"
/*** DOCUMENTATION
<application name="DAHDISendKeypadFacility" language="en_US">
@@ -10137,15 +10138,15 @@ static int dahdi_dnd(struct dahdi_pvt *dahdichan, int flag)
return 0;
}
-static int canmatch_featurecode(const char *exten)
+static int canmatch_featurecode(const char *pickupexten, const char *exten)
{
int extlen = strlen(exten);
- const char *pickup_ext;
+
if (!extlen) {
return 1;
}
- pickup_ext = ast_pickup_ext();
- if (extlen < strlen(pickup_ext) && !strncmp(pickup_ext, exten, extlen)) {
+
+ if (extlen < strlen(pickupexten) && !strncmp(pickupexten, exten, extlen)) {
return 1;
}
/* hardcoded features are *60, *67, *69, *70, *72, *73, *78, *79, *82, *0 */
@@ -10191,6 +10192,8 @@ static void *analog_ss_thread(void *data)
int res;
int idx;
struct ast_format tmpfmt;
+ RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
ast_mutex_lock(&ss_thread_lock);
ss_thread_count++;
@@ -10210,6 +10213,17 @@ static void *analog_ss_thread(void *data)
ast_hangup(chan);
goto quit;
}
+
+ ast_channel_lock(chan);
+ pickup_cfg = ast_get_chan_features_pickup_config(chan);
+ if (!pickup_cfg) {
+ ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
+ pickupexten = "";
+ } else {
+ pickupexten = ast_strdupa(pickup_cfg->pickupexten);
+ }
+ ast_channel_unlock(chan);
+
if (p->dsp)
ast_dsp_digitreset(p->dsp);
switch (p->sig) {
@@ -10576,7 +10590,7 @@ static void *analog_ss_thread(void *data)
memset(exten, 0, sizeof(exten));
timeout = firstdigittimeout;
- } else if (!strcmp(exten,ast_pickup_ext())) {
+ } else if (!strcmp(exten, pickupexten)) {
/* Scan all channels and see if there are any
* ringing channels that have call groups
* that equal this channels pickup group
@@ -10708,7 +10722,7 @@ static void *analog_ss_thread(void *data)
}
} else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
- && !canmatch_featurecode(exten)) {
+ && !canmatch_featurecode(pickupexten, exten)) {
ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<Unknown Caller>"),
ast_channel_context(chan));