Changeset 226


Ignore:
Timestamp:
Feb 23, 2006 6:03:29 PM (18 years ago)
Author:
bennylp
Message:

Fixed crashed bugs when session dissapers while pjsua is waiting for keyboard in

Location:
pjproject/trunk/pjsip/src/pjsua
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua/main.c

    r222 r226  
    345345                    continue; 
    346346 
     347                /* 
     348                 * Must check again! 
     349                 * Call may have been disconnected while we're waiting for  
     350                 * keyboard input. 
     351                 */ 
     352                if (inv_session == &pjsua.inv_list) { 
     353                    puts("Call has been disconnected"); 
     354                    fflush(stdout); 
     355                    continue; 
     356                } 
     357 
    347358                status = pjsip_inv_answer(inv_session->inv, atoi(buf),  
    348359                                          NULL, NULL, &tdata); 
     
    440451 
    441452            } else { 
     453                struct pjsua_inv_data *cur = inv_session; 
     454 
    442455                ui_input_url("Transfer to URL", buf, sizeof(buf), &result); 
     456 
     457                /* Check if call is still there. */ 
     458 
     459                if (cur != inv_session) { 
     460                    puts("Call has been disconnected"); 
     461                    continue; 
     462                } 
     463 
    443464                if (result.nb_result != NO_NB) { 
    444465                    if (result.nb_result == -1)  
     
    468489            } else { 
    469490                pj_str_t digits; 
     491                struct pjsua_inv_data *cur = inv_session; 
    470492                pj_status_t status; 
    471493 
    472494                if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,  
    473495                                  sizeof(buf))) 
     496                { 
    474497                        break; 
     498                } 
     499 
     500                if (cur != inv_session) { 
     501                    puts("Call has been disconnected"); 
     502                    continue; 
     503                } 
    475504 
    476505                digits = pj_str(buf); 
  • pjproject/trunk/pjsip/src/pjsua/pjsua_inv.c

    r223 r226  
    122122 
    123123 
     124    /* Add invite session to the list. */ 
     125     
     126    pj_list_push_back(&pjsua.inv_list, inv_data); 
     127 
     128 
    124129    /* Send initial INVITE: */ 
    125130 
    126131    status = pjsip_inv_send_msg(inv, tdata, NULL); 
    127132    if (status != PJ_SUCCESS) { 
     133        /* 
     134         * Note: 
     135         *  inv_data will be removed from the list in the callback 
     136         */ 
    128137        pjsua_perror(THIS_FILE, "Unable to send initial INVITE request",  
    129138                     status); 
    130139        goto on_error; 
    131140    } 
    132  
    133     /* Add invite session to the list. */ 
    134      
    135     pj_list_push_back(&pjsua.inv_list, inv_data); 
    136141 
    137142 
Note: See TracChangeset for help on using the changeset viewer.