Background: Community-acquired pneumonia (CAP) is an essential consideration in patients presenting to primary care with respiratory symptoms; however, accurate diagnosis is difficult when clinical and radiologic examinations are not possible, such as during telehealth consultations. Aim: To develop and test a smartphone-based algorithm for diagnosing CAP without need for clinical examination or radiology inputs. Design and Setting: A prospective cohort study using data from subjects aged over 12 years presenting with acute respiratory symptoms to a hospital in Western Australia. Method: Five cough audio-segments were recorded and four patient-reported symptoms (fever, acute cough, productive cough, age) were analysed by the smartphone-based algorithm to generate an immediate diagnostic output for CAP. We recruited independent cohorts to train and test the accuracy of the algorithm. Diagnostic agreement was calculated against the confirmed discharge diagnosis of CAP by specialist physicians. Specialist radiologists reported medical imaging. Results: The algorithm had high percent agreement (PA) with the clinical diagnosis of CAP in the total cohort (n=322, Positive PA=86%, Negative PA=86%, AUC=0.95); in subjects 22-65 years (n=192, PPA=86%, NPA=87%, AUC=0.94) and in subjects >65 years (n=86, PPA=86%, NPA=87.5%, AUC=0.94). Agreement was preserved across CAP severity: 85% (80/94) of subjects with CRB-65 scores 1-2, and 87% (57/65) with a score of 0, were correctly diagnosed by the algorithm. Conclusion: The algorithm provides rapid and accurate diagnosis of CAP. It offers improved accuracy over current protocols when clinical evaluation is difficult. It provides increased capabilities for primary and acute care, including telehealth services, required during the COVID-19 pandemic.