コード例 #1
0
ファイル: PageGroup.java プロジェクト: astubbs/sipxecs
  /** The event handler for this group's timers, RtpFork, and calls. */
  public boolean onEvent(LegEvent event) {
    LOG.debug("PageGroup::onEvent got event " + event.getDescription());

    if (event.getDescription().equals("timer: status=fired name=maximum_duration")) {
      // Maximum duration timer fired, end the page.
      end();
    } else if (event.getDescription().equals("timer: status=fired name=beep_start")) {
      if (beep != null) {
        // Start the beep (if any)
        // Add the inbound caller to the RTP mix so he can hear the beep
        rtpFork.addDestination(inboundRtp);
        rtpFork.startLocalAudio(beep);
      }
    } else if (event.getDescription().equals("localAudio end")) {
      // Now that the beep is done, remove the inbound caller to the RTP mix
      // So he does not hear himself
      rtpFork.removeDestination(inboundRtp);
    } else if (event.getDescription().startsWith("dialog bye")) {
      // Someone hung up.
      Leg leg = event.getLeg();
      if (leg == inbound) {
        // Inbound call ended.  End the page.
        end();
      } else {
        // Outbound call ended.  Stop sending rtp to it
        rtpFork.removeDestination(leg.getRemoteRtpAddress());
      }
    } else if (event.getDescription().equals("sdp")) {
      // SDP changed, keep rtpFork informed.
      rtpFork.removeDestination(event.getLeg().getPreviousRtpAddress());
      rtpFork.addDestination(event.getLeg().getRemoteRtpAddress());
    }

    return true;
  }