Author |
|
timkelly1980 Intermediate
Joined: February 07 2005 Posts: 25
|
Posted: February 22 2005 at 7:18am | IP Logged
|
|
|
Hi I am getting strange behaviour when calling makeCall.
MakeCall(theHandle, 'MYNUMBER', 'sipcall.co.uk', 5060, 0, false, 0);
This should be a non-blocking call, but the thread seems to block for about 8 seconds and then i get a sipCallFailure returned, but then the call goes through as it should do after that! I am using a proxy and pre-registering.
So really I want to get rid of the 5 second delay and get a sipSuccess back!
I do have a warning message in the log, but i think it is not related:
Warning: 392 81.144.154.81:5060 "Noisy feedback tells: pid=22206 req_src_ip=82.
14.78.14 req_src_port=5060 in_uri=sip:sipcall.co.uk out_uri=sip:sipcall.co.uk vi
a_cnt==1"
My initialization is like follows (in delphi):
params.pPersonalityMicrocode := @LanScapeVME_F186495C_7AFF_4742_ADB7_87EA48A42633;
params.NumPhoneLinesRequested := 1;
params.LineMode := PHONE_LINE;
params.UserNotifyCallbackProc := callmeback;
params.pUserDefinedData := nil;
params.IpAddressOfThisHost[0] := 192;
params.IpAddressOfThisHost[1] := 168;
params.IpAddressOfThisHost[2] := 0;
params.IpAddressOfThisHost[3] := 2;
params.SipPort := 5060;
params.pPhoneName := '7059202740';
params.pPhoneDisplayName := '7059202740';
params.FarEndCallTransferEnabled := true;
params.MinLocalRtpPort := 8000;
params.MaxLocalRtpPort := 8010;
params.ZeroBasedAudioDeviceId := SIP_USE_PREFERED_AUDIO_DEVICE;
params.AudioRecordBandWidth := AUDIO_BW_PCM_22K;
params.AudioPlaybackBandWidth := AUDIO_BW_PCM_22K;
params.LogSipMessages := true;
params.PlaybackBufferingDefault := 2;
params.PlaybackBufferingDuringSounds := 2;
params.PhoneLineTransmitBuffering := 2;
params.pSipLogFileName := 'c:\log2.log';
params.StartupFlags := false;
SafeSIP(StartSipTelephony(@Params, @theHandle));
SafeSIP(SipTelephonyEnable(theHandle));
SafeSIP(EnableSIPDomain(theHandle, 'sipcall.co.uk'));
SAFESIP(AddAuthorizationCredentials(theHandle, '7059202740@sipcall.co.uk', 'passwordnot4u', 'sipcall.co.uk'));
SAFESIP(EnableSIPProxyServer(theHandle, 'sip.sipcall.co.uk', 5060));
SAFESIP(EnableSIPRegisterServer(theHandle, '7059202740', true, '', 0, 60, 60, 20000, true));
Where SafeSIP is a function that just checks the return value and raises an exception if there is a problem.
|
Back to Top |
|
|
timkelly1980 Intermediate
Joined: February 07 2005 Posts: 25
|
Posted: February 22 2005 at 8:46am | IP Logged
|
|
|
I have a feeling that this may have something to do with the callback... if i leave my callback function empty I actually get an access violation. This may have something 2 do with my port from delphi.
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 23 2005 at 7:18am | IP Logged
|
|
|
Ok. Just let us know when you resolve the issue and what the problem was. :)
LanScape Support
|
Back to Top |
|
|
timkelly1980 Intermediate
Joined: February 07 2005 Posts: 25
|
Posted: February 23 2005 at 9:22am | IP Logged
|
|
|
I have given up with my delphi port for now. I have reverted to C++ builder and it works fine... but unfortunatly this means a bit more work (I am going to my own bespoke protocol for my delphi app to talk to the c++ program!).
I have a feeling that it was something to do with the callback procedure, obviously if the calling convention or argument data types are slightly different then the stack is going to get messed up.
If anybody else has any success then please let me know. I have tried about every combination of calling convention and argument data-types as I can (ie is the phone line number a 32 bit int, or 16 etc.)
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 23 2005 at 10:53am | IP Logged
|
|
|
Hi Tim,
I would bet that you are exactly right and that it has to do with the calling convention you are using between the Delphi code and the LanScape API. All bets are off if that is not right.
Note: The VOIP Media Engine was developed using Microsoft VC++ 6.x Enterprise Edition. For bit lengths of C/C++ data types, Goolge the words: microsoft c++ data types. All function pointers and integer related data values (int, long, DWORD, BOOL) are 32 bits.
I did a quick check and from the Delphi documentation we have here, you should only have to use the cdecl calling convention to describe our API to Delphi and thats it.
When calling a VOIP Media Engine API procedure from Delphi, parameters must be passed on the stack from right to left and the caller must clean up the stack. That is all that should have to be done. I bet if you post this question to one of Googles Delphi newsgroups, a vetran Delphi developer will make it sound simple. As a matter of fact, why don't you post the main header file for the VOIP Media Engine API to a Delphi news group. I am sure there are many other vetran Delphi developers who have written code against Microsoft developed C/C++ libraries.
Also Important: Data structure member alignment must be maintained at 8 bytes. Check your Delphi docs, this 8 byte alignment requirement is critical and could also be killing you.
LanScape Support
|
Back to Top |
|
|
|
|