[Asterisk-code-review] core: New variables CONNECTED LINE ORIGINAL * for intercepti... (asterisk[13])
Alexei Gradinari
asteriskteam at digium.com
Thu Sep 27 12:19:33 CDT 2018
Alexei Gradinari has uploaded this change for review. ( https://gerrit.asterisk.org/10299
Change subject: core: New variables CONNECTED_LINE_ORIGINAL_* for interception routine
......................................................................
core: New variables CONNECTED_LINE_ORIGINAL_* for interception routine
This patch added new variables
CONNECTED_LINE_ORIGINAL_ID_NUM
CONNECTED_LINE_ORIGINAL_ID_NAME
CONNECTED_LINE_ORIGINAL_ANI_NUM
CONNECTED_LINE_ORIGINAL_ANI_NAME
to get the original values inside the interception routine
CONNECTED_LINE_SEND_SUB.
It can help to prevent Connected Line update by reverting to original values
or alter Connected Line information based on original values.
ASTERISK-28079 #close
Change-Id: Ie39f7a3402101333531884873cb353c73cd5334d
---
M main/channel.c
1 file changed, 26 insertions(+), 3 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/99/10299/1
diff --git a/main/channel.c b/main/channel.c
index 5fc9cd8..8285297 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -10499,6 +10499,7 @@
const char *sub;
const char *sub_args;
int retval;
+ struct ast_party_connected_line saved_connected;
ast_channel_lock(sub_chan);
sub = pbx_builtin_getvar_helper(sub_chan, "CONNECTED_LINE_SEND_SUB");
@@ -10511,6 +10512,21 @@
return -1;
}
+ ast_party_connected_line_init(&saved_connected);
+ ast_party_connected_line_copy(&saved_connected, ast_channel_connected(sub_chan));
+ if (saved_connected.id.number.valid && !ast_strlen_zero(saved_connected.id.number.str)) {
+ pbx_builtin_setvar_helper(sub_chan, "CONNECTED_LINE_ORIGINAL_ID_NUM", saved_connected.id.number.str);
+ }
+ if (saved_connected.id.name.valid && !ast_strlen_zero(saved_connected.id.name.str)) {
+ pbx_builtin_setvar_helper(sub_chan, "CONNECTED_LINE_ORIGINAL_ID_NAME", saved_connected.id.name.str);
+ }
+ if (saved_connected.ani.number.valid && !ast_strlen_zero(saved_connected.ani.number.str)) {
+ pbx_builtin_setvar_helper(sub_chan, "CONNECTED_LINE_ORIGINAL_ANI_NUM", saved_connected.ani.number.str);
+ }
+ if (saved_connected.ani.name.valid && !ast_strlen_zero(saved_connected.ani.name.str)) {
+ pbx_builtin_setvar_helper(sub_chan, "CONNECTED_LINE_ORIGINAL_ANI_NAME", saved_connected.ani.name.str);
+ }
+
if (is_frame) {
const struct ast_frame *frame = connected_info;
@@ -10525,17 +10541,24 @@
channel_set_intercept_mode(1);
retval = ast_app_run_sub(autoservice_chan, sub_chan, sub, sub_args, 0);
channel_set_intercept_mode(0);
- if (!retval) {
- struct ast_party_connected_line saved_connected;
+ ast_channel_lock(sub_chan);
+ pbx_builtin_setvar_helper(sub_chan, "CONNECTED_LINE_ORIGINAL_ID_NUM", NULL);
+ pbx_builtin_setvar_helper(sub_chan, "CONNECTED_LINE_ORIGINAL_ID_NAME", NULL);
+ pbx_builtin_setvar_helper(sub_chan, "CONNECTED_LINE_ORIGINAL_ANI_NUM", NULL);
+ pbx_builtin_setvar_helper(sub_chan, "CONNECTED_LINE_ORIGINAL_ANI_NAME", NULL);
+ ast_channel_unlock(sub_chan);
+
+ if (!retval) {
ast_party_connected_line_init(&saved_connected);
ast_channel_lock(sub_chan);
ast_party_connected_line_copy(&saved_connected, ast_channel_connected(sub_chan));
ast_channel_unlock(sub_chan);
ast_channel_update_connected_line(sub_chan, &saved_connected, NULL);
- ast_party_connected_line_free(&saved_connected);
}
+ ast_party_connected_line_free(&saved_connected);
+
return retval;
}
--
To view, visit https://gerrit.asterisk.org/10299
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie39f7a3402101333531884873cb353c73cd5334d
Gerrit-Change-Number: 10299
Gerrit-PatchSet: 1
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180927/76bb6442/attachment.html>
More information about the asterisk-code-review
mailing list