Changeset 4575 for pjproject/branches/projects/jni/pjsip-apps/src/jni/src/org/pjsip/hello/hello.java
- Timestamp:
- Jul 26, 2013 9:16:37 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/jni/pjsip-apps/src/jni/src/org/pjsip/hello/hello.java
r4574 r4575 11 11 class app_config { 12 12 public static int cur_call_id = -1; 13 public static int cur_acc_id = -1; 13 14 } 14 15 … … 83 84 return (app_config.cur_call_id > -1); 84 85 } 85 86 public static void main(String[] args) {86 87 public static int init() { 87 88 int[] tp_id = new int[1]; 88 89 int[] acc_id = new int[1]; 89 int[] call_id = new int[1];90 90 int status; 91 91 … … 98 98 if (status != pjsua.PJ_SUCCESS) { 99 99 System.out.println("Error creating pjsua: " + status); 100 System.exit(status);100 return status; 101 101 } 102 102 } … … 115 115 status = pjsua.init(cfg, log_cfg, null); 116 116 if (status != pjsua.PJ_SUCCESS) { 117 pj_error_exit("Error inintializing pjsua", status); 117 System.out.println("Error initializing pjsua: " + status); 118 return status; 118 119 } 119 120 } … … 126 127 status = pjsua.transport_create(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP, cfg, tp_id); 127 128 if (status != pjsua.PJ_SUCCESS) { 128 pj_error_exit("Error creating transport", status); 129 System.out.println("Error creating transport: " + status); 130 return status; 129 131 } 130 132 } … … 134 136 status = pjsua.acc_add_local(tp_id[0], true, acc_id); 135 137 if (status != pjsua.PJ_SUCCESS) { 136 pj_error_exit("Error creating local UDP account", status); 137 } 138 System.out.println("Error creating local UDP account: " + status); 139 return status; 140 } 141 app_config.cur_acc_id = acc_id[0]; 138 142 } 139 143 … … 142 146 status = pjsua.start(); 143 147 if (status != pjsua.PJ_SUCCESS) { 144 pj_error_exit("Error starting pjsua", status); 145 } 146 } 147 148 /* Make call to the URL. */ 149 if (false) { 150 status = pjsua.call_make_call(acc_id[0], "sip:localhost:6000", null, 0, null, call_id); 151 if (status != pjsua.PJ_SUCCESS) { 152 pj_error_exit("Error making call", status); 153 } 154 app_config.cur_call_id = call_id[0]; 148 System.out.println("Error starting pjsua: " + status); 149 return status; 150 } 155 151 } 156 152 … … 165 161 166 162 pjsua.schedule_timer(timer, tv); 163 } 164 165 return pjsua.PJ_SUCCESS; 166 } 167 168 169 public static void destroy() { 170 pjsua.destroy(); 171 } 172 173 174 public static void main(String[] args) 175 { 176 /* Init pjsua */ 177 int status = init(); 178 if (status != pjsua.PJ_SUCCESS) { 179 pj_error_exit("Failed initializing pjsua", status); 180 } 181 182 /* Make call to the URL. */ 183 if (args.length > 1) { 184 int[] call_id = new int[1]; 185 status = pjsua.call_make_call(app_config.cur_acc_id, args[1], null, 0, null, call_id); 186 if (status != pjsua.PJ_SUCCESS) { 187 pj_error_exit("Error making call", status); 188 } 189 app_config.cur_call_id = call_id[0]; 167 190 } 168 191 … … 221 244 } 222 245 } 223 246 224 247 /* Finally, destroy pjsua */ 225 { 226 pjsua.destroy(); 227 } 228 229 } 230 } 248 destroy(); 249 250 } 251 }
Note: See TracChangeset
for help on using the changeset viewer.