Changeset 492 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_reg.c
- Timestamp:
- Jun 6, 2006 6:40:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_reg.c
r487 r492 96 96 * Get account info. 97 97 */ 98 PJ_DEF(pj_status_t) pjsua_acc_get_info( unsigned acc_index,98 PJ_DEF(pj_status_t) pjsua_acc_get_info( pjsua_acc_id acc_index, 99 99 pjsua_acc_info *info) 100 100 { … … 102 102 pjsua_acc_config *acc_cfg = &pjsua.config.acc_config[acc_index]; 103 103 104 PJ_ASSERT_RETURN( acc_index < pjsua.config.acc_cnt, PJ_EINVAL);105 104 PJ_ASSERT_RETURN(info != NULL, PJ_EINVAL); 105 106 106 pj_memset(info, 0, sizeof(pjsua_acc_info)); 107 107 108 PJ_ASSERT_RETURN(acc_index < (int)pjsua.config.acc_cnt, 109 PJ_EINVAL); 110 PJ_ASSERT_RETURN(pjsua.acc[acc_index].valid, PJ_EINVALIDOP); 111 112 108 113 info->index = acc_index; 109 114 info->acc_id = acc_cfg->id; … … 115 120 pj_strerror(acc->reg_last_err, info->buf, sizeof(info->buf)); 116 121 info->status_text = pj_str(info->buf); 117 } else {122 } else if (acc->reg_last_code) { 118 123 info->status = acc->reg_last_code; 119 124 info->status_text = *pjsip_get_status_text(acc->reg_last_code); 125 } else { 126 info->status = 0; 127 info->status_text = pj_str("In Progress"); 120 128 } 121 129 … … 130 138 131 139 140 PJ_DEF(pj_status_t) pjsua_acc_enum_info( pjsua_acc_info info[], 141 unsigned *count ) 142 { 143 unsigned i, c; 144 145 for (i=0, c=0; c<*count && i<PJ_ARRAY_SIZE(pjsua.acc); ++i) { 146 if (!pjsua.acc[i].valid) 147 continue; 148 149 pjsua_acc_get_info(i, &info[c]); 150 ++c; 151 } 152 153 *count = c; 154 return PJ_SUCCESS; 155 } 156 157 158 /** 159 * Enum accounts id. 160 */ 161 PJ_DEF(pj_status_t) pjsua_acc_enum_id( pjsua_acc_id ids[], 162 unsigned *count ) 163 { 164 unsigned i, c; 165 166 for (i=0, c=0; c<*count && i<PJ_ARRAY_SIZE(pjsua.acc); ++i) { 167 if (!pjsua.acc[i].valid) 168 continue; 169 ids[c] = i; 170 ++c; 171 } 172 173 *count = c; 174 return PJ_SUCCESS; 175 } 176 177 132 178 /* 133 179 * Update registration. If renew is false, then unregistration will be performed. 134 180 */ 135 PJ_DECL(pj_status_t) pjsua_acc_set_registration(unsigned acc_index, pj_bool_t renew) 181 PJ_DECL(pj_status_t) pjsua_acc_set_registration(pjsua_acc_id acc_index, 182 pj_bool_t renew) 136 183 { 137 184 pj_status_t status = 0; 138 185 pjsip_tx_data *tdata = 0; 186 187 PJ_ASSERT_RETURN(acc_index < (int)pjsua.config.acc_cnt, 188 PJ_EINVAL); 189 PJ_ASSERT_RETURN(pjsua.acc[acc_index].valid, PJ_EINVALIDOP); 139 190 140 191 if (renew) {
Note: See TracChangeset
for help on using the changeset viewer.