Ignore:
Timestamp:
Feb 19, 2006 3:37:19 PM (18 years ago)
Author:
bennylp
Message:

SIMPLE test with FWD, and added more info in UI

File:
1 edited

Legend:

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

    r184 r201  
    3838     * Print registration status. 
    3939     */ 
    40     if (param->code < 0 || param->code >= 300) { 
     40    if (param->status!=PJ_SUCCESS) { 
     41        pjsua_perror(THIS_FILE, "SIP registration error",  
     42                     param->status); 
     43        pjsua.regc = NULL; 
     44         
     45    } else if (param->code < 0 || param->code >= 300) { 
    4146        PJ_LOG(2, (THIS_FILE, "SIP registration failed, status=%d (%s)",  
    42                    param->code, pjsip_get_status_text(param->code)->ptr)); 
     47                   param->code,  
     48                   pjsip_get_status_text(param->code)->ptr)); 
    4349        pjsua.regc = NULL; 
    4450 
     
    5460    } 
    5561 
     62    pjsua.regc_last_err = param->status; 
    5663    pjsua.regc_last_code = param->code; 
    5764 
     
    6976 
    7077    if (renew) { 
    71         PJ_LOG(3,(THIS_FILE, "Performing SIP registration...")); 
     78        if (pjsua.regc == NULL) { 
     79            status = pjsua_regc_init(); 
     80            if (status != PJ_SUCCESS) { 
     81                pjsua_perror(THIS_FILE, "Unable to create registration",  
     82                             status); 
     83                return; 
     84            } 
     85        } 
    7286        status = pjsip_regc_register(pjsua.regc, 1, &tdata); 
    7387    } else { 
    74         PJ_LOG(3,(THIS_FILE, "Performing SIP unregistration...")); 
     88        if (pjsua.regc == NULL) { 
     89            PJ_LOG(3,(THIS_FILE, "Currently not registered")); 
     90            return; 
     91        } 
    7592        status = pjsip_regc_unregister(pjsua.regc, &tdata); 
    7693    } 
    7794 
     95    if (status == PJ_SUCCESS) 
     96        status = pjsip_regc_send( pjsua.regc, tdata ); 
     97 
    7898    if (status != PJ_SUCCESS) { 
    79         pjsua_perror("Unable to create REGISTER request", status); 
    80         return; 
     99        pjsua_perror(THIS_FILE, "Unable to create/send REGISTER",  
     100                     status); 
     101    } else { 
     102        PJ_LOG(3,(THIS_FILE, "%s sent", 
     103                 (renew? "Registration" : "Unregistration"))); 
    81104    } 
    82  
    83     pjsip_regc_send( pjsua.regc, tdata ); 
    84105} 
    85106 
     
    97118 
    98119        if (status != PJ_SUCCESS) { 
    99             pjsua_perror("Unable to create client registration", status); 
     120            pjsua_perror(THIS_FILE, "Unable to create client registration",  
     121                         status); 
    100122            return status; 
    101123        } 
     
    108130                                  pjsua.reg_timeout); 
    109131        if (status != PJ_SUCCESS) { 
    110             pjsua_perror("Client registration initialization error", status); 
     132            pjsua_perror(THIS_FILE,  
     133                         "Client registration initialization error",  
     134                         status); 
    111135            return status; 
    112136        } 
Note: See TracChangeset for help on using the changeset viewer.