JAIN-SIP 1.2 for Android: Missing javax.sip.STACK_NAME property

冷暖自知 提交于 2020-01-07 04:39:26

问题


I'm trying to run JAIN-SIP Stack on an Android-Device (4.0.2). I was able to repackage the jar-files which were needed (jain-sip-api-1.2-src.jar, jain-sip-src-1.2.1111.jar, concurrent.jar, log4j-1.2.8.jar).

This is my build.xml file which I used:

    <!-- 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>

And this is a code-sample where I tried to test the repackaged file in a none Android environment:

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);

When I try to run this code I got the following error:

 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)

As far as I understood, I've just changed the name of the packages, but it seems like that it doesn't work for the "interna" of some packages. That's why I looked into the source and saw there some hard coded strings like:

if (name == null ) throw new PeerUnavailableException("Missing javax.sip.STACK_NAME property");

Now is my question are there any appropriate ways/solutions to make JAIN-SIP under Android working?

Thanks for your help in advance :-)

Daniel


回答1:


There is now a supported Android port of JAIN SIP by the people who wrote much of the original JAIN SIP stack:

http://www.telestax.com/jain-sip-stack-for-android/




回答2:


I just saw this post and ran into the same problem.

After a few minutes, I success porting jain sip stack to Nexus 7 Android 4.1.

The main reason of your problem is the "Jar" package name. Since Android do not support the libraries import from the package name of "javax.*" , the first job porting jsip to Android platform is to change the import package name.

And you have changed one of the package name javax.sip into sipper.sip with the following script.

<rule pattern="javax.sip.**" result="sipper.sip.@1"/>

This would make the jsip produce the exception you just mention above.

Please first check the full source code by this link (line 551~552). You will see the following code.

String name = configurationProperties.getProperty("javax.sip.STACK_NAME");

So the jsip just find the property to get the sip stack name. And finally , the answer to this question. Please add those code in your jsip application.

Properties properties = new Properties();
properties.setProperty("sipper.sip.STACK_NAME", "stack");

Hope this could help you and the viewer from the internet!!!



来源:https://stackoverflow.com/questions/15867541/jain-sip-1-2-for-android-missing-javax-sip-stack-name-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!