2013-04-16 51 views
2

我完全參與了SipDemo應用程序。我正在製作撥打電話並完成。我可以聽到聲音,但其他啜飲的人是無法聽到我的聲音SipDemo打電話

這是我的註冊碼: -

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

    //sipcallid 
    // username and password should be same 
// sipAddress = "[email protected]"; 
    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(); 
    } 

這是我的啓動呼叫: -

// sipcallid = "[email protected]"; 
    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(); 
     } 
    } 
} 

請除外。我可以聽到別人的聲音,但其他人聽不到我的聲音。

請幫幫我!感謝您的時間。

+0

嘿我工作在相同的代碼,我沒有連接到我的SIP服務器。你有沒有找到解決方案?請聯繫我。 – mehmetakifalp

回答

0

我看到你打電話call.toggleMute()

難道說你是靜音麥克風? SipDemo應用程序有一個用於取消靜音麥克風的按鈕。

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

也許您只是在啓動呼叫時將麥克風靜音,但從不取消靜音?

0

當您的IP地址通常是NAT地址時引發。 Android默認不支持NAT。爲了支持NAT,您將使用其他外部庫,例如CSipSimple。