GithubHelp home page GithubHelp logo

pytwinkle's Introduction

Github contributors

License: MIT

Description

Twinkle sip client, ported to a python module.

Tested environments

Hardware Rpi zero W & Rp3 mob B
Operating systems Linux
Python versions Python 3.x
Distros Raspbian 10 & 11
Languages English

Instalation

sudo apt-get install twinkle
sudo pip3 install pytwinkle

Example

from pytwinkle import Twinkle

def callback(event, *args):
    if event=="registration_succeeded":
        uri, expires = args
        print("registratiom succeeded, uri: %s, expires in %s seconds"%(uri, expires))
        # The module keeps the session, you havent to register
        mTP.message("name@domain", "Hello")
        mTP.call("name@domain")

    if event=="new_msg":
        msg=args[0]
        print("new_msg!: "+str(msg))
    
    if event=="incoming_call":
        call=args[0]
        print("call: "+str(call))

    if event=="cancelled_call":
        line=args[0]
        print("call cancelled, line: %s"%(line))
        
    if event=="failed_call":
        line=args[0]
        print("failed_call, line: %s"%(line))
        
    if event=="dtmf_received":
        line=args[0]
        key=args[0]
        print("dtmf_received, line: %s, key: %s"%(key))
        
    if event=="answered_call":
        call=args[0]
        print("answered: %s"%(str(call)))
        
    if event=="ended_call":
        line=args[0]
        print("call ended, line: %s"%(line))
  
mTP = Twinkle(callback)  
mTP.set_account("name","domain","password")
mTP.run()
  • Callbacks
Event Description *Returns *
"registration_succeeded" When the registration suceed Line number and seconds to expire (*)
"new_msg" New message receives msg={'from':uri, 'to':uri 'msg':msg}
"incoming_call" Incoming call call={'from':uri, 'to':uri}
"cancelled_call" Cancelled call Line number
"answered_call" Answered call call={'msg':msg, 'code':num, 'to':uri}
"ended_call" Ended call Line number
"failed_call" Failed call Line number
"dtmf_received" DMTF reveived Line number and Key number

(*) doesnt matter the seconds to expire, the program keep the session active

  • Functions

    • call Call someone
    • answer Answer an incoming call
    • answerbye Answer an incoming call or end a call
    • reject Reject an incoming call
    • bye End a call
    • hold Put a call on-hold
    • retrieve Retrieve a held call
    • redial Repeat last call
    • register Register your phone at a registrar
    • deregister De-register your phone at a registrar
    • message Send an instant message
  • Not supported at the moment

    • redirect Redirect an incoming call
    • transfer Transfer a standing call
    • conference Join 2 calls in a 3-way conference
    • mute Mute a line
    • dtmf Send DTMF
    • fetch_reg Fetch registrations from registrar
    • options Get capabilities of another SIP endpoint
    • line Toggle between phone lines
    • dnd Do not disturb
    • auto_answer Auto answer
    • user Show users / set active user
    • presence Publish your presence state
    • quit Quit

Dependencies

  • System dependencies
    • python3
    • twinkle
  • Python dependencies
    • multiprocessing

Mentions

@LubosD - https://github.com/LubosD/twinkle

Developer

Roberto Lama Rodríguez - [email protected]

pytwinkle's People

Contributors

ercole79 avatar roberware avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pytwinkle's Issues

Profile switching fails

I think switching between profiles is not working correctly.
If we always use twinkle -c to start the Twinkle app, it will, by default, use twinkle.cfg (regardless of the start_user_profile variable).

To make it work, we need to invoke something like twinkle -f 913842 -c where 913842 is the profile's name (and the config file's name as well). Better yet, Twinkle can run multiple profiles simultaneously like this: twinkle -f 913842 296346 -c. And after running it this way, we can switch between profiles with every command: twinkle --set-profile 913842 --call +123456789

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.