Easer Smartphone Automation for LineageOS and Android. Example for OpenVPN, SIP Softphone, Nexttracks / Owntracks


On the website there are already many interesting entries for the setup of the Asterisk VoIP telephony with the possibility of keeping the extension on the mobile phone parallel to other extensions. The entire setup is of course secured by a VPN-connection using OpenVPN so that there is no possibility of listening in between the softphone and the VoIP server.

Furthermore, an update was made to the link to self-hosted OwnTrack / Nexttrack solution, which enables tracking profiles to be created without sending data to third parties.

The use of Easer to automate app start and stop processes has already been mentioned in the telephony article and the setup was described there too.

But now I got a lot of questions related to Easer and that is the reason for my new contribution.

Tasks needed:

With Easer, the running apps on the smartphone should be changed depending on the location. There were the following requirements:

Home WiFi

If the home WLAN is available, the following should be changed:

  • Since your own servers in the house can be reached directly via the home WLAN, stop the OpenVPN connection when connecting to the home WLAN.
  • Since it makes no sense to transmit Nexttrack GPS positions to the recorder while you are in the home WiFi, stop Nexttrack app
  • Linphone automatically reconnects to the Asterisk server after the OpenVPN is disconnected, i.e. the phone remains continuously available.

Other data connection

  • If the connection with the home WLAN is lost, an OpenVPN connection should be established automatically.
  • Nexttrack should then be started in order to transmit the movement data to the recorder.
  • Linphone re-establishes its connection, secured by the OpenVPN, and the extension can then be reached.

As a general rule

  • In the border area of ​​the WLAN, on/off loops should be prevented by WLAN on/off situations.

Setup for cool SmartPhone Pro users

Here comes the icing on the cake of a smartphone setup for really cool users, which automates things and lets you never forget to activate or deactivate them.

SmartPhone Pro users move around in a variety of networks and one of the most exciting things is routine activities that could be automated. Easer was found to match, which is an open source automation tool for LineageOS and Android. As always preferred, the installation can be done via F-Droid. Easer doesn’t need Google Play Services!

Automatic switching of the OpenVPN based on the connected network

Assumption: The SmartPhone Pro user moves in a WLAN that reaches the VoIP server directly and in other networks that require the VPN for access. The main problem with this routine activity, activating and deactivating the VPN is of course often forgotten and calls are lost.

Setup as follows:

  • Open->Settings
    • Enable‚ “Use root features”
    • Check “Activated skills”, where the minimum is: Wi-Fi, Connectivity Type, Wi-Fi Connection

The Test WLAN has SSID AT435020

  • Open->Data
    • Create Condition -> Choose a Condition -> WiFi Connection
    • Condition Title: AT435020
    • Match SSID: Your AT435020

  • Create Event -> Choose an Event -> Connection Type
    • Event Title: Connected
    • Selected Types: Wi-Fi and Mobile

  • Create Profile:

    • From plus(+) icon select “Run Command”
    • Profile Title: Profile Leaving Home
    • command: am start -a android.intent.action.MAIN -n de.blinkt.openvpn/.LaunchVPN -e de.blinkt.openvpn.shortcutProfileName PROFILENAME
  • Create Profile:

    • From plus(+) icon select ‚Run Command’
    • Profile Title: Profile Coming Home
    • command: am start –user 0 -n de.blinkt.openvpn/.api.DisconnectVPN

  • Create Pivot

    • Script Title: Online
    • Profile:
    • Event: Connected
    • Online->Add child
      • Script title: NET-AT435020
      • Profile: Profile Coming Home
      • Condition: AT435020
      • Reverse Scenario: disabled
    • Online->Add child
      • Script title: NET-Insecure
      • Profile: Profile Leaving Home
      • Condition: AT435020
      • Reverse Scenario: enabled
  • Finally

    • Start Rules

If everything has been done correctly, OpenVPN will start automatically, as soon as the home WLAN is no longer available and deactivates itself at the return. LinPhone logs in again immediately after switching and thus the functionality is always available without any manual intervention given. A really cool solution and it’s really good to have the extension with you without having to manually program any forwarding calls. All devices ring at the same time!

To test, simply press and hold the respective profile and then select “trigger”. Then you can see whether the profile is set up correctly. Then just go out of the range of the WLAN and test. Do not switch off WLAN, disconnect, or try otherwise! The area covered by the WLAN must be left!

Stop and start Nexttrack

Now it got really funny, because if you think you can start an app so easily, you’re wrong. You can already see from the command for OpenVPN that Android has its own conventions here.

The stop command at force-stop org.nexttracks.android was found quickly, but the start was an action of several hours of searching and testing. TermUX, available in the F-Drod Store, is a great help in testing. TermUX offers a shell and can also use su for root commands. The result is the following and applies similarly to all packages:

TermUX starten

cmd package resolve-activity --brief org.nexttracks.android | tail -n 1

results in:


then we can leave the su with exit and test the start command:

am start -n org.nexttracks.android/.ui.map.MapActivity

This starts Nexttracks and transfers the position data.

Now we can finish the profiles for leaving and entering the home WiFi area:

A really cool solution for SmartPhone Pro users who will love to let stupid activities run completely automatically! Easer can do a lot more, but this example should be a good place to start.

Commercial customers

CTS IT Solutions founded by me offers commercial customers perfect and well-tested IT solutions! We would be happy to advise you on all questions relating to IT!

EURAFRI Matrix Group Chat

We look forward to active participation in the EURAFRI project and ask you to also visit the EURAFRI reception in the matrix.



Author: Karl M. Joch
© KMJ.at, Permission to publish the article on EURAFRI.com @20210531