Getting LINE based DeviceSpecific callbacks

Coordinator
Oct 22, 2013 at 8:55 PM
Hi,

I keep having a problem where I cannot create a TSP Media Stream and a solution was presented to me that I need to receive SLDSMT_START_TRANSMISSION and SLDSMT_START_RECEPTION events. Here is what I received:

To receive SLDSMT_START/STOP_TRANSMISION/RECEPTION events,
you should lineNegociateExtVersion() with ExtVersion 0x00010000 or above and lineOpen() with negociated ext version, and then call lineDevSpecific() function after lineOpen():
CCiscoLineDevSpecificStatusMsgs statusMsgs;
statusMsgs.m_DevSpecificStatusMsgsFlag = DEVSPECIFC_MEDIA_STREAM;
lineDevSpecific(hLine, 0, 0, statusMsgs.lpParams(), statusMsgs.dwSize());

Then, you will be able to receive SLDSMT_START/STOP_TRANSMISION/RECEPTION events as dwParam1 of LINE_DEVSPACIFIC event.
The dwParam1 of LINE_DEVSPACIFIC event will 'contain' the message type(SLDSMT_START/STOP_TRANSMISION/RECEPTION).
You need to calculate message type from dwParam1. The calculation depends on ext version.
The following calculation will work on any ext versions:
DWORD dwMsgType = (dwDevSpecific1 & 0xff);

In order for this to work I needed to create a DeviceSpecific method for TapiLine (mostly copy&pasted from TapiCall). It seems to work (there are no error results), however nothing happens. The callback function that I have entered with lineNegotiateExtVersion is called, but doesn’t contain data that I need.

I was wondering that maybe you know how can I send such a data in C# (the example is in C++).

Regards,
Istvan
Coordinator
Oct 22, 2013 at 8:56 PM
Edited Oct 22, 2013 at 8:57 PM
Hi Istvan,

You shouldn't need to add anything into the code - when you use lineNegotiate, you register a callback for device specific notifications on the line. So, it would look like this:
TapiLine line = ...;  // Find the line you want

line.NegotiateExtensions(0x00010000, 0x00010000, OnDeviceSpecific);
...

then you have this method in your logic:

// Called when a LINE_DEVSPECIFIC event occurs for this line.
void OnDeviceSpecific(object sender, DeviceSpecificEventArgs e)
{
   TapiLine line = e.Line;
   uint messageType = e.Param1 & 0xff;
   switch (messageType) {
       ... process your message here using e.Param2, e.Param3 ...
   }

}
I hope that helps!
mark
Developer
Oct 23, 2013 at 8:08 AM
The problem is that in OnDeviceSpecific I don't get all the message. Only 2 out of 25. It seems to me that I must somehow activate the rest of the messages. That is why I think I need to send a lineDevSpecific message. The problem is that I keep getting size errors when sending the message data.

Istvan
Developer
Oct 23, 2013 at 10:14 AM
It seems that I have solved the problem.

In order to receive the TSP provider specific messages in the LINE_DEVSPECIFIC event, first you must set them by sending s lineDevSpecific message. You must do this on the line and only once, right after the line is opened. For this I needed to copy the lineDevSpecific region from TapiCall to TapiLine. Also had to change the lineDevSpecific function call:
NativeMethods.lineDevSpecific(this.Handle, 0, 0, ip, inData.Length);

It seems to me that the same function in TapiCall has no usage in this situation.
Coordinator
Oct 23, 2013 at 3:27 PM
Cool -- if you'd like to submit the code as a patch it could be integrated into the public builds..

mark