Making Skype phone calls and sms
Making Skype phone calls and sms
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
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
Dear AHF,
Try
oCall := oSkype:SendSms(cPhone, cComment)
Regards,
Dutch
Try
oCall := oSkype:SendSms(cPhone, cComment)
Code: Select all
oCall := oSkype:PlaceCall(cphone)
Dutch
- richard-service
- Posts: 583
- Joined: Tue Oct 16, 2007 8:57 am
- Location: New Taipei City, Taiwan
- Contact:
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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: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
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: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