public void setAccountOutboundProxyEnabled(int n, boolean enabled) {
   try {
     LinphoneProxyConfig prxCfg = getProxyConfig(n);
     prxCfg.edit();
     if (enabled) {
       String route = prxCfg.getProxy();
       prxCfg.setRoute(route);
     } else {
       prxCfg.setRoute(null);
     }
     prxCfg.done();
   } catch (LinphoneCoreException e) {
     e.printStackTrace();
   }
 }
  public TransportType getAccountTransport(int n) {
    TransportType transport = null;
    LinphoneProxyConfig proxyConfig = getProxyConfig(n);

    if (proxyConfig != null) {
      LinphoneAddress proxyAddr;
      try {
        proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy());
        transport = proxyAddr.getTransport();
      } catch (LinphoneCoreException e) {
        e.printStackTrace();
      }
    }

    return transport;
  }
  public void setAccountTransport(int n, String transport) {
    LinphoneProxyConfig proxyConfig = getProxyConfig(n);

    if (proxyConfig != null && transport != null) {
      LinphoneAddress proxyAddr;
      try {
        proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxyConfig.getProxy());
        int port = 0;
        if (transport.equals(getString(R.string.pref_transport_udp_key))) {
          proxyAddr.setTransport(TransportType.LinphoneTransportUdp);
        } else if (transport.equals(getString(R.string.pref_transport_tcp_key))) {
          proxyAddr.setTransport(TransportType.LinphoneTransportTcp);
        } else if (transport.equals(getString(R.string.pref_transport_tls_key))) {
          proxyAddr.setTransport(TransportType.LinphoneTransportTls);
          port = 5223;
        }

        /* 3G mobile firewall might block random TLS port, so we force use of 5223.
         * However we must NOT use this port when changing to TCP/UDP because otherwise
         * REGISTER (and everything actually) will fail...
         * */
        if ("sip.linphone.org".equals(proxyConfig.getDomain())) {
          proxyAddr.setPort(port);
        }

        LinphoneProxyConfig prxCfg = getProxyConfig(n);
        prxCfg.edit();
        prxCfg.setProxy(proxyAddr.asStringUriOnly());
        prxCfg.done();

        if (isAccountOutboundProxySet(n)) {
          setAccountOutboundProxyEnabled(n, true);
        }
      } catch (LinphoneCoreException e) {
        e.printStackTrace();
      }
    }
  }