Esempio n. 1
0
 def play_audio_welcome(self, welcome_prompt):
     try:
         audio_stream = next(stream for stream in self.session.streams
                             if stream.type == 'audio')
     except StopIteration:
         return
     player = WavePlayer(audio_stream.mixer,
                         '',
                         pause_time=1,
                         initial_delay=1,
                         volume=50)
     audio_stream.bridge.add(player)
     try:
         if welcome_prompt:
             file = Resources.get('sounds/co_welcome_conference.wav')
             self.play_file_in_player(player, file, 1)
         user_count = len({
             str(s.remote_identity.uri)
             for s in self.room.sessions
             if s.remote_identity.uri != self.session.remote_identity.uri
             and any(stream
                     for stream in s.streams if stream.type == 'audio')
         })
         if user_count == 0:
             file = Resources.get('sounds/co_only_one.wav')
             self.play_file_in_player(player, file, 0.5)
         elif user_count == 1:
             file = Resources.get('sounds/co_there_is_one.wav')
             self.play_file_in_player(player, file, 0.5)
         elif user_count < 100:
             file = Resources.get('sounds/co_there_are.wav')
             self.play_file_in_player(player, file, 0.2)
             if user_count <= 24:
                 file = Resources.get('sounds/bi_%d.wav' % user_count)
                 self.play_file_in_player(player, file, 0.1)
             else:
                 file = Resources.get('sounds/bi_%d0.wav' %
                                      (user_count / 10))
                 self.play_file_in_player(player, file, 0.1)
                 file = Resources.get('sounds/bi_%d.wav' %
                                      (user_count % 10))
                 self.play_file_in_player(player, file, 0.1)
             file = Resources.get('sounds/co_more_participants.wav')
             self.play_file_in_player(player, file, 0)
         file = Resources.get('sounds/connected_tone.wav')
         self.play_file_in_player(player, file, 0.1)
     except proc.ProcExit:
         # No need to remove the bridge from the stream, it's done automatically
         pass
     else:
         audio_stream.bridge.remove(player)
         self.room.audio_conference.add(audio_stream)
         self.room.audio_conference.unhold()
     finally:
         player.stop()
Esempio n. 2
0
class GeneralConfig(ConfigSection):
    __cfgfile__ = 'playback.ini'
    __section__ = 'Playback'

    files_dir = ConfigSetting(type=Path,
                              value=Path(Resources.get('sounds/playback')))
    enable_video = False
    answer_delay = 1
Esempio n. 3
0
class WebServerConfig(ConfigSection):
    __cfgfile__ = configuration_filename
    __section__ = 'WebServer'

    local_ip = ConfigSetting(type=IPAddress, value=IPAddress(host.default_ip))
    local_port = ConfigSetting(type=Port, value=10888)
    hostname = ''
    certificate = ConfigSetting(type=Path,
                                value=Path(Resources.get('tls/default.crt')))
Esempio n. 4
0
class ServerConfig(ConfigSection):
    __cfgfile__ = configuration_filename
    __section__ = 'Server'

    ca_file = ConfigSetting(type=Path, value=Path(Resources.get('tls/ca.crt')))
    certificate = ConfigSetting(type=Path,
                                value=Path(Resources.get('tls/default.crt')))
    verify_server = False
    enable_bonjour = False
    default_application = 'conference'
    application_map = ConfigSetting(type=StringList, value=['echo:echo'])
    disabled_applications = ConfigSetting(type=StringList, value='')
    extra_applications_dir = ConfigSetting(type=Path, value=None)
    trace_dir = ConfigSetting(type=Path,
                              value=Path(VarResources.get('log/sylkserver')))
    trace_core = False
    trace_sip = False
    trace_msrp = False
    trace_notifications = False
    spool_dir = ConfigSetting(type=Path,
                              value=Path(VarResources.get('spool/sylkserver')))
Esempio n. 5
0
 def play_audio_welcome(self, welcome_prompt):
     try:
         audio_stream = next(stream for stream in self.session.streams if stream.type == 'audio')
     except StopIteration:
         return
     player = WavePlayer(audio_stream.mixer, '', pause_time=1, initial_delay=1, volume=50)
     audio_stream.bridge.add(player)
     try:
         if welcome_prompt:
             file = Resources.get('sounds/co_welcome_conference.wav')
             self.play_file_in_player(player, file, 1)
         user_count = len({str(s.remote_identity.uri) for s in self.room.sessions if s.remote_identity.uri != self.session.remote_identity.uri and any(stream for stream in s.streams if stream.type == 'audio')})
         if user_count == 0:
             file = Resources.get('sounds/co_only_one.wav')
             self.play_file_in_player(player, file, 0.5)
         elif user_count == 1:
             file = Resources.get('sounds/co_there_is_one.wav')
             self.play_file_in_player(player, file, 0.5)
         elif user_count < 100:
             file = Resources.get('sounds/co_there_are.wav')
             self.play_file_in_player(player, file, 0.2)
             if user_count <= 24:
                 file = Resources.get('sounds/bi_%d.wav' % user_count)
                 self.play_file_in_player(player, file, 0.1)
             else:
                 file = Resources.get('sounds/bi_%d0.wav' % (user_count / 10))
                 self.play_file_in_player(player, file, 0.1)
                 file = Resources.get('sounds/bi_%d.wav' % (user_count % 10))
                 self.play_file_in_player(player, file, 0.1)
             file = Resources.get('sounds/co_more_participants.wav')
             self.play_file_in_player(player, file, 0)
         file = Resources.get('sounds/connected_tone.wav')
         self.play_file_in_player(player, file, 0.1)
     except proc.ProcExit:
         # No need to remove the bridge from the stream, it's done automatically
         pass
     else:
         audio_stream.bridge.remove(player)
         self.room.audio_conference.add(audio_stream)
         self.room.audio_conference.unhold()
     finally:
         player.stop()
Esempio n. 6
0
 def index(self, request):
     return StaticFileResource(Resources.get('html/webrtcgateway/'))
Esempio n. 7
0
 def test(self, request):
     path = Resources.get('html/webrtcgateway/test/')
     return StaticFileResource(path)
Esempio n. 8
0
 def index(self, request):
     path = Resources.get('html/webrtcgateway/index.html')
     r = StaticFileResource(path)
     r.isLeaf = True
     return r
Esempio n. 9
0
 def test(self, request):
     path = Resources.get('html/webrtcgateway/test/')
     return StaticFileResource(path)
Esempio n. 10
0
 def index(self, request):
     path = Resources.get('html/webrtcgateway/index.html')
     r = StaticFileResource(path)
     r.isLeaf = True
     return r
Esempio n. 11
0
 def js(self, request):
     path = Resources.get("html/webrtcgateway/js/")
     return StaticFileResource(path)