code: @Override
      public boolean buyNumber(PhoneNumber phoneNumberObject, PhoneNumberParameters phoneNumberParameters) {
          String phoneNumber = phoneNumberObject.getPhoneNumber();
          phoneNumber = phoneNumber.substring(2);
          // Provision the number from VoIP Innovations if they own it.
          if (isValidDid(phoneNumber)) {
              if (phoneNumber != null && !phoneNumber.isEmpty()) {
                  final StringBuilder buffer = new StringBuilder();
                  buffer.append("<request id=\""+generateId()+"\">");
                  buffer.append(header);
                  buffer.append("<body>");
                  buffer.append("<requesttype>").append("assignDID").append("</requesttype>");
                  buffer.append("<item>");
                  buffer.append("<did>").append(phoneNumber).append("</did>");
                  buffer.append("<endpointgroup>").append(endpoint).append("</endpointgroup>");
                  buffer.append("</item>");
                  buffer.append("</body>");
                  buffer.append("</request>");
                  final String body = buffer.toString();
                  final HttpPost post = new HttpPost(uri);
                  try {
                      List<NameValuePair> parameters = new ArrayList<NameValuePair>();
                      parameters.add(new BasicNameValuePair("apidata", body));
                      post.setEntity(new UrlEncodedFormEntity(parameters));
                      final DefaultHttpClient client = new DefaultHttpClient();
                      if(telestaxProxyEnabled) {
                          addTelestaxProxyHeaders(post, ProvisionProvider.REQUEST_TYPE.ASSIGNDID.name());
                      }
                      final HttpResponse response = client.execute(post);
                      if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                          final String content = StringUtils.toString(response.getEntity().getContent());
                          if (content.contains("<statuscode>100</statuscode>")) {
                              return true;
                          }
                      }
                  } catch (final Exception ignored) {
                  }
              }
          }
  
          return false;
      }
docs: /*
  (non-Javadoc)
  @see PhoneNumberProvisioningManager#buyNumber(java.lang.String, PhoneNumberParameters)