Changeset 247


Ignore:
Timestamp:
Feb 27, 2006 11:54:23 PM (18 years ago)
Author:
bennylp
Message:

Fixed bug in conference instantiation when max-ports is not properly set

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r238 r247  
    420420static int PJ_THREAD_FUNC pjsua_poll(void *arg) 
    421421{ 
     422    pj_status_t last_err = 0; 
     423 
    422424    PJ_UNUSED_ARG(arg); 
    423425 
    424426    do { 
    425427        pj_time_val timeout = { 0, 10 }; 
    426         pjsip_endpt_handle_events (pjsua.endpt, &timeout); 
     428        pj_status_t status; 
     429         
     430        status = pjsip_endpt_handle_events (pjsua.endpt, &timeout); 
     431        if (status != last_err) { 
     432            last_err = status; 
     433            pjsua_perror(THIS_FILE, "handle_events() returned error", status); 
     434        } 
    427435    } while (!pjsua.quit_flag); 
    428436 
     
    508516        return status; 
    509517    } 
     518 
     519    /* Init pjmedia-codecs: */ 
     520 
     521    status = pjmedia_codec_init(pjsua.med_endpt); 
     522    if (status != PJ_SUCCESS) { 
     523        pj_caching_pool_destroy(&pjsua.cp); 
     524        pjsua_perror(THIS_FILE,  
     525                     "Media codec initialization has returned error",  
     526                     status); 
     527        return status; 
     528    } 
     529 
     530 
     531    /* Done. */ 
     532    return PJ_SUCCESS; 
     533} 
     534 
     535 
     536/* 
     537 * Find account for incoming request. 
     538 */ 
     539int pjsua_find_account_for_incoming(pjsip_rx_data *rdata) 
     540{ 
     541    pjsip_uri *uri; 
     542    pjsip_sip_uri *sip_uri; 
     543    int acc_index; 
     544 
     545    uri = rdata->msg_info.to->uri; 
     546 
     547    /* Just return account #0 if To URI is not SIP: */ 
     548    if (!PJSIP_URI_SCHEME_IS_SIP(uri) &&  
     549        !PJSIP_URI_SCHEME_IS_SIPS(uri))  
     550    { 
     551        return 0; 
     552    } 
     553 
     554 
     555    sip_uri = (pjsip_sip_uri*)pjsip_uri_get_uri(uri); 
     556 
     557    /* Find account which has matching username and domain. */ 
     558    for (acc_index=0; acc_index < pjsua.acc_cnt; ++acc_index) { 
     559 
     560        pjsua_acc *acc = &pjsua.acc[acc_index]; 
     561 
     562        if (pj_stricmp(&acc->user_part, &sip_uri->user)==0 && 
     563            pj_stricmp(&acc->host_part, &sip_uri->host)==0)  
     564        { 
     565            /* Match ! */ 
     566            return acc_index; 
     567        } 
     568    } 
     569 
     570    /* No matching, try match domain part only. */ 
     571    for (acc_index=0; acc_index < pjsua.acc_cnt; ++acc_index) { 
     572 
     573        pjsua_acc *acc = &pjsua.acc[acc_index]; 
     574 
     575        if (pj_stricmp(&acc->host_part, &sip_uri->host)==0) { 
     576            /* Match ! */ 
     577            return acc_index; 
     578        } 
     579    } 
     580 
     581    /* Still no match, just return account #0 */ 
     582    return 0; 
     583} 
     584 
     585 
     586/* 
     587 * Find account for outgoing request. 
     588 */ 
     589int pjsua_find_account_for_outgoing(const pj_str_t *url) 
     590{ 
     591    PJ_UNUSED_ARG(url); 
     592 
     593    /* Just use account #0 */ 
     594    return 0; 
     595} 
     596 
     597 
     598/* 
     599 * Start pjsua stack. 
     600 * This will start the registration process, if registration is configured. 
     601 */ 
     602pj_status_t pjsua_start(void) 
     603{ 
     604    int i;  /* Must be signed */ 
     605    pjsip_transport *udp_transport; 
     606    pj_status_t status = PJ_SUCCESS; 
    510607 
    511608    /* Init conference bridge. */ 
     
    521618        return status; 
    522619    } 
    523  
    524     /* Init pjmedia-codecs: */ 
    525  
    526     status = pjmedia_codec_init(pjsua.med_endpt); 
    527     if (status != PJ_SUCCESS) { 
    528         pj_caching_pool_destroy(&pjsua.cp); 
    529         pjsua_perror(THIS_FILE,  
    530                      "Media codec initialization has returned error",  
    531                      status); 
    532         return status; 
    533     } 
    534  
    535  
    536     /* Done. */ 
    537     return PJ_SUCCESS; 
    538 } 
    539  
    540  
    541 /* 
    542  * Find account for incoming request. 
    543  */ 
    544 int pjsua_find_account_for_incoming(pjsip_rx_data *rdata) 
    545 { 
    546     pjsip_uri *uri; 
    547     pjsip_sip_uri *sip_uri; 
    548     int acc_index; 
    549  
    550     uri = rdata->msg_info.to->uri; 
    551  
    552     /* Just return account #0 if To URI is not SIP: */ 
    553     if (!PJSIP_URI_SCHEME_IS_SIP(uri) &&  
    554         !PJSIP_URI_SCHEME_IS_SIPS(uri))  
    555     { 
    556         return 0; 
    557     } 
    558  
    559  
    560     sip_uri = (pjsip_sip_uri*)pjsip_uri_get_uri(uri); 
    561  
    562     /* Find account which has matching username and domain. */ 
    563     for (acc_index=0; acc_index < pjsua.acc_cnt; ++acc_index) { 
    564  
    565         pjsua_acc *acc = &pjsua.acc[acc_index]; 
    566  
    567         if (pj_stricmp(&acc->user_part, &sip_uri->user)==0 && 
    568             pj_stricmp(&acc->host_part, &sip_uri->host)==0)  
    569         { 
    570             /* Match ! */ 
    571             return acc_index; 
    572         } 
    573     } 
    574  
    575     /* No matching, try match domain part only. */ 
    576     for (acc_index=0; acc_index < pjsua.acc_cnt; ++acc_index) { 
    577  
    578         pjsua_acc *acc = &pjsua.acc[acc_index]; 
    579  
    580         if (pj_stricmp(&acc->host_part, &sip_uri->host)==0) { 
    581             /* Match ! */ 
    582             return acc_index; 
    583         } 
    584     } 
    585  
    586     /* Still no match, just return account #0 */ 
    587     return 0; 
    588 } 
    589  
    590  
    591 /* 
    592  * Find account for outgoing request. 
    593  */ 
    594 int pjsua_find_account_for_outgoing(const pj_str_t *url) 
    595 { 
    596     PJ_UNUSED_ARG(url); 
    597  
    598     /* Just use account #0 */ 
    599     return 0; 
    600 } 
    601  
    602  
    603 /* 
    604  * Start pjsua stack. 
    605  * This will start the registration process, if registration is configured. 
    606  */ 
    607 pj_status_t pjsua_start(void) 
    608 { 
    609     int i;  /* Must be signed */ 
    610     pjsip_transport *udp_transport; 
    611     pj_status_t status = PJ_SUCCESS; 
    612620 
    613621    /* Create WAV file player if required: */ 
Note: See TracChangeset for help on using the changeset viewer.