我正在尝试在 Android 设备(4.0.2)上运行 JAIN-SIP 堆栈。我能够重新打包所需的 jar 文件(jain-sip-api-1.2-src.jar、jain-sip-src-1.2.1111.jar、concurrent.jar、log4j-1.2.8.jar)。
这是我使用的 build.xml 文件:
<!-- Converts this project's .class files into .dex files -->
<target name="-jarjar" depends="-compile">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="buildtools/jarjar-1.4.jar"/>
<jarjar jarfile="${out.absolute.dir}/JainSipApi1.2_re.jar">
<zipgroupfileset dir="mylib" includes="jain-sip-api-1.2-src.jar" />
<rule pattern="javax.sip.**" result="sipper.sip.@1"/>
</jarjar>
<jarjar jarfile="${out.absolute.dir}/JainSipRi1.2_re.jar">
<zipgroupfileset dir="mylib" includes="jain-sip-src-1.2.1111.jar" />
<rule pattern="gov.nist.**" result="sipper.nist.@1"/>
</jarjar>
<jarjar jarfile="${out.absolute.dir}/concurrent_re.jar">
<zipgroupfileset dir="mylib" includes="concurrent.jar" />
<rule pattern="EDU.**" result="sipper.EDU.@1"/>
</jarjar>
<jarjar jarfile="${out.absolute.dir}/log4j-1.2.8_re.jar">
<zipgroupfileset dir="mylib" includes="log4j-1.2.8.jar" />
<rule pattern="org.apache.log4j.**" result="sipper.org.apache.log4j.@1"/>
</jarjar>
</target>
这是一个代码示例,我尝试在非 Android 环境中测试重新打包的文件:
import sipper.sip.SipFactory;
...
sipFactory = SipFactory.getInstance();
sipFactory.setPathName("sipper.nist");
Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME", "Sipper");
properties.setProperty("javax.sip.IP_ADDRESS", "127.0.0.1");
sipStack = sipFactory.createSipStack(properties);
当我尝试运行此代码时,出现以下错误:
Problem initializing the SIP stack.
sipper.sip.PeerUnavailableException: Missing javax.sip.STACK_NAME property
at sipper.sip.SipFactory.createSipStack(SipFactory.java:144)
at SipLayer.<init>(SipLayer.java:86)
at SipperClient.main(SipperClient.java:51)
据我了解,我刚刚更改了包的名称,但它似乎不适用于某些包的“内部”。这就是为什么我查看源代码并看到一些硬编码字符串,例如:
if (name == null ) throw new PeerUnavailableException("Missing javax.sip.STACK_NAME property");
现在我的问题是有什么合适的方法/解决方案可以使 Android 下的 JAIN-SIP 工作吗?
提前感谢您的帮助:-)
丹尼尔