Ejemplo n.º 1
0
  public static void inAppDial(final BaseActivity activity, String dial) {
    if (TextUtils.isEmpty(dial)) {
      return;
    }
    final String phone = StringUtils.phoneFormat(dial);
    if (Constant.noCall.contains(phone)) {
      call(activity, phone);
    } else {
      HttpServer hServer = new HttpServer(Constant.URL.phoneCall, activity.getHandlerContext());
      Map<String, String> headers = new HashMap<String, String>();
      headers.put("sign", User.ACCESSKEY);
      hServer.setHeaders(headers);
      Map<String, String> params = new HashMap<String, String>();
      params.put("accessid", User.ACCESSID);
      params.put("userTel", activity.getAppContext().currentUser().getPhone());
      params.put("oppno", phone);
      hServer.setParams(params);
      hServer.get(
          new HttpRunnable() {

            @Override
            public void run(Response response) throws AppException {
              Map<String, String> info = response.getMapData("serverinfo");
              RecordingContentView.isRefreshData = true;
              BaseContext.getSharedPreferences()
                  .putString(Constant.Preferences.SP_CALL_DIAL, phone);
              call(activity, info.get("serverno"));
              activity.getRecentDaoImpl().insertCallLog(phone);
            }
          });
    }
  }