Open SSL and TLS issue in iOS for Pjsip

时间:2019-01-09 22:09:24

标签: ios openssl tls1.2 pjsip

I am using below code to configure TLS. I had enable to in config_site.h file

define PJ_HAS_SSL_SOCK 1

pjsua_transport_config cfg;
    pjsua_transport_config_default(&cfg);
    cfg.port = 5061;
    cfg.tls_setting.ca_list_file = pj_str((char*)[[[NSBundle mainBundle] pathForResource:@"ca_list" ofType:@"pem"] cStringUsingEncoding:NSUTF8StringEncoding]); // location of cacert.pem

    cfg.tls_setting.cert_file = pj_str((char*)[[[NSBundle mainBundle] pathForResource:@"certificate" ofType:@"pem"] cStringUsingEncoding:NSUTF8StringEncoding]); // location of cacert.pem

    cfg.tls_setting.privkey_file = pj_str((char*)[[[NSBundle mainBundle] pathForResource:@"pvkey" ofType:@"pem"] cStringUsingEncoding:NSUTF8StringEncoding]); //

    cfg.tls_setting.password = pj_str("myPassword");
    cfg.tls_setting.verify_client = PJ_TRUE;
    cfg.tls_setting.verify_server = PJ_TRUE;
    cfg.tls_setting.method = PJSIP_TLSV1_METHOD;

    //
    NSLog(@"******TLS********");
    //pjsua_transport_id  transport_id = 1;
    status = pjsua_transport_create(PJSIP_TRANSPORT_TLS , &cfg, NULL);

    if (status != PJ_SUCCESS) error_exit("Error creating transport", status);

Reference Link : How to apply TLS support to PJSIP for ios

I am using Pod "pjsip" : pjsip 2.7.1 version https://cocoapods.org/pods/pjsip

I cannot see the logs :

...
checking for OpenSSL installations..
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... no
aconfigure: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!
aconfigure: WARNING: openssl/ssl.h: proceeding with the compiler's result
checking for openssl/ssl.h... yes
checking for ERR_load_BIO_strings in -lcrypto... yes
checking for SSL_library_init in -lssl... yes
OpenSSL library found, SSL support enabled
...

I am getting error :

Error creating transport: Unsupported transport (PJSIP_EUNSUPTRANSPORT) [status=171060]

0 个答案:

没有答案