-->

How to apply TLS support to PJSIP for ios

2019-07-10 17:21发布

问题:

I am creating a VoIP application for IOS. i am using the pjsip open source libraries for this . I am able to connect when i configure the pjsip to UDP . But i always get error code 171060 [Error creating transport: Unsupported transport (PJSIP_EUNSUPTRANSPORT) [status=171060]]

I get it that somewhere I am making mistake while configuring the file settings for TLS. This is what i am doing.

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);

I have searched up and down on google on how to resolve this issue but i haven't come across any concrete solution thus far. Please if anyone knows can you help me??

回答1:

Solved it. The newly created frameworks were not getting added. And were not FAT libs so the problem rose.