Changeset 492 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
- Timestamp:
- Jun 6, 2006 6:40:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r482 r492 128 128 * Get maximum number of calls configured in pjsua. 129 129 */ 130 PJ_DEF(unsigned) pjsua_ get_max_calls(void)130 PJ_DEF(unsigned) pjsua_call_get_max_count(void) 131 131 { 132 132 return pjsua.config.max_calls; … … 137 137 * Get current number of active calls. 138 138 */ 139 PJ_DEF(unsigned) pjsua_ get_call_count(void)139 PJ_DEF(unsigned) pjsua_call_get_count(void) 140 140 { 141 141 return pjsua.call_cnt; … … 167 167 * Get call info. 168 168 */ 169 PJ_DEF(pj_status_t) pjsua_ get_call_info( unsigned call_index,169 PJ_DEF(pj_status_t) pjsua_call_get_info( unsigned call_index, 170 170 pjsua_call_info *info) 171 171 { … … 213 213 } 214 214 215 info-> cause = call->inv->cause;216 info-> cause_text = *pjsip_get_status_text(info->cause);215 info->last_status = call->last_code; 216 info->last_status_text = *pjsip_get_status_text(info->last_status); 217 217 218 218 info->has_media = (call->session != NULL); … … 226 226 * Duplicate call info. 227 227 */ 228 PJ_DEF(void) pjsua_ dup_call_info( pj_pool_t *pool,228 PJ_DEF(void) pjsua_call_info_dup( pj_pool_t *pool, 229 229 pjsua_call_info *dst_info, 230 230 const pjsua_call_info *src_info) … … 246 246 * Make outgoing call. 247 247 */ 248 PJ_DEF(pj_status_t) pjsua_ make_call(unsigned acc_index,249 250 248 PJ_DEF(pj_status_t) pjsua_call_make_call(unsigned acc_index, 249 const pj_str_t *dest_uri, 250 int *p_call_index) 251 251 { 252 252 pjsip_dialog *dlg = NULL; … … 385 385 * Answer call. 386 386 */ 387 PJ_DEF( void) pjsua_call_answer(int call_index, int code)387 PJ_DEF(pj_status_t) pjsua_call_answer(int call_index, int code) 388 388 { 389 389 pjsip_tx_data *tdata; 390 390 pj_status_t status; 391 391 392 PJ_ASSERT_ ON_FAIL(call_index >= 0 &&392 PJ_ASSERT_RETURN( call_index >= 0 && 393 393 call_index < (int)pjsua.config.max_calls, 394 return);394 PJ_EINVAL); 395 395 396 396 if (pjsua.calls[call_index].inv == NULL) { 397 397 PJ_LOG(3,(THIS_FILE, "Call %d already disconnected")); 398 return ;398 return PJSIP_ESESSIONTERMINATED; 399 399 } 400 400 … … 409 409 status); 410 410 411 return status; 411 412 } 412 413 … … 613 614 } 614 615 616 /* Notify application */ 617 if (pjsua.cb.on_incoming_call) 618 pjsua.cb.on_incoming_call(acc_index, call_index, rdata); 619 620 615 621 /* This INVITE request has been handled. */ 616 622 return PJ_TRUE; … … 636 642 if (call->res_time.sec == 0) 637 643 pj_gettimeofday(&call->res_time); 644 call->last_code = e->body.tsx_state.tsx->status_code; 638 645 break; 639 646 case PJSIP_INV_STATE_CONFIRMED: … … 642 649 case PJSIP_INV_STATE_DISCONNECTED: 643 650 pj_gettimeofday(&call->dis_time); 651 if (e->body.tsx_state.tsx->status_code > call->last_code) { 652 call->last_code = e->body.tsx_state.tsx->status_code; 653 } 644 654 break; 645 655 default: 646 /* Nothing to do. Just to keep gcc from complaining about 647 * unused enums. 648 */ 656 call->last_code = e->body.tsx_state.tsx->status_code; 649 657 break; 650 658 } … … 683 691 break; 684 692 685 default:693 case PJSIP_INV_STATE_INCOMING: 686 694 /* Nothing to do. Just to keep gcc from complaining about 687 695 * unused enums. … … 854 862 /* Now make the outgoing call. */ 855 863 tmp = pj_str(uri); 856 status = pjsua_ make_call(existing_call->acc_index, &tmp, &new_call);864 status = pjsua_call_make_call(existing_call->acc_index, &tmp, &new_call); 857 865 if (status != PJ_SUCCESS) { 858 866 … … 1355 1363 * Put call on-Hold. 1356 1364 */ 1357 PJ_DEF( void) pjsua_call_set_hold(int call_index)1365 PJ_DEF(pj_status_t) pjsua_call_set_hold(int call_index) 1358 1366 { 1359 1367 pjmedia_sdp_session *sdp; … … 1366 1374 if (!call->inv) { 1367 1375 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 1368 return ;1376 return PJSIP_ESESSIONTERMINATED; 1369 1377 } 1370 1378 1371 1379 if (call->inv->state != PJSIP_INV_STATE_CONFIRMED) { 1372 1380 PJ_LOG(3,(THIS_FILE, "Can not hold call that is not confirmed")); 1373 return ;1381 return PJSIP_ESESSIONSTATE; 1374 1382 } 1375 1383 1376 1384 status = create_inactive_sdp(call, &sdp); 1377 1385 if (status != PJ_SUCCESS) 1378 return ;1386 return status; 1379 1387 1380 1388 /* Send re-INVITE with new offer */ … … 1382 1390 if (status != PJ_SUCCESS) { 1383 1391 pjsua_perror(THIS_FILE, "Unable to create re-INVITE", status); 1384 return ;1392 return status; 1385 1393 } 1386 1394 … … 1388 1396 if (status != PJ_SUCCESS) { 1389 1397 pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status); 1390 return; 1391 } 1398 return status; 1399 } 1400 1401 return PJ_SUCCESS; 1392 1402 } 1393 1403 … … 1396 1406 * re-INVITE. 1397 1407 */ 1398 PJ_DEF( void) pjsua_call_reinvite(int call_index)1408 PJ_DEF(pj_status_t) pjsua_call_reinvite(int call_index) 1399 1409 { 1400 1410 pjmedia_sdp_session *sdp; … … 1407 1417 if (!call->inv) { 1408 1418 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 1409 return ;1419 return PJSIP_ESESSIONTERMINATED; 1410 1420 } 1411 1421 … … 1413 1423 if (call->inv->state != PJSIP_INV_STATE_CONFIRMED) { 1414 1424 PJ_LOG(3,(THIS_FILE, "Can not re-INVITE call that is not confirmed")); 1415 return ;1425 return PJSIP_ESESSIONSTATE; 1416 1426 } 1417 1427 … … 1422 1432 pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint", 1423 1433 status); 1424 return ;1434 return status; 1425 1435 } 1426 1436 … … 1429 1439 if (status != PJ_SUCCESS) { 1430 1440 pjsua_perror(THIS_FILE, "Unable to create re-INVITE", status); 1431 return ;1441 return status; 1432 1442 } 1433 1443 … … 1435 1445 if (status != PJ_SUCCESS) { 1436 1446 pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status); 1437 return; 1438 } 1447 return status; 1448 } 1449 1450 return PJ_SUCCESS; 1439 1451 } 1440 1452 … … 1443 1455 * Transfer call. 1444 1456 */ 1445 PJ_DEF( void) pjsua_call_xfer(unsigned call_index, const pj_str_t *dest)1457 PJ_DEF(pj_status_t) pjsua_call_xfer(unsigned call_index, const pj_str_t *dest) 1446 1458 { 1447 1459 pjsip_evsub *sub; … … 1455 1467 if (!call->inv) { 1456 1468 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 1457 return ;1469 return PJSIP_ESESSIONTERMINATED; 1458 1470 } 1459 1471 … … 1465 1477 if (status != PJ_SUCCESS) { 1466 1478 pjsua_perror(THIS_FILE, "Unable to create xfer", status); 1467 return ;1479 return status; 1468 1480 } 1469 1481 … … 1474 1486 if (status != PJ_SUCCESS) { 1475 1487 pjsua_perror(THIS_FILE, "Unable to create REFER request", status); 1476 return ;1488 return status; 1477 1489 } 1478 1490 … … 1481 1493 if (status != PJ_SUCCESS) { 1482 1494 pjsua_perror(THIS_FILE, "Unable to send REFER request", status); 1483 return ;1495 return status; 1484 1496 } 1485 1497 … … 1488 1500 * may want to hold the INVITE, or terminate the invite, or whatever. 1489 1501 */ 1502 1503 return PJ_SUCCESS; 1490 1504 } 1491 1505 … … 1513 1527 * Send instant messaging inside INVITE session. 1514 1528 */ 1515 PJ_DE CL(void) pjsua_call_send_im(int call_index, const pj_str_t *str)1529 PJ_DEF(pj_status_t) pjsua_call_send_im(int call_index, const pj_str_t *str) 1516 1530 { 1517 1531 pjsua_call *call; … … 1525 1539 if (!call->inv) { 1526 1540 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 1527 return ;1541 return PJSIP_ESESSIONTERMINATED; 1528 1542 } 1529 1543 … … 1561 1575 on_return: 1562 1576 pjsip_dlg_dec_lock(call->inv->dlg); 1577 return status; 1563 1578 } 1564 1579 … … 1567 1582 * Send IM typing indication inside INVITE session. 1568 1583 */ 1569 PJ_DECL(void) pjsua_call_typing(int call_index, pj_bool_t is_typing) 1584 PJ_DEF(pj_status_t) pjsua_call_send_typing_ind(int call_index, 1585 pj_bool_t is_typing) 1570 1586 { 1571 1587 pjsua_call *call; … … 1577 1593 if (!call->inv) { 1578 1594 PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 1579 return ;1595 return PJSIP_ESESSIONTERMINATED; 1580 1596 } 1581 1597 … … 1603 1619 1604 1620 on_return: 1605 pjsip_dlg_dec_lock(call->inv->dlg);} 1621 pjsip_dlg_dec_lock(call->inv->dlg); 1622 return status; 1623 } 1606 1624 1607 1625
Note: See TracChangeset
for help on using the changeset viewer.