Help - Search - Members - Calendar
Full Version: Simple python caller
Skype Community > English > Development, Betas and Skype Garage > Public API
austinaggie
I am just getting started with the python api and I love it. I am wanting to perform what seems to be a common workflow.

Initiate Call
on Answer, play wav
hang up

I can dial and process events as expected but for some reason it doesn't accept me changing the InputDevice to a file. I am using version 2.6 of skype on the mac. I was just guessing on this application so if there is a best practice that I should follow please advise. From the example code, that is what I have been able to deduce.

CODE
import Skype4Py
import sys
import time
flag = 1
class CallEvents:
        def CallInputStatusChanged(self,call,status):
                print call.InputDevice()
                print "Input",call,status
        def CallStatus(self,call,status):
                print "Status",call,status
                if status == "INPROGRESS":
                        print "change to file input"
                        print call.InputDevice(Skype4Py.callIoDeviceTypeFile,'a.wav')
                elif status == "FINISHED":
                        print "DIE"
                        flag = 0
                        sys.exit(1)
                print "WHY",status

skype = Skype4Py.Skype(Events=CallEvents())
skype.Attach()

print skype.PlaceCall("anybody")

while flag == 1:
        time.sleep(1)
pkolmann
QUOTE(austinaggie @ Fri Feb 15 2008, 22:08) [snapback]497875[/snapback]

I can dial and process events as expected but for some reason it doesn't accept me changing the InputDevice to a file.


How is the file encoded?

It needs to be a WAV encoded, 16 bit mono 16kHz file.

Philipp
jlh
I once had a problem because 'a.wav' is a relative path and I don't know where Skype will be looking for that file. Try using an absolute path.
ButeLinux
I am by no means an expert but shouldn't the line

call.InputDevice(Skype4Py.callIoDeviceTypeFile,'a.wav')

be indented to the same point as the previous ( print ) line?

Or is it just the way it is being displayed in the forum?
dlx
Hi i cant post new threads so i try in this one, I got this problem when trying out Skype4Py.
Output [Errors]:
raise ISkypeError(int(errnum), errstr)
Skype4Py.errors.ISkypeError: [Errno 114] SET Invalid avatar file

-------------------------

Code:
skype = Skype4Py.Skype()
sett = Skype4Py.settings.ISettings(skype)

sett.LoadAvatarFromFile("C:\\Skype_avatars\\my_photo.jpg", 1)

That code will change my image! But i gettin that error so my script closes down. How can i get this to work?

Thanks,

BTW: This module is awesome!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.