Heat oil in a kadai. Add mustard seeds and let them splutter. Add urad dal, fenugreek seeds, and cumin seeds. Sauté until the dal turns golden.
Add asafoetida, slit green chilies, curry leaves, sliced garlic, shallots, and chopped onions. Sauté until the onions turn soft and translucent.
Add chopped tomatoes and sauté for a minute.
Add turmeric powder, sambar powder, and salt. Mix well and cook for another minute.
Pour in 3 cups of water and bring the mixture to a rolling boil. Cook until the onions and shallots are tender and the raw smell of the spices disappears.
In a small bowl, whisk together besan flour and ½ cup water until completely smooth and lump-free.
Reduce the heat and slowly pour the besan slurry into the sambar while stirring continuously. The sambar will begin to thicken immediately.
Add another 3 cups of water (or adjust as needed) to reach your desired consistency. Mix well.
Simmer on low to medium heat for about 10 minutes, stirring occasionally, until the raw smell of the besan flour is completely gone. Add sugar and chopped coriander leaves. Give everything a final stir.
Switch off the flame and serve hot with idli, dosa, pongal, or medu vada.