Skip to content

Instantly share code, notes, and snippets.

@enp
Last active January 19, 2019 20:50
Show Gist options
  • Save enp/abad4cbc3e5c6c9821708845c53d6add to your computer and use it in GitHub Desktop.
Save enp/abad4cbc3e5c6c9821708845c53d6add to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import asyncio
from aiohttp import web
from switchio import Client, EventLoop
class CallServer:
def __init__(self, loop, host):
events = EventLoop(host=host, loop=loop)
#events.handle(self.handler)
async def handler(self, event):
print(event)
class WebServer:
def __init__(self, loop, host, port):
app = web.Application()
app.router.add_route('GET', '/', self.handler)
loop.run_until_complete(loop.create_server(app.make_handler(), host, port))
async def handler(self, request):
return web.Response(body='OK')
if __name__ == '__main__':
loop = asyncio.get_event_loop()
WebServer(loop, '0.0.0.0', '8080')
CallServer(loop, 'sipbox')
loop.run_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment