Simply ring a phone via SIP/VoIP
Project description
Table of Contents
About The Project
nanosip is a minimal implementation of the the SIP INVITE
transaction, which is used to ring another phone.
It is
- not a complete or compliant implementation of SIP.
- not establishing a VoIP / audio link with the callee.
Simply rings and hangs up.
This package was created to be used by my home assistant integration "sipcall", however it can be used in any other project.
Installation
Install the package from PyPI
pip install nanosip
This package does not have any dependencies
Usage
To make a call, you will need
- either a cloud-based SIP registrar (e.g. sipgate, easybell or others)
- or a local PBX that runs on your router or local server (e.g. a FRITZ!Box or asterisk)
From your registrar you will obtain the following required information:
- username
- password
- SIP server
- Domain (usually the same as the server)
You can then make a call like this:
from nanosip import call_and_cancel
auth_creds = SIPAuthCreds(
username="USERNAME",
password="PASSWORD"
)
inv = Invite(
uri_from="sip:USERNAME@DOMAIN",
uri_to="sip:CALLEE@DOMAIN",
uri_via="SIP_SERVER",
auth_creds=auth_creds,
)
call_and_cancel(inv, 15, "SIP_SERVER")
This package also supports use with asyncio
. For more examples, check out the examples/
subfolder.
The call_and_cancel
method may throw an OSError
if something with the connection of the SIP call went wrong.
For example, if the credentials are wrong, it will throw an OSError('nanosip error: 407 Unauthorized')
.
License
Distributed under the GPLv3 License. See LICENSE
for more information.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.