{
final ManagerResponse showVersionFilesResponse;
final List<String> showVersionFilesResult;
// increase timeout as output is quite large
showVersionFilesResponse = sendAction(new CommandAction("show version files pbx.c"), defaultResponseTimeout * 2);
if (!(showVersionFilesResponse instanceof CommandResponse))
{
// return early in case of permission problems
// org.asteriskjava.manager.response.ManagerError:
// actionId='null'; message='Permission denied'; response='Error';
// uniqueId='null'; systemHashcode=15231583
break;
}
showVersionFilesResult = ((CommandResponse) showVersionFilesResponse).getResult();
if (showVersionFilesResult != null && showVersionFilesResult.size() > 0)
{
final String line1 = showVersionFilesResult.get(0);
if (line1.startsWith("File"))
{
final String rawVersion;
rawVersion = getRawVersion();
if (rawVersion != null && rawVersion.startsWith("Asterisk 1.4"))
{
return AsteriskVersion.ASTERISK_1_4;
}
return AsteriskVersion.ASTERISK_1_2;
}
else if (line1.contains("No such command"))
{
final ManagerResponse coreShowVersionResponse = sendAction(new CommandAction("core show version"), defaultResponseTimeout * 2);
if (coreShowVersionResponse != null && coreShowVersionResponse instanceof CommandResponse)
{
final List<String> coreShowVersionResult = ((CommandResponse) coreShowVersionResponse).getResult();