Trying to control channel volume using AMI Getvar/Setvar

Hello, genius people.

I’ve written a simple VB.Net front end to control a conference room (confbridge) using AMI.

I get ConferenceJoin and ConferenceLeave events and mange the list on the screen and it’s working very well.

Now, I’m trying to control the volume of each participant like the keys 7 and 9 from the user menu do, so I tried to test the Getvar action, to read the current channel volume and then to try to change it by Setvar.

Unfortunately, I can get the value for EXTEN for example, but not many other channel variables values. Wasnt able to see the VOLUME variable in any case (no CLI, no Getvar).

Any help would be appreciated.

The ConfBridge application does not use the VOLUME dialplan function to control the volume on the channel, so you can’t use it to get the volume. ConfBridge does its own thing internally and stores the information elsewhere. If there’s not an AMI action in ConfBridge to get or control the volume, then I don’t think there is a way for that part.

Thanks for looking into my issue. I see and agree.

So, let’s start from the basics: If I have a normal bridged channel (like a normal phone call). Can I see and control that channel VOLUME value?
I think this will be a good starting point for me to try.

Many thanks again!

Looking at the code implementation[1] you can set the volume, but there is no implementation of reading. You would need to store the volume information yourself on another dialplan variable. You can do this while in a call.

[1] https://github.com/asterisk/asterisk/blob/master/funcs/func_volume.c

Thanks for that.

Can I find the list of channel variables and functions that are available for the Getvar and Setvar AMI actions?

I was hoping all of the dialplan available variables are available to AMI also, but it seems it’s not working like this…

Again, any help would be appreciated.

They are all available. There’s no restrictions. It’s just in this case VOLUME isn’t used by ConfBridge, and it also doesn’t allow you to read the current volume.

What other variables are you referring to? Some may not exist or be set when you think they should be.

Just trying now this, and here is what I get:

Action: Getvar
ActionID: 17
Channel: SIP/115-00000185
Variable: SIP_CODEC

Response: Success
ActionID: 17
Variable: SIP_CODEC
Value:

Did you set that variable? If not, then it wouldn’t be set. The chan_sip module only reads the variable, it doesn’t write it. If you want to get codec information then the CHANNEL dialplan function exists[1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_CHANNEL

Tried this now, also doesn’t return a value… :frowning:

Action: Getvar
ActionID: 17
Channel: SIP/115-00000195
Variable: CHANNEL(amflags)


Response: Success
ActionID: 17
Variable: CHANNEL(amflags)
Value:

It’s amaflags, not amflags.

Thanks for that. My mistake.
After correcting the typo - I’ve got a value.

So no I’m back to my first need: tried to query for CHANNEL(txgain) but didn’t get anything. Googling it didn’t make it clear for me if this setting is available only for analog lines, or for SIP lines also.

About the VOLUME(tx) variable - do you think Getvar it will not work but Setvar will work?

The txgain value is only available for analog lines.

Setvar will work for VOLUME.

Thanks for that, again.

I didn’t succeeded to test it yet, but hope to do it soon.

So you say that Setvar can work also on variables that are not available to Getvar?
Maybe we can make it a feature request - to make Getvar availability for such variables also?

Getvar is available for any variable that is set, or any dialplan function that can be read. Some dialplan functions don’t have such functionality though, and that’s an implementation detail of that dialplan function - for example VOLUME.

I think you cna use Local channel to send the DTMF code for 7 and 9 , through AMI

oops…

That’s an idea I didn’t think of.
To play like the user pressed ‘7’ or ‘9’.

I must give it a try.

(Now that I think about it - It means I’ll not be able to disable the user menu and let them change their volume themselves. A little problem for me. But anyway - it worth trying).

Thanks again for all the support.

The Setvar seems to work very good, so it seems I’ll have to make an array in my program to story the last volume I’ve set for each channel. Also, I’ll have to disable the 7 and 9 from the user menu, to make sure I have to correct value.

I really think it worth to add the Getvar ability to this function, to be able to control the current channel settings.

How can we make this happen?
I mean, where can we ask the great Asterisk guys to add this functionality to the VOLUME function?

Many thanks!!!

We don’t currently accept feature requests on the issue tracker without patches. If someone does provide a patch then once up for code review we review it and then it is included once it is through that process.

So, there is no one central place to include all feature requests / bug reports so one of the great Asterisk programmers will have a pool of things to choose what to work on?

I myself not good in c programming, so I’ll not be able to do it.

Would you please put here a link to the actual VOLUME function source code, so maybe we’ll have a way to find good people that will ‘take if forward’?

Let’s make this happen!

Many thanks for any help is that direction!!!

There is no such pool. A direct link to the file in question is available on Github[1]. The Asterisk repo itself is held on Gerrit[2].

[1] https://github.com/asterisk/asterisk/blob/master/funcs/func_volume.c
[2] https://gerrit.asterisk.org/admin/repos/asterisk

1 Like