Help - Search - Members - Calendar
Full Version: Simple python caller
Skype Community > English > Development, Betas and Skype Garage > Skype 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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.