A baresip-based, multithreaded, event handling SIP client written in Python
Project description
python_sip_client - A baresip-based, multithreaded, event handling SIP client written in Python
Requirements
This package acts as a wrapper for BareSIP, which is required for this package to function. For installation instructions, see the BareSIP Repository. Typically, it can be installed using your favorite linux/macos package manager.
Installation
pip3 install python-sip-client
Example Usage
from python_sip_client import BareSIP
import time
if __name__ == "__main__":
# Create BareSIP instance
bs = BareSIP(debug=False)
# Define event handlers
def handle_incoming_call(from_uri):
print("Incoming call from", from_uri)
x = None
while x.lower() not in ["a", "h"]:
x = input("Answer or hangup? (a/h): ")
if x == "a":
bs.answer()
else:
bs.hangup()
# Set event handlers
bs.on(BareSIP.Event.INCOMING_CALL, handle_incoming_call)
try:
# Start BareSIP
bs.start()
# Create a user agent
bs.create_user_agent("user", "password", "domain")
# Wait for registration
while not bs.user_agents()[0].registered:
pass
bs.dial("user@domain / phone number")
time.sleep(10)
bs.hangup()
while True:
pass
finally:
# Stop BareSIP
bs.stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_sip_client-0.0.4-py3-none-any.whl.
File metadata
- Download URL: python_sip_client-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b251f6ae5f5d48d1deade99a52ba3f57422fbcdc528c629eb94d5509cf465767
|
|
| MD5 |
85e6c7e5723d61e9b217e1ec0c1fa678
|
|
| BLAKE2b-256 |
c7fa112cb7152a6d78bd179782cff967eb7fe47b07fa9e418c95df54a60e48cb
|