• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to make calls in android using Intent?

Hi all,

I want to write code in android for making outgoing-calls after registering with the SIP server. I already have done with the registration part, but I want to know which class/function should I use to make calls to any of the number.

I tried to do it using Intent, but the goal is not achieved. Please guide me for the right approach.

Thanks!
 
Not exactly sure what your asking ... but this intent will call someone


Intent i = new Intent("android.intent.action.CALL",
ContentURI.create("tel:" + phone));
startActivity(i);


you have to have the

<uses-permission id="android.permission.CALL_PHONE" />

permission

but I don't think there is any SIP stuff in android by default (atleast not 2.2 and down)
 
Actually I'm making a SIP application, in which I first register with the SIP server and then make call to any number on 'Back' press. Though registration is done successfully, but I couldn't listen to any response while making a call....Now I want to know if I should add something else in my code to listen from the other side or there's any other way to make call in SIP application.

Here's my code to make call:
Code:
@Override
      public void onBackPressed(){
          super.onBackPressed();
      final TextView lblStatus = (TextView) findViewById(R.id.statusTxt);
          if((lblStatus.getText())=="Active")
          {
              try{
                  Intent dialIntent = new Intent(Intent.ACTION_DIAL);
                  dialIntent.setData(Uri.parse("tel:9234567890"));
                  dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);                
                  this.startActivity(dialIntent);
              } catch (ActivityNotFoundException e) {            
                      Log.e("SIP Demo Dialing example", "Call failed", e);            
                  }   
          }
If anybody have idea...please help!
Thanks!
 
Back
Top Bottom