my $output = IO::File->new(*STDOUT);
my $writer = XML::Writer->new(OUTPUT => $output, DATA_MODE => 1, DATA_INDENT => 2);
print $q->header('text/xml');
$writer->xmlDecl("UTF-8");
$writer->startTag("document", "type" => "freeswitch/xml");
if($params->{'Hunt-Destination-Number'} eq 'puppet') {
$writer->startTag("section", "name" => "dialplan");
$writer->startTag("context", "name" => "$params->{'Hunt-Context'}");
$writer->startTag("extension", "name" => "puppet");
$writer->startTag("condition");
while (exists $params->{"variable_sip_h_X-DP-$count"}) {
my ($app, $arg) = split(/:/, $params->{"variable_sip_h_X-DP-$count"});
$writer->emptyTag("action", "application" => "$app", "data" => "$arg");
$writer->emptyTag("action", "application" => "$app");
$writer->endTag("condition");
$writer->endTag("extension");
$writer->endTag("context");
$writer->startTag("section", "name" => "result");
$writer->emptyTag("result", "status" => "not found");
$writer->endTag("section");
$writer->endTag("document");