|
SIP 911 Implementation
Summary: The main purpose of this research is to determine the feasibility of implementing
SIP 911 feature in a real network environment. The results from various component testings in SNMP, shell scripting,
and MIB proved that it is possible to acheive such a goal.Architecture Design: The program will accept either IP address or DNS of the source of the 911 call. This command can be invoked by the SIP server or a command line. The program then nslookup the host to obtain the IP address. Then, this IP address is traced from where the programing is running to the last hop router of the source. Assumming that there is a SNMP read-access to the router, the original design was to get the MAC of the source IP address by quering polling the entire ARP table from the router. Then, using CDP SNMP query against the router, it would be possible to find out not only which interface the source is connected to, but what switch it is. Then, using the switch information just obtained from CDP query, it is possible to go through the entire CAM table in that switch. As soon as the desired MAC entry is found in the switch, bridge information and interface index information is used to determine whether or not the entry is learned directly from the connected source device or indirectly by establishing VLAN and other bridging configuraiton from other switch. Upon finding the last switch that has the direct physical connection to the source, the code then uses the internal SQL table to look up the physical location of the source. This is the value which will be returned to the SIP server. SQL database: The SQL database which stores the mapping of switch ports to physical jack location is in the following format.
Example There is only one command, perl SIP911.pl source_DNS [-debug] -debug: enables all debuging printouts. -source_DNS: either DNS or IP address of the source. Currently the program successfully returns the source location when MAC/switch information are hardcoded into the program. Since all the switches that were available to me connect to router, it wasn't possible CDP/ARP query the router to get cascasding switch devices. Therefore, the program only make sures that source_DNS is traceable and pingable. DNS Lookup @NslookupResult = `nslookup $hostname`; if ($debug3) {print @NslookupResult;} while(@NslookupResult){ $CurrentLine = shift(@NslookupResult); if ($debug) {print "$CurrentLine\n";} if ($CurrentLine =~ /Name:/){ $CurrentLine = shift(@NslookupResult); if ($CurrentLine =~ /Address:|Addresses:/){ $IpAddress = $CurrentLine; $IpAddress =~ s/Address://g; $IpAddress =~ s/\s//g; if ($IpAddress !~ /d+\.d+\.d+\.d+/){ $IpAddress =~ s/Addresses://g; $IpAddress =~ s/\s//g; @IpAddressArray = split(/\,/, $IpAddress); $IpAddress = $IpAddressArray[0]; } if ($debug) {print "$IpAddress\n";} } } } SNMP Switch CAM table lookup @Result1 = `$BinDir\\snmpwalk -Oq -m all $Switch $ReadCommunityString\@$i .1.3.6.1.2.1.17.4.3.1.1`; while (@Result1){ ... my ($GetBridgePortNum) = `$BinDir\\snmpwalk -Oq -m all $Switch $ReadCommunityString\@$i .1.3.6.1.2.1.17.4.3.1.2$TempSignficantOID`; @TempArray = split(/\s/, $GetBridgePortNum); $TempSignficantOID = $TempArray[1]; if($debug) {print "BridgePortNum:".$TempArray[1]."\n";} my ($GetIfIndex) = `$BinDir\\snmpwalk -Oq -m all $Switch $ReadCommunityString\@$i .1.3.6.1.2.1.17.1.4.1.2.$TempSignficantOID`; @TempArray = split(/\s/, $GetIfIndex); $TempSignficantOID = $GetIfIndex = $TempArray[1]; if($debug) {print "Interface Index:".$TempArray[1]."\n";} my ($GetIfName) = `$BinDir\\snmpwalk -Oq -m all $Switch $ReadCommunityString\@$i .1.3.6.1.2.1.31.1.1.1.1.$TempSignficantOID`; @TempArray = split(/\s/, $GetIfName); $TempArray[1] =~ s/\"//g; my ($ReturnPort) = $TempArray[1]; if($debug) {print "Interface Name:".$ReturnPort."\n";} ...SQL table lookup $SqlString = "select * from PortMap where Switch='".$q_switch."' and Board=".$q_board." and Port=".$q_port; ... print("PM ID:".$pmid." Building:".$building." Room:".$room." Jack:".$jack." Switch:".$switch." Board:".$board." Port:".$port."\n");The command such as above will return, PM ID:482 Building:computer science Room: Jack:441b Switch:cs-4-1 Board:2 Port:2 Code There are currently three perl files. SIP911.pl: main perl file which interpretates and invokes necessary sub-functions. getPortInfo.pl: module to SNMP query switches and routers. This module eventually calls pullPortInfo.pl file. pullPortInfo.pl: module to look up a physical location of the switch/port/slot information input. SIP911.pl requires require "m_pullPortInfo.pl"; require "m_getPortInfo.pl"; use Win32::ODBC; use Net::SNMP; use Net::Ping; use Net::DNS; SIP integration The program can be easily called from linux or windows platform becuase the only difference between the OSs in respect to this program is the shell script parsing between the linux and windows. SQL database can be easily replicated into other database format. Depending on how well program performs with router SNMP query enabled, we'll know for sure to what extent this program will be integrated int SIP server environment. As anyone can see, the program can be run independently. Other modular integration for wireless/non-Cisco equipments In order to accomodate different non-Cisco equipments, it will be necessary write a specific module for that device as it was done in m_pullPortInfo.pl. Right before calling m_pullPortInfo.pl in the main program, it is possible to query what type of device is connecting off of the router interface. Extreme switches either have or in-progress of implementing CDP. This interoperability will allow easy addition of new module that will support multiple hardware vendors. Wireless modules can also be queried using SNMP to determine the device/port inforamation and m_getPortInfo.pl can be used anywhere in the program to obtain the physical locatoin of the 911 source. Task List
Links and References
Last updated by Henning Schulzrinne |