aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-17 15:36:31 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-17 15:36:31 +0000
commit82c8ef7415d9fa1cab877da20d671ba9093c8895 (patch)
treee0f98e5d12f079b7d8f94c031808eaea340b8065 /include
parent17d3dd99a4716c14fe7a9ee5835049cdf2c6855a (diff)
Enhancements to connected line and redirecting work.
From reviewboard: Digium has a commercial customer who has made extensive use of the connected party and redirecting information present in later versions of Asterisk Business Edition and which is to be in the upcoming 1.8 release. Through their use of the feature, new problems and solutions have come about. This patch adds several enhancements to maximize usage of the connected party and redirecting information functionality. First, Asterisk trunk already had connected line interception macros. These macros allow you to manipulate connected line information before it was sent out to its target. This patch adds the same feature except for redirecting information instead. Second, the ast_callerid and ast_party_id structures have been enhanced to provide a "tag." This tag can be set with func_callerid, func_connectedline, func_redirecting, and in the case of DAHDI, mISDN, and SIP channels, can be set in a configuration file. The idea behind the callerid tag is that it can be set to whatever value the administrator likes. Later, when running connected line and redirecting macros, the admin can read the tag off the appropriate structure to determine what action to take. You can think of this sort of like a channel variable, except that instead of having the variable associated with a channel, the variable is associated with a specific identity within Asterisk. Third, app_dial has two new options, s and u. The s option lets a dialplan writer force a specific caller ID tag to be placed on the outgoing channel. The u option allows the dialplan writer to force a specific calling presentation value on the outgoing channel. Fourth, there is a new control frame subclass called AST_CONTROL_READ_ACTION added. This was added to correct a very specific situation. In the case of SIP semi-attended (blond) transfers, the party being transferred would not have the opportunity to run a connected line interception macro to possibly alter the transfer target's connected line information. The issue here was that during a blond transfer, the SIP transfer code has no bridged channel on which to queue the connected line update. The way this was corrected was to add this new control frame subclass. Now, we queue an AST_CONTROL_READ_ACTION frame on the channel on which the connected line interception macro should be run. When ast_read is called to read the frame, ast_read responds by calling a callback function associated with the specific read action the control frame describes. In this case, the action taken is to run the connected line interception macro on the transferee's channel. Review: https://reviewboard.asterisk.org/r/652/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@263541 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/channel.h44
-rw-r--r--include/asterisk/frame.h18
2 files changed, 62 insertions, 0 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index b2cb8e5eb..5aa5f1ff3 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -288,6 +288,17 @@ struct ast_callerid {
* (Field will eventually move to struct ast_channel.dialed.transit_network_select)
*/
int cid_tns;
+
+ /*!
+ * \brief Callerid "Tag"
+ * A user-settable field used to help associate some extrinsic information
+ * about the channel or user of the channel to the caller ID. This information
+ * is not transmitted over the wire and so is only useful within an Asterisk
+ * environment.
+ * (Field will eventually move to struct ast_channel.caller.id.tag)
+ */
+ char *cid_tag;
+
/*!
* \brief Caller id subaddress.
* (Field will eventually move to struct ast_channel.caller.id.subaddress)
@@ -314,6 +325,9 @@ struct ast_party_id {
/*! \brief Subscriber name (Malloced) */
char *name;
+ /*! \brief User-set "tag" */
+ char *tag;
+
/*! \brief Subscriber subaddress. */
struct ast_party_subaddress subaddress;
@@ -2779,6 +2793,36 @@ int ast_channel_data_add_structure(struct ast_data *tree, struct ast_channel *ch
int ast_channel_data_cmp_structure(const struct ast_data_search *tree, struct ast_channel *chan,
const char *structure_name);
+/*!
+ * \since 1.8
+ * \brief Run a redirecting interception macro and update a channel's redirecting information
+ *
+ * \details
+ * Whenever we want to update a channel's redirecting information, we may need to run
+ * a macro so that an administrator can manipulate the information before sending it
+ * out. This function both runs the macro and sends the update to the channel.
+ *
+ * \param autoservice_chan Channel to place into autoservice while the macro is running.
+ * It is perfectly safe for this to be NULL
+ * \param macro_chan The channel to run the macro on. Also the channel from which we
+ * determine which macro we need to run.
+ * \param redirecting_info Either an ast_party_redirecting or ast_frame pointer of type
+ * AST_CONTROL_REDIRECTING
+ * \param is_caller If true, then run REDIRECTING_CALLER_SEND_MACRO, otherwise run
+ * REDIRECTING_CALLEE_SEND_MACRO
+ * \param is_frame If true, then redirecting_info is an ast_frame pointer, otherwise it is an
+ * ast_party_redirecting pointer.
+ *
+ * \retval 0 Success
+ * \retval -1 Either the macro does not exist, or there was an error while attempting to
+ * run the macro
+ *
+ * \todo Have multiple return codes based on the MACRO_RESULT
+ * \todo Make constants so that caller and frame can be more expressive than just '1' and
+ * '0'
+ */
+int ast_channel_redirecting_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *redirecting_info, int is_caller, int is_frame);
+
#include "asterisk/ccss.h"
/*!
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index 0d8d557d2..4198fad79 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -326,6 +326,24 @@ enum ast_control_frame_type {
AST_CONTROL_T38_PARAMETERS = 24, /*! T38 state change request/notification with parameters */
AST_CONTROL_CC = 25, /*!< Indication that Call completion service is possible */
AST_CONTROL_SRCCHANGE = 26, /*!< Media source has changed and requires a new RTP SSRC */
+ AST_CONTROL_READ_ACTION = 27, /*!< Tell ast_read to take a specific action */
+};
+
+enum ast_frame_read_action {
+ AST_FRAME_READ_ACTION_CONNECTED_LINE_MACRO,
+};
+
+struct ast_control_read_action_payload {
+ /* An indicator to ast_read of what action to
+ * take with the frame;
+ */
+ enum ast_frame_read_action action;
+ /* The size of the frame's payload
+ */
+ size_t payload_size;
+ /* A payload for the frame.
+ */
+ unsigned char payload[0];
};
enum ast_control_t38 {