Preheat the barbecue or smoker on HIGH. Place corn cobs, husks intact, on the grill, and cook turning occasionally for 20 minutes. Let cool slightly before husking.
Using a sharp serrated knife, cut the kernels off the cobs, reserving the cobs.
In a large stockpot, heat the chicken broth and add the lemongrass, ginger (or galangal), lime leaves and chilis. Bring to a boil and add the reserved corncobs. Simmer for 30 minutes.
Meanwhile, in a smaller stockpot, heat the oil and add the onions. Cook until translucent and very fragrant. Add the potatoes and curry paste, and stir to coat well.
Remove the corncobs, and strain the liquid into the small stockpot. Add the corn kernels (reserving a few for garnish) and continue to simmer for about 20 minutes, or until the potatoes are very tender.
Puree the soup in a blender, then strain through a fine meshed sieve. Add the coconut milk, and add the fish sauce, and lime juice to taste.
To make the pesto, whir the herbs and garlic in a blender or food processor and add the oil in a stream until the mixture comes together and is a good consistency. You may need slightly more or less oil, depending on the amount of herbs. Add a splash of vinegar and salt, to taste.
Spoon the soup into heated bowls, and garnish with the pesto, a few kernels of corn, a red chili, and a wedge of lime.