Changeset 4576 for pjproject/branches/projects/jni/pjsip-apps/src/jni/src/org/pjsip/hello/hello.java
- Timestamp:
- Jul 26, 2013 2:20:15 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/jni/pjsip-apps/src/jni/src/org/pjsip/hello/hello.java
r4575 r4576 12 12 public static int cur_call_id = -1; 13 13 public static int cur_acc_id = -1; 14 15 public static int sip_port = 6000; 16 17 public static boolean is_reg = true; 18 public static String user = "301"; 19 public static String pwd = "pw301"; 20 public static String domain = "pjsip.org"; 21 public static String proxy[] = { "sip:sip.pjsip.org;transport=tcp" }; 14 22 } 15 23 … … 124 132 pjsua_transport_config cfg = new pjsua_transport_config(); 125 133 pjsua.transport_config_default(cfg); 126 cfg.setPort( 6000);134 cfg.setPort(app_config.sip_port); 127 135 status = pjsua.transport_create(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP, cfg, tp_id); 128 136 if (status != pjsua.PJ_SUCCESS) { … … 132 140 } 133 141 134 /* Add local account */142 /* Add UDP local account */ 135 143 { 136 144 status = pjsua.acc_add_local(tp_id[0], true, acc_id); … … 140 148 } 141 149 app_config.cur_acc_id = acc_id[0]; 150 } 151 152 /* Add SIP TCP transport */ 153 { 154 pjsua_transport_config cfg = new pjsua_transport_config(); 155 pjsua.transport_config_default(cfg); 156 cfg.setPort(app_config.sip_port); 157 status = pjsua.transport_create(pjsip_transport_type_e.PJSIP_TRANSPORT_TCP, cfg, tp_id); 158 if (status != pjsua.PJ_SUCCESS) { 159 System.out.println("Error creating transport: " + status); 160 return status; 161 } 162 } 163 164 /* Add TCP local account */ 165 { 166 status = pjsua.acc_add_local(tp_id[0], true, acc_id); 167 if (status != pjsua.PJ_SUCCESS) { 168 System.out.println("Error creating local UDP account: " + status); 169 return status; 170 } 171 app_config.cur_acc_id = acc_id[0]; 172 } 173 174 /* Add registered account */ 175 if (app_config.is_reg) { 176 pjsip_cred_info [] cred_info = { new pjsip_cred_info() }; 177 cred_info[0].setUsername(app_config.user); 178 cred_info[0].setData_type(0); 179 cred_info[0].setData(app_config.pwd); 180 cred_info[0].setRealm("*"); 181 cred_info[0].setScheme("Digest"); 182 183 pjsua_acc_config acc_cfg = new pjsua_acc_config(); 184 pjsua.acc_config_default(acc_cfg); 185 acc_cfg.setId("sip:" + app_config.user + "@" + app_config.domain); 186 acc_cfg.setCred_info(cred_info); 187 acc_cfg.setReg_uri("sip:" + app_config.domain); 188 acc_cfg.setProxy(app_config.proxy); 189 190 status = pjsua.acc_add(acc_cfg, true, acc_id); 191 if (status != pjsua.PJ_SUCCESS) { 192 System.out.println("Error creating account " + acc_cfg.getId() + ": " + status); 193 return status; 194 } 195 app_config.cur_acc_id = acc_id[0]; 142 196 } 143 197
Note: See TracChangeset
for help on using the changeset viewer.