Skip to main content

Simply ring a phone via SIP/VoIP

Project description


Logo

nanosip

Simply ring a phone
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Installation
  3. Usage
  4. License

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.

(back to top)

Installation

Install the package from PyPI

pip install nanosip

This package does not have any dependencies

(back to top)

Usage

To make a call, you will need

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').

(back to top)

License

Distributed under the GPLv3 License. See LICENSE for more information.

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanosip-0.0.7.tar.gz (61.9 kB view hashes)

Uploaded Source

Built Distribution

nanosip-0.0.7-py3-none-any.whl (19.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page