[asterisk-commits] may: branch may/ooh323_qsig r397667 - in /team/may/ooh323_qsig: ./ funcs/ inc...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Aug 26 14:22:49 CDT 2013
Author: may
Date: Mon Aug 26 14:22:44 2013
New Revision: 397667
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397667
Log:
Multiple revisions 393005,393034
........
r393005 | jrose | 2013-06-27 00:59:14 +0400 (Thu, 27 Jun 2013) | 8 lines
func_channel: Read/Write after_bridge_goto option
Allows reading and setting of a channel's after_bridge_goto datastore
(closes issue ASTERISK-21875)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2628/
........
r393034 | rmudgett | 2013-06-27 06:55:16 +0400 (Thu, 27 Jun 2013) | 9 lines
Add config framework non-empty string validation requirement option.
Add config framework OPT_CHAR_ARRAY_T and OPT_STRINGFIELD_T non-empty
requirement option. There are cases were you don't want a config option
string to be empty. To require the option string to be non-empty, just
set the aco_option_register() flags parameter to non-zero.
* Updated some config framework enum aco_option_type comments.
........
Merged revisions 393005,393034 from http://svn.asterisk.org/svn/asterisk/trunk
Modified:
team/may/ooh323_qsig/ (props changed)
team/may/ooh323_qsig/funcs/func_channel.c
team/may/ooh323_qsig/include/asterisk/bridging.h
team/may/ooh323_qsig/include/asterisk/config_options.h
team/may/ooh323_qsig/main/bridging.c
team/may/ooh323_qsig/main/config_options.c
Propchange: team/may/ooh323_qsig/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 26 14:22:44 2013
@@ -1,1 +1,1 @@
-/trunk:376342-376345,377841-378166,379864-380142,380165-390991,391012,391016-392987
+/trunk:376342-376345,377841-378166,379864-380142,380165-390991,391012,391016-392987,393005-393034
Propchange: team/may/ooh323_qsig/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Aug 26 14:22:44 2013
@@ -1,1 +1,1 @@
-/trunk:1-380157,380165-391000,391012,391016-393000
+/trunk:1-380157,380165-391000,391012,391016-393000,393005-393034
Modified: team/may/ooh323_qsig/funcs/func_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/funcs/func_channel.c?view=diff&rev=397667&r1=397666&r2=397667
==============================================================================
--- team/may/ooh323_qsig/funcs/func_channel.c (original)
+++ team/may/ooh323_qsig/funcs/func_channel.c Mon Aug 26 14:22:44 2013
@@ -37,6 +37,7 @@
#include "asterisk/module.h"
#include "asterisk/channel.h"
+#include "asterisk/bridging.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
@@ -118,6 +119,12 @@
<enum name="checkhangup">
<para>R/O Whether the channel is hanging up (1/0)</para>
</enum>
+ <enum name="after_bridge_goto">
+ <para>R/W the parseable goto string indicating where the channel is
+ expected to return to in the PBX after exiting the next bridge it joins
+ on the condition that it doesn't hang up. The parseable goto string uses
+ the same syntax as the <literal>Goto</literal> application.</para>
+ </enum>
<enum name="hangup_handler_pop">
<para>W/O Replace the most recently added hangup handler
with a new hangup handler on the channel if supplied. The
@@ -475,6 +482,8 @@
struct ast_str *tmp_str = ast_str_alloca(1024);
locked_copy_string(chan, buf, ast_print_namedgroups(&tmp_str, ast_channel_named_pickupgroups(chan)), len);
+ } else if (!strcasecmp(data, "after_bridge_goto")) {
+ ast_after_bridge_goto_read(chan, buf, len);
} else if (!strcasecmp(data, "amaflags")) {
ast_channel_lock(chan);
snprintf(buf, len, "%d", ast_channel_amaflags(chan));
@@ -516,7 +525,13 @@
locked_string_field_set(chan, accountcode, value);
else if (!strcasecmp(data, "userfield"))
locked_string_field_set(chan, userfield, value);
- else if (!strcasecmp(data, "amaflags")) {
+ else if (!strcasecmp(data, "after_bridge_goto")) {
+ if (ast_strlen_zero(value)) {
+ ast_after_bridge_goto_discard(chan);
+ } else {
+ ast_after_bridge_set_go_on(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), value);
+ }
+ } else if (!strcasecmp(data, "amaflags")) {
ast_channel_lock(chan);
if (isdigit(*value)) {
int amaflags;
Modified: team/may/ooh323_qsig/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/include/asterisk/bridging.h?view=diff&rev=397667&r1=397666&r2=397667
==============================================================================
--- team/may/ooh323_qsig/include/asterisk/bridging.h (original)
+++ team/may/ooh323_qsig/include/asterisk/bridging.h Mon Aug 26 14:22:44 2013
@@ -1634,6 +1634,16 @@
*/
void ast_after_bridge_goto_discard(struct ast_channel *chan);
+/*!
+ * \brief Read after bridge goto if it exists
+ * \since 12.0.0
+ *
+ * \param chan Channel to read the after bridge goto parseable goto string from
+ * \param buffer Buffer to write the after bridge goto data to
+ * \param buf_size size of the buffer being written to
+ */
+void ast_after_bridge_goto_read(struct ast_channel *chan, char *buffer, size_t buf_size);
+
/*! Reason the the after bridge callback will not be called. */
enum ast_after_bridge_cb_reason {
/*! The datastore is being destroyed. Likely due to hangup. */
Modified: team/may/ooh323_qsig/include/asterisk/config_options.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/include/asterisk/config_options.h?view=diff&rev=397667&r1=397666&r2=397667
==============================================================================
--- team/may/ooh323_qsig/include/asterisk/config_options.h (original)
+++ team/may/ooh323_qsig/include/asterisk/config_options.h Mon Aug 26 14:22:44 2013
@@ -265,7 +265,7 @@
* struct test_item {
* int enabled;
* };
- aco_option_register(&cfg_info, "enabled", ACO_EXACT, my_types, "no", OPT_BOOL_T, 1, FLDSET(struct test_item, enabled));
+ * aco_option_register(&cfg_info, "enabled", ACO_EXACT, my_types, "no", OPT_BOOL_T, 1, FLDSET(struct test_item, enabled));
* {endcode}
*/
OPT_BOOL_T,
@@ -284,13 +284,15 @@
* struct test_item {
* unsigned int flags;
* };
- aco_option_register(&cfg_info, "quiet", ACO_EXACT, my_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct test_item, flags), MY_TYPE_ISQUIET);
- * {endcode}
- */
-
+ * aco_option_register(&cfg_info, "quiet", ACO_EXACT, my_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct test_item, flags), MY_TYPE_ISQUIET);
+ * {endcode}
+ */
OPT_BOOLFLAG_T,
- /*! \brief Type for default option handler for character arrays
+ /*! \brief Type for default option handler for character array strings
+ * \note aco_option_register flags:
+ * non-zero : String cannot be empty.
+ * 0 : String can be empty.
* \note aco_option_register varargs:
* CHARFLDSET macro with a field of type char[]
*
@@ -299,7 +301,7 @@
* struct test_item {
* char description[128];
* };
- * aco_option_register(&cfg_info, "description", ACO_EXACT, my_types, "none", OPT_CHAR_ARRAY_T, CHARFLDSET(struct test_item, description));
+ * aco_option_register(&cfg_info, "description", ACO_EXACT, my_types, "none", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct test_item, description));
* {endcode}
*/
OPT_CHAR_ARRAY_T,
@@ -338,7 +340,7 @@
* double dub;
* };
* {code}
- * aco_option_register(&cfg_info, "doubleopt", ACO_EXACT, my_types, "3", OPT_DOUBLE_T, FLDSET(struct test_item, dub));
+ * aco_option_register(&cfg_info, "doubleopt", ACO_EXACT, my_types, "3", OPT_DOUBLE_T, 0, FLDSET(struct test_item, dub));
* {endcode}
*/
OPT_DOUBLE_T,
@@ -393,7 +395,8 @@
/*! \brief Type for default option handler for stringfields
* \note aco_option_register flags:
- * none
+ * non-zero : String cannot be empty.
+ * 0 : String can be empty.
* aco_option_register varargs:
* STRFLDSET macro with the field being the field created by AST_STRING_FIELD
*
Modified: team/may/ooh323_qsig/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/main/bridging.c?view=diff&rev=397667&r1=397666&r2=397667
==============================================================================
--- team/may/ooh323_qsig/main/bridging.c (original)
+++ team/may/ooh323_qsig/main/bridging.c Mon Aug 26 14:22:44 2013
@@ -3414,6 +3414,47 @@
}
}
+void ast_after_bridge_goto_read(struct ast_channel *chan, char *buffer, size_t buf_size)
+{
+ struct ast_datastore *datastore;
+ struct after_bridge_goto_ds *after_bridge;
+ char *current_pos = buffer;
+ size_t remaining_size = buf_size;
+
+ SCOPED_CHANNELLOCK(lock, chan);
+
+ datastore = ast_channel_datastore_find(chan, &after_bridge_goto_info, NULL);
+ if (!datastore) {
+ buffer[0] = '\0';
+ return;
+ }
+
+ after_bridge = datastore->data;
+
+ if (after_bridge->parseable_goto) {
+ snprintf(buffer, buf_size, "%s", after_bridge->parseable_goto);
+ return;
+ }
+
+ if (!ast_strlen_zero(after_bridge->context)) {
+ snprintf(current_pos, remaining_size, "%s,", after_bridge->context);
+ remaining_size = remaining_size - strlen(current_pos);
+ current_pos += strlen(current_pos);
+ }
+
+ if (after_bridge->run_h_exten) {
+ snprintf(current_pos, remaining_size, "h,");
+ remaining_size = remaining_size - strlen(current_pos);
+ current_pos += strlen(current_pos);
+ } else if (!ast_strlen_zero(after_bridge->exten)) {
+ snprintf(current_pos, remaining_size, "%s,", after_bridge->exten);
+ remaining_size = remaining_size - strlen(current_pos);
+ current_pos += strlen(current_pos);
+ }
+
+ snprintf(current_pos, remaining_size, "%d", after_bridge->priority);
+}
+
int ast_after_bridge_goto_setup(struct ast_channel *chan)
{
struct ast_datastore *datastore;
@@ -3479,6 +3520,10 @@
after_bridge->exten, after_bridge->priority + 1);
}
if (!goto_failed) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
+ ast_channel_priority_set(chan, ast_channel_priority(chan) + 1);
+ }
+
ast_debug(1, "Setup after bridge goto location to %s,%s,%d.\n",
ast_channel_context(chan),
ast_channel_exten(chan),
Modified: team/may/ooh323_qsig/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_qsig/main/config_options.c?view=diff&rev=397667&r1=397666&r2=397667
==============================================================================
--- team/may/ooh323_qsig/main/config_options.c (original)
+++ team/may/ooh323_qsig/main/config_options.c Mon Aug 26 14:22:44 2013
@@ -1342,6 +1342,10 @@
ast_string_field *field = (const char **)(obj + opt->args[0]);
struct ast_string_field_pool **pool = (struct ast_string_field_pool **)(obj + opt->args[1]);
struct ast_string_field_mgr *mgr = (struct ast_string_field_mgr *)(obj + opt->args[2]);
+
+ if (opt->flags && ast_strlen_zero(var->value)) {
+ return -1;
+ }
ast_string_field_ptr_set_by_fields(*pool, *mgr, field, var->value);
return 0;
}
@@ -1384,7 +1388,7 @@
return ast_parse_arg(var->value, PARSE_ADDR | opt->flags, field);
}
-/*! \brief Default handler for doing noithing
+/*! \brief Default handler for doing nothing
*/
static int noop_handler_fn(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
@@ -1400,6 +1404,9 @@
char *field = (char *)(obj + opt->args[0]);
size_t len = opt->args[1];
+ if (opt->flags && ast_strlen_zero(var->value)) {
+ return -1;
+ }
ast_copy_string(field, var->value, len);
return 0;
}
More information about the asterisk-commits
mailing list