Heat a saucepan. Add the red chillies, coriander seeds, cumin seeds, peppercorns, and cloves. Dry-roast the ingredients for five minutes over medium-low heat until fragrant and a couple of shades darker.
Remove the ingredients to a blender. In the same pan, dry-roast the garlic until golden-brown spots appear. Add to the blender. Then roast the grated coconut over low heat, stirring constantly, until lightly golden. Add to the blender along with 1 cup water. If you are using coconut milk just skip the roasting step and add the coconut milk directly to the blender.
Blend the masala until you get a smooth paste.
Add oil to the same saucepan.
Add the chopped onions and saute, stirring frequently, until they start to turn golden-brown.
Add the sausages, if using, and saute until they start to get a crust.
Add the tamarind paste and the ground masala paste. Stir well to mix and allow the mixture to come to a boil. Reduce to a simmer and cook for about five minutes.
Add the beans along with a cup of water or cooking liquid. If your curry is already water, add less liquid. Add salt to taste.
Let the curry come to a boil, reduce heat to a simmer, and cook for 15 minutes so all the flavors mix together.
Garnish with coriander leaves, and serve hot with some rice or a crusty bread.