如何增加PJSUA中的最大运输数量?

时间:2016-01-19 20:42:27

标签: python c build config pjsip

摘要

我正在尝试使用32个唯一IP支持32个唯一帐户:端口地址。我目前能够在构建期间使用config_site.h来成功调整最大帐户(PJSIP_MAX_ACC),但传输仍然限制为默认值8.

除了PJ_IOQUEUE_MAX_HANDLESPJSIP_MAX_TRANSPORTS之外,还需要哪些其他设置才能实现32项独特传输?

额外学分:以下测试代码的C等价物是什么,所以我可以直接测试该库?

历史

struggling了解如何正确使用config_site.h进行构建之后,我终于可以在Ubuntu 15.10安装上看到一些结果。不幸的是,在看到一些变化时,我无法看到完成程序所需的更改; 32个帐户的32个运输。

我用来尝试进行这些更改的引用是通过PJSIP Mailing ListNarkive Mailing List Archive找到的,只有PJSIP Reference DocumentationGetting Started Guide提供的帮助很少。

最终结果是config_site.h,有8种不同的设置(请参阅下面的代码部分)。不幸的是,它仍然没有让我到达我想要的地方。

我需要唯一的IP:端口地址,因为我正在尝试点对点VOIP呼叫,这些呼叫通过转发/代理服务器重定向两次,导致帐户检测到软件无法一致地工作。

代码

config_site.h

/*
 * This file is customized by Ash to (attempt) to override the 
 * default settings of PJSIP to support much more  
 */

#define PJ_IOQUEUE_MAX_HANDLES      32
#define FD_SETSIZE_SETABLE      1
#define __FD_SETSIZE            32

#define PJSIP_MAX_TRANSPORTS        32
#define PJSIP_MAX_RESOLVED_ADDRESSES    32

#define PJSUA_MAX_ACC           32
#define PJSUA_MAX_CALLS     32
#define PJSUA_MAX_PLAYERS       32

测试代码(通过Python)

import pjsua

lib = pjsua.Lib()
lib.init()
lib.start()

custom_range = 32
transport = dict()
acc = dict()

for x in range(custom_range):
    transport[x] = (lib.create_transport(pjsua.TransportType.UDP))
    print 'Transport', x, 'created:', transport[x]

for x in range(custom_range):
    acc[x] = (lib.create_account_for_transport(transport[x]))
    print 'Account', x, 'created:', acc[x]

print 'All Clear. Shutting Down.'

lib.destroy()
lib = None

错误

Traceback (most recent call last):
  File "/Users/ashpesante/Documents/Development/PyCharms/pj/32t32a.py", line 12, in <module>
    transport[x] = (lib.create_transport(pjsua.TransportType.UDP))
  File "/Library/Python/2.7/site-packages/pjsua.py", line 2302, in create_transport
    self._err_check("create_transport()", self, err)
  File "/Library/Python/2.7/site-packages/pjsua.py", line 2721, in _err_check
    raise Error(op_name, obj, err_code, err_msg)
pjsua.Error: Object: Lib, operation=create_transport(), error=Too many objects of the specified type (PJ_ETOOMANY)
Exception AttributeError: "'NoneType' object has no attribute 'destroy'" in <bound method Lib.__del__ of <pjsua.Lib instance at 0x10c0f58c0>> ignored

Undefine Error

_pjsua.c: In function ‘py_pjsua_enum_transports’:
_pjsua.c:1202:17: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
     pj_status_t status;
             ^
_pjsua.c: In function ‘py_pjsua_conf_get_port_info’:
_pjsua.c:2338:9: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
     int status; 
     ^
_pjsua.c: In function ‘py_pjsua_get_snd_dev’:
_pjsua.c:2714:9: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
     int status; 
     ^

0 个答案:

没有答案