I download source code from svn and I still have this error. I attach the code. In the method make_call() I comment out lines that depends on successful wav player initialization. Any advice? # $Id:$ # # SIP call sample. # # Copyright (C) 2003-2008 Benny Prijono <benny at prijono.org> # import sys import wave import pjsua as pj import thread import _pjsua from time import sleep LOG_LEVEL=3 current_call = None C_QUIT = 0 THIS_FILE = "SIPSender.py" # Logging callback def log_cb(level, str, len): print str, # Callback to receive events from account class MyAccountCallback(pj.AccountCallback): def __init__(self, account): pj.AccountCallback.__init__(self, account) # Notification on incoming call def on_incoming_call(self, call): global current_call if current_call: call.answer(486, "Busy") return print "Incoming call from ", call.info().remote_uri print "Press 'a' to answer" current_call = call call_cb = MyCallCallback(current_call) current_call.set_callback(call_cb) current_call.answer(180) # Callback to receive events from Call class MyCallCallback(pj.CallCallback): def __init__(self, call): pj.CallCallback.__init__(self, call) # Notification when call state has changed def on_state(self): global current_call print "Call with", self.call.info().remote_uri, print "is", self.call.info().state_text, print "last code =", self.call.info().last_code, print "(" + self.call.info().last_reason + ")" if self.call.info().state == pj.CallState.DISCONNECTED: current_call = None # Notification when call's media state has changed. def on_media_state(self): if self.call.info().media_state == pj.MediaState.ACTIVE: # Connect the call to sound device call_slot = self.call.info().conf_slot pj.Lib.instance().conf_connect(call_slot, 0) pj.Lib.instance().conf_connect(0, call_slot) print "Media is now active" else: print "Media is inactive" # Function to make call def make_call(uri, arg): try: global lib # register python thread thread_desc = 0; err = _pjsua.thread_register("python worker", thread_desc) # make a call print "Making call to", uri call = acc.make_call(uri) call_cb = MyCallCallback(call) call.set_callback(call_cb) # stream wav file # calculate wav time wfile = wave.open("input.48.wav") time = (1.0 * wfile.getnframes ()) / wfile.getframerate () print str(time) + "ms" wfile.close() # stream wav file player_id = lib.create_player("input.48.wav") print "Wav player id is: ", player_id # lib.conf_connect(lib.player_get_slot(player_id), call.info ().conf_slot) sleep(time) # lib.conf_disconnect(lib.player_get_slot(player_id), call.info ().conf_slot) # lib.player_destroy(player_id) except pj.Error, e: print "Error: " + str(e) return None # Create library instance lib = pj.Lib() try: # Init library with default config and some customized # logging config. lib.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, callback=log_cb), media_cfg = pj.MediaConfig()) # Create UDP transport which listens to any available port transport = lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(0)) print "\nListening on", transport.info().host, print "port", transport.info().port, "\n" # Start the library lib.start() # Create account config acc_conf = pj.AccountConfig() acc_conf.build_config("192.168.169.99", "1000", "1234", "SIPAgent") # Create account acc = lib.create_account(acc_conf) acc_cb = MyAccountCallback(acc) acc.set_callback(acc_cb) # Make a call t = thread.start_new_thread(make_call, ("sip:1001 at 192.168.169.99<sip%3A1001 at 192.168.169.99>", 1)) input = sys.stdin.readline().rstrip("\r\n") # Shutdown the library lib.destroy() lib = None except pj.Error, e: print "Exception: " + str(e) lib.destroy() lib = None 2008/7/11 Benny Prijono <bennylp at pjsip.org>: > On Fri, Jul 11, 2008 at 10:03 AM, Adamczak Krzysztof <kradamcz at gmail.com> > wrote: > >> Hey, >> >> Thank to your work - now I'm working with Python binding to pjsip so I'm >> very glad that we have new Python wrapper. Now I'm switching to this wrapper >> and I have a very short question. How I can initialize media? I'm talking >> about streaming wav files. I initialize library with line: >> lib.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, callback=log_cb), >> media_cfg = pj.MediaConfig()) >> >> But later when i create wav player it returns id = 0. And when I try: >> lib.conf_connect(lib.player_get_slot(player_id), call.info().conf_slot) >> >> it returns: >> Error: Object: Lib, operation=player_get_slot(), error=Invalid player id >> >> > It's a bug in player_get_slot(), I've just fixed that. > > Thanks for the report. > > Cheers > Benny > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080711/fb67c25b/attachment.html