public void setExpires(int n, String expire) {
   try {
     LinphoneProxyConfig prxCfg = getProxyConfig(n);
     prxCfg.edit();
     prxCfg.setExpires(Integer.parseInt(expire));
     prxCfg.done();
   } catch (NumberFormatException nfe) {
   }
 }
    /**
     * Creates a new account
     *
     * @throws LinphoneCoreException
     */
    public void saveNewAccount() throws LinphoneCoreException {

      if (tempUsername == null
          || tempUsername.length() < 1
          || tempDomain == null
          || tempDomain.length() < 1) {
        Log.w("Skipping account save: username or domain not provided");
        return;
      }

      String identity = "sip:" + tempUsername + "@" + tempDomain;
      String proxy = "sip:";
      if (tempProxy == null) {
        proxy += tempDomain;
      } else {
        if (!tempProxy.startsWith("sip:")
            && !tempProxy.startsWith("<sip:")
            && !tempProxy.startsWith("sips:")
            && !tempProxy.startsWith("<sips:")) {
          proxy += tempProxy;
        } else {
          proxy = tempProxy;
        }
      }
      LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy);
      LinphoneAddress identityAddr = LinphoneCoreFactory.instance().createLinphoneAddress(identity);

      if (tempDisplayName != null) {
        identityAddr.setDisplayName(tempDisplayName);
      }

      if (tempTransport != null) {
        proxyAddr.setTransport(tempTransport);
      }

      String route = tempOutboundProxy ? proxyAddr.asStringUriOnly() : null;

      LinphoneProxyConfig prxCfg =
          lc.createProxyConfig(
              identityAddr.asString(), proxyAddr.asStringUriOnly(), route, tempEnabled);

      if (tempContactsParams != null) prxCfg.setContactUriParameters(tempContactsParams);
      if (tempExpire != null) {
        try {
          prxCfg.setExpires(Integer.parseInt(tempExpire));
        } catch (NumberFormatException nfe) {
        }
      }

      prxCfg.enableAvpf(tempAvpfEnabled);
      prxCfg.setAvpfRRInterval(tempAvpfRRInterval);
      prxCfg.enableQualityReporting(tempQualityReportingEnabled);
      prxCfg.setQualityReportingCollector(tempQualityReportingCollector);
      prxCfg.setQualityReportingInterval(tempQualityReportingInterval);

      if (tempRealm != null) prxCfg.setRealm(tempRealm);

      LinphoneAuthInfo authInfo =
          LinphoneCoreFactory.instance()
              .createAuthInfo(tempUsername, tempUserId, tempPassword, null, null, tempDomain);

      lc.addProxyConfig(prxCfg);
      lc.addAuthInfo(authInfo);

      if (!tempNoDefault && LinphonePreferences.instance().getAccountCount() == 1)
        lc.setDefaultProxyConfig(prxCfg);
    }