Package org.cipango.media

Examples of org.cipango.media.Player


    public void init() throws Exception
    {
        String fileName = getFileName("hello", _audioPayloadType);
        DatagramSocket datagramSocket = new DatagramSocket();
        UdpEndPoint udpEndPoint = new UdpEndPoint(datagramSocket);
        _player = new Player(fileName, _host, _destPort, _audioPayloadType,
                udpEndPoint);
        _dtmfHandler = new DtmfHandler(_dtmfPayloadType, udpEndPoint);
        _player.init();
        _dtmfHandler.init();
        _dtmfHandlerThread = new Thread(_dtmfHandler);
View Full Code Here


            SipServletResponse resp = invite.createResponse(
                    SipServletResponse.SC_SERVER_INTERNAL_ERROR);
            resp.send();
            return;
        }
        Player player = new Player(file.getAbsolutePath(),
                rtpConnection.getHost(), rtpConnection.getPort(),
                payloadType);
        player.addEventListener(this);
        try {
            player.init();
        } catch (Exception e) {
            SipServletResponse resp = invite.createResponse(
                    SipServletResponse.SC_SERVER_INTERNAL_ERROR);
            resp.send();
            return;
        }
        int localPort = player.getLocalPort();
        Recorder recorder = new Recorder(localPort);
        Map<Integer, Recorder> recorders = (Map<Integer, Recorder>)
            servletContext.getAttribute(Recorder.class.getName());
        recorders.put(localPort, recorder);
        invite.getApplicationSession(true).setAttribute(
                Player.class.getName(), player);
        SipServletResponse resp =
            invite.createResponse(SipServletResponse.SC_OK);
        String sdpAnswer = "v=0\r\n"
            + "o=user1 123 456 IN IP4 127.0.0.1\r\n"
            + "s=-\r\n"
            + "c=IN IP4 127.0.0.1\r\n"
            + "t=0 0\r\n"
            + "m=audio " + player.getLocalPort() + " RTP/AVP "
                + payloadType + "\r\n"
            + "a=rtpmap:0 PCMU/8000\r\n";
       
        resp.setContent(sdpAnswer.getBytes(charset), "application/sdp");
        resp.send();
View Full Code Here

    protected void doAck(SipServletRequest ack) throws ServletException,
            IOException {
        log("doAck");
        SipApplicationSession sipApplicationSession =
            ack.getApplicationSession();
        Player player = (Player)sipApplicationSession.getAttribute(
                Player.class.getName());
        player.play();
    }
View Full Code Here

            IOException {
        log("doBye");
        bye.createResponse(SipServletResponse.SC_OK).send();
        SipApplicationSession sipApplicationSession =
            bye.getApplicationSession();
        Player player = (Player)sipApplicationSession.getAttribute(
                Player.class.getName());
        player.stop();
        ServletContext servletContext = getServletContext();
        Map<Integer, Recorder> recorders = (Map<Integer, Recorder>)
            servletContext.getAttribute(Recorder.class.getName());
        Recorder recorder = recorders.get(player.getLocalPort());
        recorder.stop();
        recorders.remove(player.getLocalPort());
        bye.getSession().invalidate();
        sipApplicationSession.invalidate();
    }
View Full Code Here

TOP

Related Classes of org.cipango.media.Player

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.