pilot = "77911"
    callers = ["302102310" + "%03d" % i for i in range(NumberOfCallers)]
    agents = ["302118840" + "%03d" % i for i in range(NumberOfAgents)]
    link = ConnectSip(callers, baseLocalPort=6280)
    link.update(ConnectSip(agents, baseLocalPort=6280 + NumberOfCallers))
    try:
        for user in callers + agents:
            Register(user)
            sleep(0.1)

        for agent in agents:
            agentThreads.append(util.serverThread(WaitForCall, user))
            sleep(0.1)

        test = util.Load(flow,
                         util.loop(callers),
                         duration=0,
                         quantity=calls,
                         interval=secondsPer)

    finally:
        for user in userPool:
            Unregister(user)
            link[user] = None
            sleep(0.1)
        print("Unregister done")
        # join all threads
        for thread in agentThreads:
            thread.result()
    # Close the connection
    #C.close()
Exemplo n.º 2
0
    link = ConnectSip(userPool, baseLocalPort=6280)
    try:
        linkCsta = ConnectCsta(cstaPool)
    except:
        print(
            "Cannot connect to port 1040. Is the firewall is blocking the connection?"
        )
        raise
    try:
        for user in userPool:
            Register(user)
            MonitorStart(user)
            sleep(0.1)

        test = util.Load(flow,
                         util.loop(userPool),
                         duration=0,
                         quantity=calls,
                         interval=secondsPer)

    finally:
        for user in userPool:
            Unregister(user)
            linkCsta[user] = None
            sleep(0.1)
        print("Unregister done")
        # join all threads
        for thread in serverThreads:
            thread.result()
    # Close the connection
    # C.close()