11-27-2007 11:53 AM - edited 03-13-2019 04:44 PM
Is there a way to programatically find out which IP phone is connected with a given PC? We have a need where an application will be installed on each PC, but instead of having the user manually enter the information about the PC, we want auto detect the phone connected with that PC.
11-27-2007 11:52 PM
Why 2 topics about this?
Find some information about CDP (Cisco Discovery Protocol). Each Cisco device sends a CDP-package every minute. This package contains information about the device, including it's MAC adres.
11-28-2007 04:51 AM
I have seen tools that one can install on windows box to read CDP packets, but they have a GUI interface. I was wondering if there is a way to programetically get that information, like a Java based CDP reader, etc. Thanks
11-28-2007 06:03 AM
reading CDP in java is pretty easy, especially with jpcap, etc. The problem is, you will need to install it on every client, and java is just too heavy to be a background service. unfortunately, we need something lightweight...
09-08-2008 10:12 AM
have you got a example script that this can be done with?
09-11-2008 12:00 PM
Old topic, but if anyone is interested I played around and got something working in VS 2005/C# using SharpPcap and the PacketCDP class from an app on codeproject called Pacanal. I had to make some changes to the PacketCDP.cs code to get it to work, but if you can get that far I believe it was relatively minor. The app I made sniffed the CDP packet for the phone devicename and then used that to call a CUAE app to log a phone into extension mobility. Here's some partial code:
PcapDeviceList devices = SharpPcap.GetAllDevices();
PcapDevice device = devices[i];
device.PcapOnPacketArrival += new SharpPcap.PacketArrivalEvent( device_PcapOnPacketArrival );
device.PcapOpen(true, 1000);
string filter = "ether host 01:00:0c:cc:cc:cc";
device.PcapSetFilter( filter );
device.PcapStartCapture();
private static void device_PcapOnPacketArrival(object sender, Packet packet)
{
EthernetPacket eth = (EthernetPacket)packet;
returnbool = PacketCDP.Parser(myTreeNode.Nodes, eth.Data, index, LItem, ref deviceName);
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://10.10.50.75:8000/emLogin?phone=" + deviceName + "&user=testuser");
}
09-11-2008 12:14 PM
whats the chances that you can email me a copy of all the files in a zip file? and the easiest way to execute it.
i tried to use a cdpr.exe that someone edited, but it doesnt work on vista and this is a little bit of an issue for us.
04-17-2013 09:35 AM
I know this is an old post, but I am trying to do something very similar. Would it be possibe to see your code from the PacketCDP class?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide