Giter VIP home page Giter VIP logo

linphone-spam-call-block's Introduction

Linphone Call Block

Linphone Call Block is a PowerShell script designed to block unwanted calls on Linphone App (Windows).

Disclaimer

This script cannot intercept calls, meaning that you will likely hear the bell ring before the call is automatically blocked.

Features

Address Blacklist

  • Anyone included in this list will be blocked.
  • The blacklist takes priority over everything else.
  • This list is represented as variable $blacklist.

Address Whitelist

  • Anyone included in this list will not be blocked.
  • This list is represented as variable $whitelist.

Contact-based Whitelist

  • Anyone who is in your Linphone contact list (address book) will not be blocked.

Unknown Caller Allow/Block

  • By default, Linphone Call Block will block unknown callers.
  • Variable $block_unknown_caller, which is either $true or $false, lets you decide whether to block calls from unknown adresses or not.

How it works

Read Console Window Output

When you execute the Linphone binary with --verbose option through Command Prompt or PowerShell, you will be able to see what is going on behind the Linphone app. This stream of outputs normally cannot be piped, but there is a workaround for that. Here is a part of the script that makes the workaround possible:

$binary_path = 'C:\Program Files\Linphone\bin\linphone.exe'

$linphone_app = Start-Job -ScriptBlock {
    param($binary)
    powershell.exe -Command "& '$binary' --verbose" *>&1
} -ArgumentList $binary_path

While ($true) {
    $linphone_stream = $linphone_app | Receive-Job
    EvaluateStream($linphone_stream)
    Start-Sleep -Milliseconds 500
}

This way, you will be able to "pipe" the console window output.
However, there is a limitation; since the above reads lines off from the console window, any output longer than the console window width will have a line break.

You can evaluate and extract meaningful parts from the output stream using regular expressions like the following:

Switch -Regex ($s|Out-String) {
    $regex_A {Function_A($matches)}
    $regex_B {Function_B($matches)}
    $regex_C {Function_C($matches)}
}

$matches is an automatic variable. Read this for details.

Limitations and Possible Improvements

Currently, Linphone Call Block uses Linphone Command Line to deny calls. Although this method is most straightforward, it takes significant time (>1sec).

Considered Method Positive Side Negative Side
Linphone CLI bye Straightforward Slow
Mute system sound Quick Affects sounds that are already playing
Pause Process Quick Need admin privillege & cannot interact with Linphone while paused
Automatically click "End Call" Button Not tested Not tested

The best method would be Linphone app itself having a call block feature.

Note

Execution Policy Change

If you happen to encounter the above message, please restart the script.

linphone-spam-call-block's People

Contributors

r8btx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.