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] ...")
sys.exit(1)
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
webbrowser.open(full_url)
if __name__ == "__main__":
main()
I hope this helps someone and Free Palestine! Stop the genocide!
Leave a Reply