[asterisk-commits] file: branch file/bridging r102371 - /team/file/bridging/main/bridging.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 4 16:43:56 CST 2008
Author: file
Date: Mon Feb 4 16:43:55 2008
New Revision: 102371
URL: http://svn.digium.com/view/asterisk?view=rev&rev=102371
Log:
Add the beginnings of the transfer options. It will basically present the dialtone and read in the DTMF for both attended and blind right now.
Modified:
team/file/bridging/main/bridging.c
Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=102371&r1=102370&r2=102371
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Mon Feb 4 16:43:55 2008
@@ -43,6 +43,8 @@
#include "asterisk/linkedlists.h"
#include "asterisk/bridging.h"
#include "asterisk/app.h"
+#include "asterisk/file.h"
+#include "asterisk/dial.h"
static AST_RWLIST_HEAD_STATIC(bridge_technologies, ast_bridge_technology);
@@ -1243,17 +1245,56 @@
return 0;
}
+/*! \brief Helper function that presents dialtone and grabs extension */
+static int grab_transfer(struct ast_channel *chan, char *exten, size_t exten_len, char *context)
+{
+ int res;
+
+ /* Play the simple "transfer" prompt out and wait */
+ res = ast_stream_and_wait(chan, "pbx-transfer", AST_DIGIT_ANY);
+ ast_stopstream(chan);
+
+ /* If the person hit a DTMF digit while the above played back stick it into the buffer */
+ if (res)
+ exten[0] = (char)res;
+
+ /* Drop to dialtone so they can enter the extension they want to transfer to */
+ res = ast_app_dtget(chan, context, exten, exten_len, 100, 1000);
+
+ return res;
+}
+
/*! \brief Internal built in feature for blind transfers */
static int feature_blind_transfer(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
+ char exten[AST_MAX_EXTENSION] = "";
+
+ /* Grab the extension to transfer to */
+ if (!grab_transfer(bridge_channel->chan, exten, sizeof(exten), bridge_channel->chan->context)) {
+ ast_stream_and_wait(bridge_channel->chan, "pbx-invalid", AST_DIGIT_ANY);
+ bridge_channel->state = AST_BRIDGE_CHANNEL_STATE_WAIT;
+ return 0;
+ }
+
bridge_channel->state = AST_BRIDGE_CHANNEL_STATE_WAIT;
+
return 0;
}
/*! \brief Internal built in feature for attended transfers */
static int feature_attended_transfer(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
+ char exten[AST_MAX_EXTENSION] = "";
+
+ /* Grab the extension to transfer to */
+ if (!grab_transfer(bridge_channel->chan, exten, sizeof(exten), bridge_channel->chan->context)) {
+ ast_stream_and_wait(bridge_channel->chan, "pbx-invalid", AST_DIGIT_ANY);
+ bridge_channel->state = AST_BRIDGE_CHANNEL_STATE_WAIT;
+ return 0;
+ }
+
bridge_channel->state = AST_BRIDGE_CHANNEL_STATE_WAIT;
+
return 0;
}
More information about the asterisk-commits
mailing list