[asterisk-bugs] [JIRA] (ASTERISK-26849) Newchannel event doesn't inherit variables

Rusty Newton (JIRA) noreply at issues.asterisk.org
Thu Mar 9 11:50:10 CST 2017


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=235638#comment-235638 ] 

Rusty Newton edited comment on ASTERISK-26849 at 3/9/17 11:48 AM:
------------------------------------------------------------------

This patch makes it work even though it feels a bit wrong to cast away the const with (void*)

[Edit by Rusty - We can't accept inline patches. Patches must be attached to the issue as a contribution under a license agreement]


was (Author: edge):
This patch makes it work even though it feels a bit wrong to cast away the const with (void*)

diff --git a/main/channel.c b/main/channel.c
index 28cfa79..fa71f74 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -981,6 +981,17 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
                return ast_channel_unref(tmp);
        }

+        // Niclas testing variables
+        if (requestor) {
+                //ast_channel_lock_both(requestor, tmp);
+                ast_channel_lock((void*)requestor);
+                ast_channel_inherit_variables(requestor, tmp);
+                ast_channel_datastore_inherit((void*)requestor, tmp);
+                ast_max_forwards_decrement(tmp);
+                ast_channel_unlock((void*)requestor);
+                //ast_channel_unlock(tmp);
+        }
+
        ast_channel_internal_finalize(tmp);

        ast_atomic_fetchadd_int(&chancount, +1);

> Newchannel event doesn't inherit variables
> ------------------------------------------
>
>                 Key: ASTERISK-26849
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26849
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>    Affects Versions: 13.14.0
>         Environment: Debian 8.6
>            Reporter: Niclas Larsson
>
> Dialplan:
> exten => _X.,1,Set(__VARIABLE=${EXTEN})
> All Newchannel events after that doesn't contain the variable.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list