Changeset 847


Ignore:
Timestamp:
Dec 7, 2006 10:09:16 AM (17 years ago)
Author:
bennylp
Message:

Fixed ticket #38: misleading error message when destination URI is not valid when making outgoing call

File:
1 edited

Legend:

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

    r831 r847  
    219219    PJ_ASSERT_RETURN(options == 0, PJ_EINVAL); 
    220220 
     221    /* Check arguments */ 
     222    PJ_ASSERT_RETURN(dest_uri, PJ_EINVAL); 
     223 
    221224    PJSUA_LOCK(); 
    222225 
     
    242245 
    243246    call = &pjsua_var.calls[call_id]; 
     247 
     248    /* Verify that destination URI is valid before calling  
     249     * pjsua_acc_create_uac_contact, or otherwise there   
     250     * a misleading "Invalid Contact URI" error will be printed 
     251     * when pjsua_acc_create_uac_contact() fails. 
     252     */ 
     253    if (1) { 
     254        pj_pool_t *pool; 
     255        pjsip_uri *uri; 
     256        pj_str_t dup; 
     257 
     258        pool = pjsua_pool_create("tmp-uri", 4000, 4000); 
     259        if (!pool) { 
     260            pjsua_perror(THIS_FILE, "Unable to create pool", PJ_ENOMEM); 
     261            PJSUA_UNLOCK(); 
     262            return PJ_ENOMEM; 
     263        } 
     264         
     265        pj_strdup_with_null(pool, &dup, dest_uri); 
     266        uri = pjsip_parse_uri(pool, dup.ptr, dup.slen, 0); 
     267        pj_pool_release(pool); 
     268 
     269        if (uri == NULL) { 
     270            pjsua_perror(THIS_FILE, "Unable to make call",  
     271                         PJSIP_EINVALIDREQURI); 
     272            PJSUA_UNLOCK(); 
     273            return PJSIP_EINVALIDREQURI; 
     274        } 
     275    } 
    244276 
    245277    PJ_LOG(4,(THIS_FILE, "Making call with acc #%d to %.*s", acc_id, 
Note: See TracChangeset for help on using the changeset viewer.