summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2012-09-25 19:29:14 +0000
committerMark Michelson <mmichelson@digium.com>2012-09-25 19:29:14 +0000
commitfdfb3ae5faac680bf939eea1312919bee14db76f (patch)
tree75907425ac9b850412fae5bc7b7e6d89e1aa19e1 /include
parentb7233b18ebd9ce2f8f4bad1309fbe33edaf44e44 (diff)
Allow for redirecting reasons to be set to arbitrary strings.
This allows for the REDIRECTING dialplan function to be used to set the reason to any string. The SIP channel driver has been modified to set the redirecting reason string to the value received in a Diversion header. In addition, SIP 480 response reason text will set the redirecting reason as well. (closes issue AST-942) reported by Malcolm Davenport (closes issue AST-943) reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/2101 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/callerid.h6
-rw-r--r--include/asterisk/channel.h89
2 files changed, 87 insertions, 8 deletions
diff --git a/include/asterisk/callerid.h b/include/asterisk/callerid.h
index 7c4905e13..4f32dbf66 100644
--- a/include/asterisk/callerid.h
+++ b/include/asterisk/callerid.h
@@ -424,15 +424,17 @@ int ast_redirecting_reason_parse(const char *data);
*/
const char *ast_redirecting_reason_describe(int data);
+struct ast_party_redirecting_reason;
+
/*!
* \since 1.8
* \brief Convert redirecting reason value to text code
*
- * \param data Q931_REDIRECTING_REASON from callerid.h
+ * \param data ast_party_redirecting_reason structure from channel.h
*
* \return string for config file
*/
-const char *ast_redirecting_reason_name(int data);
+const char *ast_redirecting_reason_name(const struct ast_party_redirecting_reason *data);
/*!
* \brief Connected line update source code
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index b60c8ad00..fed032a3d 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -450,6 +450,21 @@ struct ast_set_party_connected_line {
};
/*!
+ * \brief Redirecting reason information
+ */
+struct ast_party_redirecting_reason {
+ /*! \brief a string value for the redirecting reason
+ *
+ * Useful for cases where an endpoint has specified a redirecting reason
+ * that does not correspond to an enum AST_REDIRECTING_REASON
+ */
+ char *str;
+
+ /*! \brief enum AST_REDIRECTING_REASON value for redirection */
+ int code;
+};
+
+/*!
* \since 1.8
* \brief Redirecting Line information.
* RDNIS (Redirecting Directory Number Information Service)
@@ -477,14 +492,14 @@ struct ast_party_redirecting {
/*! \brief Call is redirecting to a new party (Sent to the caller) - private representation */
struct ast_party_id priv_to;
- /*! \brief Number of times the call was redirected */
- int count;
+ /*! \brief Reason for the redirection */
+ struct ast_party_redirecting_reason reason;
- /*! \brief enum AST_REDIRECTING_REASON value for redirection */
- int reason;
+ /*! \brief Reason for the redirection by the original party */
+ struct ast_party_redirecting_reason orig_reason;
- /*! \brief enum AST_REDIRECTING_REASON value for redirection by original party */
- int orig_reason;
+ /*! \brief Number of times the call was redirected */
+ int count;
};
/*!
@@ -3229,6 +3244,68 @@ void ast_party_connected_line_collect_caller(struct ast_party_connected_line *co
void ast_party_connected_line_free(struct ast_party_connected_line *doomed);
/*!
+ * \brief Initialize the given redirecting reason structure
+ *
+ * \param init Redirecting reason structure to initialize
+ *
+ * \return Nothing
+ */
+void ast_party_redirecting_reason_init(struct ast_party_redirecting_reason *init);
+
+/*!
+ * \brief Copy the source redirecting reason information to the destination redirecting reason.
+ *
+ * \param dest Destination redirecting reason
+ * \param src Source redirecting reason
+ *
+ * \return Nothing
+ */
+void ast_party_redirecting_reason_copy(struct ast_party_redirecting_reason *dest,
+ const struct ast_party_redirecting_reason *src);
+
+/*!
+ * \brief Initialize the given redirecting reason structure using the given guide
+ * for a set update operation.
+ *
+ * \details
+ * The initialization is needed to allow a set operation to know if a
+ * value needs to be updated. Simple integers need the guide's original
+ * value in case the set operation is not trying to set a new value.
+ * String values are simply set to NULL pointers if they are not going
+ * to be updated.
+ *
+ * \param init Redirecting reason structure to initialize.
+ * \param guide Source redirecting reason to use as a guide in initializing.
+ *
+ * \return Nothing
+ */
+void ast_party_redirecting_reason_set_init(struct ast_party_redirecting_reason *init,
+ const struct ast_party_redirecting_reason *guide);
+
+/*!
+ * \brief Set the redirecting reason information based on another redirecting reason source
+ *
+ * This is similar to ast_party_redirecting_reason_copy, except that NULL values for
+ * strings in the src parameter indicate not to update the corresponding dest values.
+ *
+ * \param dest The redirecting reason one wishes to update
+ * \param src The new redirecting reason values to update the dest
+ *
+ * \return Nothing
+ */
+void ast_party_redirecting_reason_set(struct ast_party_redirecting_reason *dest,
+ const struct ast_party_redirecting_reason *src);
+
+/*!
+ * \brief Destroy the redirecting reason contents
+ *
+ * \param doomed The redirecting reason to destroy.
+ *
+ * \return Nothing
+ */
+void ast_party_redirecting_reason_free(struct ast_party_redirecting_reason *doomed);
+
+/*!
* \brief Initialize the given redirecting structure.
* \since 1.8
*