[Asterisk-code-review] chan sip: Send stasis message on invite with replaces (asterisk[13])
Jasper Hafkenscheid
asteriskteam at digium.com
Tue Oct 9 07:47:33 CDT 2018
Jasper Hafkenscheid has uploaded this change for review. ( https://gerrit.asterisk.org/10448
Change subject: chan_sip: Send stasis message on invite with replaces
......................................................................
chan_sip: Send stasis message on invite with replaces
When a call pickup is performed using and invite with replaces header
the expected PICKUP message is now sent.
ASTERISK-28081 #close
Reported-by: Luit van Drongelen
Change-Id: Ieb1442027a3ce6ae55faca47bc095e53972f947a
---
M channels/chan_sip.c
M include/asterisk/pickup.h
M main/pickup.c
3 files changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/10448/1
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 34299a8..8d92733 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -25684,7 +25684,15 @@
}
ao2_ref(bridge, -1);
} else {
+ RAII_VAR(struct ast_channel_snapshot *, chan_snapshot, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_channel_snapshot *, target_snapshot, NULL, ao2_cleanup);
+
+ chan_snapshot = ast_channel_snapshot_create(c);
+ target_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(replaces_chan));
+
ast_channel_move(replaces_chan, c);
+
+ ast_send_call_pickup_stasis_message(replaces_chan, chan_snapshot, target_snapshot);
ast_hangup(c);
}
ast_channel_unref(c);
diff --git a/include/asterisk/pickup.h b/include/asterisk/pickup.h
index 17b38e7..5e2296f 100644
--- a/include/asterisk/pickup.h
+++ b/include/asterisk/pickup.h
@@ -58,6 +58,19 @@
*/
int ast_pickup_call(struct ast_channel *chan);
+struct ast_channel_snapshot;
+/*!
+ * \brief Send a pickup stasis message
+ *
+ * \param picking_up channel that initiated pickup.
+ * \param chan snapshot of channel that initiated pickup.
+ * \param target snapshot of channel to be picked up.
+ *
+ * \retval 0 on success.
+ * \retval -1 on failure.
+ */
+int ast_send_call_pickup_stasis_message(struct ast_channel *picking_up, struct ast_channel_snapshot *chan, struct ast_channel_snapshot *target);
+
/*!
* \brief Pickup a call target.
*
diff --git a/main/pickup.c b/main/pickup.c
index 6f1e0f1..87a7533 100644
--- a/main/pickup.c
+++ b/main/pickup.c
@@ -277,7 +277,7 @@
return res;
}
-static int send_call_pickup_stasis_message(struct ast_channel *picking_up, struct ast_channel_snapshot *chan, struct ast_channel_snapshot *target)
+int ast_send_call_pickup_stasis_message(struct ast_channel *picking_up, struct ast_channel_snapshot *chan, struct ast_channel_snapshot *target)
{
RAII_VAR(struct ast_multi_channel_blob *, pickup_payload, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
@@ -377,7 +377,7 @@
}
/* target points to the channel that did the pickup at this point, so use that channel's topic instead of chan */
- send_call_pickup_stasis_message(target, chan_snapshot, target_snapshot);
+ ast_send_call_pickup_stasis_message(target, chan_snapshot, target_snapshot);
res = 0;
--
To view, visit https://gerrit.asterisk.org/10448
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb1442027a3ce6ae55faca47bc095e53972f947a
Gerrit-Change-Number: 10448
Gerrit-PatchSet: 1
Gerrit-Owner: Jasper Hafkenscheid <jasper.hafkenscheid at wearespindle.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181009/e1b06acf/attachment.html>
More information about the asterisk-code-review
mailing list