⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sipphone.java

📁 jtapi for telephone
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                {
                    console.showException(        "The following exception occurred while trying to open media connection:\n"
                    + ex.getMessage(),           ex);
                }
                call.getRemoteSdpDescription();
                console.debug("+++++++++++++          ++++++      +++++ DIIIS conecTTTTEDDD"+ call.getRemoteName());
                sipProvider.sipConnectionDisconnected(el.getJtapiId(), el.getAddress(), ConnectionEvent.CAUSE_NORMAL);
            }
        }
        finally
        {
            console.logExit();
        }
    }
    
    public void messageReceived(MessageEvent evt)
    {
      /*  try
        {
            console.logEntry();
            String fromAddress = evt.getFromAddress();
            String fromName = evt.getFromName();
            String messageBody = evt.getBody();
            console.showDetailedMsg(
            "Incoming MESSAGE",
            "You received a MESSAGE\n"
            + "From:    " + fromName + "\n"
            + "Address: " + fromAddress + "\n"
            + "Message: " + messageBody + "\n");
        }
        finally
        {
            console.logExit();
        }*/
    }
    
    public void nonFatalMediaErrorOccurred(MediaErrorEvent evt)
    {
        console.logEntry();
    }
    
    /** Returns a Credentials object associated with the specified realm.
     * @param realm The realm that the credentials are needed for.
     * @param defaultValues the values to propose the user by default
     * @return The credentials associated with the specified realm or null if
     * none could be provided.
     *
     */
    public UserCredentials obtainCredentials(String realm, UserCredentials defaultValues)
    {
        console.logEntry();
        return null;
    }
    
    public void playerStarting(MediaEvent evt)
    {console.logEntry();
    }
    
    public void playerStopped()
    {console.logEntry();
    }
    
    public void receivedUnknownMessage(UnknownMessageEvent evt)
    {console.logEntry();
    }
    
    public void registered(RegistrationEvent evt)
    {console.logEntry();
    }
    
    public void registering(RegistrationEvent evt)
    {
    }
    
    
    public void callReceived(net.sourceforge.gjtapi.raw.sipprovider.sip.event.CallEvent evt)
    {
        console.logEntry();
    }
    
    public void callRejectedLocally(CallRejectedEvent evt)
    {
        console.logEntry();
    }
    
    public void callRejectedRemotely(CallRejectedEvent evt)
    {
        console.logEntry();
    }
    
    
    
    public void communicationsErrorOccurred(CommunicationsErrorEvent evt)
    {
        console.logEntry();
    }
    
    
    
    
    
    public void unregistered(RegistrationEvent evt)
    {console.logEntry();
    }
    
    
    
    //init methode section---------------------------------------------------------------
    public void launch()
    {
        try
        {
            console.logEntry();
            //mode = PHONE_MODE;
            NetworkAddressManager.start();
            try
            {
                mediaManager.start();
                
                
            }
            catch (MediaException exc)
            {
                console.error("Failed to start mediaManager", exc);
                console.showException(
                "The following exception occurred while initializing media!\n"
                + exc.getMessage(),
                exc);
            }
            mediaManager.addMediaListener(this);            
                     
            sipManager.addCommunicationsListener(this);
            sipManager.setSecurityAuthority(this);
            
            
            try
            {
                sipManager.start();
                if (sipManager.isStarted())
                {
                    terminal = new TermData("sip:" + sipManager.getLocalUser() + "@" + sipManager.getLocalHostAddress(),true );// + "@" + sipManager.getLocalHostAddress(), true);
                    
                    console.trace(
                    "sipManager appears to be successfully started");
                    //  guiManager.setCommunicationActionsEnabled(true);
                }
            }
            catch (CommunicationsException exc)
            {
                console.showException(
                "An exception occurred while initializing communication stack!\n"
                + "You won't be able to send or receive calls",
                exc);
                return;
            }
            /*try
            {
                sipManager.register();
            }
            catch (CommunicationsException exc)
            {
                console.error(
                "An exception occurred while trying to register, exc");
                console.showException(
                "Failed to register!\n"
                + exc.getMessage() + "\n"
                + "This is a warning only. The phone would still function",
                exc);
            }*/
        }
        finally
        {
            console.logExit();
        }
    }
    //end of init method section-------------------------------------------------------
    
    private ListIdElement getElementIdListBySipId(int sipId)
    {
        ListIdElement ret = null;
        Enumeration enum = idVector.elements();
        while (enum.hasMoreElements())
        {
            ListIdElement lst = (ListIdElement)enum.nextElement();
            if ( lst.getSipId() == sipId)
            {
                ret = lst;
            }
        }
        return ret;
    }
    
    private ListIdElement getElementIdListByJtapiId(CallId callid)
    {
        ListIdElement ret = null;
        Enumeration enum = idVector.elements();
        while (enum.hasMoreElements())
        {
            ListIdElement lst = (ListIdElement)enum.nextElement();
            if ( lst.getJtapiId().equals(callid))
            {
                ret = lst;
            }
        }
        return ret;
    }
    
    public SipManager getSipManager()
    {
        return sipManager;
    }
    
    public void unregistering(RegistrationEvent evt)
    {
    }
    
    public void play(String url)
    {
        try
        {
            this.mediaManager.play(url);
        }
        catch(Exception ex)
        {
            console.debug(ex.toString());
        }
    }
    public void record(String url)
    {
        try
        {
            this.mediaManager.record(url);
        }
        catch(Exception ex)
        {
            console.debug(ex.toString());
        }
    }
    public void stop()
    {
        
        this.mediaManager.stopPlaying();
        this.mediaManager.stopRecording();
    }
    
   
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -