androidpjsip

PJSIP Android TLS --Unable to generate suitable Contact header for registration: Unsupported transport (PJSIP_EUNSUPTRANSPORT)


I am trying to make call using pjsip TLS in android.As per pjsip guidelines i built the pjsip library with openssl commands.

I have included following in my config_site.h

define PJSIP_HAS_TLS_TRANSPORT 1

define PJ_HAS_SSL_SOCK 1

I can see while building the library OpenSSL included.

OpenSSL library found, SSL support enabled

I sucessfully created TLS transportusing below command

ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_TLS,
                    sipTpTLSConfig); 

I can see TLS Listener started on my local ip address. But when i try to register it gives me error

Unable to generate suitable Contact header for registration: Unsupported transport (PJSIP_EUNSUPTRANSPORT)

Java Code

String sipid = sipURI + username + "@" + switch_ip + ":" + switch_port;
String registrar = sipURI + switch_ip + ":" + switch_port+addTransportTLS;
String proxy = sipURI + switch_ip + ":" + switch_port;
AccountConfig accCfg = new AccountConfig();
accCfg.setIdUri(sipid);
accCfg.getRegConfig().setRegistrarUri(registrar);
accCfg.getRegConfig().setRetryIntervalSec(60);
accCfg.getNatConfig().setIceEnabled(false);
app.addAcc(accCfg);

I did the following as per pjsip docs and added ;transport=tls to my registrar address. But I still get this error.


Solution

  • Registration of sip account should be done as code below shows. Also, you have to set port in TransportConfig by setting sipTpTLSConfig.setPort(your_sip_port);

    AccountConfig accCfg = new AccountConfig();
    accCfg.getSipConfig().getProxies().add("sip:" + your_sip_server_host + ";hide;transport=tls");
    accCfg.setIdUri("sip:" + your_sip_username + "@" + your_sip_domain);
    accCfg.getRegConfig().setRegistrarUri("sip:" + your_sip_domain);
    
    AuthCredInfoVector creds = accCfg.getSipConfig().getAuthCreds();
    creds.add(new AuthCredInfo("Digest", "*", your_sip_username, 0, your_sip_password));
    
    app.addAcc(accCfg);
    

    You can keep your code for setting registration interval and disable ice.