[asterisk-commits] mmichelson: branch mmichelson/features_config r389966 - in /team/mmichelson/f...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 28 17:03:16 CDT 2013
Author: mmichelson
Date: Tue May 28 17:03:13 2013
New Revision: 389966
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389966
Log:
Change builtin attended transfer to use configured values.
This includes the transferdigittimeout, the xferfailsound, and
the menu options for the attended transfer.
Modified:
team/mmichelson/features_config/bridges/bridge_builtin_features.c
team/mmichelson/features_config/include/asterisk/features_config.h
team/mmichelson/features_config/main/features_config.c
Modified: team/mmichelson/features_config/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/bridges/bridge_builtin_features.c?view=diff&rev=389966&r1=389965&r2=389966
==============================================================================
--- team/mmichelson/features_config/bridges/bridge_builtin_features.c (original)
+++ team/mmichelson/features_config/bridges/bridge_builtin_features.c Tue May 28 17:03:13 2013
@@ -49,6 +49,7 @@
#include "asterisk/astobj2.h"
#include "asterisk/pbx.h"
#include "asterisk/parking.h"
+#include "asterisk/features_config.h"
/*!
* \brief Helper function that presents dialtone and grabs extension
@@ -59,6 +60,13 @@
static int grab_transfer(struct ast_channel *chan, char *exten, size_t exten_len, const char *context)
{
int res;
+ int digit_timeout;
+ RAII_VAR(struct ast_features_xfer_config *, xfer_cfg, NULL, ao2_cleanup);
+
+ ast_channel_lock(chan);
+ xfer_cfg = ast_get_chan_features_xfer_config(chan);
+ digit_timeout = xfer_cfg->transferdigittimeout;
+ ast_channel_unlock(chan);
/* Play the simple "transfer" prompt out and wait */
res = ast_stream_and_wait(chan, "pbx-transfer", AST_DIGIT_ANY);
@@ -73,8 +81,7 @@
}
/* Drop to dialtone so they can enter the extension they want to transfer to */
-/* BUGBUG the timeout needs to be configurable from features.conf. */
- res = ast_app_dtget(chan, context, exten, exten_len, exten_len - 1, 3000);
+ res = ast_app_dtget(chan, context, exten, exten_len, exten_len - 1, digit_timeout);
if (res < 0) {
/* Hangup or error */
res = -1;
@@ -263,6 +270,11 @@
struct ast_bridge_features_attended_transfer *attended_transfer = hook_pvt;
const char *context;
enum atxfer_code transfer_code = ATXFER_INCOMPLETE;
+ const char *atxfer_abort;
+ const char *atxfer_threeway;
+ const char *atxfer_complete;
+ const char *fail_sound;
+ RAII_VAR(struct ast_features_xfer_config *, xfer_cfg, NULL, ao2_cleanup);
bridge = ast_bridge_channel_merge_inhibit(bridge_channel, +1);
@@ -270,6 +282,11 @@
ast_channel_lock(bridge_channel->chan);
context = ast_strdupa(get_transfer_context(bridge_channel->chan,
attended_transfer ? attended_transfer->context : NULL));
+ xfer_cfg = ast_get_chan_features_xfer_config(bridge_channel->chan);
+ atxfer_abort = ast_strdupa(xfer_cfg->atxferabort);
+ atxfer_threeway = ast_strdupa(xfer_cfg->atxferthreeway);
+ atxfer_complete = ast_strdupa(xfer_cfg->atxfercomplete);
+ fail_sound = ast_strdupa(xfer_cfg->xferfailsound);
ast_channel_unlock(bridge_channel->chan);
/* Grab the extension to transfer to */
@@ -284,8 +301,7 @@
if (!peer) {
ast_bridge_merge_inhibit(bridge, -1);
ao2_ref(bridge, -1);
-/* BUGBUG beeperr needs to be configurable from features.conf */
- ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+ ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
return 0;
}
@@ -295,24 +311,17 @@
if (ast_bridge_features_init(&caller_features)
|| ast_bridge_hangup_hook(&caller_features,
attended_transfer_complete, &transfer_code, NULL, 0)
- || ast_bridge_dtmf_hook(&caller_features,
- attended_transfer && !ast_strlen_zero(attended_transfer->abort)
- ? attended_transfer->abort : "*1",
+ || ast_bridge_dtmf_hook(&caller_features, atxfer_abort,
attended_transfer_abort, &transfer_code, NULL, 0)
- || ast_bridge_dtmf_hook(&caller_features,
- attended_transfer && !ast_strlen_zero(attended_transfer->complete)
- ? attended_transfer->complete : "*2",
+ || ast_bridge_dtmf_hook(&caller_features, atxfer_complete,
attended_transfer_complete, &transfer_code, NULL, 0)
- || ast_bridge_dtmf_hook(&caller_features,
- attended_transfer && !ast_strlen_zero(attended_transfer->threeway)
- ? attended_transfer->threeway : "*3",
+ || ast_bridge_dtmf_hook(&caller_features, atxfer_threeway,
attended_transfer_threeway, &transfer_code, NULL, 0)) {
ast_bridge_features_cleanup(&caller_features);
ast_hangup(peer);
ast_bridge_merge_inhibit(bridge, -1);
ao2_ref(bridge, -1);
-/* BUGBUG beeperr needs to be configurable from features.conf */
- ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+ ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
return 0;
}
@@ -324,8 +333,7 @@
ast_hangup(peer);
ast_bridge_merge_inhibit(bridge, -1);
ao2_ref(bridge, -1);
-/* BUGBUG beeperr needs to be configurable from features.conf */
- ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+ ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
return 0;
}
ast_bridge_merge_inhibit(attended_bridge, +1);
@@ -338,8 +346,7 @@
ast_hangup(peer);
ast_bridge_merge_inhibit(bridge, -1);
ao2_ref(bridge, -1);
-/* BUGBUG beeperr needs to be configurable from features.conf */
- ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+ ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
return 0;
}
@@ -405,7 +412,7 @@
if (xfer_failed) {
ast_hangup(peer);
if (!ast_check_hangup_locked(bridge_channel->chan)) {
- ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_NONE);
+ ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
}
}
Modified: team/mmichelson/features_config/include/asterisk/features_config.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/include/asterisk/features_config.h?view=diff&rev=389966&r1=389965&r2=389966
==============================================================================
--- team/mmichelson/features_config/include/asterisk/features_config.h (original)
+++ team/mmichelson/features_config/include/asterisk/features_config.h Tue May 28 17:03:13 2013
@@ -56,6 +56,8 @@
AST_STRING_FIELD(xferfailsound);
/*! DTMF sequence used to abort an attempted atxfer */
AST_STRING_FIELD(atxferabort);
+ /*! DTMF sequence used to complete an attempted atxfer */
+ AST_STRING_FIELD(atxfercomplete);
/*! DTMF sequence used to turn an attempted atxfer into a three-way call */
AST_STRING_FIELD(atxferthreeway);
);
Modified: team/mmichelson/features_config/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/main/features_config.c?view=diff&rev=389966&r1=389965&r2=389966
==============================================================================
--- team/mmichelson/features_config/main/features_config.c (original)
+++ team/mmichelson/features_config/main/features_config.c Tue May 28 17:03:13 2013
@@ -490,6 +490,8 @@
ast_string_field_set(xfer, xferfailsound, value);
} else if (!strcasecmp(name, "atxferabort")) {
ast_string_field_set(xfer, atxferabort, value);
+ } else if (!strcasecmp(name, "atxfercomplete")) {
+ ast_string_field_set(xfer, atxfercomplete, value);
} else if (!strcasecmp(name, "atxferthreeway")) {
ast_string_field_set(xfer, atxferthreeway, value);
} else {
@@ -521,6 +523,8 @@
ast_copy_string(buf, xfer->xferfailsound, len);
} else if (!strcasecmp(field, "atxferabort")) {
ast_copy_string(buf, xfer->atxferabort, len);
+ } else if (!strcasecmp(field, "atxfercomplete")) {
+ ast_copy_string(buf, xfer->atxfercomplete, len);
} else if (!strcasecmp(field, "atxferthreeway")) {
ast_copy_string(buf, xfer->atxferthreeway, len);
} else {
@@ -1182,6 +1186,12 @@
"beep", xfer_handler, 0);
aco_option_register_custom(&cfg_info, "xferfailsound", ACO_EXACT, global_options,
"beeperr", xfer_handler, 0);
+ aco_option_register_custom(&cfg_info, "atxferabort", ACO_EXACT, global_options,
+ "*1", xfer_handler, 0);
+ aco_option_register_custom(&cfg_info, "atxfercomplete", ACO_EXACT, global_options,
+ "*2", xfer_handler, 0);
+ aco_option_register_custom(&cfg_info, "atxferthreeway", ACO_EXACT, global_options,
+ "*3", xfer_handler, 0);
aco_option_register_custom(&cfg_info, "pickupexten", ACO_EXACT, global_options,
"*8", pickup_handler, 0);
More information about the asterisk-commits
mailing list