2

I've totally involved by SipDemo app. I am making Sip call and it is done. I can hear voice but other sip person is unable to hear my voice.

This is my Registration code:-

 public void initializeLocalProfile() {
    if (manager == null) {
        return;
    }
    if (me != null) {
        closeLocalProfile();
    }

    //sipcallid
   // username and password should be same
 //   sipAddress = "101@217.xx.xxx.xxx";
    String domain =  sipAddress.substring(sipAddress.indexOf('@')+1);
    String username = sipAddress.substring(0,sipAddress.indexOf('@'));
    Toast.makeText(outcall.this, "domain = "+domain+" username "+username, Toast.LENGTH_LONG).show();

    try {
        SipProfile.Builder builder = new SipProfile.Builder(username, domain);
        builder.setPassword("123456");
        builder.setOutboundProxy(domain);
        builder.setDisplayName(username);
        builder.setAuthUserName(username);
        //builder.setDisplayName(username);
       // builder.setAutoRegistration(true);
       // builder.setSendKeepAlive(true);

        me = builder.build();

        manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() {
                public void onRegistering(String localProfileUri) {
                   updateStatus("Registering with SIP Server...");
                }

                public void onRegistrationDone(String localProfileUri, long expiryTime) {
                    updateStatus("Ready");
                }

                public void onRegistrationFailed(String localProfileUri, int errorCode,
                        String errorMessage) {
                    updateStatus("Registration failed.  Please check settings.");
                }
            });
    } catch (SipException se) {
        updateStatus("Connection error.");
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

This is my Initiate call:-

    // sipcallid = "rahul22@sip2sip.info";
    updateStatus(sipcallid);

    try {
          SipAudioCall.Listener listener = new SipAudioCall.Listener() {

            @Override
            public void onCallEstablished(SipAudioCall call) {
                call.startAudio();
                //call.setSpeakerMode(true);
                call.toggleMute();
                updateStatus1("on call established");

            }
            @Override
            public void onCallEnded(SipAudioCall call) {
                updateStatus1("on call end");
                 finish();
            }



        };

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

        updateStatus1(""+call.getState());
    }
    catch (Exception e) {
        Toast.makeText(outcall.this, "Error when trying to close manager"+ e.getMessage(), Toast.LENGTH_LONG).show();

        if (me != null) {
            try {
                manager.close(me.getUriString());
            } catch (Exception ee) {
                Toast.makeText(outcall.this, "ee"+ e.getMessage(), Toast.LENGTH_LONG).show();
                ee.printStackTrace();
            }
        }
        if (call != null) {
            call.close();
        }
    }
}

Please Except. I can hear the voice of other person but other person can't hear my voice.

please help me!. Thank you for your timing.

user2160008
  • 379
  • 2
  • 5
  • 20

2 Answers2

1

It raise when your IP adress is NAT address usually. Android not support NAT by default. For supporting with NAT you will use other external libraries such as CSipSimple.

beka
  • 11
  • 3
0

I see that you call call.toggleMute()

Could it be that you are muting the microphone? The SipDemo app has a button which unmutes the microphone.

public boolean onTouch(View v, MotionEvent event) {
    if (call == null) {
        return false;
    } else if (event.getAction() == MotionEvent.ACTION_DOWN && call != null && call.isMuted()) {
        call.toggleMute();
    } else if (event.getAction() == MotionEvent.ACTION_UP && !call.isMuted()) {
        call.toggleMute();
    }
    return false;
}

Maybe you just mute the microphone when you initiate the call but never unmute?

PeterH
  • 801
  • 2
  • 7
  • 16