#!/usr/bin/perl ### ### This program has no warranty or anything. ### Consider it public domain. ### ### This Update Script uses CURL to send the update ### If you would prefer a pure Perl solution, look ### at http://netmonks.ca/projects/opensource/asterisk/dundi-update.txt ### #### Settings: #### ## Set this to your local EID my $LOCAL_EID = "00:YO:UR:EI:DH:ER"; ## Set this to your hostname or IP, ## or blank if you don't want one to show my $LOCAL_NAME = "your.host.or.ip"; ## The command to issue to get your 'dundi show peers' my $ASTERISK = "/usr/sbin/asterisk -rx 'dundi show peers'"; ## DUNDi Mapping Target my $TARGET = 'http://vulcan.dmacc.cc.ia.us/dundi/add.cgi'; #### Stop Changing Here #### my $SHOWPEERS = ""; open F, "$ASTERISK|"; while() { $SHOWPEERS .= $_ if m/^[0-9a-f]/; } close F; print "Sending the following peer list:\n"; print $SHOWPEERS; open CURL, "curl --user-agent DundiUpdate/Curl-1.0 --data label='$LOCAL_NAME' --data local_eid='$LOCAL_EID' --data showpeers='$SHOWPEERS' $TARGET |"; while() { $resp .= $_; } close CURL; if($resp =~ m/^DUNDI_UPDATE_OK/) { print "Server Update Successful\n"; } else { $resp =~ m/:\s+(.*)$/; print "Server Update FAILED: $1\n"; }