How the shell finds your programs
When you type foo in the command-line of your shell, it looks foo up in a set of paths defined by your shell's PATH environment variable (which you can inspect by running echo $PATH).
So my guess is simpe: the asterisk package you had before reinstalling had the asterisk binary located in a place listed in your user's $PATH and the package installed afterwards had it installed elsewhere.
You can check this easily by correlating echo $PATH in your shell with the output of
$ dpkg -L asterisk | grep bin/asterisk
In any case, you can run your binary program by specifying its full pathname.
Pathname resulution caching in the shells
Another possibility, though less likely, is pathname resolution caching. Interactive shells, bash included, only look up a bare program's name through the list in $PATH once, and then remember that full location they've found. If you then remove the program from that location, the shell will be unable to run it anymore, even if the program's file is now accessible in some other place listed in the $PATH.
You can help the shell by running hash -r in it (please see help hash in your bash prompt).
Miscellanea
Note that in the general case, when you do
apt-get remove --purge asterisk
apt-get install asterisk
that is, perform a remove+install cycle, the version of a package as known to the APT system based on the archives made available to it is installed. That is, if you have installed your hand-built version directly via dpkg -i ..., APT won't attempt to find and install this same version when you later remove and install the package with the same name.
If you want to make your hand-built asterisk package be available for general installation, you'd have to maintain a proper local Debian repository (reprepro is properly the simplest tool to use, also see apt-ftparchive), make it known to your local APT system and also possibly make packages from that repository preferred using APT preferences.