BelledonneCommunications / linphone-iphone

Linphone is a free VoIP and video softphone based on the SIP protocol. Mirror of linphone-iphone (git://git.linphone.org/linphone-iphone.git)
http://linphone.org
GNU General Public License v3.0
588 stars 355 forks source link

Can't Create TLS Account. Really old and serious problem. (Can't normal use app!) #698

Closed Kellendros007 closed 2 weeks ago

Kellendros007 commented 4 years ago

Bug info

App crash after add custom TLS Sip Account and can't start after reopen after that. (App can open only after reinstall) This problem block normal app use.

Steps to reproduce:

  1. Install latest app from store or build from source (try only on clear app, .
  2. Allow: Notification, Camera, Contacts. Not allow: Photo. (I think if you allow photo it does not resolve a problem).
  3. Touch "USE SIP ACCOUNT"
  4. Enter CORRECT username, password, domian, select TLS, and Touch login.
  5. After few seconds before connection to SIP server established app crash.

More info about problem:

  1. Try this case on
    • iOS simulator: iPhone 5s (12), iPhone 8 (14.1) - (App 4.3.2 SDK 4.4.3)
    • Real device iPhone 5s (12.4.8), iPhone 8 Plus (14.0.1) - Last AppStore released version on (24.10.2020)
  2. Use FreePBX with pjsip Extention as username pass e.t.c. and Let's Encrypt as Cert provider for TLS connection.
  3. On Windows and Android devices this problem is not observed.

    My code analyze:

  4. App crash happend when linphone-sdk request linphone_iphone_popup_password_request (part of stacktrace auth_requested->linphone_core_notify_authentication_requested), because app can't get username, realm and domain from LinphoneAuthInfo, app get null string for all 3 vars, and this crash app.

LinphoneManager.m: 719

static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method) {
    // let the wizard handle its own errors
    if ([PhoneMainView.instance currentView] != AssistantView.compositeViewDescription) {
                //!!!try get vars!!!
        const char * realmC = linphone_auth_info_get_realm(auth_info);
        const char * usernameC = linphone_auth_info_get_username(auth_info);
        const char * domainC = linphone_auth_info_get_domain(auth_info);
        static UIAlertController *alertView = nil;

        // avoid having multiple popups
        [PhoneMainView.instance dismissViewControllerAnimated:YES completion:nil];

        // dont pop up if we are in background, in any case we will refresh registers when entering
        // the application again
        if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateActive) {
            return;
        }

        NSString *realm = [NSString stringWithUTF8String:realmC?:domainC]; //!!!App crash here!!!
        NSString *username = [NSString stringWithUTF8String:usernameC];
        NSString *domain = [NSString stringWithUTF8String:domainC];
  1. If comment this function app can working correctly, and connection can established.

Recomendation

i think that if this bug can't resolve fast, it can be temporary hidden by commenting out this entire function to get the app back up and running. It is not a new error here has some same issues reports: #596 #576 #574 #406 (Maybe #143) The Problem happend from 2018 (2017) year and a lot of people tell about them and now it does not resolved.

fnasser commented 3 years ago

Just confirming the same problem persists as of Nov 20 in the app available from the Apple Store. iOS 14.2 Linphone 4.3.2