|
@@ -1,14 +1,12 @@
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
-
|
|
|
-import asyncio
|
|
|
import logging
|
|
|
import urllib.parse
|
|
|
+from argparse import ArgumentParser
|
|
|
|
|
|
-from panoramisk import Manager
|
|
|
from panoramisk.actions import Action
|
|
|
|
|
|
-LOOP = asyncio.get_event_loop()
|
|
|
+import asterisk_misc_common
|
|
|
|
|
|
log = logging.getLogger("transferback")
|
|
|
|
|
@@ -105,12 +103,28 @@ class TransferAndTakeBack(BaseApp):
|
|
|
|
|
|
# meant to be overridden by children {{{
|
|
|
def get_destination(self):
|
|
|
+ """
|
|
|
+ la destination e' tipicamente una confbridge in cui l'utente remoto
|
|
|
+ incontra lo speaker
|
|
|
+ """
|
|
|
return "private,9438,1"
|
|
|
|
|
|
def get_backroom(self):
|
|
|
+ """
|
|
|
+ nella backroom, l'utente locale si incontra nuovamente con l'utente
|
|
|
+ remoto
|
|
|
+ """
|
|
|
return "private,9401,1"
|
|
|
|
|
|
def get_waiting_room(self):
|
|
|
+ """
|
|
|
+ nella waiting room, l'utente locale sente musica d'attesa mentre aspetta
|
|
|
+ che una di queste due cose avvenga:
|
|
|
+ - l'utente remoto riaggancia
|
|
|
+ - l'utente locale riaggancia
|
|
|
+ - l'utente locale preme #
|
|
|
+ """
|
|
|
+
|
|
|
return "private,9401,1"
|
|
|
|
|
|
def is_context_auth(self, context):
|
|
@@ -246,21 +260,16 @@ async def on_shutdown(m):
|
|
|
|
|
|
|
|
|
def main():
|
|
|
- logging.basicConfig(level=logging.DEBUG)
|
|
|
- logging.getLogger("panoramisk.manager").setLevel(logging.WARNING)
|
|
|
- manager = Manager(
|
|
|
- loop=LOOP,
|
|
|
- host="127.0.0.1",
|
|
|
- port=5038,
|
|
|
- ssl=False,
|
|
|
- encoding="utf8",
|
|
|
- username="admin",
|
|
|
- secret="secret123password",
|
|
|
- ping_delay=10, # Delay after start
|
|
|
- ping_interval=10, # Periodically ping AMI (dead or alive)
|
|
|
- reconnect_timeout=2, # Timeout reconnect if connection lost
|
|
|
+ p = ArgumentParser()
|
|
|
+
|
|
|
+ asterisk_misc_common.add_arguments(p)
|
|
|
+ args = p.parse_args()
|
|
|
+ asterisk_misc_common.do_common_options(args)
|
|
|
+
|
|
|
+ manager = asterisk_misc_common.get_manager(args)
|
|
|
+ asterisk_misc_common.run_manager(
|
|
|
+ manager, args, on_startup=init, on_shutdown=on_shutdown
|
|
|
)
|
|
|
- manager.connect(run_forever=True, on_startup=init, on_shutdown=on_shutdown)
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|