[Asterisk-code-review] channel_internal_api: Add LASTCONTEXT and LASTEXTEN (asterisk[master])
N A
asteriskteam at digium.com
Thu Jan 6 07:59:41 CST 2022
N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/17784 )
Change subject: channel_internal_api: Add LASTCONTEXT and LASTEXTEN
......................................................................
channel_internal_api: Add LASTCONTEXT and LASTEXTEN
Adds the LASTCONTEXT and LASTEXTEN channel variables
to allow users to access previous dialplan execution
locations.
ASTERISK-29840 #close
Change-Id: Ib455fe300cc8e9a127686896ee2d0bd11e900307
---
A doc/CHANGES-staging/channel_internal_api.txt
M main/channel_internal_api.c
2 files changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/84/17784/1
diff --git a/doc/CHANGES-staging/channel_internal_api.txt b/doc/CHANGES-staging/channel_internal_api.txt
new file mode 100644
index 0000000..1f9e23b
--- /dev/null
+++ b/doc/CHANGES-staging/channel_internal_api.txt
@@ -0,0 +1,4 @@
+Subject: channel_internal_api
+
+LASTCONTEXT and LASTEXTEN variables are
+now available for use in the dialplan.
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 9dd72ae..e27548e 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -48,6 +48,7 @@
#include "asterisk/stream.h"
#include "asterisk/test.h"
#include "asterisk/vector.h"
+#include "asterisk/pbx.h"
/*!
* \brief Channel UniqueId structure
@@ -347,6 +348,9 @@
}
void ast_channel_context_set(struct ast_channel *chan, const char *value)
{
+ if (strcmp(value, chan->context)) {
+ pbx_builtin_setvar_helper(chan, "LASTCONTEXT", chan->context);
+ }
ast_copy_string(chan->context, value, sizeof(chan->context));
ast_channel_snapshot_invalidate_segment(chan, AST_CHANNEL_SNAPSHOT_INVALIDATE_DIALPLAN);
}
@@ -356,6 +360,9 @@
}
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
{
+ if (strcmp(value, chan->exten)) {
+ pbx_builtin_setvar_helper(chan, "LASTEXTEN", chan->exten);
+ }
ast_copy_string(chan->exten, value, sizeof(chan->exten));
ast_channel_snapshot_invalidate_segment(chan, AST_CHANNEL_SNAPSHOT_INVALIDATE_DIALPLAN);
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17784
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ib455fe300cc8e9a127686896ee2d0bd11e900307
Gerrit-Change-Number: 17784
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220106/8340fa86/attachment.html>
More information about the asterisk-code-review
mailing list