Changeset 1930


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

Use the smart Contact header for TCP/TLS

Location:
pjproject/branches/projects/ice-turn07/pjsip/src/pjsua-lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/ice-turn07/pjsip/src/pjsua-lib/pjsua_acc.c

    r1908 r1930  
    566566        pjsip_regc_destroy(acc->regc); 
    567567        acc->regc = NULL; 
     568        acc->contact.slen = 0; 
    568569    } 
    569570 
     
    854855        pjsip_regc_destroy(acc->regc); 
    855856        acc->regc = NULL; 
     857        acc->contact.slen = 0; 
    856858         
    857859        /* Stop keep-alive timer if any. */ 
     
    864866        pjsip_regc_destroy(acc->regc); 
    865867        acc->regc = NULL; 
     868        acc->contact.slen = 0; 
    866869 
    867870        /* Stop keep-alive timer if any. */ 
     
    873876            pjsip_regc_destroy(acc->regc); 
    874877            acc->regc = NULL; 
     878            acc->contact.slen = 0; 
    875879 
    876880            /* Stop keep-alive timer if any. */ 
     
    941945        pjsip_regc_destroy(acc->regc); 
    942946        acc->regc = NULL; 
     947        acc->contact.slen = 0; 
    943948    } 
    944949 
     
    987992        pj_pool_release(pool); 
    988993        acc->regc = NULL; 
     994        acc->contact.slen = 0; 
    989995        return status; 
    990996    } 
  • pjproject/branches/projects/ice-turn07/pjsip/src/pjsua-lib/pjsua_call.c

    r1912 r1930  
    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/branches/projects/ice-turn07/pjsip/src/pjsua-lib/pjsua_pres.c

    r1569 r1930  
    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.