Lets get list of packages installed by asterisk
root@cloud1:/var/log/apache2# dpkg -l | grep asterisk ii asterisk 1:1.8.13.1~dfsg-1ubuntu2 amd64 Open Source Private Branch Exchange (PBX) ii asterisk-config 1:1.8.13.1~dfsg-1ubuntu2 all Configuration files for Asterisk ii asterisk-core-sounds-en 1.4.22-1 all asterisk PBX sound files - US English ii asterisk-core-sounds-en-gsm 1.4.22-1 all asterisk PBX sound files - en-us/gsm ii asterisk-modules 1:1.8.13.1~dfsg-1ubuntu2 amd64 loadable modules for the Asterisk PBX ii asterisk-moh-opsound-gsm 2.03-1 all asterisk extra sound files - English/gsm ii asterisk-voicemail 1:1.8.13.1~dfsg-1ubuntu2 amd64 simple voicemail support for the Asterisk PBX root@cloud1:/var/log/apache2#
To uninstall a package, you need to use
apt-get remove PACKAGE-NAME
So, lets first remove asterisk package.
apt-get remove asterisk
In most cause, it will remove all dependency. If not, check with dpkg -l and un install remaining packages.