Skip to content

philipp-fischer/nanosip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


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)

About

Simply ring a phone

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages