Changeset 4185 for pjproject


Ignore:
Timestamp:
Jun 28, 2012 2:16:05 PM (12 years ago)
Author:
ming
Message:

Re #1537: Modify NAT detection to no longer update the transport address.

File:
1 edited

Legend:

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

    r4181 r4185  
    13421342    tp = param->rdata->tp_info.transport; 
    13431343 
    1344     /* If allow_via_rewrite is enabled, we save the Via "sent-by" address 
     1344    /* Get the received and rport info */ 
     1345    via = param->rdata->msg_info.via; 
     1346    if (via->rport_param < 1) { 
     1347        /* Remote doesn't support rport */ 
     1348        rport = via->sent_by.port; 
     1349        if (rport==0) { 
     1350            pjsip_transport_type_e tp_type; 
     1351            tp_type = (pjsip_transport_type_e) tp->key.type; 
     1352            rport = pjsip_transport_get_default_port_for_type(tp_type); 
     1353        } 
     1354    } else 
     1355        rport = via->rport_param; 
     1356 
     1357    if (via->recvd_param.slen != 0) 
     1358        via_addr = &via->recvd_param; 
     1359    else 
     1360        via_addr = &via->sent_by.host; 
     1361 
     1362    /* If allow_via_rewrite is enabled, we save the Via "received" address 
    13451363     * from the response. 
    13461364     */ 
     
    13481366        (acc->via_addr.host.slen == 0 || acc->via_tp != tp)) 
    13491367    { 
    1350         via = param->rdata->msg_info.via; 
    1351         if (pj_strcmp(&acc->via_addr.host, &via->sent_by.host)) 
    1352             pj_strdup(acc->pool, &acc->via_addr.host, &via->sent_by.host); 
    1353         acc->via_addr.port = via->sent_by.port; 
     1368        if (pj_strcmp(&acc->via_addr.host, via_addr)) 
     1369            pj_strdup(acc->pool, &acc->via_addr.host, via_addr); 
     1370        acc->via_addr.port = rport; 
    13541371        acc->via_tp = tp; 
    13551372        pjsip_regc_set_via_sent_by(acc->regc, &acc->via_addr, acc->via_tp); 
     
    13891406    } 
    13901407#endif 
    1391  
    1392     /* Get the received and rport info */ 
    1393     via = param->rdata->msg_info.via; 
    1394     if (via->rport_param < 1) { 
    1395         /* Remote doesn't support rport */ 
    1396         rport = via->sent_by.port; 
    1397         if (rport==0) { 
    1398             pjsip_transport_type_e tp_type; 
    1399             tp_type = (pjsip_transport_type_e) tp->key.type; 
    1400             rport = pjsip_transport_get_default_port_for_type(tp_type); 
    1401         } 
    1402     } else 
    1403         rport = via->rport_param; 
    1404  
    1405     if (via->recvd_param.slen != 0) 
    1406         via_addr = &via->recvd_param; 
    1407     else 
    1408         via_addr = &via->sent_by.host; 
    14091408 
    14101409    /* Compare received and rport with the URI in our registration */ 
     
    15541553 
    15551554        /* Always update, by http://trac.pjsip.org/repos/ticket/864. */ 
     1555        /* Since the Via address will now be overwritten to the correct 
     1556         * address by https://trac.pjsip.org/repos/ticket/1537, we do 
     1557         * not need to update the transport address. 
     1558         */ 
     1559        /* 
    15561560        pj_strdup_with_null(tp->pool, &tp->local_name.host, via_addr); 
    15571561        tp->local_name.port = rport; 
     1562         */ 
    15581563 
    15591564    } 
Note: See TracChangeset for help on using the changeset viewer.