Personal area networks and, more specifically, body area networks (BANs) are key building blocks of future generation networks and of the Internet of Things as well. In this article, we present a novel analytical framework for network performance analysis of body sensor networks with hierarchical (tree) topologies. This framework takes into account the specificities of the on-body channel modeling and the impact of the surrounding environment. The obtained results clearly highlight the differences between indoor and outdoor scenarios, and provide several insights on BAN design and analysis. In particular, it will be shown that the BAN topology should be selected according to the foreseen medical application and the deployment environment.