Changeset 1104 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- Mar 25, 2007 6:44:51 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r1099 r1104 554 554 { 555 555 unsigned i; 556 pj_sockaddr_in addr; 556 557 pj_status_t status; 558 559 pj_sockaddr_in_init(&addr, 0, (pj_uint16_t)cfg->port); 557 560 558 561 /* Create each media transport */ 559 562 for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { 560 pj_ice_st *ice_st; 563 pj_ice_st_comp comp; 564 int next_port; 561 565 562 566 status = pjmedia_ice_create(pjsua_var.med_endpt, NULL, 1, … … 569 573 } 570 574 571 ice_st = pjmedia_ice_get_ice_st(pjsua_var.calls[i].med_tp); 572 573 /* Add host candidates for RTP */ 574 status = pj_ice_st_add_all_host_interfaces(ice_st, 1, 0); 575 status = pjmedia_ice_start_init(pjsua_var.calls[i].med_tp, 0, &addr, 576 &pjsua_var.stun_srv.ipv4, NULL); 575 577 if (status != PJ_SUCCESS) { 576 pjsua_perror(THIS_FILE, "Error adding ICE host candidates",578 pjsua_perror(THIS_FILE, "Error starting ICE transport", 577 579 status); 578 580 goto on_error; 579 581 } 580 582 581 /* Configure STUN server */ 582 if (pjsua_var.stun_srv.addr.sa_family != 0) { 583 584 status = pj_ice_st_set_stun_addr(ice_st, 585 pjsua_var.media_cfg.enable_relay, 586 &pjsua_var.stun_srv.ipv4); 587 if (status != PJ_SUCCESS) { 588 pjsua_perror(THIS_FILE, "Error setting ICE's STUN server", 589 status); 590 goto on_error; 591 } 592 593 /* Add STUN server reflexive candidate for RTP */ 594 status = pj_ice_st_add_stun_interface(ice_st, 1, 0, NULL); 595 if (status != PJ_SUCCESS) { 596 pjsua_perror(THIS_FILE, "Error adding ICE address", 597 status); 598 goto on_error; 599 } 600 } 583 pjmedia_ice_get_comp(pjsua_var.calls[i].med_tp, 1, &comp); 584 next_port = pj_ntohs(comp.local_addr.ipv4.sin_port); 585 next_port += 2; 586 addr.sin_port = pj_htons((pj_uint16_t)next_port); 601 587 } 602 588 603 589 /* Wait until all ICE transports are ready */ 604 590 for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { 605 pj_ice_st *ice_st;606 607 ice_st = pjmedia_ice_get_ice_st(pjsua_var.calls[i].med_tp);608 591 609 592 /* Wait until interface status is PJ_SUCCESS */ 610 593 for (;;) { 611 status = pj _ice_st_get_interfaces_status(ice_st);594 status = pjmedia_ice_get_init_status(pjsua_var.calls[i].med_tp); 612 595 if (status == PJ_EPENDING) 613 596 pjsua_handle_events(100);
Note: See TracChangeset
for help on using the changeset viewer.