mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 22:58:21 +00:00
Migrate AMI VarSet events raised by GoSub local variables
This patch moves VarSet events for local variables raised by GoSub over to Stasis-Core. It also tweaks up the post-processing documentation scripts to not combine parameters if both parameters are already documented. (issue ASTERISK-21462) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -40,6 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/manager.h"
|
#include "asterisk/manager.h"
|
||||||
#include "asterisk/channel.h"
|
#include "asterisk/channel.h"
|
||||||
#include "asterisk/agi.h"
|
#include "asterisk/agi.h"
|
||||||
|
#include "asterisk/stasis_channels.h"
|
||||||
|
|
||||||
/*** DOCUMENTATION
|
/*** DOCUMENTATION
|
||||||
<application name="Gosub" language="en_US">
|
<application name="Gosub" language="en_US">
|
||||||
@@ -202,7 +203,32 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
<para>Cause the channel to execute the specified dialplan subroutine,
|
<para>Cause the channel to execute the specified dialplan subroutine,
|
||||||
returning to the dialplan with execution of a Return().</para>
|
returning to the dialplan with execution of a Return().</para>
|
||||||
</description>
|
</description>
|
||||||
|
<see-also>
|
||||||
|
<ref type="application">GoSub</ref>
|
||||||
|
</see-also>
|
||||||
</agi>
|
</agi>
|
||||||
|
<managerEvent language="en_US" name="VarSet">
|
||||||
|
<managerEventInstance class="EVENT_FLAG_DIALPLAN">
|
||||||
|
<synopsis>Raised when a variable local to the gosub stack frame is set due to a subroutine call.</synopsis>
|
||||||
|
<syntax>
|
||||||
|
<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
|
||||||
|
<parameter name="Variable">
|
||||||
|
<para>The LOCAL variable being set.</para>
|
||||||
|
<note><para>The variable name will always be enclosed with
|
||||||
|
<literal>LOCAL()</literal></para></note>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="Value">
|
||||||
|
<para>The new value of the variable.</para>
|
||||||
|
</parameter>
|
||||||
|
</syntax>
|
||||||
|
<see-also>
|
||||||
|
<ref type="application">GoSub</ref>
|
||||||
|
<ref type="agi">gosub</ref>
|
||||||
|
<ref type="function">LOCAL</ref>
|
||||||
|
<ref type="function">LOCAL_PEEK</ref>
|
||||||
|
</see-also>
|
||||||
|
</managerEventInstance>
|
||||||
|
</managerEvent>
|
||||||
***/
|
***/
|
||||||
|
|
||||||
static const char app_gosub[] = "Gosub";
|
static const char app_gosub[] = "Gosub";
|
||||||
@@ -235,6 +261,8 @@ static int frame_set_var(struct ast_channel *chan, struct gosub_stack_frame *fra
|
|||||||
{
|
{
|
||||||
struct ast_var_t *variables;
|
struct ast_var_t *variables;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
int len;
|
||||||
|
RAII_VAR(char *, local_buffer, NULL, ast_free);
|
||||||
|
|
||||||
/* Does this variable already exist? */
|
/* Does this variable already exist? */
|
||||||
AST_LIST_TRAVERSE(&frame->varshead, variables, entries) {
|
AST_LIST_TRAVERSE(&frame->varshead, variables, entries) {
|
||||||
@@ -252,20 +280,13 @@ static int frame_set_var(struct ast_channel *chan, struct gosub_stack_frame *fra
|
|||||||
pbx_builtin_setvar_helper(chan, var, value);
|
pbx_builtin_setvar_helper(chan, var, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** DOCUMENTATION
|
len = 8 + strlen(var); /* LOCAL() + var */
|
||||||
<managerEventInstance>
|
local_buffer = ast_malloc(len);
|
||||||
<synopsis>Raised when a LOCAL channel variable is set due to a subroutine call.</synopsis>
|
if (!local_buffer) {
|
||||||
<see-also>
|
return 0;
|
||||||
<ref type="application">GoSub</ref>
|
}
|
||||||
</see-also>
|
sprintf(local_buffer, "LOCAL(%s)", var);
|
||||||
</managerEventInstance>
|
ast_channel_publish_varset(chan, local_buffer, value);
|
||||||
***/
|
|
||||||
manager_event(EVENT_FLAG_DIALPLAN, "VarSet",
|
|
||||||
"Channel: %s\r\n"
|
|
||||||
"Variable: LOCAL(%s)\r\n"
|
|
||||||
"Value: %s\r\n"
|
|
||||||
"Uniqueid: %s\r\n",
|
|
||||||
ast_channel_name(chan), var, value, ast_channel_uniqueid(chan));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,9 +22,9 @@ def merge_parameter_information(managerEvent):
|
|||||||
|
|
||||||
def __swap_parameter_documentation(one, two):
|
def __swap_parameter_documentation(one, two):
|
||||||
# See who has the better documentation and use it
|
# See who has the better documentation and use it
|
||||||
if (one.hasChildNodes()):
|
if (one.hasChildNodes() and not two.hasChildNodes()):
|
||||||
two.parentNode.replaceChild(one.cloneNode(True), two)
|
two.parentNode.replaceChild(one.cloneNode(True), two)
|
||||||
elif (two.hasChildNodes()):
|
elif (two.hasChildNodes() and not one.hasChildNodes()):
|
||||||
one.parentNode.replaceChild(two.cloneNode(True), one)
|
one.parentNode.replaceChild(two.cloneNode(True), one)
|
||||||
|
|
||||||
def __merge_parameter(param, other_instances):
|
def __merge_parameter(param, other_instances):
|
||||||
|
Reference in New Issue
Block a user