summaryrefslogtreecommitdiff
path: root/res/res_features.c
diff options
context:
space:
mode:
authorBJ Weschke <bweschke@btwtech.com>2006-05-22 16:43:43 +0000
committerBJ Weschke <bweschke@btwtech.com>2006-05-22 16:43:43 +0000
commit5235890be44ffebcb332fcaacb0b4e0618fd62db (patch)
tree6bd3ba904b5634988db52e6c9201ed21e4ac4613 /res/res_features.c
parenta0f95cd52639cc30e23c8cb5986358f3c3a7c8f9 (diff)
This is part 2/2 of the patches for #7090. Adds one-step call parking to /trunk via builtin functions and 'k' 'K' application options added to app_dial. This also resolves #6340.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@29467 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_features.c')
-rw-r--r--res/res_features.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/res/res_features.c b/res/res_features.c
index f71f6a913..8ab36c6c8 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -426,6 +426,37 @@ static void set_peers(struct ast_channel **caller, struct ast_channel **callee,
}
}
+static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
+{
+ struct ast_channel *parker;
+ struct ast_channel *parkee;
+
+ int res=0;
+ struct localuser *u;
+ LOCAL_USER_ADD(u);
+
+ set_peers(&parker, &parkee, peer, chan, sense);
+ /* Setup the exten/priority to be s/1 since we don't know
+ where this call should return */
+ strcpy(chan->exten, "s");
+ chan->priority = 1;
+ if (chan->_state != AST_STATE_UP)
+ res = ast_answer(chan);
+ if (!res)
+ res = ast_safe_sleep(chan, 1000);
+ if (!res)
+ res = ast_park_call(parkee, parker, 0, NULL);
+ LOCAL_USER_REMOVE(u);
+ if (!res) {
+ if (sense == FEATURE_SENSE_CHAN)
+ res = AST_PBX_NO_HANGUP_PEER;
+ else
+ res = AST_PBX_KEEPALIVE;
+ }
+ return res;
+
+}
+
static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
{
char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL;
@@ -779,6 +810,7 @@ struct ast_call_feature builtin_features[] =
{ AST_FEATURE_REDIRECT, "Attended Transfer", "atxfer", "", "", builtin_atxfer, AST_FEATURE_FLAG_NEEDSDTMF },
{ AST_FEATURE_AUTOMON, "One Touch Monitor", "automon", "", "", builtin_automonitor, AST_FEATURE_FLAG_NEEDSDTMF },
{ AST_FEATURE_DISCONNECT, "Disconnect Call", "disconnect", "*", "*", builtin_disconnect, AST_FEATURE_FLAG_NEEDSDTMF },
+ { AST_FEATURE_PARKCALL, "Park Call", "parkcall", "", "", builtin_parkcall, AST_FEATURE_FLAG_NEEDSDTMF },
};