Unset a global variable

Is there any way to unset a global variable? I’ve seen the question asked a few times, but the only answer I’ve seen is by Tilghman Lesher who claimed you simply set the variable to null. But if I do “dialplan show globals”, I can see that the variable still exists in the global variable space, so obviously that is not true.

The reason I ask is because I want some information to be available to a group of channels, and the only practical way is to put it in global variables (or global hash). But when the last of those channels is hung up, I want to clear the variables, otherwise I’ll create a memory leak.

I think import() function could work for you instead use global var

No, all channels need to able to change the data as well.

There is no way to remove a global variable - the most that can be done is setting it to an empty value.

1 Like

OK, thanks for the confirmation.