Place the sahlab or cornstarch in a small bowl. Whisk in 2 tablespoons milk until smooth.
Use a mortar and pestle to grind the mastic gum into a fine powder.
In a medium saucepan, whisk together the remaining 4 1/2 cup milk, cream, and the ground mastic gum over medium heat. Stir often and bring to a boil.
Gradually whisk in granulated sugar. Continue to stir to dissolve sugar and bring to a boil. Pour in the dissolved sahlab or cornstarch and boil for 5 minutes, stirring frequently.
Remove from heat and whisk in the rose water and orange blossom water if using.
Refrigerate until chilled, 4 hours to overnight.
Pour into prepared ice cream maker and churn according to manufacturer's instructions. Transfer to freezer safe bowl and freeze to desired consistency.
Serve covered with chopped pistachios.