<s> import Skype4Py <EOL> import sys <EOL> import time <EOL> CallStatus = <NUM_LIT:0> <EOL> CallIsFinished = set ( [ Skype4Py . clsFailed , Skype4Py . clsFinished , Skype4Py . clsMissed , Skype4Py . clsRefused , Skype4Py . clsBusy , Skype4Py . clsCancelled ] ) ; <EOL> def AttachmentStatusText ( status ) : <EOL> return skype . Convert . AttachmentStatusToText ( status ) <EOL> def CallStatusText ( status ) : <EOL> return skype . Convert . CallStatusToText ( status ) <EOL> WavFile = '<STR_LIT>' <EOL> OutFile = '<STR_LIT>' <EOL> def OnCall ( call , status ) : <EOL> global CallStatus <EOL> global WavFile <EOL> global OutFile <EOL> CallStatus = status <EOL> print '<STR_LIT>' + CallStatusText ( status ) <EOL> if ( status == Skype4Py . clsEarlyMedia or status == Skype4Py . clsInProgress ) and OutFile != '<STR_LIT>' : <EOL> print '<STR_LIT>' + OutFile <EOL> call . OutputDevice ( Skype4Py . callIoDeviceTypeFile , OutFile ) <EOL> OutFile = '<STR_LIT>' <EOL> if status == Skype4Py . clsInProgress and WavFile != '<STR_LIT>' : <EOL> print '<STR_LIT>' + WavFile <EOL> call . InputDevice ( Skype4Py . callIoDeviceTypeFile , WavFile ) <EOL> HasConnected = False <EOL> def OnInputStatusChanged ( call , status ) : <EOL> global HasConnected <EOL> print '<STR_LIT>' , call . InputDevice ( ) , call , status <EOL> print '<STR_LIT>' , call . InputDevice ( ) <EOL> if status == True : <EOL> HasConnected = True <EOL> if status == False and HasConnected == True : <EOL> print '<STR_LIT>' <EOL> call . Finish ( ) <EOL> def OnAttach ( status ) : <EOL> print '<STR_LIT>' + AttachmentStatusText ( status ) <EOL> if status == Skype4Py . apiAttachAvailable : <EOL> skype . Attach ( ) <EOL> try : <EOL> CmdLine = sys . argv [ <NUM_LIT:1> ] <EOL> except : <EOL> print '<STR_LIT>' <EOL> sys . exit ( ) <EOL> try : <EOL> WavFile = sys . argv [ <NUM_LIT:2> ] <EOL> except : <EOL> WavFile = '<STR_LIT>' <EOL> try : <EOL> OutFile = sys . argv [ <NUM_LIT:3> ] <EOL> except : <EOL> OutFile = '<STR_LIT>' <EOL> skype = Skype4Py . Skype ( ) <EOL> skype . OnAttachmentStatus = OnAttach <EOL> skype . OnCallStatus = OnCall <EOL> skype . OnCallInputStatusChanged = OnInputStatusChanged <EOL> if not skype . Client . IsRunning : <EOL> print '<STR_LIT>' <EOL> skype . Client . Start ( ) <EOL> print '<STR_LIT>' <EOL> skype . Attach ( ) <EOL> Found = False <EOL> for F in skype . Friends : <EOL> if F . Handle == CmdLine : <EOL> Found = True <EOL> print '<STR_LIT>' + F . Handle + '<STR_LIT:..>' <EOL> skype . PlaceCall ( CmdLine ) <EOL> break <EOL> if not Found : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' + CmdLine + '<STR_LIT>' <EOL> skype . PlaceCall ( CmdLine ) <EOL> while not CallStatus in CallIsFinished : <EOL> time . sleep ( <NUM_LIT:0.1> ) </s>
