Making Skype phone calls and sms

Making Skype phone calls and sms

Postby AHF » 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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby dutch » Wed Nov 14, 2007 6:41 pm

Dear AHF,

Try

oCall := oSkype:SendSms(cPhone, cComment)

Code: Select all  Expand view
oCall := oSkype:PlaceCall(cphone)


Regards,
Dutch
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Otto » Wed Nov 14, 2007 6: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.
User avatar
Otto
 
Posts: 6064
Joined: Fri Oct 07, 2005 7:07 pm

Postby AHF » Fri Nov 16, 2007 11:48 am

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

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby richard-service » Fri Nov 16, 2007 3: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
User avatar
richard-service
 
Posts: 772
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Postby AHF » Fri Nov 16, 2007 4:14 pm

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

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » Fri Nov 16, 2007 9:54 pm

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

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41397
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Sat Nov 17, 2007 9: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Antonio Linares » Sat Nov 17, 2007 9:29 am

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41397
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Sat Nov 17, 2007 1:35 pm

Below is the code to make phone calls and send sms through skype.
Function Countrycode() not included.

Hope you'll enjoy it. :lol:

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:Client:IsRunning()
MsgRun("Informação","Activando o Skipe",{||oSkype:Client:Start()})
Endif

//not online
if oSkype:CurrentUserStatus <> oSkype:Convert:TextToUserStatus("ONLINE")
//lets pout it on line
oSkype:changeUserStatus(oSkype:Convert: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:Client:IsRunning()
MsgRun("Informação","Activando o Skip",{||oSkype:Client:Start()})
Endif

//not online
if oSkype:CurrentUserStatus <> oSkype:Convert:TextToUserStatus("ONLINE")
//lets pout it on line
oSkype:changeUserStatus(oSkype:Convert: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Horizon and 36 guests