2012-03-13 5 views
0

내 안드로이드 모금 구현을 구현하려고하는데 내 SIP 서버에 등록하는 데 문제가 있습니다. 특히 SipManager.register() 함수는 NullPointerException을 던지고 있습니다. 아무도 전에 이것을 경험 한 적이 있습니까? 아래 함수에서 null이 아닌 것이 없으므로 어디에서 왔는지 이해할 수 없습니다. 감사합니다Android SipManager throw NullPointException

public boolean initializeProfile() { 
    final Globals global = Globals.getInstance(); 
    if (sipProfile != null) 
     closeLocalProfile(); 

    String username = "omitted"; 
    String password = "omitted"; 
    String server = "omitted"; 

    try { 
     global.Log("Trying to build the profile"); 
     SipProfile.Builder builder = new SipProfile.Builder(username, 
       server); 
     builder.setPassword(password); 
     sipProfile = builder.build(); 


     builder.setAutoRegistration(true); 

     sipManager.open(sipProfile); 

     SipRegistrationListener listener = new SipRegistrationListener() { 

      public void onRegistering(String localProfileUri) { 
       global.Log("Sip Listener- Attempting to Register"); 
      } 

      public void onRegistrationDone(String localProfileUri, 
        long expiryTime) { 
       global.Log("Sip Listener- Registration Success!"); 
      } 

      public void onRegistrationFailed(String localProfileUri, 
        int errorCode, String errorMessage) { 
       global.Log("Sip Listener- Registration Failed"); 
      } 
     }; 

     sipManager.setRegistrationListener(sipProfile.getUriString(), listener); 

     //THIS IS WHERE THE EXCEPTION IS BEING THROWN 
     sipManager.register(sipProfile, 3000, listener); 

     if (sipManager.isRegistered(sipProfile.getUriString())) 
     { 
      global.Log("SipManager is ready for calls"); 
      return true; 
     } 
     else 
      return false; 

    } catch (Exception ex) { 

      global.Log("---Error-- initializeProfile: " + ex.getMessage()); 
      return false; 

    } 

} 

답변

0

해결되었습니다. 스레드에서 실행되는 동안 이것이 잘 작동하지 않는 것 같습니다.