Changeset 201 for pjproject/trunk/pjsip/src/pjsua/pjsua_reg.c
- Timestamp:
- Feb 19, 2006 3:37:19 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua/pjsua_reg.c
r184 r201 38 38 * Print registration status. 39 39 */ 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) { 41 46 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)); 43 49 pjsua.regc = NULL; 44 50 … … 54 60 } 55 61 62 pjsua.regc_last_err = param->status; 56 63 pjsua.regc_last_code = param->code; 57 64 … … 69 76 70 77 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 } 72 86 status = pjsip_regc_register(pjsua.regc, 1, &tdata); 73 87 } 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 } 75 92 status = pjsip_regc_unregister(pjsua.regc, &tdata); 76 93 } 77 94 95 if (status == PJ_SUCCESS) 96 status = pjsip_regc_send( pjsua.regc, tdata ); 97 78 98 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"))); 81 104 } 82 83 pjsip_regc_send( pjsua.regc, tdata );84 105 } 85 106 … … 97 118 98 119 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); 100 122 return status; 101 123 } … … 108 130 pjsua.reg_timeout); 109 131 if (status != PJ_SUCCESS) { 110 pjsua_perror("Client registration initialization error", status); 132 pjsua_perror(THIS_FILE, 133 "Client registration initialization error", 134 status); 111 135 return status; 112 136 }
Note: See TracChangeset
for help on using the changeset viewer.