Hundreds of accounts with pjsip (python binding)

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

 



Hello everybody,
I'm new to pjsip/pjsua, and I think that the new python bindings are really
great!!

I have to test an Asterisk installation, I'd like to run 500 softphones and 100
concurrent calls, so the first thing to do for me was to register those 500
softphones.

I took registration.py and I modified it like this (removed comments):

----------------------------------------------------------------------------
import sys
import pjsua as pj

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

class MyAccountCallback(pj.AccountCallback):
    def __init__(self, account, username):
        pj.AccountCallback.__init__(self, account)
        self.username = username

    def on_reg_state(self):
        print "Registration complete for", self.username, ", status=", self.account.info().reg_status, "(" + self.account.info().reg_reason + ")"

lib = pj.Lib()

try:
    lib.init(log_cfg = pj.LogConfig(level=4, callback=log_cb))
    lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(5080))
    lib.start()

    for i in xrange(2000, 2005):
        acc_cfg = pj.AccountConfig()
        acc_cfg.id = "sip:%d at 192.168.1.90" % i
        acc_cfg.reg_uri = "sip:192.168.1.90"
        acc_cfg.auth_cred = [ pj.AuthCred("asterisk", str(i), str(i)) ]
        acc = lib.create_account(acc_cfg)

        acc_cb = MyAccountCallback(acc, i)
        acc.set_callback(acc_cb)


    print "Press ENTER to exit"
    sys.stdin.readline()

    lib.destroy()
    lib = None

except pj.Error, e:
    print "Exception: " + str(e)
    lib.destroy()

----------------------------------------------------------------------------

Obviously, the central "for i in xrange(x, y)" controls how many accounts I
create.

If I create less than 10 accounts, it works like a charm. But when I set the
range to "2000, 2009", I get this error:

python: ../src/pjsua-lib/pjsua_acc.c:263: pjsua_acc_add: Assertion `pjsua_var.acc_cnt < (sizeof(pjsua_var.acc)/sizeof(pjsua_var.acc[0]))' failed.

I'm obviously getting something wrong. Can anybody help me please?

Thanks in advance,
best regards

-- 
Dr. Andrea Spadaccini
Multimedia Technologies Institute - MTI S.r.l.
Web: www.x-voice.it - Tel: +39 (0) 95 7224945



[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