PDA

View Full Version : How to start a phone call



Raccoon29
11th September 2007, 18:38
Hi everyone!

I just have to start a Skype call when clicking on the PushButton related to a VoIP number.
The question is:
How is possible to achieve this?
Could be to post a 'callto' an idea? If yes, how could I do it? If no...well, sorry :)
Any suggestion is well accepted!

Thank you in advance to everyone will help or not!

marcel
11th September 2007, 18:51
Maybe QDesktopServices (http://doc.trolltech.com/latest/qdesktopservices.html) can help you with this.
Otherwise, maybe you can use QProcess and start/pass a parameter to Skype to start a call. If Skype doesn't allow multiple instances, then trying to open a new instance causes all the params passed to the new instance to be passed to the old instance. I guess you should document first on skype command line parameters.

Regards

Correa
13th September 2007, 18:21
Did you check the skype SDK? Maybe there is something as easy as calling a function ;)
Check out their site, there must be a link there somewhere with the documentation.

Raccoon29
14th September 2007, 11:39
Thank you for answer! :)

I am going to check both of your hints, anyway some people told me that all I need is to send a "callto:+390123456789" to a browser in order to obtain an internet call that automatically uses skype to call it.
So while I check your suggestions, could you please tell me how to post this sort of messages? (I refer to the callto ,or mailto , is the same )

Thank you so much!
Greetings

marcel
14th September 2007, 13:31
QDesktopServices:: openUrl("callto:+390123456789");

Raccoon29
14th September 2007, 16:31
Thank you marcel
Great as ever! :D

Raccoon29
14th September 2007, 17:50
Ehm, sorry marcel, :crying:
but QDesktopServices has been introduced in Qt 4.2 and I am using Qt 3 (as the thread says) ...
so, are there other ways to achieve this callto ?

marcel
14th September 2007, 22:35
Ehm, sorry marcel, :crying:
but QDesktopServices has been introduced in Qt 4.2 and I am using Qt 3 (as the thread says) ...
so, are there other ways to achieve this callto ?

Sorry about that. I always miss it.

The correct form of the URL is : "callto://{phonenumber}", like "callto://123456789".
When you install Skype on Windows you have the option to associate it with the "callto://" protocol.

To make a call, just use( not tested )


ShellExecute(0, 0, "callto://123456789", 0, 0, SW_SHOWNORMAL);

Raccoon29
15th September 2007, 11:32
Thank you, always so kind :)

I'm going to test it and report soon.

Raccoon29
15th September 2007, 16:28
Sorry but ShellExecute results undefined...
so where is it defined?

Greetings

PS: I tried to include shellapi.h ,as suggested on the microsoft msdn site, and the compiler gave me something like over 100 errors inside "shellapi.h"... so I thougth smartly to have missed something... :eek:

marcel
15th September 2007, 16:36
Have you linked with shell32.dll?
If you're using Visual Studio you have to import shell32.lib.

But anyway, you can post the errors you get.

Raccoon29
15th September 2007, 22:45
Have you linked with shell32.dll?
No, I have not, because I'm not able to, I never linked a dll... :o


If you're using Visual Studio you have to import shell32.lib.
I'm using compiler Microsoft Visual C++ 2005 Express


But anyway, you can post the errors you get.
I don't think it could help: at 100 errors compiler stopped saying they were too much, and analysing the errors given they seems to say that that "shellapi.h" is written in some language else c++, a lot of undefined symbols and messages like:
''default-int'' is no longer accepted in C++ or sim.

In this post I can't, but if you want I could post the errors in the next message.

Thank you for your time
Greetings

marcel
15th September 2007, 23:30
Include these instead of shellapi:



#include <windows.h>
#include <shlobj.h>

Raccoon29
17th September 2007, 10:53
It works!

Thank you marcel!

Just one note for those will follow this thread: there is needed an "L" before the number to pass, that should make it compatible with the LPCWSTR Windows type.
Code is:

#include <windows.h>
#include <shlobj.h>

void callVoip()
{
ShellExecute(0,0,L"callto://+390123456789",0,0,SW_SHOWNORMAL);
}

this will automatically start the voip client making this call (if configured to do it).

Thank you all again!
Greetings