1

JAIN SIP 1.2 と Android の NIST 実装を使用して SIP アプリケーションを構築しようとしています。

ソースから とjain-sip-api-1.2.jarを再構築し、 と の名前を変更しました。標準のJavaで問題なくテキストクライアントの例でjarファイルをテストしました。ただし、Androidで実行すると、まだエラーが発生します:jain-sip-ri-1.2.1111.jarjavax -> jain_javaxgov.nist.javax -> jain_gov.nist.jain_javax

"The Peer SIP Stack: jain_gov.nist.jain_javax.sip.SipstackImpl could not be instantiated. Ensure the Path Name has been set".

ここで何か見逃しましたか?

4

3 に答える 3

0

JAIN-SIP-1-2-164 を使用しています。アプリのコードは次のとおりです。

import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.text.ParseException;
import java.util.*;
import android.os.Handler;

import jain_javax.sip.*;
import jain_javax.sip.address.*;
import jain_javax.sip.header.*;
import jain_javax.sip.message.*;

public class SipLayer implements SipListener {

private SipStack sipStack;
private SipFactory sipFactory;
private Properties properties;
private String local_ip;    
int listen_port;            

/** Here we initialize the SIP stack. */
public SipLayer(int listen_port) {
    try {   
    setUsername(username);
    this.local_ip = InetAddress.getLocalHost().getHostAddress();;
    this.listen_port = listen_port;     
    // Create the SIP factory and set the path name.
    this.sipFactory = SipFactory.getInstance();
    this.sipFactory.setPathName("jain_gov.nist");   
    // Create and set the SIP stack properties.
    this.properties = new Properties();
    this.properties.setProperty("jain_javax.sip.STACK_NAME", "stack");
    this.properties.setProperty("jain_javax.sip.IP_ADDRESS", local_ip);
    if(proxy != null) 
        this.properties.setProperty("jain_javax.sip.OUTBOUND_PROXY", proxy + ':' + server_port + '/' + protocol);

    //DEBUGGING: Information will go to files textclient.log and textclientdebug.log
    this.properties.setProperty("jain_gov.nist.javax.sip.TRACE_LEVEL", "32");
    // this.properties.setProperty("jain_gov.nist.javax.sip.SERVER_LOG", "textclient.txt");
    // this.properties.setProperty("jain_gov.nist.javax.sip.DEBUG_LOG", "textclientdebug.log");

    // Create the SIP stack.
    this.sipStack = this.sipFactory.createSipStack(properties);
  }
  catch (Exception e) {       
    msgProc.processError("SipLayer failed: " + e.getMessage() + "\n");
  }
    }
}

同じコードは、Windows マシンの Java でも正常に実行されますが、上記のエラー メッセージが表示された Android エミュレーターです。

「SipStack sipStack = (SipStack) sipStackConstructor.newInstance(conArgs);」で Jain SIP 1.2 ルーチンのフォローに失敗していることがわかりました。

private SipStack createStack(Properties properties)
        throws PeerUnavailableException {
    try {
        // create parameters argument to identify constructor
        Class[] paramTypes = new Class[1];
        paramTypes[0] = Class.forName("java.util.Properties");
        // get constructor of SipStack in order to instantiate
        Constructor sipStackConstructor = Class.forName(
                getPathName() + ".jain_javax.sip.SipStackImpl").getConstructor(
                paramTypes);
        // Wrap properties object in order to pass to constructor of
        // SipSatck
        Object[] conArgs = new Object[1];
        conArgs[0] = properties;
        // Creates a new instance of SipStack Class with the supplied
        // properties.
        SipStack  sipStack = (SipStack) sipStackConstructor.newInstance(conArgs);
        sipStackList.add(sipStack);
        String name = properties.getProperty("jain_javax.sip.STACK_NAME");
        this.sipStackByName.put(name, sipStack);
                    return sipStack;
    } catch (Exception e) {
        String errmsg = "The Peer SIP Stack: "
                + getPathName()
                + ".jain_javax.sip.SipStackImpl"
                + " could not be instantiated. Ensure the Path Name has been set.";
        throw new PeerUnavailableException(errmsg, e);
    }
}

提案やさらにデバッグする方法はありますか?

于 2014-02-13T17:53:47.110 に答える