[asterisk-commits] rmudgett: branch rmudgett/misdn_facility r170313 - in /team/rmudgett/misdn_fa...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 22 16:10:23 CST 2009
Author: rmudgett
Date: Thu Jan 22 16:10:23 2009
New Revision: 170313
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=170313
Log:
Merged from
https://origsvn.digium.com/svn/asterisk/be/branches/C.2...
..........
r170310 | rmudgett | 2009-01-22 15:52:38 -0600 (Thu, 22 Jan 2009) | 3 lines
* Added a new dialplan function (mISDN_CC) to the allow retrieval of
various values from an active call completion record.
Modified:
team/rmudgett/misdn_facility/CHANGES
team/rmudgett/misdn_facility/channels/chan_misdn.c
Modified: team/rmudgett/misdn_facility/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/rmudgett/misdn_facility/CHANGES?view=diff&rev=170313&r1=170312&r2=170313
==============================================================================
--- team/rmudgett/misdn_facility/CHANGES (original)
+++ team/rmudgett/misdn_facility/CHANGES Thu Jan 22 16:10:23 2009
@@ -14,8 +14,8 @@
Dialplan Functions
------------------
- * Added new dialplan functions CONNECTEDLINE and REDIRECTING which permits
- setting various connected line and redirecting party information.
+ * Added new dialplan functions CONNECTEDLINE and REDIRECTING which permits
+ setting various connected line and redirecting party information.
Queue changes
-------------
@@ -44,13 +44,37 @@
received number from the ISDN link if that number has the corresponding
Type-Of-Number.
-
SIP channel driver (chan_sip) changes
-------------------------------------------
* The sendrpid parameter has been expanded to include the options
'rpid' and 'pai'. Setting sendrpid to 'rpid' will cause Remote-Party-ID
header to be sent (equivalent to setting sendrpid=yes) and setting
sendrpid to 'pai' will cause P-Asserted-Identity header to be sent.
+
+------------------------------------------------------------------------------
+--- Functionality changes for CCBS/CCNR feature ------------------------------
+------------------------------------------------------------------------------
+
+mISDN channel driver (chan_misdn) changes
+------------------
+ * Added new dialplan application misdn_command which permits controlling
+ the CCBS/CCNR functionality.
+ * Added new dialplan function mISDN_CC which permits retrieval of various
+ values from an active call completion record.
+
+------------------------------------------------------------------------------
+--- mISDN v1.1.8 enhancements ------------------------------------------------
+------------------------------------------------------------------------------
+
+mISDN has been modified by Digium, Inc. to greatly expand facility message
+support to allow:
+ * Enhanced COLP support for call diversion and transfer.
+ * CCBS/CCNR support.
+
+The modified mISDN v1.1.8 is available at:
+http://svn.digium.com/svn/thirdparty/mISDN/trunk
+http://svn.digium.com/svn/thirdparty/mISDNuser/trunk
+
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.6.1 to Asterisk 1.6.2 -------------
Modified: team/rmudgett/misdn_facility/channels/chan_misdn.c
URL: http://svn.digium.com/svn-view/asterisk/team/rmudgett/misdn_facility/channels/chan_misdn.c?view=diff&rev=170313&r1=170312&r2=170313
==============================================================================
--- team/rmudgett/misdn_facility/channels/chan_misdn.c (original)
+++ team/rmudgett/misdn_facility/channels/chan_misdn.c Thu Jan 22 16:10:23 2009
@@ -10316,6 +10316,141 @@
/** TE STUFF END **/
+
+
+
+/* ******************************************************************* */
+#if defined(AST_MISDN_ENHANCEMENTS)
+/*!
+ * \internal
+ * \brief Get call completion record information.
+ *
+ * \param chan Asterisk channel to operate upon. (Not used)
+ * \param function_name Name of the function that called us.
+ * \param function_args Argument string passed to function (Could be NULL)
+ * \param buf Buffer to put returned string.
+ * \param size Size of the supplied buffer including the null terminator.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+static int misdn_cc_read(struct ast_channel *chan, const char *function_name,
+ char *function_args, char *buf, size_t size)
+{
+ char *parse;
+ struct misdn_cc_record *cc_record;
+
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(cc_id); /* Call completion record ID value. */
+ AST_APP_ARG(get_name); /* Name of what to get */
+ AST_APP_ARG(other); /* Any extraneous garbage arguments */
+ );
+
+ /* Ensure that the buffer is empty */
+ *buf = 0;
+
+ if (ast_strlen_zero(function_args)) {
+ ast_log(LOG_ERROR, "Function '%s' requires arguments.\n", function_name);
+ return -1;
+ }
+
+ parse = ast_strdupa(function_args);
+ AST_STANDARD_APP_ARGS(args, parse);
+
+ if (!args.argc || ast_strlen_zero(args.cc_id)) {
+ ast_log(LOG_ERROR, "Function '%s' missing call completion record ID.\n",
+ function_name);
+ return -1;
+ }
+ if (!isdigit(*args.cc_id)) {
+ ast_log(LOG_ERROR, "Function '%s' call completion record ID must be numeric.\n",
+ function_name);
+ return -1;
+ }
+
+ if (ast_strlen_zero(args.get_name)) {
+ ast_log(LOG_ERROR, "Function '%s' missing what-to-get parameter.\n",
+ function_name);
+ return -1;
+ }
+
+ ast_mutex_lock(&misdn_cc_record_lock);
+ cc_record = misdn_cc_find_by_id(atoi(args.cc_id));
+ if (cc_record) {
+ if (!strcasecmp("a-all", args.get_name)) {
+ snprintf(buf, size, "\"%s\" <%s>", cc_record->redial.caller.name,
+ cc_record->redial.caller.number);
+ } else if (!strcasecmp("a-name", args.get_name)) {
+ ast_copy_string(buf, cc_record->redial.caller.name, size);
+ } else if (!strncasecmp("a-num", args.get_name, 5)) {
+ ast_copy_string(buf, cc_record->redial.caller.number, size);
+ } else if (!strcasecmp("a-ton", args.get_name)) {
+ snprintf(buf, size, "%d",
+ misdn_to_ast_plan(cc_record->redial.caller.number_plan)
+ | misdn_to_ast_ton(cc_record->redial.caller.number_type));
+ } else if (!strncasecmp("a-pres", args.get_name, 6)) {
+ ast_copy_string(buf, ast_named_caller_presentation(
+ misdn_to_ast_pres(cc_record->redial.caller.presentation)
+ | misdn_to_ast_screen(cc_record->redial.caller.screening)), size);
+ } else if (!strcasecmp("a-busy", args.get_name)) {
+ ast_copy_string(buf, cc_record->party_a_free ? "no" : "yes", size);
+ } else if (!strncasecmp("b-num", args.get_name, 5)) {
+ ast_copy_string(buf, cc_record->redial.dialed.number, size);
+ } else if (!strcasecmp("b-ton", args.get_name)) {
+ snprintf(buf, size, "%d",
+ misdn_to_ast_plan(cc_record->redial.dialed.number_plan)
+ | misdn_to_ast_ton(cc_record->redial.dialed.number_type));
+ } else if (!strcasecmp("port", args.get_name)) {
+ snprintf(buf, size, "%d", cc_record->port);
+ } else if (!strcasecmp("available-notify-priority", args.get_name)) {
+ snprintf(buf, size, "%d", cc_record->remote_user_free.priority);
+ } else if (!strcasecmp("available-notify-exten", args.get_name)) {
+ ast_copy_string(buf, cc_record->remote_user_free.exten, size);
+ } else if (!strcasecmp("available-notify-context", args.get_name)) {
+ ast_copy_string(buf, cc_record->remote_user_free.context, size);
+ } else if (!strcasecmp("busy-notify-priority", args.get_name)) {
+ snprintf(buf, size, "%d", cc_record->b_free.priority);
+ } else if (!strcasecmp("busy-notify-exten", args.get_name)) {
+ ast_copy_string(buf, cc_record->b_free.exten, size);
+ } else if (!strcasecmp("busy-notify-context", args.get_name)) {
+ ast_copy_string(buf, cc_record->b_free.context, size);
+ } else {
+ ast_mutex_unlock(&misdn_cc_record_lock);
+ ast_log(LOG_ERROR, "Function '%s': Unknown what-to-get '%s'.\n", function_name, args.get_name);
+ return -1;
+ }
+ }
+ ast_mutex_unlock(&misdn_cc_record_lock);
+
+ return 0;
+} /* end misdn_cc_read() */
+#endif /* defined(AST_MISDN_ENHANCEMENTS) */
+
+
+
+
+#if defined(AST_MISDN_ENHANCEMENTS)
+static struct ast_custom_function misdn_cc_function = {
+ .name = "mISDN_CC",
+ .synopsis = "Get call completion record information.",
+ .syntax = "mISDN_CC(${MISDN_CC_RECORD_ID},<what-to-get>)",
+ .desc =
+ "mISDN_CC(${MISDN_CC_RECORD_ID},<what-to-get>)\n"
+ "The following can be retrieved:\n"
+ "\"a-num\", \"a-name\", \"a-all\", \"a-ton\", \"a-pres\", \"a-busy\",\n"
+ "\"b-num\", \"b-ton\", \"port\",\n"
+ " User-A is available for call completion:\n"
+ " \"available-notify-priority\",\n"
+ " \"available-notify-exten\",\n"
+ " \"available-notify-context\",\n"
+ " User-A is busy:\n"
+ " \"busy-notify-priority\",\n"
+ " \"busy-notify-exten\",\n"
+ " \"busy-notify-context\"\n",
+ .read = misdn_cc_read,
+};
+#endif /* defined(AST_MISDN_ENHANCEMENTS) */
+
/******************************************
*
* Asterisk Channel Endpoint END
@@ -10344,6 +10479,7 @@
ast_unregister_application("misdn_check_l2l1");
#if defined(AST_MISDN_ENHANCEMENTS)
ast_unregister_application(misdn_command_name);
+ ast_custom_function_unregister(&misdn_cc_function);
#endif /* defined(AST_MISDN_ENHANCEMENTS) */
ast_channel_unregister(&misdn_tech);
@@ -10537,6 +10673,8 @@
"activation request.\n"
"MISDN_ERROR_MSG is set to a descriptive message on error.\n"
);
+
+ ast_custom_function_register(&misdn_cc_function);
#endif /* defined(AST_MISDN_ENHANCEMENTS) */
More information about the asterisk-commits
mailing list