public void halt() { // modified long time = SystemClock.elapsedRealtime(); int i = 0; for (RegisterAgent ra : ras) { unregister(i); while (ra != null && ra.CurrentState != RegisterAgent.UNREGISTERED && SystemClock.elapsedRealtime() - time < 2000) try { Thread.sleep(100); } catch (InterruptedException e1) { } if (wl[i].isHeld()) { wl[i].release(); if (pwl[i] != null && pwl[i].isHeld()) pwl[i].release(); } if (kas[i] != null) { Receiver.alarm(0, LoopAlarm.class); kas[i].halt(); } Receiver.onText(Receiver.REGISTER_NOTIFICATION + i, null, 0, 0); if (ra != null) ra.halt(); if (uas[i] != null) uas[i].hangup(); if (sip_providers[i] != null) sip_providers[i].halt(); i++; } }
public void keepAlive() { int i = 0; for (KeepAliveSip ka : kas) { if (ka != null && Receiver.on_wlan && isRegistered(i)) try { ka.sendToken(); Receiver.alarm(60, LoopAlarm.class); } catch (IOException e) { if (!Ruby.release) e.printStackTrace(); } i++; } }
public void unregister(int i) { if (user_profiles[i] == null || user_profiles[i].username.equals("") || user_profiles[i].realm.equals("")) return; RegisterAgent ra = ras[i]; if (ra != null && ra.unregister()) { Receiver.alarm(0, LoopAlarm.class); Receiver.onText( Receiver.REGISTER_NOTIFICATION + i, getUIContext().getString(R.string.reg), R.drawable.sym_presence_idle, 0); wl[i].acquire(); } else Receiver.onText(Receiver.REGISTER_NOTIFICATION + i, null, 0, 0); }
public void onUaRegistrationSuccess( RegisterAgent reg_ra, NameAddress target, NameAddress contact, String result) { int i = 0; for (RegisterAgent ra : ras) { if (ra == reg_ra) break; i++; } if (isRegistered(i)) { if (Receiver.on_wlan) Receiver.alarm(60, LoopAlarm.class); Receiver.onText( Receiver.REGISTER_NOTIFICATION + i, getUIContext().getString(i == pref ? R.string.regpref : R.string.regclick), R.drawable.sym_presence_available, 0); reg_ra.subattempts = 0; reg_ra.startMWI(); Receiver.registered(); } else Receiver.onText(Receiver.REGISTER_NOTIFICATION + i, null, 0, 0); if (wl[i].isHeld()) { wl[i].release(); if (pwl[i] != null && pwl[i].isHeld()) pwl[i].release(); } }