Ubiquity, heterogeneity and dense deployment of sensors have yielded the Internet of Things (IoT) concept, which is an integral component of various smart spaces including smart cities. Applications and services in a smart city ecosystem aim at minimizing the cost and maximizing the quality of living. Among these services, waste management is a unique service that covers both aspects. To this end, in this paper, we propose a WSN-driven system for smart waste management in urban areas. In our proposed framework, the waste bins are equipped with sensors that continuously monitor the waste level and trigger alarms that are wirelessly communicated to a cloud platform to actuate the municipal agents, i.e., waste collection trucks. We formulate an Integer Linear Programming (ILP) model to find the best set of trajectory-truck with the objectives of minimum cost or minimum delay. In order for the trajectory assistance to work in real time, we propose three heuristics, one of which is a greedy one. Through simulations, we show that the ILP formulation can provide a baseline reference to the heuristics, whereas the non-greedy heuristics can significantly outperform the greedy approach regarding cost and delay under moderate waste accumulation scenarios.