Example #1
0
  @Before
  public void setUp() throws Exception {
    // given
    DtlsSrtpServerProvider mockedDtlsServerProvider = mock(DtlsSrtpServerProvider.class);
    DtlsSrtpServer mockedDtlsSrtpServer = mock(DtlsSrtpServer.class);

    // when
    when(mockedDtlsServerProvider.provide()).thenReturn(mockedDtlsSrtpServer);
    when(mockedDtlsSrtpServer.getCipherSuites()).thenReturn(cipherSuites);

    // then
    AudioFormat pcma = FormatFactory.createAudioFormat("pcma", 8000, 8, 1);
    Formats fmts = new Formats();
    fmts.add(pcma);

    Formats dstFormats = new Formats();
    dstFormats.add(FormatFactory.createAudioFormat("LINEAR", 8000, 16, 1));

    dspFactory.addCodec("org.mobicents.media.server.impl.dsp.audio.g711.alaw.Encoder");
    dspFactory.addCodec("org.mobicents.media.server.impl.dsp.audio.g711.alaw.Decoder");

    dsp11 = dspFactory.newProcessor();
    dsp12 = dspFactory.newProcessor();

    dsp21 = dspFactory.newProcessor();
    dsp22 = dspFactory.newProcessor();

    // use default clock
    clock = new WallClock();

    // create single thread scheduler
    mediaScheduler = new PriorityQueueScheduler();
    mediaScheduler.setClock(clock);
    mediaScheduler.start();

    udpManager = new UdpManager(scheduler);
    scheduler.start();
    udpManager.start();

    channelsManager = new ChannelsManager(udpManager, mockedDtlsServerProvider);
    channelsManager.setScheduler(mediaScheduler);

    detector = new DetectorImpl("dtmf", mediaScheduler);
    detector.setVolume(-35);
    detector.setDuration(40);
    detector.addListener(this);

    channel = channelsManager.getChannel();
    channel.bind(false);

    sender = new Sender(channel.getLocalPort());

    channel.setPeer(new InetSocketAddress("127.0.0.1", 9200));
    channel.setInputDsp(dsp11);
    channel.setFormatMap(AVProfile.audio);

    audioMixer = new AudioMixer(mediaScheduler);
    audioMixer.addComponent(channel.getAudioComponent());

    detectorComponent = new AudioComponent(1);
    detectorComponent.addOutput(detector.getAudioOutput());
    detectorComponent.updateMode(true, true);
    audioMixer.addComponent(detectorComponent);

    oobMixer = new OOBMixer(mediaScheduler);
    oobMixer.addComponent(channel.getOOBComponent());

    oobComponent = new OOBComponent(1);
    oobComponent.addOutput(detector.getOOBOutput());
    oobComponent.updateMode(true, true);
    oobMixer.addComponent(oobComponent);
  }
Example #2
0
 private byte[] getMasterClientSalt() {
   return server.getSrtpMasterClientSalt();
 }
Example #3
0
 private SRTPPolicy getSrtcpPolicy() {
   return server.getSrtcpPolicy();
 }
Example #4
0
 private byte[] getMasterServerKey() {
   return server.getSrtpMasterServerKey();
 }