- It is currently Fri May 24, 2013 8:29 pm • All times are UTC + 2 hours
Speakerphone
37 posts
• Page 1 of 1
Speakerphone
Here are 2 samples for the article with the Speakerphone. You can read it at:
http://teksoftco.com/forum/viewtopic.php?t=80
The sample for WM2003:
www.teksoftco.com/radu/posts/addon/speakerphone2003.php
The sample for WM2005:
www.teksoftco.com/radu/posts/addon/speakerphone2005.php
Happy testing I know you'll love this,
Radu
http://teksoftco.com/forum/viewtopic.php?t=80
The sample for WM2003:
www.teksoftco.com/radu/posts/addon/speakerphone2003.php
The sample for WM2005:
www.teksoftco.com/radu/posts/addon/speakerphone2005.php
Happy testing I know you'll love this,
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
Well no because it works like this:
-cprog.exe (good as an example) is making a call. The user goes to speakerphone by pressing the green key. The audio driver only receives the command to go to speakerphone mode (that message i've talked about in the article)
-the user decides to stop the speakerphone, so he presses the green key again. Now the audio driver receives the same message.
-the user keeps the speakerphone on up to the end of his call. then he stops the call with the red key. the call is terminated and so is the speakerphone. The audio driver receives the same message.
As you can see we only have a command which means "switch it". Not even cprog doesnt check is previously the speakerphone was activated, it just sends that message (probably who wrote cprog.exe didnt think someone will do it from another application
they didnt give any docs on this just joking).
So what you can do is to assume that the first thing when a call is established, you wont have the speakerphone on.
Is there a scenario in which you definitively need to know the status of the speakerphone?
Radu
-cprog.exe (good as an example) is making a call. The user goes to speakerphone by pressing the green key. The audio driver only receives the command to go to speakerphone mode (that message i've talked about in the article)
-the user decides to stop the speakerphone, so he presses the green key again. Now the audio driver receives the same message.
-the user keeps the speakerphone on up to the end of his call. then he stops the call with the red key. the call is terminated and so is the speakerphone. The audio driver receives the same message.
As you can see we only have a command which means "switch it". Not even cprog doesnt check is previously the speakerphone was activated, it just sends that message (probably who wrote cprog.exe didnt think someone will do it from another application
So what you can do is to assume that the first thing when a call is established, you wont have the speakerphone on.
Is there a scenario in which you definitively need to know the status of the speakerphone?
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
additional audio control
Hi,
I would like to say great post first of all, controlling the speakerphone was a major issue which I could not get my head around. - Thanks
Was wondering if you were able to decifer other commands from ossvcs.dll? Currently I'm trying to stop audio from going out to the handset audio device on a WM5 CDMA device while in a call. I've tried setting the audio device to NONE via the RIL API calls with no luck (e.g. RIL_GetAudioDevices(...)). I could possibly use waveOut calls but i'm afraid that it might be device specific. Was wondering if there was a general call to control the audio device like the speakerphone toggle call from the ossvcs.dll. Any help would greatly be appreciated.
Thanks in Advance
Q.
I would like to say great post first of all, controlling the speakerphone was a major issue which I could not get my head around. - Thanks
Was wondering if you were able to decifer other commands from ossvcs.dll? Currently I'm trying to stop audio from going out to the handset audio device on a WM5 CDMA device while in a call. I've tried setting the audio device to NONE via the RIL API calls with no luck (e.g. RIL_GetAudioDevices(...)). I could possibly use waveOut calls but i'm afraid that it might be device specific. Was wondering if there was a general call to control the audio device like the speakerphone toggle call from the ossvcs.dll. Any help would greatly be appreciated.
Thanks in Advance
Q.
- qcorporation
- TEK-Newbie

- Posts: 6
- Joined: Wed Jul 05, 2006 2:22 pm
re: voice routing
Hi Radhoo,
When you talk about "voice routing" I'm assuming that you're speaking of using the WaveForm Audio Functions to set the preferred audio device?
Thanks for the quick response
Q.
When you talk about "voice routing" I'm assuming that you're speaking of using the WaveForm Audio Functions to set the preferred audio device?
Thanks for the quick response
Q.
- qcorporation
- TEK-Newbie

- Posts: 6
- Joined: Wed Jul 05, 2006 2:22 pm
When you talk about "voice routing" I'm assuming that you're speaking of using the WaveForm Audio Functions to set the preferred audio device?
Actually not.
Voice routing is used in conjunctions with In-call audio. The audio is routed from sistem->speaker to phone->speaker. There also is routing used for bluetooth headsets.
So this means that if while in a call you re-route the audio to sistem->speaker, the other party in the phone call cant be heard in the speaker ~ muted.
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
Hi,
I think this is the appropriate place to post my question
I am programming a client on my smartphone. I receive voice packets on it and am not able to play. I need to receive and send voice packets. How can I play the raw voice packets that I receive?
How can I record what I talk into my phone mic and send it as raw packet?
Would be very helpful if someone could answer..
I am doing it on a Smartphone 2003 device
I think this is the appropriate place to post my question
I am programming a client on my smartphone. I receive voice packets on it and am not able to play. I need to receive and send voice packets. How can I play the raw voice packets that I receive?
How can I record what I talk into my phone mic and send it as raw packet?
Would be very helpful if someone could answer..
I am doing it on a Smartphone 2003 device
- ibm_thinkpad
- TEK-Newbie

- Posts: 8
- Joined: Thu Jul 06, 2006 9:29 am
hi ibm_thinkpad,
How are those pachets received? Are you using sockets and TCP/IP?
What does the Raw data represent? How do you code the voice? In order for me to tell you how to play the data i need to know what data representation you are using.
At least for this question there is a direct answer: see WAVEIN api functions in order to use the microphone.
2003 is ok for this application. good luck!
Radu
I receive voice packets on it and am not able to play
How are those pachets received? Are you using sockets and TCP/IP?
How can I play the raw voice packets that I receive?
What does the Raw data represent? How do you code the voice? In order for me to tell you how to play the data i need to know what data representation you are using.
How can I record what I talk into my phone mic and send it as raw packet?
At least for this question there is a direct answer: see WAVEIN api functions in order to use the microphone.
I am doing it on a Smartphone 2003 device
2003 is ok for this application. good luck!
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
Hi Radoo,
Thanks for the fast reply...
Yes, I receive the packets using TCP/IP
The voice is coded using SIP (Session Initiation Protocol)
I have sucessfully initiated the session and also have split the voice data from the packet.
But I dont know how to play the voice data on my phone...
Its wave format for sure but how to play is the question
For example...the following is the voice data I have split from the packet
[code]vcdata ="SÛ:yAmv5()Y)ØC
Thanks for the fast reply...
Yes, I receive the packets using TCP/IP
The voice is coded using SIP (Session Initiation Protocol)
I have sucessfully initiated the session and also have split the voice data from the packet.
But I dont know how to play the voice data on my phone...
Its wave format for sure but how to play is the question
For example...the following is the voice data I have split from the packet
[code]vcdata ="SÛ:yAmv5()Y)ØC
- ibm_thinkpad
- TEK-Newbie

- Posts: 8
- Joined: Thu Jul 06, 2006 9:29 am
Hi again Radhoo,
I just found out that it is compressed in Truespeech wave format.
Anyway to decompress it and play it?
I just found out that it is compressed in Truespeech wave format.
Anyway to decompress it and play it?
- ibm_thinkpad
- TEK-Newbie

- Posts: 8
- Joined: Thu Jul 06, 2006 9:29 am
Hi,
for playing wave files you must use the WAVEOUT set of functions. That would be:
waveOutOpen , waveOutPrepareHeader , waveOutWrite
We might write an article on this later. Until then try reading the docs available online, there are plenty of those!
Cheers,
Radu
for playing wave files you must use the WAVEOUT set of functions. That would be:
waveOutOpen , waveOutPrepareHeader , waveOutWrite
We might write an article on this later. Until then try reading the docs available online, there are plenty of those!
Cheers,
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
Hi Radoo,
I just finished coding waveout and wavein but what about the compression? How do i decomepress the stream?
I just finished coding waveout and wavein but what about the compression? How do i decomepress the stream?
- ibm_thinkpad
- TEK-Newbie

- Posts: 8
- Joined: Thu Jul 06, 2006 9:29 am
Hi Radhoo,
It is just wave format...
Will you be able to give me a sample code to play the string i had pasted over here?
It is just wave format...
Will you be able to give me a sample code to play the string i had pasted over here?
- ibm_thinkpad
- TEK-Newbie

- Posts: 8
- Joined: Thu Jul 06, 2006 9:29 am
Hi Radhoo,
U can try just one of the formats and check if it plays with your code.
Just give me whichever play.
Thanks in advance
U can try just one of the formats and check if it plays with your code.
Just give me whichever play.
Thanks in advance
- ibm_thinkpad
- TEK-Newbie

- Posts: 8
- Joined: Thu Jul 06, 2006 9:29 am
PlayWAV
Some old code, i didnt have the time to check it properly but should get the job done:
Radu
- Code: Select all
BYTE *bSave;
WAVEFORMATEX wfe;
HWAVEOUT hWaveOut;
DWORD dwLength;
WAVEHDR whdr1;
void LoadWaveFile(TCHAR *szPath)
{
FILE *fp;
int len;
BYTE data[1024];
if (fp = _tfopen(szPath,L"rb"))
{
fread(data, 4, 1, fp); // strings are case-sensitive
fread(&len, 4, 1, fp);
fread(data, 8, 1, fp); // note: space is required
fread(&len, 4, 1, fp);
fread(&wfe, 18, 1, fp);
fread(data, 4, 1, fp);
fread(&dwLength, 4, 1, fp);
bSave = (BYTE *)malloc(dwLength);
fread(bSave, dwLength, 1, fp);
fclose(fp);
}
}
void PlayWave()
{
waveOutReset(hWaveOut);
waveOutUnprepareHeader(hWaveOut , &whdr1 , sizeof(WAVEHDR));
whdr1.lpData = (LPSTR)bSave;
whdr1.dwBufferLength = dwLength;
whdr1.dwBytesRecorded = 0;
whdr1.dwFlags = WHDR_BEGINLOOP | WHDR_ENDLOOP;
whdr1.dwLoops = 1;
whdr1.lpNext = NULL;
whdr1.dwUser = 0;
whdr1.reserved = 0;
//play to speaker
waveOutOpen(&hWaveOut , WAVE_MAPPER , &wfe ,(DWORD)g_hWnd , 0 , CALLBACK_WINDOW);
waveOutPrepareHeader(hWaveOut , &whdr1 , sizeof(WAVEHDR));
waveOutWrite(hWaveOut , &whdr1 , sizeof(WAVEHDR));
// free(memSave);
}
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
Hi Radhoo,
Thanks for the speedy reply.
That code is useful but it is for opening a file. I just have to play the characters in the string that i have.
How do i converts the characters into streams?
Thanks for the speedy reply.
That code is useful but it is for opening a file. I just have to play the characters in the string that i have.
How do i converts the characters into streams?
- ibm_thinkpad
- TEK-Newbie

- Posts: 8
- Joined: Thu Jul 06, 2006 9:29 am
Well... to adapt that code do the following:
Instead of using LoadWaveFile, put your stream data in this structure:
Then be sure to correctly populate the fields of the WAVEFORMATEX wfe; structure. Here you need to know the sample rate (11025,22050 Hz etc,...) and the bit depth.
Radu
Instead of using LoadWaveFile, put your stream data in this structure:
- Code: Select all
bSave = (BYTE *)malloc(dwLength);
fread(bSave, dwLength, 1, fp);
fclose(fp);
Then be sure to correctly populate the fields of the WAVEFORMATEX wfe; structure. Here you need to know the sample rate (11025,22050 Hz etc,...) and the bit depth.
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
Hi Radhoo,
thank you very much for the help...
I tried it and I get jumbled up noises. The sound is actually encoded using Truespeech, so i will need a codec to decode it and then I have to play it
thank you very much for the help...
I tried it and I get jumbled up noises. The sound is actually encoded using Truespeech, so i will need a codec to decode it and then I have to play it
- ibm_thinkpad
- TEK-Newbie

- Posts: 8
- Joined: Thu Jul 06, 2006 9:29 am
Hi Radhoo,
I just want the default phone speakers to be used while I play a media file. It is played on the external loud speakers, but i want that to be played on the default phone speakers. I tried with RIL API to set that. But it fails on Sprint 6700 device. Is there a way to set that media file to be played on the phone speakers. I tried your sample applications. It works great.
Can you help ?
With Regards,
TeMp123
I just want the default phone speakers to be used while I play a media file. It is played on the external loud speakers, but i want that to be played on the default phone speakers. I tried with RIL API to set that. But it fails on Sprint 6700 device. Is there a way to set that media file to be played on the phone speakers. I tried your sample applications. It works great.
Can you help ?
With Regards,
TeMp123
- temp123
- TEK-Seeker
- Posts: 37
- Joined: Mon Jul 24, 2006 9:21 pm
voice routing
Hi Radhoo,
Sorry for dropping off on that conversation earlier about voice routing. I had to put that task on the back-burner to deal with more pressing matters.
Now that I'm revisiting the issue, how would someone be able to route voice properly, or rather what API calls could be used, to allow the earpiece to be "muted" during an active call.
Thanks for the earlier answers, you're site is great!
Q.
Sorry for dropping off on that conversation earlier about voice routing. I had to put that task on the back-burner to deal with more pressing matters.
Now that I'm revisiting the issue, how would someone be able to route voice properly, or rather what API calls could be used, to allow the earpiece to be "muted" during an active call.
Thanks for the earlier answers, you're site is great!
Q.
- qcorporation
- TEK-Newbie

- Posts: 6
- Joined: Wed Jul 05, 2006 2:22 pm
how would someone be able to route voice properly, or rather what API calls could be used, to allow the earpiece to be "muted" during an active call.
muting the speaker...
the simple approach is to modify the audio gain. RIL_SetAudioGain. So this would change the volume bar (you can tap on the speaker icon while in a call and you get a single slider instead of the usual 2 sliders). This wont mute the speaker perfectly, it would just lower its volume. again, its all about what you are trying to do.
the not so simple approach is to route the voice from one device to another. so if while in a call you are routing the voice to go from the system's audio to the loudspeaker instead of going from the audio-modem to the 'earpiece' speaker, you're phone speaker will get muted. still, there might be side effects depending on each hardware platform.
The code for routing the voice cant be posted here, as Teksoft sells it as a library.
Cheers,
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
muting the speaker
Hi Radu,
Thanks for the post.
I've tried the SetAudioGain before in the past without any luck.
To give you some background, on CDMA devices there seems to be no official "hold" of an active call. The resident dailler on the device performs a "quasi" hold (i'm guessing here) where it mutes the incoming and outgoing audio streams. This gives a fake impression that the remote party is really on hold. For specific devices i'm able to write to a register to get the muting but this is device specific.
I wanted to mimic that quasi hold state in a general sense in my phone application.
The Audio Gateway seems to do voice routing to the bluetooth headset, i'm wondering if there's any way I'll be able to see how that works and apply it to my specific situation.
Many thanks for the guidance. Wish me luck
Cheers,
Q.
Thanks for the post.
I've tried the SetAudioGain before in the past without any luck.
To give you some background, on CDMA devices there seems to be no official "hold" of an active call. The resident dailler on the device performs a "quasi" hold (i'm guessing here) where it mutes the incoming and outgoing audio streams. This gives a fake impression that the remote party is really on hold. For specific devices i'm able to write to a register to get the muting but this is device specific.
I wanted to mimic that quasi hold state in a general sense in my phone application.
The Audio Gateway seems to do voice routing to the bluetooth headset, i'm wondering if there's any way I'll be able to see how that works and apply it to my specific situation.
Many thanks for the guidance. Wish me luck
Cheers,
Q.
- qcorporation
- TEK-Newbie

- Posts: 6
- Joined: Wed Jul 05, 2006 2:22 pm
Hi Q.,
On 2003 devices, the Audio gateway, is in fact a driver loaded by devices.exe at system startup. Some implementations that I've seen have this driver as a file: audiogw.dll in the windows folder.
It is true that you can control the voice routing from there. We have developed our own version of this driver so we can customize its functionality but then we saw that for the voice routing the AudioGW is using the Audio Driver. So using the AudioGW for voice routing is just the longer path for getting to the same result as of working with the Audio Driver directly. I dont say its not good, but keep in mind that this interactions (Controlling the voice routing) are highly dependant on the hardware implementations, and its usually a good idea to keep things as simple as possible (my advise: skip the AudioGW and use the Audio Driver directly).
It would be nice for things to be as simple as wishing you good luck, its just that we've checked those possibilities already and we saw what can and what cannot be done.
Again, if interested, you can contact Teksoft at sales@teksoftco.com for details on the library that controls the voice routing.
Radu
On 2003 devices, the Audio gateway, is in fact a driver loaded by devices.exe at system startup. Some implementations that I've seen have this driver as a file: audiogw.dll in the windows folder.
It is true that you can control the voice routing from there. We have developed our own version of this driver so we can customize its functionality but then we saw that for the voice routing the AudioGW is using the Audio Driver. So using the AudioGW for voice routing is just the longer path for getting to the same result as of working with the Audio Driver directly. I dont say its not good, but keep in mind that this interactions (Controlling the voice routing) are highly dependant on the hardware implementations, and its usually a good idea to keep things as simple as possible (my advise: skip the AudioGW and use the Audio Driver directly).
It would be nice for things to be as simple as wishing you good luck, its just that we've checked those possibilities already and we saw what can and what cannot be done.
Again, if interested, you can contact Teksoft at sales@teksoftco.com for details on the library that controls the voice routing.
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
temp123, there is a similar thread (with source code) here:
http://www.teksoftco.com/forum/viewtopic.php?t=778
Mr. A
http://www.teksoftco.com/forum/viewtopic.php?t=778
Mr. A
- admin
- Editors
- Posts: 314
- Joined: Sat Mar 04, 2006 3:37 pm
radhoo wrote:You're not the only one with this request. Dozens of programmers doing voip software have raised this question.
The answer to yours for the moment is no. Im sorry, but i hope we can give better news later.
Cheers,
Radu
Does anyone have the solution to play the voip sound to the speakerphone?
FCCH
- fcch
- TEK-Newbie

- Posts: 6
- Joined: Sat Jul 28, 2007 8:21 am
rui luis wrote:this all sound very interesting, do you guys can tell me if its possible to build an aplication that when we receive a phone call the ppc answers it with a prerecorded message or music before we pick-up the ppc phone?
thanks
Hello Luis,
Everything that happens before you pickup the phone is handled by the phone operator.
It is barely possible that after the phone connection is established to send some sounds, but indirectly, by using the speaker-microphone acoustic link (bad quality).
Regards,
Radu
- radhoo
- TEK-Insider

- Posts: 640
- Joined: Fri Mar 17, 2006 2:47 am
37 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests