Hello all,
I am writing an api which is a modified version of the global call demo. I wanted to add an audio file that will play when an outbound call is placed. For some reason, I have that method but it is not playing anything. I don't know where to start. Please help. Any code will be helpful. I have attached my file here.
Thank you,
Sincerely,
Anupam Menon
Hi,
Please find attached. I changed a bit an order of getxmitslot/Listen, the new code is commented with //L.P.
Hello Leonid,
Thank you for the help.
I changed the part but for some reason, I still cannot hear anything on the other side. When I use global call to call, I don't hear anything on the other side.
Thank you.
Anupam
It looks like the code never enter Player(). The condition is:
case GCST_ALERTING: { if (evttype == GCEV_CONNECTED && evttype == TDX_PLAY)
But this is not possible. The evttype can only take 1 value, it cannot be both GCEV_CONNECTED && TDX_PLAY.
Try
case GCST_ALERTING: { if (evttype == GCEV_CONNECTED || evttype == TDX_PLAY)
I'd recommend to put some debug printouts to make sure where the control goes is when the call is connected.
Thanks for the quick reply.
The problem is it is not giving me any error even if the something is not passing. I have changed the code a little bit. but I don't know how to rectify the error.
Thank you
You layesy cade does not call Player() at all. I added it in the outbound application. Also, when assigning the file descriptor to the DX_IOTT you first must initialize the descriptor itself via dx_fileopen; I changed it, too. Please try, should work.
I am sorry to sound dumb but I wanted to ask you if we have to configure anything else for the voice demo. Like we configured it for the global call. I am still not able to hear anything on the phone side. I have pretty much changed whatever you told me too and still it is not working.
I am not an expert at this so your expertise will be really helpful.
Oh, no problem at all, sometimes it may be tricky to work with plain C-stile code.
I modified this demo, added a voice on outbound calls, I tested with PRI, it worked (played music). Please try, if it works, you may follow the logic and implement in your code something similar. I commented the relevant changes with L.P.
Thank you very much for the help. I really appreciate it Leonid. I just had one last question. I have a pcm file that I want to play but for some reason Its not clear when I play it. However, when I play it on a windows media player it works fine. but when I play it through the phone there is a lot of static.
Most likely, when playing this file, your app specifies audio encoding incorrectly. Please send me the file, I'll see if it's format is supported, and if it is, will send you the right settings of DX_XPB for this file.
Thank you leonid. Its working fine now. A quick question. Why is there a time delay for playing the file. I want to play the file as soon as the phone is answered.
It's normally about 100 ms delay between kicking off the play command and the audio utterance. It's virtually unnoticeable. If you experience longer delay it may mean that 1) The connection event is delayed by the network; 2) Code issues; 3) the file contains some silence at the beginning. If you believe the later may be a reason, try to play other file, or remove the silence with any audio editor (there are some available for free on the web).
For the second reason, in the RTF log check the time difference between GCEV_CONNECTED and dx_play. If there is no significant difference, then the code is OK .
Unfortunately, we have no control over the reason #1.
Thanks Leonid,
I tried with 4 different PCM files. There has been a 4-7 seconds time delay. I don't know about the code be wrong but I am missing DX_CAP structure or is it a different issue. Because the connection is pretty quick over here, there is no silence at the beginning of the PCM files. SO I assume there is something wrong with the code.
I still haven't heard from anyone. Please help.