Changeset 5738 for pjproject/trunk/pjsip-apps/src/swig/java/sample.java
- Timestamp:
- Feb 16, 2018 9:37:00 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/swig/java/sample.java
r5649 r5738 26 26 class MyObserver implements MyAppObserver { 27 27 private static MyCall currentCall = null; 28 private boolean del_call_scheduled = false; 29 30 public void check_call_deletion() 31 { 32 if (del_call_scheduled && currentCall != null) { 33 currentCall.delete(); 34 currentCall = null; 35 del_call_scheduled = false; 36 } 37 } 28 38 29 39 @Override … … 58 68 ci = null; 59 69 } 60 if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) 61 currentCall = null; 70 if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) { 71 // Should not delete call instance in this context, 72 // so let's just schedule it, the call will be deleted 73 // in our main worker thread context. 74 del_call_scheduled = true; 75 } 76 62 77 } 63 78 … … 86 101 public class sample { 87 102 private static MyApp app = new MyApp(); 88 private static My AppObserver observer = new MyObserver();103 private static MyObserver observer = new MyObserver(); 89 104 private static MyAccount account = null; 90 105 private static AccountConfig accCfg = null; … … 142 157 143 158 while (!Thread.currentThread().isInterrupted()) { 159 // Handle events 144 160 MyApp.ep.libHandleEvents(10); 161 162 // Check if any call instance need to be deleted 163 observer.check_call_deletion(); 164 145 165 try { 146 166 Thread.currentThread().sleep(50); 147 167 } catch (InterruptedException ie) { 148 168 break; 149 } 169 } 150 170 } 151 171 app.deinit();
Note: See TracChangeset
for help on using the changeset viewer.