From: gregarican Date: 2005-10-09T21:16:51+09:00 Subject: Re: Ruby/DL Question Takaaki Tateishi wrote: > I think the above line should be csta['acsOpenStream', 'IPSISSSSSISIIIIS']. > As you can see, I put 'I' before the 'PSISS....' since the method is supposed to > return an integer value. I made the change to include the integer return value, and removed the P entry since the pointer was no longer in the picture. In addition I checked the parameter data types to ensure that they matched. There were a couple of entries that I originally had as strings which were actually enum types in the C header file. So I went in and found the corresponding integer values they represent. Now my code looks like: ---------------------------------------- =begin TSAPI acsOpenStream (acsHandle /* RETURN an integer value? */ invokeIDType, /* INPUT an integer ENUM value?*/ invokeID, /* INPUT an integer value? */ streamType, /* INPUT an integer ENUM value? */ serverID, /* INPUT a null terminated string value? */ loginID, /* INPUT a null terminated string value? */ passwd, /* INPUT a null terminated string value? */ applicationName,/* INPUT a null terminated string value? */ acsLevelReq, /* INPUT an integer ENUM value?*/ apiVer, /* INPUT a string value? */ sendQSize, /* INPUT an integer value? */ sendExtraBufs, /* INPUT an integer value? */ recvQSize, /* INPUT an integer value? */ recvExtraBufs, /* INPUT an integer value? */ privateData /* INPUT a null terminated string value? */); =end require 'dl' csta=DL.dlopen('csta32.dll') openStream=csta['acsOpenStream', 'IIIISSSSISIIIIS'] invokeIdType=2 invokeId=0 streamType=1 serverId="AVAYA#MERLIN#CSTA#MERLIN-CTI\000" loginId="username\000" passwd="password\000" applicationName="CTI Test\000" acsLevelReq=1 apiVer="TS2" sendQSize=0 sendExtraBufs=0 recvQSize=0 recvExtraBufs=0 privateData="VERSION\000" resultCode=openStream.call(invokeIdType,invokeId,streamType,serverId,loginId,passwd,applicationName,acsLevelReq,apiVer,sendQSize,sendExtraBufs,recvQSize,recvExtraBufs,privateData) p resultCode[0] ---------------------------- The resultCode[0] entry returned -2, which according to the API means a bad parameter was passed to the call. I double checked the expected parameter data types and everything appears to be correct. the code comments indicate what I _think_ the API expects to be passed to the acsOpenStream method. This was going strictly against the TSAPI docs that are public domain. http://www.cs.cornell.edu/courses/cs519/1998fa/project/Doc/PBX/tsapi.pdf is such an example. Sigh....this is getting frustrating...