Skip to main content

alt text

Katari - SIP (Session Initiated Protocol) Application Framework

PyPI pyversions PyPI version shields.io PyPI license PyPI version shields.io

Documentation

https://katari.readthedocs.io/en/latest/

Installing

pip install Katari 

Installing from Git

pip install git+https://github.com/hyperioxx/Katari.git

Getting Started

to create a katari project run the following command in your terminal

katari --build-app <project name>

app.py

import settings
from Katari import KatariApplication
from Katari.sip.response import ResponseFactory

app = KatariApplication(settings=settings)

@app.invite()
def do_invite(request, client):
    # add INVITE logic here 
    response = ResponseFactory.build(200) # 200 OK
    app.send(request.create_response(response), client)

@app.register()
def do_register(request, client):
    # add REGISTER logic here 
    response = ResponseFactory.build(401) # 401 unauthorized 
    app.send(request.create_response(OK200()), client)

@app.options()
def do_options(request, client):
    # add OPTIONS logic here 
    response = ResponseFactory.build(200) # 200 OK
    app.send(request.create_response(response), client)

@app.info()
def do_info(request, client):
    # add INFO logic here 
    response = ResponseFactory.build(200) # 200 OK
    app.send(request.create_response(response), client)

if __name__ == "__main__":   
    app.run()

Writing your own middleware

create a directory called middleware within your project

myproject -
   - app.py
   - settings.py
   - middleware   << LIKE THIS 
     - __init__.py
     - test.py

your middleware can modify the sip message before it reaches your main logic using the process_request method and also modify the response before it gets sent back to the client using process response method.

Example

test.py

from Katari.interfaces import MiddlewareInterface

class Test(MiddlewareInterface):

    def process_request(self, message):
        print(str(message))
        return message


    def process_response(self, message):
        print(str(message))
        return message

settings.py

"""
##    ##    ###    ########    ###    ########  ####
##   ##    ## ##      ##      ## ##   ##     ##  ##
##  ##    ##   ##     ##     ##   ##  ##     ##  ##
#####    ##     ##    ##    ##     ## ########   ##
##  ##   #########    ##    ######### ##   ##    ##
##   ##  ##     ##    ##    ##     ## ##    ##   ##
##    ## ##     ##    ##    ##     ## ##     ## ####

SIP (Session Initiated Protocol) Application Framework

"""

HOST = "127.0.0.1" #Specify interface to listen on 

PORT = 5060 # Specify port to listen on

ALLOWED_HOSTS = ["127.0.0.1"] # Katari whitelist

USER_AGENT = "Katari Server 0.0.6" # User Agent sent in response 

# Logging settings
KATARI_LOGGING = {
                   "LOGFILE" :"Katari.log",
                   "LEVEL": "INFO", 
                   "OUTPUTMODE": "file"
                 }

# Katari middleware 
KATARI_MIDDLEWARE = [
    'middleware.test',   # Add import path here

]

Metadata

Release files for Katari 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Katari 0.0.9
File Size Uploaded
Katari-0.0.9.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Katari 0.0.9
File Interpreter ABI Platform
Katari-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 27.0 kB

Release files / Katari-0.0.9.tar.gz

Download URL Katari-0.0.9.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b483ae8affbae43c2b168231238b3d1736bbe16a873a255102d9e0824c6cebcf
BLAKE2b-256 checksum
How to use checksums
ae6d52c222aab32317e8e6ed054120f9f98d161c21946e67c74593fb767b654a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

Release files / Katari-0.0.9-py3-none-any.whl

Download URL Katari-0.0.9-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3fd1ad4cf4731ad6d65331e46ed0a870e7130118a19b1229c8788a75ec688d0
BLAKE2b-256 checksum
How to use checksums
7c28b9b8b079c610ed502156a5a85f7603ac792a84feeda189c02aa5e72b7051
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

1 release file

0.0.6

1 release file

0.0.4

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page