Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Use of callback functions in Python causi


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
marc at kasteris.com
Guest





PostPosted: Wed Oct 22, 2008 3:31 pm    Post subject: [Freeswitch-users] Use of callback functions in Python causi Reply with quote

Hello,

In FreeSwitch 1.0.1 using Python, I'm having a strange problem with callback functions.
When I define a callback function, for some reason I'm unable to use any of the os.stat() related functions in Python.

The example below shows the problem. When it runs, I get the following error:

return os.stat(filename).st_size
TypeError: expected string or Unicode object, NoneType found

I know that I'm passing a correct value into the stat function.

But if I comment-out my call to the callback function, it executes fine.

I'm sure there's some larger issue going on here, but I'm not sure where to look.

import os
from freeswitch import *

def input_callback_record_file_pound_stop(session, what, obj):
if (type == "dtmf" and obj['digit'] == '#'):
return "break"

def input_callback_normal(session,what,obj):
consoleLog("INFO", "input_callback_normal")

def record_file(session,filename):
session.streamFile("/usr/local/acudoc/prompts/shortbeeptone.wav")
session.setInputCallback(input_callback_record_file_pound_stop)
ret = session.recordFile(filename, 60000, 3, 3)
session.setInputCallback(input_callback_normal)
return(ret)

def handler(session, args):
session.answer()
session.execute("sleep", "1000")
record_file(session,"/home/marc/test.wav")
thesize = os.path.getsize("/home/marc/test.wav")
consoleLog("INFO","Size = " + str(thesize) + "\n")


Thanks,
Marc
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services