Android net.sip: manager.makeAudioCall (..) throws sip session error

I am trying to set a call using sip on Android. Permissions in my manifest:

<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 permission is there, because my application also calls regular numbers.
This is the action code:

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

Error shown on 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) 

I am trying to do this tiny little work on examples before arranging this code a little differently (username and password, for example, are not hardcoded). I am also not very familiar with a sip. Actually all the tips. any ideas? Thanks!

+7
source share
1 answer

The problem is the following line:

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

The second parameter of the makeAudioCall method should be the URI of the SIP profile to make the call to , but you specified only its username (for example, "12345678910"). Change it to something like:

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

All Articles