Source

asterator / notes.py

Full commit
#!/usr/bin/env python

import socket
import time
from Asterisk import manager, listener

def callback(frame):
    pass

def main():
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect(('localhost', 5038))
    man = manager.manager(sock=manager.mansock(sock=sock, debug=True), debug=True)
    listen = listener.manager_listener(man)
    man.start()
    
    man.login(callback, username='test', secret='pass')

    time.sleep(1)
    
    man.status(callback)

    time.sleep(1)

    listen.dump()
    man.terminate()
    man.join()

if __name__ == "__main__":
    main()