Android net.sip:manager.makeAudioCall(..)会引发sip会话错误

我正在尝试使用sip在Android上build立通话。 我的清单中的权限是:

<uses-permission android:name="android.permission.CALL_PHONE"/> <uses-permission android:name="android.permission.USE_SIP"/> <uses-permission android:name="android.permission.INTERNET"/> 

CALL_PHONE权限在那里,因为我的应用程序也调用常规数字。
这是活动代码:

 package xxx; import java.text.ParseException; import android.app.Activity; import android.app.PendingIntent; import android.content.Intent; import android.net.sip.SipAudioCall; import android.net.sip.SipException; import android.net.sip.SipManager; import android.net.sip.SipProfile; import android.os.Bundle; import android.util.Log; public class CallScreen extends Activity{ public SipManager manager = null; public SipProfile me = null; public SipAudioCall call = null; //IncomingCallReceiver callReceiver; String domain = "myserver.net"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.callscreen); initManager(); Log.d("Z:","Done initManger()"); Thread waiter = new Thread(){ @Override public void run() { // TODO Auto-generated method stub try { sleep(10000); Log.d("Z:","Done waiting"); initCall(); Log.d("Z:","Done initCall"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; waiter.start(); //initCall(); } public void initManager() { manager = SipManager.newInstance(this); initLocalProfile(); } public void initLocalProfile() { String username = "user"; String password = "12345"; String domain = "myserver.net"; try { SipProfile.Builder builder = new SipProfile.Builder(username,domain); builder.setPassword(password); me = builder.build(); //Intent intent = new Intent(); //PendingIntent pi = PendingIntent.getBroadcast(this, 0, intent, Intent.FILL_IN_DATA); //manager.open(me,pi,null); manager.open(me); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SipException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void initCall() { SipAudioCall.Listener listener = new SipAudioCall.Listener(){ @Override public void onCallEstablished(SipAudioCall call) { // TODO Auto-generated method stub //super.onCallEstablished(call); call.startAudio(); call.setSpeakerMode(true); call.toggleMute(); } @Override public void onCallEnded(SipAudioCall call) { // TODO Auto-generated method stub super.onCallEnded(call); } }; try { call = manager.makeAudioCall(me.getUriString(), "12345678910", listener, 30); } catch (SipException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } 

logcat上显示的错误:

 01-26 22:20:25.710: D/SipAudioCall(31060): sip session error: CLIENT_ERROR: libcore.io.ErrnoException: getaddrinfo failed: ENOENT (No such file or directory) 

我试图让这个小例子工作之前,我组织这个代码有点不同(用户名和传递不硬编码,例如)。 我也不是很有家的人。 真正appriciate任何意见。
有任何想法吗? 谢谢!

Solutions Collecting From Web of "Android net.sip:manager.makeAudioCall(..)会引发sip会话错误"

问题在于以下行:

 call = manager.makeAudioCall(me.getUriString(), "12345678910", listener, 30); 

makeAudioCall方法的第二个参数必须是 the URI of the SIP profile to make the call to ,但您只提供其用户名(即“12345678910”)。 将其改为如下所示:

 call = manager.makeAudioCall(me.getUriString(), "sip:12345678910@myserver.net", listener, 30);