aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2010-12-13 22:10:40 +0000
committerrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2010-12-13 22:10:40 +0000
commit2c6fbf9fc75f6b2aab6a5705f04a908f87308114 (patch)
tree80ecc6bc9176f82ff4ab782ac998da9f2af73e58
parent9e7e5f5c37306f9a82e1a45a26672bd55257fa1f (diff)
Post AMI hold events on PRI spans when the remote party HOLD/RETRIEVEs the call.
Part of JIRA SWP-2687/ABE-2691. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@298288 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/sig_pri.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index 9b6d63a51..ab9c7d927 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -4037,6 +4037,29 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev
#if defined(HAVE_PRI_CALL_HOLD)
/*!
* \internal
+ * \brief Post an AMI hold event.
+ * \since 1.10
+ *
+ * \param chan Channel to post event to
+ * \param is_held TRUE if the call was placed on hold.
+ *
+ * \return Nothing
+ */
+static void sig_pri_ami_hold_event(struct ast_channel *chan, int is_held)
+{
+ ast_manager_event(chan, EVENT_FLAG_CALL, "Hold",
+ "Status: %s\r\n"
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n",
+ is_held ? "On" : "Off",
+ chan->name,
+ chan->uniqueid);
+}
+#endif /* defined(HAVE_PRI_CALL_HOLD) */
+
+#if defined(HAVE_PRI_CALL_HOLD)
+/*!
+ * \internal
* \brief Handle the hold event from libpri.
* \since 1.8
*
@@ -4089,20 +4112,14 @@ static int sig_pri_handle_hold(struct sig_pri_span *pri, pri_event *ev)
}
sig_pri_handle_subcmds(pri, chanpos_old, ev->e, ev->hold.channel, ev->hold.subcmds,
ev->hold.call);
+ pri_queue_control(pri, chanpos_old, AST_CONTROL_HOLD);
chanpos_new = pri_fixup_principle(pri, chanpos_new, ev->hold.call);
if (chanpos_new < 0) {
/* Should never happen. */
+ pri_queue_control(pri, chanpos_old, AST_CONTROL_UNHOLD);
retval = -1;
} else {
- struct ast_frame f = { AST_FRAME_CONTROL, };
-
- /*
- * Things are in an odd state here so we cannot use pri_queue_control().
- * However, we already have the owner lock so we can simply queue the frame.
- */
- f.subclass.integer = AST_CONTROL_HOLD;
- ast_queue_frame(owner, &f);
-
+ sig_pri_ami_hold_event(owner, 1);
sig_pri_span_devstate_changed(pri);
retval = 0;
}
@@ -4170,7 +4187,12 @@ static void sig_pri_handle_retrieve(struct sig_pri_span *pri, pri_event *ev)
sig_pri_lock_private(pri->pvts[chanpos]);
sig_pri_handle_subcmds(pri, chanpos, ev->e, ev->retrieve.channel,
ev->retrieve.subcmds, ev->retrieve.call);
+ sig_pri_lock_owner(pri, chanpos);
pri_queue_control(pri, chanpos, AST_CONTROL_UNHOLD);
+ if (pri->pvts[chanpos]->owner) {
+ sig_pri_ami_hold_event(pri->pvts[chanpos]->owner, 0);
+ ast_channel_unlock(pri->pvts[chanpos]->owner);
+ }
sig_pri_unlock_private(pri->pvts[chanpos]);
sig_pri_span_devstate_changed(pri);
pri_retrieve_ack(pri->pri, ev->retrieve.call,