Soak the beans overnight and cook them until tender but not mushy. Alternatively, use two cups of canned beans, rinsed thoroughly.
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 watery, 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 that all the flavours mix together.