Changeset 1717 for pjproject/trunk
- Timestamp:
- Jan 19, 2008 1:01:42 PM (17 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r1591 r1717 216 216 unsigned call_cnt; /**< Call counter. */ 217 217 pjsua_call calls[PJSUA_MAX_CALLS];/**< Calls array. */ 218 pjsua_call_id next_call_id; /**< Next call id to use*/ 218 219 219 220 /* Buddy; */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r1693 r1717 215 215 #define LATE_SDP 0 216 216 217 /* Allocate one call id */ 218 static pjsua_call_id alloc_call_id(void) 219 { 220 pjsua_call_id cid; 221 222 #if 1 223 /* New algorithm: round-robin */ 224 if (pjsua_var.next_call_id >= (int)pjsua_var.ua_cfg.max_calls || 225 pjsua_var.next_call_id < 0) 226 { 227 cid = 0; 228 } 229 230 for (cid=pjsua_var.next_call_id; 231 cid<(int)pjsua_var.ua_cfg.max_calls; 232 ++cid) 233 { 234 if (pjsua_var.calls[cid].inv == NULL) { 235 ++pjsua_var.next_call_id; 236 return cid; 237 } 238 } 239 240 for (cid=0; cid < pjsua_var.next_call_id; ++cid) { 241 if (pjsua_var.calls[cid].inv == NULL) { 242 ++pjsua_var.next_call_id; 243 return cid; 244 } 245 } 246 247 #else 248 /* Old algorithm */ 249 for (cid=0; cid<(int)pjsua_var.ua_cfg.max_calls; ++cid) { 250 if (pjsua_var.calls[cid].inv == NULL) 251 return cid; 252 } 253 #endif 254 255 return PJSUA_INVALID_ID; 256 } 257 217 258 /* 218 259 * Make outgoing call to the specified URI using the specified account. … … 254 295 255 296 /* Find free call slot. */ 256 for (call_id=0; call_id<(int)pjsua_var.ua_cfg.max_calls; ++call_id) { 257 if (pjsua_var.calls[call_id].inv == NULL) 258 break; 259 } 260 261 if (call_id == (int)pjsua_var.ua_cfg.max_calls) { 297 call_id = alloc_call_id(); 298 299 if (call_id == PJSUA_INVALID_ID) { 262 300 pjsua_perror(THIS_FILE, "Error making file", PJ_ETOOMANY); 263 301 PJSUA_UNLOCK(); … … 498 536 499 537 /* Find free call slot. */ 500 for (call_id=0; call_id<(int)pjsua_var.ua_cfg.max_calls; ++call_id) { 501 if (pjsua_var.calls[call_id].inv == NULL) 502 break; 503 } 504 505 if (call_id == (int)pjsua_var.ua_cfg.max_calls) { 538 call_id = alloc_call_id(); 539 540 if (call_id == PJSUA_INVALID_ID) { 506 541 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 507 542 PJSIP_SC_BUSY_HERE, NULL,
Note: See TracChangeset
for help on using the changeset viewer.