We found no way to do this from AMI.
Very tied up on other projects, but if another developer wanted to look into
adding support for it, I believe it would be something along these lines….
int action_hold(struct mansession *s, const struct message *m)
{
const char *channelarg = astman_get_header(m, "Channel");
struct ast_channel *chan = NULL;
int res = -1;
if (ast_strlen_zero(channelarg))
{
astman_send_error(s, m, "No channel specified");
return 0;
}
chan = ast_channel_get_by_name(channelarg);
if (chan)
{
ast_log(LOG_DEBUG, "Putting channel %s on hold (0x%p)\n",
ast_channel_name(chan), chan);
if ((res = ast_indicate(chan, AST_CONTROL_HOLD)))
{
astman_send_error(s, m, "Failed to put channel on hold");
}
ast_channel_unref(chan);
}
else astman_send_error(s, m, "No such channel");
if (!res) astman_send_ack(s, m, "Hold");
return 0;
}
int action_unhold(struct mansession *s, const struct message *m)
{
const char *channelarg = astman_get_header(m, "Channel");
struct ast_channel *chan = NULL;
int res = -1;
if (ast_strlen_zero(channelarg))
{
astman_send_error(s, m, "No channel specified");
return 0;
}
chan = ast_channel_get_by_name(channelarg);
if (chan)
{
if ((res = ast_indicate(chan, AST_CONTROL_UNHOLD)))
{
astman_send_error(s, m, "Failed to remove channel from hold");
}
ast_channel_unref(chan);
}
else astman_send_error(s, m, "No such channel");
if (!res) astman_send_ack(s, m, "Unhold");
return 0;
}
const char *hold_synopsis = "Place Channel on Hold";
const char *hold_desc = "Place the channel specified by the 'Channel' argument
on Hold";
const char *unhold_synopsis = "Remove Channel from Hold";
const char *unhold_desc = "Remove the channel specified by the 'Channel'
argument from Hold";
ast_manager_register2("Hold", EVENT_FLAG_CALL, action_hold, AST_MODULE_SELF,
hold_synopsis, hold_desc);
ast_manager_register2("UnHold", EVENT_FLAG_CALL, action_unhold,
AST_MODULE_SELF, unhold_synopsis, unhold_desc);
From: asterisk-users <[email protected]> On Behalf Of
Joshua C. Colp
Sent: Wednesday, July 21, 2021 5:57 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
<[email protected]>
Subject: Re: [asterisk-users] Call Hold / Transfer via AMI
On Wed, Jul 21, 2021 at 7:39 AM Antony Stone
<[email protected]<mailto:[email protected]>>
wrote:
Hi.
From the lack of response to my question, I'm assuming that either:
a) putting a call on hold is not possible via AMI
or
b) everyone thinks it's so obvious that I should be able to see it for myself
Can anyone confirm one way or the other?
If it simply isn't possible, I'd like to put my efforts into exploring
alternative solutions instead of spending more time on AMI.
From a surface level I know of no way from AMI to control putting a call on and
off hold.
--
Joshua C. Colp
Asterisk Technical Lead
Sangoma Technologies
Check us out at www.sangoma.com<http://www.sangoma.com> and
www.asterisk.org<http://www.asterisk.org>
This email is intended only for the use of the party to which it is addressed
and may contain information that is privileged, confidential, or protected by
law. If you are not the intended recipient you are hereby notified that any
dissemination, copying or distribution of this email or its contents is
strictly prohibited. If you have received this message in error, please notify
us immediately by replying to the message and deleting it from your computer.
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
Check out the new Asterisk community forum at: https://community.asterisk.org/
New to Asterisk? Start here:
https://wiki.asterisk.org/wiki/display/AST/Getting+Started
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users