Category Archives: Bria

Enabling Auto Answer in Bria VoIP client

I thought I would post this up to help anyone having the same problem I did with finding a way to automatically set the ‘Lightning Bolt’ for turning on auto answer on the Bria3 VoIP client.

There doesnt appear to be a way to do this automatically from a preference setting, etc. So I started toying around with the idea of bolting together a script which would allow me to take control of the mouse and move it without the user being present and execute the click necessary to do that.

I was using the client on a Mac so that is what the focus of this post will demonstrate. I’m pretty sure that its possible to do the same from a Windows client, and its also worth noting that there is a Bria API that is currently available for Windows only, that could allow you to change the setting programatically with a bit more elegance than the ‘hacked-together’ approach I have had to take.

Anyhow, I used a couple of different approaches. Firstly I used Applescript and from within the Applescript I call an external C program called ‘Click‘ – (thanks to author). Which requires you to enter X and Y coordinates and then ‘click’ the mouse button.

I had to use this approach because none of the application buttons in Bria are recordable by Applescript or Automator.

There are comprehensive details provided at the Click link above, about how to compile the program,etc. (Note: you’ll probably need to have Xcode installed from Apple’s Developer site in order to compile).

You will also need to enable Assistive Devices in the Accessibility section of the Mac OSX system preferences, and you’ll probably want to chmod 775 the click executable if you are moving it to other client desktops,etc. – You’ll also want ‘Remember details’ and ‘Sign in automatically’ checked on the front page of the Bria client itself.

The first section of the applescript measures the screen resolution and a few other bits ( this is helpful if you roll this out to multiple users with different configs, as the location of the cursor changes when the resolution does. I used the following site as a reference for this component of the script

Next I make sure that I constantly activated the Bria 3 client and keep it in the foreground, and perform an initial move of the application window.

Once this is done I invoke the screensaver briefly to help prevent any unintended user interactions until the click program has moved the mouse pointer and performed the click.

Then finally do one last move, so that the cursor is not over the lightning bolt once clicked, and Bingo! my Lightning Bolt/Auto Answer is set whenever I execute the applescript!!

Ideally what you would now do is have a startup item to execute the applescript instead of Bria at system startup

tell application "Finder"
set screen_resolution to bounds of window of desktop
set screen_width to item 3 of screen_resolution
set screen_height to item 4 of screen_resolution
end tell

tell application "System Events" to tell process "Dock"
set dock_dimensions to size in list 1
set dock_height to item 2 of dock_dimensions
end tell

set desired_width to 1400

set side_space to screen_width - desired_width

set left_bound to (side_space / 2)
set right_bound to left_bound + desired_width
set bottom_bound to screen_height - dock_height
set top_bound to 22 (* for the menu bar *)

try

tell application "Bria 3"
reopen
activate
tell application "System Events"
set frontmost of application process "Bria 3" to true
end tell
end tell

tell application "System Events"
delay 10
tell application "Bria 3"
reopen
activate
end tell
set position of first window of application process "Bria 3" to {900, 60}
set size of first window of application process "Bria 3" to {300, 200}

tell application "Bria 3"
reopen
activate
end tell
delay 5
tell application "Bria 3"
reopen
activate
end tell
try
tell application id "com.apple.ScreenSaver.Engine" to launch
tell application "Bria 3"
reopen
activate
end tell
do shell script "/Library/click -x 1200 -y 123"

tell application "Bria 3"
reopen
activate
end tell
set position of first window of application process "Bria 3" to {100, 60}

end try
end tell
end try

(c) Matt Palmer 7-Aug-2013