Random access (RA) protocols are suitable for the support of massive connectivity especially in machine-type communications, such as the Internet of Things (IoT). In this context, ALOHA protocols (both slotted and unslotted) have been re-introduced as promising enablers due to a potentially high throughput when enhanced via successive interference cancellation (SIC). Meanwhile, SIC has become the most popular solution for RA detection problems.In this work, we first point out the weaknesses of SIC and then propose a novel method based on joint detection of all randomly scheduled data packets. The proposed method is based on the joint computation of a-posteriori probabilities for all data symbols and packet localizations, such that optimal detection for RA is obtained.