Giter Club home page Giter Club logo

fats's Introduction

Code Climate

Test Coverage

fats

VOIP application code:

from zope.interface import implements, Interface
from twisted.python import log, components
from twisted.application import internet, service
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.fats.service import FastAGIFactory, IFastAGIFactory, CallHandler


class HelloCallHandler(CallHandler):
    """My first call handler.
    """
    def startCall(self):
        log.msg('Hello FastAGI logging system.')
        # Answer the call.
        df = self.agi.answer()
        
        # Say number and stop call session
        df.addCalback(lambda _: self.agi.sayNumber(666))
        return df

Запуск приложения Hello World

Сервер Asterisk extensions.conf:

[fats-test] exten => 222,n,AGI(agi://localhost:9000)

Linux terminal:

$ twistd -ny fats-trunk/fats/examples/hello_agi.py

[-] Log opened.
[-] twistd 2.5.0+rUnknown (/usr/bin/python 2.5.1) starting up
[-] reactor class: 
[-] __builtin__.HelloFastAGIFactoryFromService starting on 9000
[-] Starting factory <__builtin__.HelloFastAGIFactoryFromService instance at 0xb780580c>
[FastAGIProtocol,0,127.0.0.1] Hello FastAGI logging system.
[FastAGIProtocol,0,127.0.0.1] Send Command: 'ANSWER'
[FastAGIProtocol,0,127.0.0.1] Send Command: "SAY NUMBER 666 ''"
[FastAGIProtocol,0,127.0.0.1] SAY NUMBER:[0(), None(), None()]
[FastAGIProtocol,0,127.0.0.1] Call handler result: SAY NUMBER:[0(), None(), None()]
[FastAGIProtocol,0,127.0.0.1] Connection terminated to the FastAGI server 3077895596

Теперь осталось позвонить на номер 222!

fats's People

Contributors

burus avatar

Watchers

 avatar James Cloos avatar

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.