クライアントとは別に、Android デバイスに liblinphone Android クライアントがあります。
ソフト クライアントを開発していますが、アスタリスク SIP サーバーに接続する必要があります。
これで、number1 (たとえば 14109092000) が自分のソフト クライアントを使用してアスタリスク サーバーに接続されました。同じアスタリスクサーバーに接続するために、number2(たとえば(14109092001))のliblibphoneクライアントを使用します。
liblinphone クライアントをオフにするかアンインストールすると、クライアントはアスタリスク サーバーに接続できます。
私自身のソフト クライアントはポート 5060 を使用し、liblinphone も同じポートを使用します。
これは、sip サーバーに登録する私の Android アクティビティのコード スニペットです。
Register.java
String mobNumber = "14109092000";
String domain = <some ip address;
StringBuffer sipAddress = new StringBuffer("sip:").append(mobNumber).append("@").append(domain);
String identity = sipAddress.toString();
LinphoneCore lc = null;
try {
lc = LinphoneCoreFactory.instance().createLinphoneCore(new SndNumberCoreListenerImpl(), getApplicationContext());
LinphoneProxyConfig proxy_cfg;
/*parse identity*/
LinphoneAddress from = LinphoneCoreFactory.instance().createLinphoneAddress(sipAddress.toString() );
from.setPort(5060);
LinphoneAuthInfo info = LinphoneCoreFactory.instance().createAuthInfo(mobNumber, mobNumber,null, domain); /*create authentication structure from identity*/
lc.addAuthInfo(info); /*add authentication info to LinphoneCore*/
/*create proxy config*/
proxy_cfg = lc.createProxyConfig(sipAddress.toString(),domain,null,true);//lc.createProxyConfig();
// configure proxy entries
proxy_cfg.setIdentity(identity); /*set identity with user name and domain*/
String server_addr = from.getDomain(); /*extract domain address from identity*/
proxy_cfg.setProxy(server_addr); /* we assume domain = proxy server address*/
proxy_cfg.enableRegister(true); /*activate registration for this proxy config*/
lc.addProxyConfig(proxy_cfg); /*add proxy config to linphone core*/
lc.setDefaultProxyConfig(proxy_cfg);/*set to default proxy*/
lc.addListener(new SndNumberCoreListenerImpl());
proxy_cfg.done();
while(switchState) {
lc.iterate();
sleep(50);
}
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
1) なぜこれが起こっているのですか? 2) どうすればこれを防ぐことができますか?