Skip to main content

Milena is a VoIP stack

Project description

What is Milena?

Gitpod badge Tests badge License badge

milena is a SIP stack made for us to create testing tools for anyone working with VoIP.

API References

Most of our classes follow a very similar API, providing .string() and .dict() methods to access information either raw or with a native python interface.

SIP URI

The SIP URI is a Uniform Resource Identifier (URI) scheme for the Session Initiation Protocol (SIP) multimedia communications protocol. A SIP address is a URI that addresses a specific telephone extension on a voice over IP system. Such a number could be a private branch exchange or an E.164 telephone number dialled through a specific gateway. The scheme was defined in RFC 3261.

By wikipedia.

Example

from milena.sip import URI

string = "sip:alice@atlanta.com"
dictionary = {
    "schema": "sip",
    "user": "alice",
    "password": None,
    "host": "atlanta.com",
    "port": None,
    "parameters": {},
    "headers": {},
}

alice = URI.setup(source="string", content=string)
assert alice.string() == string
assert alice.dict() == dictionary

alice = URI.setup(source="dict", content=dictionary)
assert alice.string() == string
assert alice.dict() == dictionary

Exceptions

  • In case an incorrect parameter will be passed to the API we will have an exception of type ValueError.
  • In case of a failure during the parse or stringify process we will have an exception of type RuntimeError.

Address of Record

A address of record (AOR) is very similar to a SIP URI, except that it can carry some more information, such as the display name.

Example

from milena.sip import AOR

string = "Alice <sip:alice@atlanta.example.com>;tag=9fxced76sl"
dictionary = {
    "name": "Alice",
    "uri": "sip:alice@atlanta.example.com",
    "parameters": {
        "tag": "9fxced76sl"
    },
}

alice = URI.setup(source="string", content=string)
assert alice.string() == string
assert alice.dict() == dictionary

alice = URI.setup(source="dict", content=dictionary)
assert alice.string() == string
assert alice.dict() == dictionary

Exceptions

  • In case an incorrect parameter will be passed to the API we will have an exception of type ValueError.
  • In case of a failure during the parse or stringify process we will have an exception of type RuntimeError.

Sip Headers

Here is a list of implemented sip headers with a brief code demo.

CSeq

from milena.sip import CSeq

string = "4711 INVITE",
dictionary = {"seq": 4711, "method": "INVITE"}

header = CSeq.setup(source="string", content=string)
assert header.string() == string
assert header.dict() == dictionary

header = CSeq.setup(source="dict", content=dictionary)
assert header.string() == string
assert header.dict() == dictionary

print(header)
# CSeq: 4711 INVITE

Authentication Info

from milena.sip import AuthenticationInfo

string = 'nextnonce="47364c23432d2e131a5fb210812c",qop="auth,auth-int"',
dictionary = {
    "nextnonce": '"47364c23432d2e131a5fb210812c"',
    "qop": '"auth,auth-int"',
}

header = AuthenticationInfo.setup(source="string", content=string)
assert header.string() == string
assert header.dict() == dictionary

header = AuthenticationInfo.setup(source="dict", content=dictionary)
assert header.string() == string
assert header.dict() == dictionary

print(header)
# CSeq: 4711 INVITE

Exceptions

  • In case an incorrect parameter will be passed to the SIP header API we will have an exception of type ValueError.
  • In case of a failure during the parse or stringify process we will have an exception of type RuntimeError.

Comments

  • By design choice, the properties of each API are read-only. If you want to change a certain value, work with a copy of the API dictionary you want to change and then create a new instance.
  • APIs have a setup method that must be used to inform if we are using it from a string or a dict.
  • By design choice, the string method will return the value of the formatted SIP header, but converting the object to a literal string (str(API)) will return the header in key=value format, ready to go. used on your User Agent.

How to contribute?

If you are thinking of contributing in any way to the project, you will be very welcome. Whether it's improving existing documentation, suggesting new features or running existing bugs, it's only by working together that the project will grow.

Do not forget to see our Contributing Guide and our Code of Conduct to always be aligned with the ideas of the project.

Contributors

Will be welcome ❤️

Author


@Otoru

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

milena-0.1.1.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

milena-0.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file milena-0.1.1.tar.gz.

File metadata

  • Download URL: milena-0.1.1.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for milena-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d7af8c790c3c851872d2de61d243e8fe5218e739be754d77be4ee22e8dc4558c
MD5 1e3ffcc1b8864a57b55254306afddd20
BLAKE2b-256 b209c20d91f660d5a7370644d372157bbff66c7e8ac54f4a03ab559d53c517cd

See more details on using hashes here.

File details

Details for the file milena-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: milena-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for milena-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d9df419499423a74ee9946b273361157d254cfcca1b32b9679276940f6474d7
MD5 42b91756e1669ac1a449fe33cdc6fa59
BLAKE2b-256 ede0b2811a295fd649331968eb7afed508e77da960ed63d3709509e1c73e96bc

See more details on using hashes here.

Supported by

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