Ignore:
Timestamp:
Feb 7, 2006 6:48:01 PM (18 years ago)
Author:
bennylp
Message:

Tested initial implementation: basic UAC, client registration, authentication, etc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r139 r141  
    21962196 
    21972197    } else if (tsx->status_code >= 300 && tsx->status_code <= 699) { 
     2198 
     2199 
     2200#if 0 
     2201        /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ 
     2202        /* 
     2203         * This is the old code; it's broken for authentication. 
     2204         */ 
    21982205        pj_time_val timeout; 
    21992206        pj_status_t status; 
     
    22432250        tsx_set_state( tsx, PJSIP_TSX_STATE_COMPLETED,  
    22442251                       PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata ); 
     2252 
     2253        /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ 
     2254#endif 
     2255 
     2256        /* New code, taken from 0.2.9.x branch */ 
     2257        pj_time_val timeout; 
     2258        pjsip_tx_data *ack_tdata = NULL; 
     2259 
     2260        /* Stop timer B. */ 
     2261        pjsip_endpt_cancel_timer( tsx->endpt, &tsx->timeout_timer ); 
     2262 
     2263        /* Generate ACK now (for INVITE) but send it later because 
     2264         * dialog need to use last_tx. 
     2265         */ 
     2266        if (tsx->method.id == PJSIP_INVITE_METHOD) { 
     2267            pj_status_t status; 
     2268 
     2269            status = pjsip_endpt_create_ack( tsx->endpt, tsx->last_tx,  
     2270                                             event->body.rx_msg.rdata, 
     2271                                             &ack_tdata); 
     2272            if (status != PJ_SUCCESS) 
     2273                return status; 
     2274        } 
     2275 
     2276        /* Inform TU. */ 
     2277        tsx_set_state( tsx, PJSIP_TSX_STATE_COMPLETED,  
     2278                       PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata); 
     2279 
     2280        /* Generate and send ACK for INVITE. */ 
     2281        if (tsx->method.id == PJSIP_INVITE_METHOD) { 
     2282            pj_status_t status; 
     2283 
     2284            status = tsx_send_msg( tsx, ack_tdata); 
     2285 
     2286            if (ack_tdata != tsx->last_tx) { 
     2287                pjsip_tx_data_dec_ref(tsx->last_tx); 
     2288                tsx->last_tx = ack_tdata; 
     2289                pjsip_tx_data_add_ref(ack_tdata); 
     2290            } 
     2291 
     2292            if (status != PJ_SUCCESS) { 
     2293                return status; 
     2294            } 
     2295        } 
     2296 
     2297        /* Start Timer D with TD/T4 timer if unreliable transport is used. */ 
     2298        if (PJSIP_TRANSPORT_IS_RELIABLE(tsx->transport) == 0) { 
     2299            if (tsx->method.id == PJSIP_INVITE_METHOD) { 
     2300                timeout = td_timer_val; 
     2301            } else { 
     2302                timeout = t4_timer_val; 
     2303            } 
     2304        } else { 
     2305            timeout.sec = timeout.msec = 0; 
     2306        } 
     2307        pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, &timeout); 
    22452308 
    22462309    } else { 
Note: See TracChangeset for help on using the changeset viewer.