Teacher: a person who teaches or instructs, especially as a profession; instructor.
Lecturer: a person who lectures; an academic rank given in colleges and universities to a teacher ranking below assistant professor.
Professor: a teacher of the highest academic rank in a college or university, who has been awarded the title Professor in a particular branch of learning; a full professor; any teacher who has the rank of professor, associate professor, or assistant professor.
All from dictionary.com
You may look up associate professor and assistant professor on your own.
First of all - you can call anyone who teaches a teacher (or maybe an instructor). Most of the other teaching professions (professor, lecturer, etc.) are subsets of teacher.
It appears there are two different conflicting sets of definitions here, which will determine the answer to your question. The first is in casual English. In casual English, you usually call someone by what they do. If they teach in primary schools, you usually call them just a teacher (or maybe a high school teacher, if applicable). If they teach college (by the way: college means in AmE what university means in some other regions) they are usually called a professor. If they give a lot of lectures, they may also be a lecturer.
The other system is academics. I have little to no knowledge of academic rankings. However, from the above definitions, it appears that colleges have a tiered ranking system that lecturer and professor both fit in. Thus, the same words mean different things in different contexts.
Too Long; Didn't Read: (For outside of academia): If they teach you, you can call them a teacher. If they lecture you, you can call them a lecturer. If you are in college (university), you can call them a professor.