Closed ismaiI1 closed 5 years ago
Good point! I will see if this is possible to add
I think, if account registration failed, it should be removed from VSLEndPoint.accounts
. Is't it ? So we can change account name, password or domain and re-send register. Am i wrong?
@invisible66 I've created a PR that would fix this issue in the next release. When there is a "403" error code during the registration it will return a failed through the completion block.
I tried PR codes but it didn't call registrationCompletionBlock
in VSLAccount.m
. I add else statement to if (self.shouldReregister) {
and called registrationCompletionBlock
. is it wrong?
if (code == 0 || (code != PJSIP_SC_FORBIDDEN && accountInfo.expires == -1)) {
self.accountState = VSLAccountStateDisconnected;
if (self.shouldReregister) {
[self registerAccountWithCompletion:^(BOOL success, NSError * _Nullable error) {
if (success) {
VSLLogInfo(@"Account was re-registerd after a sucessfull unregister.");
self.shouldReregister = NO;
[self reinviteActiveCalls];
} else {
VSLLogWarning(@"Unable to re-register account");
self.shouldReregister = NO;
}
}];
} else {
if (self.registrationCompletionBlock) {
VSLLogVerbose(@"Account not registered");
self.registrationCompletionBlock(NO, nil);
self.registrationCompletionBlock = nil;
}
}
self.registrationInProgress = NO;
}
Can you check your sip messages? Or print the output of code
?
code
returns PJSIP_SC_UNAUTHORIZED.
I changed my code as below, and it worked perfectly 👍 Thanks..
.
.
if (code == 0 || (code != PJSIP_SC_FORBIDDEN && code != PJSIP_SC_UNAUTHORIZED && accountInfo.expires == -1)) {
.
.
} else {
self.accountState = VSLAccountStateDisconnected;
if (code == PJSIP_SC_FORBIDDEN || code == PJSIP_SC_UNAUTHORIZED) {
Thanks, i will expand the check for me w wrong password returned a forbidden
Cool, i will create a new version of the Library soon. So this can be added in the next release
The release is made to 3.4.1 so if you update the library it should be there!
Perfect. Thanks :)
Hey, There is a new error i guess :(
If register failed it's working but if i re-send same password, i got Assertion Failed
in pjsua_acc_get_info
- (NSInteger)registrationStatus {
if (self.accountId == PJSUA_INVALID_ID) {
return 0;
}
pjsua_acc_info accountInfo;
pj_status_t status;
status = pjsua_acc_get_info((pjsua_acc_id)self.accountId, &accountInfo);
if (status != PJ_SUCCESS) {
return 0;
}
return accountInfo.status;
}
@redmerloen did you see my above answer?
Yes i have seen it, i will see what is happening soon
@invisible66 Are you using the methods in the VialerSIPLib.h to register an account?
@invisible66 Are you using the methods in the VialerSIPLib.h to register an account?
i guess.. I tried your example project..
This is if (self.accountId == PJSUA_INVALID_ID) {
should catch that assertion error.
PJSUA_INVALID_ID
is -1
but self.accountId = 0
. So i think it can not catch
Can you test this branch feature/invalid-accounts
see if that is fixing anything?
Hey dude congratulations :) It's perfectly working..
Version
3.3.4 ( same in 3.4.0 )
File / Feature
VSLAccount.m
Expected behavior
if username or password invalid, it must return false (i think)
Actual behavior
it returns success when username or password was wrong..
Other info
if registration address isn't valid it's returning error code.