Example #1
0
 public void onConnectivityChanged(boolean connected) throws SipException {
   mSipGroup.onConnectivityChanged();
   if (connected) {
     resetGroup(mLocalIp);
     if (mOpenedToReceiveCalls) openToReceiveCalls();
   } else {
     // close mSipGroup but remember mOpenedToReceiveCalls
     if (DEBUG)
       Log.d(
           TAG, "  close auto reg temporarily: " + getUri() + ": " + mIncomingCallPendingIntent);
     mSipGroup.close();
     mAutoRegistration.stop();
   }
 }
Example #2
0
 public void openToReceiveCalls() throws SipException {
   mOpenedToReceiveCalls = true;
   if (mConnected) {
     mSipGroup.openToReceiveCalls(this);
     mAutoRegistration.start(mSipGroup);
   }
   if (DEBUG)
     Log.d(TAG, "  openToReceiveCalls: " + getUri() + ": " + mIncomingCallPendingIntent);
 }
Example #3
0
 private void resetGroup(String localIp) throws SipException {
   try {
     mSipGroup.reset(localIp);
   } catch (IOException e) {
     // network disconnected
     Log.w(TAG, "resetGroup(): network disconnected?");
     if (localIp != null) {
       resetGroup(null); // reset w/o local IP
     } else {
       // recursive
       Log.wtf(TAG, "impossible!");
       throw new RuntimeException("resetGroup");
     }
   }
 }
Example #4
0
    public void start(SipSessionGroup group) {
      if (!mRunning) {
        mRunning = true;
        mBackoff = 1;
        mSession = (SipSessionGroup.SipSessionImpl) group.createSession(this);
        // return right away if no active network connection.
        if (mSession == null) return;

        // start unregistration to clear up old registration at server
        // TODO: when rfc5626 is deployed, use reg-id and sip.instance
        // in registration to avoid adding duplicate entries to server
        mMyWakeLock.acquire(mSession);
        mSession.unregister();
        TAG = "SipAutoReg:" + mSession.getLocalProfile().getUriString();
      }
    }
Example #5
0
 private String getUri() {
   return mSipGroup.getLocalProfileUri();
 }
Example #6
0
 public ISipSession createSession(ISipSessionListener listener) {
   return mSipGroup.createSession(listener);
 }
Example #7
0
 public void close() {
   mOpenedToReceiveCalls = false;
   mSipGroup.close();
   mAutoRegistration.stop();
   if (DEBUG) Log.d(TAG, "   close: " + getUri() + ": " + mIncomingCallPendingIntent);
 }
Example #8
0
 // TODO: remove this method once SipWakeupTimer can better handle variety
 // of timeout values
 void setWakeupTimer(SipWakeupTimer timer) {
   mSipGroup.setWakeupTimer(timer);
 }
Example #9
0
 public boolean containsSession(String callId) {
   return mSipGroup.containsSession(callId);
 }
Example #10
0
 public SipProfile getLocalProfile() {
   return mSipGroup.getLocalProfile();
 }