Help with accessing call status for a specific extension

Hi!

I was doing some random web browsing recently and it looks like there used to be an application included with Asterisk called muted.c which would mute the system audio of the desktop PC ‘linked’ to a particular extension by making a connection to the Asterisk rest interface.

This would be unbelievably useful for a disabled colleague where I volunteer - he really struggles to turn the sound of the news coming from his windows desktop PC down in time for answering a call with his desk phone.

I’d LOVE to get this working for him but I’d need some help in doing so.

If there’s anyone who’d be willing to help me with this I’d be really grateful.

thank you!

What’s the issue you are having?

It looks like the code is still present, I was able to compile muted by selecting it in menuconfig under the ‘Utils’ category.

I’m running FreePBX on CentOS and when I try to run the muted.c program I just get errors. I can’t remember what the errors said now to any degree of detail (but can happily try running it again) but there were problems with the #includes. It was thought in the IRC channel that it was waaaaay out of date and I was pretty much laughed out of town for thinking there might be any chance of using it with a recent version of Asterisk. If you’re able to do so, I’m very interested!!
Thanks John

OK.

What I did was a ‘make menuconfig’ in my Asterisk source directory, toggle muted on under utils and save.

then I did a ‘make’ and waited for Asterisk to compile.

After it finished I was able to execute ‘./utils/muted -?’ and I got back a ‘Invalid Option’ error followed by a list of valid options.

Can you get that far?

muted connects across AMI, not ARI. muted was built for a Linux client, not a Windows client. The audio sub-systems are probably pretty different. If one wanted to build the same thing for Windows, they could use what muted is doing w/ its AMI connection as a starting point, but that’s probably not the bulk of the work.

Hi Malcolm

Actually for me, that would be the bulk of the work, because I already have the ability to mute the Windows PC’s speakers with a single line of dialplan code.

Can you advise if I would be OK running “make menuconfig” on a FreePBX system? I don’t want to ruin my system by doing so.

thanks

If you have the ability to mute the windows PC from dialplan then you shouldn’t need muted.

Just modify your dialplan to mute the PC before dialing the user.

Hi John

The problem is I want to mute calls on INCOMING calls. Not so much outgoing. Muted looks like the answer but I’m not sure what effect running ‘make’ on my live Asterisk/FreePBX server would have. Whether FreePBX would kick up a stink, for example.
Alternatively I have been pointed to ARI listeners on the FreePBX forum but I sadly lack the knowhow to get one up and running at the moment.
Whatever is simplest is going to be best I think.
Unless you know of another way?

thanks

That shouldn’t be a problem.

Say you user is extension 701, Just do what you need to mute his PC in the extension definition for 701.

I’m also assuming you have a un-mute function to resume his audio playback once the users phone has stopped ringing.

[internal-handsets]
exten => 701,1,MY_MUTE_FUNCTION
exten => 701,n,Dial(PJSIP/${EXTEN},60)
exten => 701,n,MY_UN_MUTE_FUNCTION
exten => 701,n,Voicemail(${EXTEN})

If the user is in a dial group with other users, say as part of a auto-attendant you would want to use your mute function before dialing there too.


[my-auto-attendant]
exten => s,1,NooP()
 same => n,MY_MUTE_FUNCTION
 same => n,Dial(PJSIP/701&PJSIP/702&PJSIP/703,60)
 same => n,MY_UN_MUTE_FUNCTION
 same => n,Voicemail(900)
 same => n,Hangup()

Thanks for this. I’m just trying to work out where to put this! I don’t have an [internal-handsets] context so I figured I should make or adapt one?

I’m using FreePBX, so I thought /etc/asterisk/extensions_override_freepbx.conf might be the spot. I copied [ext-local] from extensions_additional and pasted it into extensions_override_freepbx, inserted a log line (CHECKFORTHISENTRY) but all that’s happened is my asterisk log now has a LOT of for example:

[2019-12-02 19:45:52] WARNING[10854] pbx_config.c: Unable to register extension at line 4331 of /etc/asterisk/extensions_additional.conf
[2019-12-02 19:45:52] WARNING[10854] pbx.c: Unable to register extension 'vms20' priority 1 in 'ext-local', already in use
exten => 22,1,Set(__RINGTIMER=${IF($["${DB(AMPUSER/22/ringtimer)}" > "0"]?${DB(AMPUSER/22/ringtimer)}:${RINGTIMER_DEFAULT})})
exten => 22,n(novmpw),Noop(CHECKFORTHISENTRY)
exten => 22,n,Macro(exten-vm,22,22,0,0,0)
exten => 22,n(dest),Set(__PICKUPMARK=)
exten => 22,n,Macro(vm,22,${DIALSTATUS},${IVR_RETVM})
exten => 22,n,Goto(vmret,1)
exten => 22,hint,PJSIP/22&PJSIP/9022&Custom:DND22,CustomPresence:22

I’m guessing also that this will work for calls between local handsets but not any external calls? That’s fine :slight_smile:
Also not sure that the unmute should happen when the phone has stopped ringing, but rather, if poss, when the call is actually over?

No worries if this is a right old pain in the bum, it’s not so important, it’s partly a convenience for my colleague and partly I find it fun/interesting!

My example in the [my-auto-attendant] context would be for a external call, assuming the user is in a ring group with other endpoints.

Assuming you already have a way un-mute the PC you could add a Hangup Handler to your dialplan that would run after the call completes to un-mute.

https://wiki.asterisk.org/wiki/display/AST/Hangup+Handlers

I can’t help with FreePBX integration, I’ve never worked with it, I would recommend asking FreePBX specifics in the forum at https://community.freepbx.org