STUN not working in python?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 19, 2008 at 7:31 PM, Sa?l Ibarra <saghul at gmail.com> wrote:

> Hi!
>
> I'm still having this issue :( I'll try to explain it with more detail:
>
> If I configure stun_host option in uaconfig to 'stunserver.org', for
> example, nothing happens. I captured the traffic with wireshark and I
> can't see the STUN requests...
>
> If I configure stun_domain with no nameserver option, it does nothing,
> wich is the expected behaviour.
>
> But, if I configure stun_domain and namesever options I get the following
> error:
>
> /usr/lib/python2.5/threading.py:735: RuntimeWarning: tp_compare didn't
> return -1 or -2 for exception
>  return _active[_get_ident()]
> Traceback (most recent call last):
>   File "main.py", line 51, in <module>
>    main()
>  File "main.py", line 11, in main
>    core.start()
>  File "/home/saghul/yass/core/core.py", line 109, in start
>    self.start_lib()
>  File "/home/saghul/yass/core/core.py", line 124, in start_lib
>     self.lib.start()
>  File "/usr/lib/python2.5/site-packages/pjsua.py", line 2099, in start
>    lck = self.auto_lock()
>  File "/usr/lib/python2.5/site-packages/pjsua.py", line 2565, in auto_lock
>    return _LibMutex(self._lock)
>  File "/usr/lib/python2.5/site-packages/pjsua.py", line 1995, in __init__
>    self._lck.acquire()
>  File "/usr/lib/python2.5/threading.py", line 95, in acquire
>    me = currentThread()
>  File "/usr/lib/python2.5/threading.py", line 735, in currentThread
>    return _active[_get_ident()]
> SystemError: ../Objects/listobject.c:150: bad argument to internal function
>
> I'm using a very simple ua, in console, just to check this, and it's
> still happening... Am I missing something? How could I debug this more
> deeply?
>
>
Not sure if this is the case, but when you specify both stun_domain and
nameserver, the stun_domain is first resolved using DNS SRV resolution, and
the stunserver.org doesn't seem to have DNS SRV records. On my test, this
caused PJLIB_UTIL_EDNS_NXDOMAIN error to be reported (which shouldn't
happen, but that's another problem), but it did not trigger the error like
yours.

Try with different STUN server instead. You can try with our server in
stun.pjsip.org. So your settings would be:

 ua_cfg.stun_host = "stun.pjsip.org"

or

 ua_cfg.nameserver = ["192.168.0.2"]  # replace with your local DNS server
 ua_cfg.stun_domain = "pjsip.org"

Notice the difference between stun_host and stun_domain value. The first one
is a hostname, while the second is a domain name.

Or try this little snippet below and see how it goes.

Cheers
 Benny

-- begin python --

import sys
import pjsua as pj


def log_cb(level, str, len):
    print str,

lib = pj.Lib()

ua_cfg = pj.UAConfig()
ua_cfg.stun_host = "stun.pjsip.org"
# or:
#ua_cfg.nameserver = ["192.168.0.2"]
#ua_cfg.stun_domain = "pjsip.org"

log_cfg = pj.LogConfig(level=5, callback=log_cb)

lib.init(ua_cfg=ua_cfg, log_cfg=log_cfg)
lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(0))
lib.start()

acc = lib.create_account(pj.AccountConfig("pjsip.org", "bennylp", "***"))

print "\nPress ENTER to quit"
sys.stdin.readline()

lib.destroy()
lib = None
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080819/c3206f94/attachment.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux