<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:verdana, helvetica, sans-serif;font-size:10pt;color:#000000;"><DIV>Hello,</DIV>
<DIV> </DIV>
<DIV>In FreeSwitch 1.0.1 using Python, I'm having a strange problem with callback functions.</DIV>
<DIV>When I define a callback function, for some reason I'm unable to use any of the os.stat() related functions in Python. </DIV>
<DIV> </DIV>
<DIV>The example below shows the problem. When it runs, I get the following error:</DIV>
<DIV> </DIV>
<DIV> return os.stat(filename).st_size<BR> TypeError: expected string or Unicode object, NoneType found</DIV>
<DIV> </DIV>
<DIV>I know that I'm passing a correct value into the stat function. </DIV>
<DIV> </DIV>
<DIV>But if I comment-out my call to the callback function, it executes fine.</DIV>
<DIV> </DIV>
<DIV>I'm sure there's some larger issue going on here, but I'm not sure where to look. </DIV>
<DIV> </DIV>
<DIV>import os<BR>from freeswitch import *</DIV>
<DIV> </DIV>
<DIV>def input_callback_record_file_pound_stop(session, what, obj):<BR> if (type == "dtmf" and obj['digit'] == '#'):<BR> return "break"</DIV>
<DIV> </DIV>
<DIV>def input_callback_normal(session,what,obj):<BR> consoleLog("INFO", "input_callback_normal")</DIV>
<DIV> </DIV>
<DIV>def record_file(session,filename):<BR> session.streamFile("/usr/local/acudoc/prompts/shortbeeptone.wav")<BR> session.setInputCallback(input_callback_record_file_pound_stop)<BR> ret = session.recordFile(filename, 60000, 3, 3)<BR> session.setInputCallback(input_callback_normal)<BR> return(ret)</DIV>
<DIV> </DIV>
<DIV>def handler(session, args):<BR> session.answer()<BR> session.execute("sleep", "1000")<BR> record_file(session,"/home/marc/test.wav")<BR> thesize = os.path.getsize("/home/marc/test.wav")<BR> consoleLog("INFO","Size = " + str(thesize) + "\n")<BR></DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Marc</DIV>
<DIV> </DIV></div></body></html>