summaryrefslogtreecommitdiff
path: root/channels/chan_misdn.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_misdn.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_misdn.c')
-rw-r--r--channels/chan_misdn.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index c68538e66..1a8f0d980 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -102,6 +102,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/causes.h"
#include "asterisk/format.h"
#include "asterisk/format_cap.h"
+#include "asterisk/features_config.h"
#include "chan_misdn_config.h"
#include "isdn_lib.h"
@@ -10071,6 +10072,9 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
}
if (ch->state == MISDN_WAITING4DIGS) {
+ RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
+
/* Ok, incomplete Setup, waiting till extension exists */
if (ast_strlen_zero(bc->info_dad) && ! ast_strlen_zero(bc->keypad)) {
chan_misdn_log(1, bc->port, " --> using keypad as info\n");
@@ -10080,8 +10084,18 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
strncat(bc->dialed.number, bc->info_dad, sizeof(bc->dialed.number) - strlen(bc->dialed.number) - 1);
ast_channel_exten_set(ch->ast, bc->dialed.number);
+ ast_channel_lock(ch->ast);
+ pickup_cfg = ast_get_chan_features_pickup_config(ch->ast);
+ 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(ch->ast);
+
/* Check for Pickup Request first */
- if (!strcmp(ast_channel_exten(ch->ast), ast_pickup_ext())) {
+ if (!strcmp(ast_channel_exten(ch->ast), pickupexten)) {
if (ast_pickup_call(ch->ast)) {
hangup_chan(ch, bc);
} else {
@@ -10169,6 +10183,8 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
int ai;
int im;
int append_msn = 0;
+ RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ const char *pickupexten;
if (ch) {
switch (ch->state) {
@@ -10224,6 +10240,16 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
return RESPONSE_RELEASE_SETUP;
}
+ 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 ((exceed = add_in_calls(bc->port))) {
char tmp[16];
snprintf(tmp, sizeof(tmp), "%d", exceed);
@@ -10315,7 +10341,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
}
/* Check for Pickup Request first */
- if (!strcmp(ast_channel_exten(chan), ast_pickup_ext())) {
+ if (!strcmp(ast_channel_exten(chan), pickupexten)) {
if (!ch->noautorespond_on_setup) {
/* Sending SETUP_ACK */
misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE);