Execute a script from MicroSIP on call answer

MicroSIP is a fine open source SIP VOIP soft phone. It mostly does exactly what one needs. However I wanted to make it open the browser and lookup the number of the inbound caller when you answer the phone.

It turned out to be trickier than expected as MicroSIP uses the old INI file format for passing in the command.

Upon reading the source, I saw that MicroSIP uses the function GetPrivateProfileString to read the ini file and this was never designed to cope with long strings with spaces in them.

I came up with a solution to use the good old 8.3 filename format in windows for the path names.

To discover the file names you can use dir /X. Edit the cmdCallAnswer line of the micrisip.ini file.

cmdCallAnswer=C:\Users\foo bar\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\foo bar\launch_browser.py https://example.com/path

becomes something like:

cmdCallAnswer=C:\Users\FOOBAR~1\AppData\Local\Microsoft\WindowsApps\python.exe c:\Users\FOOBAR~1\LAUNCH~1.PY https://example.com/path

Also, MicroSIP works perfectly well under wine too!

This is the script I wrote for launching the browser:

import sys
import webbrowser

def main():
    if len(sys.argv) < 2:
        print("Usage: launch_browser.py <URL> [param1=value1] [param2=value2] ...")

    base_url = sys.argv[1]
    query_params = sys.argv[2:]

    # Construct the query string
    query_string = "".join(query_params)

    # Combine the base URL and query string
    full_url = f"{base_url}{query_string}"

    # Open the default web browser with the constructed URL

if __name__ == "__main__":

I hope this helps someone and Free Palestine! Stop the genocide!


2 responses to “Execute a script from MicroSIP on call answer”

  1. Neat! I’d had visions of doing something like this when we were building a CRM-type tool for a charity years back, but never sat down and actually tried. This is for your business customers presumably?

    1. Hi Ben! We’re using it for our general phone system. Slowly moving away from physical phones to soft phones. The script enables the program to call a url that loads a search of matching numbers in our ERP. Very handy for customer service

Leave a Reply

Your email address will not be published. Required fields are marked *