private boolean isCodecG729Installed() {
   List<Location> locations = getLocationsManager().getLocationsForService(this);
   String serviceUri = null;
   FreeswitchApi api = null;
   String result = null;
   for (Location location : locations) {
     if (getSipxServiceManager().isServiceInstalled(location.getId(), BEAN_ID)) {
       serviceUri = getServiceUri(location);
       api = m_freeswitchApiProvider.getApi(serviceUri);
       try {
         result = api.g729_status();
         if (StringUtils.contains(result, G729_STATUS)) {
           return true;
         }
         // try also new FS detection algorithm
         result = api.g729_available();
         if (StringUtils.contains(result, "true")) {
           return true;
         }
       } catch (XmlRpcRemoteException xrre) {
         LOG.error(xrre);
         return false;
       }
     }
   }
   return false;
 }
Exemple #2
0
 /** @return list of addresses for all servers on which this service is installed */
 public List<String> getAddresses() {
   List<Location> locations = m_locationsManager.getLocationsForService(this);
   List<String> addresses = new ArrayList<String>();
   for (Location location : locations) {
     addresses.add(location.getAddress());
   }
   return addresses;
 }
 @Override
 public void afterReplication(Location location) {
   if (location != null) {
     reloadXmlWithRetries(location);
   } else {
     Location[] locations = getLocationsManager().getLocations();
     for (Location l : locations) {
       if (getSipxServiceManager().isServiceInstalled(l.getId(), BEAN_ID)) {
         reloadXmlWithRetries(l);
       }
     }
   }
 }
Exemple #4
0
 /**
  * Get bundles for this service installed on a given location
  *
  * @param location affected location
  * @return collection of bundles
  */
 public List<SipxServiceBundle> getBundles(Location location) {
   Collection<SipxServiceBundle> all = getBundles();
   List<SipxServiceBundle> installed = new ArrayList<SipxServiceBundle>();
   for (SipxServiceBundle bundle : all) {
     if (location.isBundleInstalled(bundle.getModelId())) {
       installed.add(bundle);
     }
   }
   return installed;
 }
Exemple #5
0
  public Object[] retrieveServiceStatus(Location location) {
    if (location == null || location.getServices() == null) {
      return ArrayUtils.EMPTY_OBJECT_ARRAY;
    }
    try {
      return getSipxProcessContext().getStatus(location, true);

    } catch (UserException e) {
      IValidationDelegate validator = getValidator(this);
      validator.record(new ValidatorException(e.getMessage()));

      Collection<ServiceStatus> serviceStatusList = new ArrayList<ServiceStatus>();
      for (LocationSpecificService lss : location.getServices()) {
        SipxService service = lss.getSipxService();
        String serviceName = service.getProcessName();
        if (serviceName != null) {
          serviceStatusList.add(new ServiceStatus(service.getBeanId(), Undefined));
        }
      }
      return serviceStatusList.toArray();
    }
  }
 public String getServiceUri(Location location) {
   return String.format("http://%s:%d/RPC2", location.getFqdn(), getXmlRpcPort());
 }