Search code examples
c#asteriskagiasternet

Asternet AGI GeneralMappingStrategy using XML


I am trying to use XML for my GeneralMappingStrategy in Asternet. I have my program working fine using List

such as:

        agiServer.MappingStrategy = new GeneralMappingStrategy(
        new List<ScriptMapping>()
        {
            new ScriptMapping() {
            ScriptName = "testIVR",
            ScriptClass = "Asterisk_Test.testIVR",
            }
        });

But I'd rather have it read an XML file as it says it can do in the documentation, however it does not seem to say anywhere what the XML format is required.

I have tried:

string pathtoxml = "test.xml";
agiServer.MappingStrategy = new GeneralMappingStrategy(pathtoxml);

With my XML as:

<?xml version="1.0"?>
<ScriptMapping>
<ScriptName>testIVR</ScriptName>
<ScriptClass>Asterisk_Test.testIVR</ScriptClass>
</ScriptMapping>

As a complete guess, seemed to make sense, but this won't compile, I get errors of:

System.InvalidOperationException: 'There was an error reflecting type 'System.Collections.Generic.List`1[AsterNET.FastAGI.MappingStrategies.ScriptMapping]'.'

Does anyone happen to know how to do this?


Solution

  • It appears that there was an issue with the Aster.NET library, I've now submitted the fix and it's been accepted. For anyone who has an issue on this in the future, the XML format is:

    <?xml version="1.0"?>
    <ArrayOfScriptMapping xmlns:xsi="w3.org/2001/XMLSchema-instance"; xmlns:xsd="w3.org/2001/XMLSchema">
    <ScriptMapping>
    <ScriptName>testIVR</ScriptName>
    <ScriptClass>Asterisk_newTest.testIVR</ScriptClass>
    </ScriptMapping>
    </ArrayOfScriptMapping>