Recognizing passengers’ trip phases can provide valuable insights for urban planners in making decisions regarding urban planning, as it involves identifying the various stages of a passenger's journey. There is a significant research gap in current trip phase recognition research. Most existing works rely on traditional techniques such as GIS, surveys, and direct observation at stations to handle the task. The goal of this paper is to present a novel approach to determine the time and distance of access and egress trip phases and waiting time at bus stations, using a machine learning algorithm based on raw GPS trajectories. Specifically, we train a random forest model using two large datasets, Geolife GPS trajectory, and Sussex-Huawei Locomotion dataset, to detect the various transportation modes. Furthermore, a new algorithm is developed for detecting access time/distance, egress time/distance, and waiting time. Our approach is the first investigation in trip phase recognition that combines two large datasets and a machine learning model for trip phase detection. Our study yields the following accuracies on test trips saved in Roma: access time and distance predicted with 80.68% and 91.61%, while egress time and distance arrived at 72.63% and 70.68% accuracy. Passenger waiting time predicted from raw GPS data as a new feature with 82.01% accuracy at the bus station. These results underscore the effectiveness of our approach in predicting different phases.