We consider how wireless sensor networks (WSN) operate and what could optimize their functionalities in order to save energy. Network messages between nodes (sensors) consume remarkable energy. We offer a practical solution to reduce network traffic by compressing messages. The collection tree protocol (CTP) is one of the best protocols of wireless sensor networks which provides a remarkable data delivery (more than 90%) and detects loops or abnormal topology structures efficiently. We employed CTP as our base framework to implement a newer version to collect data by merging compressive sensing techniques. Although CTP was originally designed to be applied in forwarding tasks, we could extend the functionalities of CTP for aggregation purposes. Our modifications on CTP do not disturb the main operations in practice.