AttributeError: '_pjsua.Transport_Config' object has no attribute '_cvt_to_pjsua'
Question: I'm currently trying to use the `pjsip` api `pjsua` in python and therefor
studying this Hello World example:
<http://trac.pjsip.org/repos/wiki/Python_SIP/Hello_World>

I copied the code over, integrated account configuration according to
<http://trac.pjsip.org/repos/wiki/Python_SIP/Accounts> etc. But when I run the
sample, I get the following output:

    
    
    Traceback (most recent call last):
        File "/home/dmeli/workspace/eit.cubiephone.sip_test/eit/cubiephone/sip_test/hello.py", line 48, in <module>
            acc = lib.create_account(acc_cfg)
        File "/usr/local/lib/python2.7/dist-packages/pjsua.py", line 2300, in create_account
            err, acc_id = _pjsua.acc_add(acc_config._cvt_to_pjsua(), set_default)
        File "/usr/local/lib/python2.7/dist-packages/pjsua.py", line 900, in _cvt_to_pjsua
            cfg.rtp_transport_cfg = self.rtp_transport_cfg._cvt_to_pjsua()
        AttributeError: '_pjsua.Transport_Config' object has no attribute '_cvt_to_pjsua'
    

Because I'm not really a python expert and never worked with PJSIP before, I
can't really figure out the error. Too me, it looks like it's actually an
error in the `pjsip` python wrapper. But what do I know?

Code:

    
    
    lib = pj.Lib()
    lib.init(log_cfg = pj.LogConfig(level=3, callback=log_cb))
    transport = lib.create_transport(pj.TransportType.UDP)
    lib.start()
    acc_cfg = pj.AccountConfig("XXXXX", "XXXXXX", "XXXXXX")
    acc_cfg.id = "sip:XXXXXXX@XXXXXXXX"
    acc_cfg.reg_uri = "sip:XXXXXXXXX"
    acc_cfg.proxy = [ "sip:XXXXXXXXX;lr" ]
    acc = lib.create_account(acc_cfg)
    
    # Make call
    call = acc.make_call("XXXXXXXXXXX", MyCallCallback())
    

Line where the error happens in pjsua.py:

    
    
    cfg.rtp_transport_cfg = self.rtp_transport_cfg._cvt_to_pjsua()
    

(`rtp_transport_cfg` doesn't seem to have a member `_cvt_to_pjsua()`??)


Answer: **For further work correctly, look at the PJSIP api (pjsua.py) that he is
waiting for the order and structure!!!**

    
    
    ## start lib.
    def start(self):
        try:
            self._start_lib()
            self._start_acc()
        except pj.Error:
            print "Error starting lib."
    
    
    
    def _bind(self):
        try:
            t = pj.TransportConfig()
            t.bound_addr = '0.0.0.0'
            t.port = 5060 
            acc_transport = "udp" # depend if you need.
            if  acc_transport == "tcp":
                self.transport = self.lib.create_transport(pj.TransportType.TCP, t)
                # or this pj.TransportConfig(0) is creating random port ... 
                #self.transport = self.lib.create_transport(pj.TransportType.TCP, pj.TransportConfig(0))
            else:
                self.transport = self.lib.create_transport(pj.TransportType.UDP, t)
                #self.transport = self.lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(0))
        except pj.Error:
            print "Error creating transport."
    
        #you need create callbacks for app, to work incoming calls, check on the server that returns the error code 200, and such a way your program will know that you are logged on correctly
        #from callback.acc_cb import acc_cb
        #self.acc_t = self.lib.create_account_for_transport(self.transport, cb=acc_cb())
    
    def _start_lib(self):
        self.lib.init(log_cfg = pj.LogConfig(level=3, callback=log_cb))
        self.lib.start()
        self._bind()
        #codecs.load_codecs()
    
    
    def _start_acc(self):
        #from callback.acc_cb import acc_cb
        try:
                proxy = "sip server ip" # or proxy = socket.gethostbyname(unicode("sip.serverdnsname.com")) is needed to import socket
                login = "Atrotygma" # real username
                password = "Atrotygma_password" # real username
                lib.create_account(acc_config=pj.AccountConfig(proxy, login, password))
        except Exception, e:
            print "Error creating account", e
    

