Changeset 1931


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

Use the smart Contact header for TCP/TLS

Location:
pjproject/trunk/pjsip/src/pjsua-lib
Files:
3 edited

Legend:

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

    r1929 r1931  
    572572        pjsip_regc_destroy(acc->regc); 
    573573        acc->regc = NULL; 
     574        acc->contact.slen = 0; 
    574575    } 
    575576 
     
    860861        pjsip_regc_destroy(acc->regc); 
    861862        acc->regc = NULL; 
     863        acc->contact.slen = 0; 
    862864         
    863865        /* Stop keep-alive timer if any. */ 
     
    870872        pjsip_regc_destroy(acc->regc); 
    871873        acc->regc = NULL; 
     874        acc->contact.slen = 0; 
    872875 
    873876        /* Stop keep-alive timer if any. */ 
     
    879882            pjsip_regc_destroy(acc->regc); 
    880883            acc->regc = NULL; 
     884            acc->contact.slen = 0; 
    881885 
    882886            /* Stop keep-alive timer if any. */ 
     
    947951        pjsip_regc_destroy(acc->regc); 
    948952        acc->regc = NULL; 
     953        acc->contact.slen = 0; 
    949954    } 
    950955 
     
    993998        pj_pool_release(pool); 
    994999        acc->regc = NULL; 
     1000        acc->contact.slen = 0; 
    9951001        return status; 
    9961002    } 
  • 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 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c

    r1569 r1931  
    553553     
    554554    /* Create suitable Contact header */ 
    555     status = pjsua_acc_create_uas_contact(rdata->tp_info.pool, &contact, 
    556                                           acc_id, rdata); 
    557     if (status != PJ_SUCCESS) { 
    558         pjsua_perror(THIS_FILE, "Unable to generate Contact header", status); 
    559         PJSUA_UNLOCK(); 
    560         return PJ_TRUE; 
     555    if (acc->contact.slen) { 
     556        contact = acc->contact; 
     557    } else { 
     558        status = pjsua_acc_create_uas_contact(rdata->tp_info.pool, &contact, 
     559                                              acc_id, rdata); 
     560        if (status != PJ_SUCCESS) { 
     561            pjsua_perror(THIS_FILE, "Unable to generate Contact header",  
     562                         status); 
     563            PJSUA_UNLOCK(); 
     564            return PJ_TRUE; 
     565        } 
    561566    } 
    562567 
     
    11241129                         acc_id, index)); 
    11251130 
    1126     /* Generate suitable Contact header */ 
    1127     status = pjsua_acc_create_uac_contact(pjsua_var.pool, &contact, 
    1128                                           acc_id, &buddy->uri); 
    1129     if (status != PJ_SUCCESS) { 
    1130         pjsua_perror(THIS_FILE, "Unable to generate Contact header", status); 
    1131         return; 
     1131    /* Generate suitable Contact header unless one is already set in 
     1132     * the account 
     1133     */ 
     1134    if (acc->contact.slen) { 
     1135        contact = acc->contact; 
     1136    } else { 
     1137        status = pjsua_acc_create_uac_contact(pjsua_var.pool, &contact, 
     1138                                              acc_id, &buddy->uri); 
     1139        if (status != PJ_SUCCESS) { 
     1140            pjsua_perror(THIS_FILE, "Unable to generate Contact header",  
     1141                         status); 
     1142            return; 
     1143        } 
    11321144    } 
    11331145 
Note: See TracChangeset for help on using the changeset viewer.