Sunday, May 09, 2010

DHCP Notify Parsing with Polycom phones

Syslog sample:

Jul  8 18:25:12 babelfish dhcpd: {"vendor-class-identifier": {"substrings": [ {"company": "Polycom"}, {"part": "SoundPointIP-SPIP_430"}, {"part_number": "2345-11402-001,1"}, {"app_version": "SIP/2.2.2.0084/20-Nov-07 10:17"}, {"bootrom_version": "BR/4.1.0.0219/10-Dec-07 13:08"} ] }}

create polycom.conf and include it in your dhcpd.conf file.

authoritative;
allow booting;
 
option option-150 code 150 = text;
option option-155 code 155 = text;
option option-160 code 160 = text;
option sip-server code 151 = text;
option voice-vlan code 128 = text;
 
 
class "polycom" {
            match if(
            (substring (option vendor-class-identifier, 0, 4) = 00:00:36:3d) and
            (substring (hardware, 1, 12) = 00:04:f2:11:f3:b9)
                        );
 
            set vendor_class_identifier = (substring (option vendor-class-identifier,5,(extract-int ((substring (option vendor-class-identifier, 4, 1)),8))));
            set vendor_class_identifier_1_len = (extract-int ((substring (vendor_class_identifier,1,1)),8));
            set vendor_class_identifier_1 = (substring (vendor_class_identifier,2,vendor_class_identifier_1_len));
 
            set vendor_class_identifier_2_len = (extract-int ((substring (vendor_class_identifier,(3 + vendor_class_identifier_1_len),1)),8));
            set vendor_class_identifier_2 = (substring (vendor_class_identifier,(4 + vendor_class_identifier_1_len),vendor_class_identifier_2_len));
 
            set vendor_class_identifier_3_len = (extract-int ((substring (vendor_class_identifier,(5 + vendor_class_identifier_1_len + vendor_class_identifier_2_len),1)),8));
            set vendor_class_identifier_3 = (substring (vendor_class_identifier,(6 + vendor_class_identifier_1_len +  vendor_class_identifier_2_len),vendor_class_identifier_3_len));
 
            set vendor_class_identifier_4_len = (extract-int ((substring (vendor_class_identifier,(7 + vendor_class_identifier_1_len + vendor_class_identifier_2_len + vendor_class_identifier_3_len),1)),8));
            set vendor_class_identifier_4 = (substring (vendor_class_identifier,(8 + vendor_class_identifier_1_len +  vendor_class_identifier_2_len + vendor_class_identifier_3_len),vendor_class_identifier_4_len));
 
            set vendor_class_identifier_5_len = (extract-int ((substring (vendor_class_identifier,(9 + vendor_class_identifier_1_len + vendor_class_identifier_2_len + vendor_class_identifier_3_len + vendor_class_identifier_4_len),1)),8));
            set vendor_class_identifier_5 = (substring (vendor_class_identifier,(10 + vendor_class_identifier_1_len +  vendor_class_identifier_2_len + vendor_class_identifier_3_len + vendor_class_identifier_4_len),vendor_class_identifier_5_len));
 
 
            log(info, (concat ("{\"vendor-class-identifier\": {\"substrings\": [ {\"company\": \"", vendor_class_identifier_1,"\"}, {\"part\": \"", vendor_class_identifier_2,"\"}, {\"part_number\": \"", vendor_class_identifier_3,"\"}, {\"app_version\": \"", vendor_class_identifier_4,"\"}, {\"bootrom_version\": \"", vendor_class_identifier_5,"\"} ] }}")));
 
            if (option dhcp-message-type = 8)
            {
                        option dhcp-parameter-request-list 2,3,4,6,15,17,42,43,60,66,128,150,151,155,160;
                        option option-150 "http://PlcmSpIp:PlcmSpIp@172.16.129.94/polycom/";
                        option option-155 "http://PlcmSpIp:PlcmSpIp@172.16.129.94/polycom/";
                        option option-160 "http://PlcmSpIp:PlcmSpIp@172.16.129.94/polycom/";
                        option tftp-server-name "http://PlcmSpIpFOO:PlcmSpIp@172.16.129.94/polycom/";
                        option sip-server "sip.voip.local";
                        option domain-name-servers 172.16.129.94, 172.16.129.94, 172.16.129.94, 172.16.129.94;
                        option domain-name "voip.local";
                        option ntp-servers 172.16.129.94;
                        option time-servers 172.16.129.94;
                        option time-offset -18000;
                        #option voice-vlan "VLAN-A=10;";
            }
}
 
subnet 172.16.0.0 netmask 255.255.0.0 {
}

1 comment:

paschaleigel said...
This comment has been removed by a blog administrator.