DivaErrorInvalidParameter returned on DivaAppendVoice OR DivaSendVoiceEx !!

rated by 0 users
This post has 8 Replies | 2 Followers

Not Ranked
Posts 9
Points 135
alfano Posted: 03-05-2010 9:12 AM

I'm using DivaSDK on a DIVA PRI/E1/T1-CTI

I want to send Voice data. (pConn point on a C struct that contains informations about the current Diva session, hDivaCall...etc)

===> First, i try first from disk, using a File name. => DivaSendVoiceFile(pConn->hDivaCall, "UIC_SIMU.wav",0) return DivaSuccess and he correctly received at the destination.

===> Second, I try to make send Voice from disk using DivaAppendVoice with an associated  DivaVoiceDescriptor. My code is below:

  pConn->DsVoice.Size = sizeof(pConn->DsVoice);
  pConn->DsVoice.DataSource = DivaVoiceDataSourceFile ;
  pConn->DsVoice.DataFormat = DivaAudioFormat_PCM_8K16BitMono; 
  pConn->DsVoice.PositionFormat = DivaVoicePositionFormatMSec; //DivaVoicePositionFormatBytes; // the twice were tried
  pConn->DsVoice.StartOffset = 0;
  pConn->DsVoice.Duration = 0;
  pConn->DsVoice.Source.File.pFilename="UIC_SIMU.wav";

  DivaRes = DivaAppendVoice(pConn->hDivaCall,&pConn->DsVoice);

// here, DivaRes is equal to 4 that is DivaErrorInvalidParameter

===> Third, I try to make send Voice from disk using DivaSendVoiceEx with an associated  DivaVoiceDescriptor (same as just previouly listed)

DivaRes = DivaSendVoiceEx
     ( pConn->hDivaCall, // concerned call
       1,    // Only one Voice descriptor
       &pConn->DsVoice, // pointer on first Voice descriptor (the only one too)
       1,   // Play only once
       0     // Play the time of the sample given.
      );

// here, DivaRes is equal to 4 that is DivaErrorInvalidParameter

===> Fourth, I try to make send Voice from memory using DivaAppendVoice with an associated  DivaVoiceDescriptor. My code is below:

 pConn->DsVoice.Size = sizeof(pConn->DsVoice);
  pConn->DsVoice.DataSource = DivaVoiceDataSourceMemory;
  pConn->DsVoice.DataFormat = DivaAudioFormat_Raw_PCM_8K16BitMono;

  pConn->DsVoice.PositionFormat = DivaVoicePositionFormatBytes;
  pConn->DsVoice.StartOffset = 0;
  pConn->DsVoice.Duration = 0;
  pConn->DsVoice.Source.Memory.DataLength = pConn->pAudiomp->LenData; // verified before call 
  pConn->DsVoice.Source.Memory.pBuffer=(char *)(pConn->pAudiomp->pData); // data also vrified befaore call

  DivaRes = DivaAppendVoice(pConn->hDivaCall,&pConn->DsVoice);

// here, DivaRes is equal to 4 that is DivaErrorInvalidParameter

===> Fifth, I try to make send Voice from memory using DivaSendVoiceEx with an associated  DivaVoiceDescriptor. (same as just previouly listed)

DivaRes = DivaSendVoiceEx
     ( pConn->hDivaCall, // concerned call
       1,    // Only one Voice descriptor
       &pConn->DsVoice, // pointer on first Voice descriptor (the only one too)
       1,   // Play only once
       0     // Play the time of the sample given.
      );

// here, DivaRes is equal to 4 that is DivaErrorInvalidParameter

======== OOOPs

Please, where is the origin of the returned DivaErrorInvalidParameter parameter ????

Have you got some track...

Another question:

I had the next behavior on connect:

=>  DivaconnectVoice(...) return DivaSucces while Divaconnect(...) returns DivaErrorNoChannel.

I found that i must set the DivaVoiceOptionEchoCanceller for the DivaOption parameter given on the DivaConnect call. If I passed DivaVoiceOptionDefault, I had the error code 11 on return.

Why default option does not work ? He's my card Diva PRI/E1/T1-CTi responsible of such a behaviour ?

Furthermore, at the end, I have to stream my audios from memory...(this is a requirement of my projetc).

Help me, please.

 

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

The code looks ok so best to look at a SDK trace to see which parameter is causing the problem. If you need memory streaming for your project then focus on that initially and take a SDK trace as below :

Run config.exe, found in the SDK directory Basic\bin - click on the logging tab.

In the file field Browse to a directory and enter a filename such as SDKTrace.txt.

Then in both of the Level drop down boxes select Debug Messages Level 2.

Now click on apply.

Now start your application(app must be started after the SDK trace is started) and make the call attempt.

After the call attempt then save the SDK trace (original will be locked whilst your app is running) and post it here, attach the trace using the Options tab.

FYI below is a snippet of memeory streaming which works ok, looks similar to your code. 

 dv.Size = sizeof( dv );
     dv.StartOffset = 0;
     dv.Duration = 0;
     dv.DataFormat = DivaAudioFormat_Raw_PCM_8K16BitMono;
     dv.DataSource = DivaVoiceDataSourceMemory;
     dv.Source.Memory.DataLength = len;
     dv.Source.Memory.pBuffer = (char*)buf;
     dv.PositionFormat = DivaVoicePositionFormatBytes;

     res = DivaAppendVoice( divacall, &dv );

 

  • | Post Points: 20
Not Ranked
Posts 9
Points 135

Very thank you for your previous help:

It is OK for me now: The problem was due to an option not set on my compiler.

It is a C++ compiler giving the option to "optimize" the storage of enum type: that is, using BYTE, WORD or DWORD depending on the domain of the enumeration values.

So for a DivaVoiceDescriptor structure, the resulting size reported was 24 bytes (with optimization) et returns to expected 32 normal size when optimization was disabled (so each enum value takes allways a DWORD size).

But.. I have now another problem:

I want to record the voice I receive and I fail to receive any voice samples ?!

I have a program wich now works good to send samples from file or memory (DivaConnect(..) etc...) and I add an api call to record receiving audio:
DivaRes = DivaRecordVoiceFile(hdcall,"tot.wav", DivaAudioFormat_PCM_8K16BitMono, 0) => returning DivaSucess
.....(sending voice to my ISDN line)
.....
DivaRes=DivaStopRecording(..);

=> Result, I do not receive anything !!! => NO Event, File on disk set at 0kb (no record into) !!!
(I have tested the source sending audio using a phone connected to the same PABX  as destination => I heard the source in the phone).

=> So I do not know how to mek to receive data :  Is there some level to set in the Diva to trig audio recording start ?

Please Help me.

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

Good to hear you have resolved the previous problem.

For this new problem we may need to see a SDK trace as this should tell us why the file is not being recorded. You dont need to do anything other than use the DivaRecordVoiceFile function as you have been using. The only reason I can think is that you are calling DivaStopRecording very quickly after you start recording so worth checking that this isn't happening in your code, I'm sure not but worth checking :-)

If you still have the problemn then please take a SDK trace like this :

Run config.exe, found in the SDK directory Basic\bin - click on the logging tab.

In the file field Browse to a directory and enter a filename such as SDKTrace.txt.

Then in both of the Level drop down boxes select Debug Messages Level 2.

Now click on apply.

Now start your application(your application must be started after the SDK trace is started) and make the call and record attempt.

Go back to the config.exe, click on view trace, and save the trace with a different filename (original is locked).

Then post the file here, use the Options tab in the post to attach the trace.

 

  • | Post Points: 20
Not Ranked
Posts 9
Points 135

Thank you.

I have made that. but there is no error message!!  There is just 3 lines for each call for initiate or stop recording expected voice, ( one for Enter, one for internal OK status, and one for exit), so I do not post those traces here. The rest of trace corresponds to connect and send voice wich works after the set of my compiler option.

I do not call Stop recording (and there is no stop) just afetr: There is ~15 seconds between timestamp of DivaRecordFile and DivaStop. And as I have said, the size of the wave file is exactly 0 : that is when you want to open it using an external weelknow program, there is non header!! As if only a system call like  fopen("name",mode create[write) for create and open a new file was made ==> NO futher fwrite made by SDK ?? This is associated with no event at all !!! 

Anyway, I will post traces this after-noon here. (but, like my pevious post, I think the problem  is elsewhere...)

 

 

 

  • | Post Points: 5
Not Ranked
Posts 9
Points 135

I precise the state of the file created on disk:

=> The file created on disk is really of 0 byte length !!! It seems that only a system call like fopen("fiilename",mode create|write) was made without any further fwrite(pbuf,length..) !!! The file is 0 byte length  (not readable by other wellknow programs) . That must be considered with the fact that no event at all are report, between call to start and stop recording (including these 2 calls => no event).

It like if no voice recording exists....

Bye

  • | Post Points: 5
Not Ranked
Posts 9
Points 135

Hello,

We have found where the bug is !!!

So, when we call DivaConnect(..) and then call DivaRecordVoiceFile(..) in sequence, with no error returned att all, the record never starts.

We correct this behaviour, by waiting DivaEventConnected though a callback handler mode before calling DivaRecordVoiceFile(..): Tis way, the record starts,is controled and terminates as expected.

I think, it will be a good to indicate in the documnentation that the state of the current connection must be checked as 'Connected' before calling  DivaRecordVoiceFile(..) (or modify SDK API to return an error code...).

Very thank you for your great help.

(Now we can talk from a TETRA Pap (as a talky-walky) under TETRA network coverage (radio) and heard the 'TETRA voice' on the PC hosting the Diva Card: very fun).

Best regards,

HA.

 

 

 

  • | Post Points: 20
Top 10 Contributor
Male
Posts 2,075
Points 27,747
Dialogic Employee

Well I haven't done much to help so far as you have found the solutions :-)

You can use RecordVoice before a call is connected if you are running in early media mode, hence why there is no error message.

I guess as general advice its worth remembering that the SDK is a mature product with very few issues so if things don't work as I expect then I usually look at one of the samples or make a simple test app just to test the different ways of using the functions until I find the way that works best. 

  • | Post Points: 20
Not Ranked
Posts 9
Points 135

Yes,but perhaps a recommended state diagram for application showing interaction with  Diva SDK (call requests and event responses) will be welcome. (and very easy to understand for a lot of people because using the vision of humans, not only the reading of a text).

Best regards,

HA

  • | Post Points: 5
Page 1 of 1 (9 items) | RSS