Ignore:
Timestamp:
Apr 15, 2008 10:37:19 AM (16 years ago)
Author:
bennylp
Message:

Use the smart Contact header for TCP/TLS

File:
1 edited

Legend:

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

    r1929 r1931  
    406406    call->res_time.sec = 0; 
    407407 
    408     /* Create suitable Contact header */ 
    409     status = pjsua_acc_create_uac_contact(pjsua_var.pool, &contact, 
    410                                           acc_id, dest_uri); 
    411     if (status != PJ_SUCCESS) { 
    412         pjsua_perror(THIS_FILE, "Unable to generate Contact header", status); 
    413         PJSUA_UNLOCK(); 
    414         return status; 
     408    /* Create suitable Contact header unless a Contact header has been 
     409     * set in the account. 
     410     */ 
     411    if (acc->contact.slen) { 
     412        contact = acc->contact; 
     413    } else { 
     414        status = pjsua_acc_create_uac_contact(pjsua_var.pool, &contact, 
     415                                              acc_id, dest_uri); 
     416        if (status != PJ_SUCCESS) { 
     417            pjsua_perror(THIS_FILE, "Unable to generate Contact header",  
     418                         status); 
     419            PJSUA_UNLOCK(); 
     420            return status; 
     421        } 
    415422    } 
    416423 
     
    788795 
    789796    /* Get suitable Contact header */ 
    790     status = pjsua_acc_create_uas_contact(rdata->tp_info.pool, &contact, 
    791                                           acc_id, rdata); 
    792     if (status != PJ_SUCCESS) { 
    793         pjsua_perror(THIS_FILE, "Unable to generate Contact header", status); 
    794         pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 
    795                                       NULL, NULL); 
    796         pjsua_media_channel_deinit(call->index); 
    797         PJSUA_UNLOCK(); 
    798         return PJ_TRUE; 
     797    if (pjsua_var.acc[acc_id].contact.slen) { 
     798        contact = pjsua_var.acc[acc_id].contact; 
     799    } else { 
     800        status = pjsua_acc_create_uas_contact(rdata->tp_info.pool, &contact, 
     801                                              acc_id, rdata); 
     802        if (status != PJ_SUCCESS) { 
     803            pjsua_perror(THIS_FILE, "Unable to generate Contact header",  
     804                         status); 
     805            pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 
     806                                          NULL, NULL); 
     807            pjsua_media_channel_deinit(call->index); 
     808            PJSUA_UNLOCK(); 
     809            return PJ_TRUE; 
     810        } 
    799811    } 
    800812 
Note: See TracChangeset for help on using the changeset viewer.