FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Making Skype phone calls and sms
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Making Skype phone calls and sms
Posted: Wed Nov 14, 2007 10:38 AM

I've been trying with the code below but it doesn't work.

FUNCTION PhoneTO(cPhone,cNome,cComment)
Local oSkype,oCall,oUser

cPhone := alltrim(cPhone)

Try
oSkype := CreateObject("Skype4COM.Skype")
Catch
alert("Skype4Com não está instalado!")
return
End

If .not. oSkype:Client:IsRunning()
MsgRun("Informação","Activando o Skipe",{||oSkype:Client:Start()})
Endif

Try
oCall := oSkype:PlaceCall(cphone)
Catch
MsgInfo("Chamada falhada! Telefone: "+cPhone)
return 0
End

oSkype := Nil
RETURN 1

I get the following error :

Args:
[ 1] = C 'echo123'
argumentos { 'echo123' }
descrição E_FAIL
ficheiro <nenhuma>
genCode 41: Unknown or reserved
operação PLACECALL
osCode (Não é erro do sistema operativo)
severity 2
subCode 16389
subSystem SKYPE4COM.Skype
tries 0

Does anyone knows how to work with it ?
I've chech already this newsgroup but the code I've found it's for old API.

Regards
Antonio

Regards

Antonio H Ferreira
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Making Skype phone calls and sms
Posted: Wed Nov 14, 2007 06:41 PM
Dear AHF,

Try

oCall := oSkype:SendSms(cPhone, cComment)

oCall := oSkype:PlaceCall(cphone)


Regards,
Dutch
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Making Skype phone calls and sms
Posted: Wed Nov 14, 2007 06:54 PM

I would suggest a own forum for the SMS and phone stuff also outlook.
I think this becomes a very important theme in future and it would be easier for someone who starts if all the information is sorted.
At the moment I don’t need this info’s but I know I will need this in near future.

Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Making Skype phone calls and sms
Posted: Fri Nov 16, 2007 11:48 AM

Can somone who can help me ?
I've tried everything.

Antonio

Regards

Antonio H Ferreira
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Making Skype phone calls and sms
Posted: Fri Nov 16, 2007 03:14 PM

Hi Antonio,

I think this is you want it.

http://www.fivetech.com.tw/big5/FWH-ActiveX-Skype.html

I use ActiveX to call Skype ActiveX and direct call within contract name or phone number. Runing OK. If you use hardware device PHONE no problem.

Regards,

Richard

Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Making Skype phone calls and sms
Posted: Fri Nov 16, 2007 04:14 PM

With Activex I get error but I have the Skyp4com.dll and skype 3 installed. Do you have some clue ?

Antonio

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Making Skype phone calls and sms
Posted: Fri Nov 16, 2007 09:54 PM

I've found the error. Application was forbbiden by skype. It's solved!
Thanks to all.

Antonio

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Making Skype phone calls and sms
Posted: Fri Nov 16, 2007 10:29 PM

Antonio,

> I've found the error. Application was forbbiden by skype. It's solved!

How did you solve it ? thanks,

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Making Skype phone calls and sms
Posted: Sat Nov 17, 2007 09:27 AM
From Skype last version you need to give permission to any program to use skype api. You can do it on :

Tools -> Options -> Advanced

Otherwise all the api requests will be rejected.

It seems next version will return to the way it was before (no permisson necessary) because of the claims.

By the way, the code has the following diference to the one post previously :

oUser:= oSkype:user(cPhone)
oCall := oSkype:PlaceCall(oUser:Handle)


It works perfectly. And it can process a call to a number or if you have the skype user name to a user directly (no cost involved).

In order to avoid any errors the phone number must be in the following format :

"+"country code+phone number without spaces.

If you have "00" in the number it must be taken out.

I'll post the complete code as soon I have it finnished.

Hope this will help.

Antonio
Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Making Skype phone calls and sms
Posted: Sat Nov 17, 2007 09:29 AM

Thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Making Skype phone calls and sms
Posted: Sat Nov 17, 2007 01:35 PM
Below is the code to make phone calls and send sms through skype.
Function Countrycode() not included.

Hope you'll enjoy it. :-)

Antonio

FUNCTION PhoneTO(cPhone,cNome,cComment,CodeCountry)
Local oSkype,oCall,oUser

DEFAULT CodeCountry := CountryCode()

if empty(cPhone)
return 0
endif

//if its a user do nothing
if val(cPhone) <>0
//phone number build format
cPhone := alltrim(cPhone)
// in the databse all international numbers have 00
//it must be taken out
if substr(cPhone,1,2) == "00"
cPhone := substr(cPhone,3)
else
//all others are national numbers code country must be added
cPhone := CodeCountry+cPhone
endif
cPhone :="+"+cPhone
endif

Try
oSkype := GetActiveObject("Skype4COM.Skype")
Catch
Try
oSkype := CreateObject("Skype4COM.Skype")
Catch
alert("Skype4Com não está instalado!"+;
";"+ole2txterror())
return 0
End
End

If .not. oSkype:IsRunning()
MsgRun("Informação","Activando o Skipe",{||oSkype:Start()})
Endif

//not online
if oSkype:CurrentUserStatus <> oSkype:TextToUserStatus("ONLINE")
//lets pout it on line
oSkype:changeUserStatus(oSkype:textToUserStatus("ONLINE"))
endif

Try
oUser:= oSkype:user(cPhone)
oCall := oSkype:PlaceCall(oUser:Handle)
Catch
MsgInfo("Chamada falhada! Telefone: "+cPhone)
return 0
End

oSkype := Nil
RETURN 1

FUNCTION EnviaSms(t_sms,cnome,t_mess,CodeCountry)
Local oSkype,oSMS,oTarget,oChunk,oCall,oUser

DEFAULT CodeCountry := CountryCode()

if empty(t_sms)
return 0
endif

//if its a user do nothing
if val(t_sms) <>0
//phone number build format
t_sms := alltrim(t_sms)
// in the databse all international numbers have 00
//it must be taken out
if substr(t_sms,1,2) == "00"
t_sms := substr(t_sms,3)
else
//all others are national numbers code country must be added
t_sms := CodeCountry+t_sms
endif
t_sms :="+"+t_sms
endif

//format message
t_mess := alltrim(t_mess)
t_mess := strtran(t_mess,"",chr(12)+CHR(13))
t_mess := strtran(t_mess,"",CHR(13))
t_mess := strtran(t_mess,"",chr(26))

Try
oSkype := GetActiveObject("Skype4COM.Skype")
Catch
Try
oSkype := CreateObject("Skype4COM.Skype")
Catch
alert("Skype4Com não está instalado!"+;
";"+ole2txterror())
return 0
End
End

If .not. oSkype:IsRunning()
MsgRun("Informação","Activando o Skip",{||oSkype:Start()})
Endif

//not online
if oSkype:CurrentUserStatus <> oSkype:TextToUserStatus("ONLINE")
//lets pout it on line
oSkype:changeUserStatus(oSkype:textToUserStatus("ONLINE"))
endif

Try
oUser:= oSkype:user(t_sms)
oSMS := oSkype:SendSms(oUser:Handle, t_mess) // generic
Catch
msginfo("Não foi possivel enviar o SMS!")
return 0
End

MsgWait( "A aguardar confirmação de envio da sms para: "+t_sms, "Skype SMS", 10 )

If oSms:Status()<>5 // not delivered ?

Msginfo("O envio da SMS pode ter falhado! ")
return 0 // erro SMS

Endif

oSkype := Nil
RETURN 1
Regards

Antonio H Ferreira

Continue the discussion