[OpenSIPS-Users] Problems with mediaproxy 2.0.3 over opensuse 11.0

Ruud Klaver ruud at ag-projects.com
Mon Aug 25 13:28:27 CEST 2008


Hi Ivan,

On 25 Aug 2008, at 04:52, Ivan Medeiros wrote:

> Hello everyone.
>
> I had been problem to use the mediaproxy 2.0.3 over opensuse 11.0. I  
> had got error both media-relay and media-dispatcher.
>
> The media-dispatcher error had been following:
>
> # ./media-dispatcher --no-fork
> Starting MediaProxy Dispatcher 2.0.3
> Twisted is using epollreactor
> failed to create MediaProxy Dispatcher: ASN1 parser: Element was not  
> found.
> Traceback (most recent call last):
> --- <exception caught here> ---
>   File "./media-dispatcher", line 52, in <module>
>     dispatcher = Dispatcher()
>   File "/usr/local/src/mediaproxy-2.0.3/mediaproxy/dispatcher.py",  
> line 413, in __init__
>     self.cred = X509Credentials(cert_name='dispatcher')
>   File "/usr/local/src/mediaproxy-2.0.3/mediaproxy/tls.py", line  
> 132, in __init__
>     twisted.X509Credentials.__init__(self, self.X509cert,  
> self.X509key, [self.X509ca], [self.X509crl])
>   File "/usr/local/src/mediaproxy-2.0.3/mediaproxy/tls.py", line 99,  
> in __get__
>     return descriptor.get()
>   File "/usr/local/src/mediaproxy-2.0.3/mediaproxy/tls.py", line 82,  
> in get
>     self.object = self.klass(f.read())
>   File "<string>", line 1, in __init__
>
>   File "/usr/lib/python2.5/site-packages/gnutls/validators.py", line  
> 273, in check_args
>     return func(*func_args)
>   File "/usr/lib/python2.5/site-packages/gnutls/crypto.py", line 70,  
> in __init__
>     gnutls_x509_crt_init(byref(self._c_object))
>   File "/usr/lib/python2.5/site-packages/gnutls/library/errors.py",  
> line 61, in _check_status
>     raise GNUTLSError(ErrorMessage(retcode))
> gnutls.errors.GNUTLSError: ASN1 parser: Element was not found.
>
>
> After spend some time tracing the execution and making gnutls  
> samples I perceived that the media-dispatcher does not call the  
> function gnutls_global_init. Thus, the gnutls_x509_crt_init can't  
> find the "PKIX1.Certificate" because the _gnutls_get_pkix () returns  
> nil. In order to solve this problem I added the follows lines on  
> mediaproxy/dispatcher.py:
>
> 23,24c24
> > from gnutls.library.functions import gnutls_global_init
> 412d411
> >     gnutls_global_init()

Indeed, gnutls_global_init() should be called, but not from here. In  
python-gnutls there is a Python C extension module called  
_gnutls_init. This module will call gnutls_global_init when it is  
loaded.

Are you sure you compiled this file before installing python-gnutls?  
You can execute "python setup.py install" to install python-gnutls  
globally or "./build_inplace" to compile this file in the local  
directory.


> The media-relay error had been following:
>
> # ./media-relay --no-fork
> Starting MediaProxy Relay 2.0.3
> Set resource limit for maximum open file descriptors to 11000
> failed to create MediaProxy Relay: Could not determine Linux kernel  
> version
>
> This problem was easier to solve, and it is happen because the  
> format of the file  /proc/sys/kernel/osrelease may be different  
> across the linux distributions. eg. 2.6.25.XX and not 2.6.25-XX
> To solve it, I apply the following patch on mediaproxy/relay.py
>
> 286c286,289
> <             major, minor, revision = [int(num) for num in  
> open(KERNEL_VERSION_FILE).read().split("-", 1)[0].split(".")]
> ---
> >             kernel_version =  
> open(KERNEL_VERSION_FILE).read().split("-", 1)[0].split(".")
> >             major = kernel_version[0]
> >             minor = kernel_version[1]
> >             revision = kernel_version[2]

This is not a fix at all, all you did was avoid the conversion from  
strings to integers. If you want to make sure this statement works  
with a weirdly named kernel such as yours, you could change it to the  
following:

major, minor, revision = [int(num) for num in open("/proc/sys/kernel/ 
osrelease").read().split("-", 1)[0].split(".", 4)[:3]]

Ruud Klaver
AG Projects



More information about the Users mailing list