我在restcomm sip servlet上工作。 我使用restcomm web sdk和restcomm tomcat作为服务器。当我想在doRegister方法中获取密码时,它返回null。
服务器代码是:
String password = ((SipURI) request.getFrom().getURI()).getUserPassword();
客户端代码是:
var parameters = {
'debug': true,
'username': 'alice',
'password': '1234',
'registrar': 'ws://192.168.1.3:5082',
'domain': '192.168.1.3'
};
RestCommClient.Device.setup(parameters);
需要在dar文件中进行一些设置吗?
修改
我找到了this链接。它描述了如何为sip servlet启用安全性,但有些不正确,例如没有:
<Realm className="org.apache.catalina.realm.MemoryRealm" />
取消注释,但我插入如下:
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Realm className="org.apache.catalina.realm.MemoryRealm" />
</Realm>
第二个isuue是在该教程中添加第3步的地方(我使用&#34;在Tomcat中启用安全性&#34;部分)
这个配置对我来说也不起作用。
我发现的另一件事是你没有SipUrI类的任何其他对象,除了用户名可能在库中出错并且没有填写SipUrl