Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pysipp] Scenario - Connection Error: socket already in use #59

Open
divinj opened this issue Apr 17, 2020 · 1 comment
Open

[pysipp] Scenario - Connection Error: socket already in use #59

divinj opened this issue Apr 17, 2020 · 1 comment

Comments

@divinj
Copy link

divinj commented Apr 17, 2020

@goodboy

I have trying to use pysipp to the following in order:
sipp_uac_register.xml will send a REGISTER to my Proxy. Contact header is set to port 5061.
sipp_uas_basic.xml will setup a UAS listening on port 5061.
sipp_uac_invite_with_sdp.xml will send a call out to the PSTN to number 2223334444.. which in turn will come back into my system and route to port 5061 on the same SIPP box.

Questions:
How do I change the params in individual sipp agents when using a scenario?
Maybe, I have to use the Async Scenario Launching, as I want to run the Second and Third together. Call from third xml will hit the second xml.

Manually, I can make this scenario work by running these commands:

Register
sipp 10.106.158.31:5060 -sf ~/did-testing/scenarios/sipp_uac_register.xml -trace_msg -inf ~/did-testing/scenarios/register.csv -t t1 -m 1 -trace_err

UAS Client Side:
sipp -sf ~/did-testing/scenarios/sipp_uas_basic.xml -t t1 -trace_err -i 10.106.158.81 -p 5061 -trace_msg

Outbound Call to +12223334444
sipp 10.106.158.75:5060 -sf ~/did-testing/scenarios/sipp_uac_invite_with_sdp.xml -trace_msg -m 1 -trace_err -s +12223334444

Here's my scenario directory. I have a directory called 'call' to use Scenario.
.:
total 8
drwxrwxr-x 2 ec2-user ec2-user 68 Apr 17 19:45 call
-rw-rw-r-- 1 ec2-user ec2-user 148 Apr 14 19:27 register.csv
-rw-rw-r-- 1 ec2-user ec2-user 1180 Apr 14 20:56 sipp_uac_register.xml

./call:
total 16
-rw-rw-r-- 1 ec2-user ec2-user 4600 Apr 14 17:27 sipp_uac_invite_with_sdp.xml
-rw-rw-r-- 1 ec2-user ec2-user 4343 Apr 14 21:24 sipp_uas_basic.xml

I got the REGISTER working with this code:

#!/usr/bin/python3
import pysipp
pysipp.utils.log_to_stderr("DEBUG")
print("helloworld")
sipp_options={
'call_count' : 1,
'info_file' : 'scenarios/register.csv',
'transport' : 't1',
'remote_host' : '10.106.158.31',
'remote_port': '5060',
'trace_message' : True
}

uac = pysipp.client(destaddr=('10.106.158.31',5060),defaults=sipp_options)
uac.local_host='10.106.158.81'
uac.local_port='5060'
uac.scen_file = '/home/ec2-user/did-testing/scenarios/sipp_uac_register.xml'
uac.scen_name = None
uac.info_file='/home/ec2-user/did-testing/scenarios/register.csv'
uac.transport='t1'
uac()

I am trying to get the UAS Client Side / Outbound call working:

#!/usr/bin/python3
import pysipp
#pysipp.utils.log_to_stderr("DEBUG")
print("helloworld")
sipp_options={
'call_count' : 1,
#'info_file' : 'scenarios/register.csv',
'local_host' :'10.106.158.81',
'local_port' :'5060',
'transport' : 't1',
'remote_host' : '10.106.158.31',
'remote_port': '5060',
'trace_message' : True
}
scen = pysipp.scenario(dirpath='/home/ec2-user/did-testing/scenarios/call/',defaults=sipp_options,proxyaddr=('10.106.158.31', 5060))

print(scen.cmditems())
scen() # run uac and uas synchronously to completion

Here's the error I get, both Agents are trying to use 5060.

stderr for 'sipp_uac_invite_with_sdp' @ ('10.106.158.81', '5060')
b"Resolving remote host '10.106.158.81'... Done.\n2020-04-17\t21:35:45.922876\t1587159345.922876: Unable to bind main socket, errno = 98 (Address already in use)\n"

Here's the scen.cmditems():
[('sipp_uas_basic', "'/home/ec2-user/sipp-3.6.0/sipp' -i '10.106.158.81' -p '5060' -mp '49147' -t 't1' -sf '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml' -recv_timeout '5000' -r '1' -l '1' -m '1' -log_file '/tmp/sipp_uas_basic_log_file' -screen_file '/tmp/sipp_uas_basic_screen_file' -trace_msg -trace_logs -trace_screen '10.106.158.31':'5060'"), ('sipp_uac_invite_with_sdp', "'/home/ec2-user/sipp-3.6.0/sipp' -i '10.106.158.81' -p '5060' -rsa '10.106.158.31':'5060' -mp '42804' -t 't1' -sf '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml' -recv_timeout '5000' -r '1' -l '1' -m '1' -log_file '/tmp/sipp_uac_invite_with_sdp_log_file' -screen_file '/tmp/sipp_uac_invite_with_sdp_screen_file' -trace_msg -trace_logs -trace_screen '10.106.158.81':'5060'")]

here's the full debug:

[ec2-user@ip-10-106-158-81 scenarios]$ python3 ../pysipp-test.py
helloworld
2020-04-17 21:35:06,110 MainThread [DEBUG] pysipp load.py:52 : No pysipp_conf.py found under '/home/ec2-user/did-testing/scenarios/call'
2020-04-17 21:35:06,114 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'defaults' contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True)])
2020-04-17 21:35:06,114 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'serverdefaults' contents:
OrderedDict([('key_vals', {}), ('global_vars', {})])
2020-04-17 21:35:06,114 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'agent.todict()' contents:
{'bin_path': '/home/ec2-user/sipp-3.6.0/sipp', 'scen_file': '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml'}
2020-04-17 21:35:06,115 MainThread [DEBUG] pysipp agent.py:368 : sipp_uas_basic merged contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True), ('bin_path', '/home/ec2-user/sipp-3.6.0/sipp'), ('scen_file', '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml')])
2020-04-17 21:35:06,115 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'defaults' contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True)])
2020-04-17 21:35:06,116 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'clientdefaults' contents:
OrderedDict([('key_vals', {}), ('global_vars', {})])
2020-04-17 21:35:06,116 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'agent.todict()' contents:
{'bin_path': '/home/ec2-user/sipp-3.6.0/sipp', 'scen_file': '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml'}
2020-04-17 21:35:06,116 MainThread [DEBUG] pysipp agent.py:368 : sipp_uac_invite_with_sdp merged contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True), ('bin_path', '/home/ec2-user/sipp-3.6.0/sipp'), ('scen_file', '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml')])
2020-04-17 21:35:06,117 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'defaults' contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True)])
2020-04-17 21:35:06,117 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'serverdefaults' contents:
OrderedDict([('key_vals', {}), ('global_vars', {})])
2020-04-17 21:35:06,117 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'agent.todict()' contents:
{'bin_path': '/home/ec2-user/sipp-3.6.0/sipp', 'media_port': 38879, 'scen_file': '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml'}
2020-04-17 21:35:06,117 MainThread [DEBUG] pysipp agent.py:368 : sipp_uas_basic merged contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True), ('bin_path', '/home/ec2-user/sipp-3.6.0/sipp'), ('media_port', 38879), ('scen_file', '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml')])
2020-04-17 21:35:06,119 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'defaults' contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True)])
2020-04-17 21:35:06,119 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'serverdefaults' contents:
OrderedDict([('key_vals', {}), ('global_vars', {})])
2020-04-17 21:35:06,119 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'agent.todict()' contents:
{'bin_path': '/home/ec2-user/sipp-3.6.0/sipp', 'media_port': 38879, 'scen_file': '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml'}
2020-04-17 21:35:06,119 MainThread [DEBUG] pysipp agent.py:368 : sipp_uas_basic merged contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True), ('bin_path', '/home/ec2-user/sipp-3.6.0/sipp'), ('media_port', 38879), ('scen_file', '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml')])
2020-04-17 21:35:06,120 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'defaults' contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True)])
2020-04-17 21:35:06,120 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'clientdefaults' contents:
OrderedDict([('key_vals', {}), ('global_vars', {}), ('destaddr', ('10.106.158.81', '5060')), ('proxyaddr', ('10.106.158.31', 5060))])
2020-04-17 21:35:06,120 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'agent.todict()' contents:
{'bin_path': '/home/ec2-user/sipp-3.6.0/sipp', 'media_port': 34516, 'scen_file': '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml'}
2020-04-17 21:35:06,120 MainThread [DEBUG] pysipp agent.py:368 : sipp_uac_invite_with_sdp merged contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True), ('destaddr', ('10.106.158.81', '5060')), ('proxyaddr', ('10.106.158.31', 5060)), ('bin_path', '/home/ec2-user/sipp-3.6.0/sipp'), ('media_port', 34516), ('scen_file', '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml')])
[('sipp_uas_basic', "'/home/ec2-user/sipp-3.6.0/sipp' -i '10.106.158.81' -p '5060' -mp '38879' -t 't1' -sf '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml' -recv_timeout '5000' -r '1' -l '1' -m '1' -log_file '/tmp/sipp_uas_basic_log_file' -screen_file '/tmp/sipp_uas_basic_screen_file' -trace_msg -trace_logs -trace_screen '10.106.158.31':'5060'"), ('sipp_uac_invite_with_sdp', "'/home/ec2-user/sipp-3.6.0/sipp' -i '10.106.158.81' -p '5060' -rsa '10.106.158.31':'5060' -mp '34516' -t 't1' -sf '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml' -recv_timeout '5000' -r '1' -l '1' -m '1' -log_file '/tmp/sipp_uac_invite_with_sdp_log_file' -screen_file '/tmp/sipp_uac_invite_with_sdp_screen_file' -trace_msg -trace_logs -trace_screen '10.106.158.81':'5060'")]
2020-04-17 21:35:06,121 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'defaults' contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True)])
2020-04-17 21:35:06,122 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'serverdefaults' contents:
OrderedDict([('key_vals', {}), ('global_vars', {})])
2020-04-17 21:35:06,122 MainThread [DEBUG] pysipp agent.py:365 : sipp_uas_basic 'agent.todict()' contents:
{'bin_path': '/home/ec2-user/sipp-3.6.0/sipp', 'media_port': 38879, 'scen_file': '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml'}
2020-04-17 21:35:06,122 MainThread [DEBUG] pysipp agent.py:368 : sipp_uas_basic merged contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True), ('bin_path', '/home/ec2-user/sipp-3.6.0/sipp'), ('media_port', 38879), ('scen_file', '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml')])
2020-04-17 21:35:06,123 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'defaults' contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True)])
2020-04-17 21:35:06,123 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'clientdefaults' contents:
OrderedDict([('key_vals', {}), ('global_vars', {}), ('destaddr', ('10.106.158.81', '5060')), ('proxyaddr', ('10.106.158.31', 5060))])
2020-04-17 21:35:06,123 MainThread [DEBUG] pysipp agent.py:365 : sipp_uac_invite_with_sdp 'agent.todict()' contents:
{'bin_path': '/home/ec2-user/sipp-3.6.0/sipp', 'media_port': 34516, 'scen_file': '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml'}
2020-04-17 21:35:06,123 MainThread [DEBUG] pysipp agent.py:368 : sipp_uac_invite_with_sdp merged contents:
OrderedDict([('recv_timeout', 5000), ('call_count', 1), ('rate', 1), ('limit', 1), ('logdir', '/tmp'), ('key_vals', {}), ('global_vars', {}), ('local_host', '10.106.158.81'), ('local_port', '5060'), ('transport', 't1'), ('remote_host', '10.106.158.31'), ('remote_port', '5060'), ('trace_message', True), ('destaddr', ('10.106.158.81', '5060')), ('proxyaddr', ('10.106.158.31', 5060)), ('bin_path', '/home/ec2-user/sipp-3.6.0/sipp'), ('media_port', 34516), ('scen_file', '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml')])
2020-04-17 21:35:06,123 MainThread [DEBUG] pysipp launch.py:63 : launching cmd:
"'/home/ec2-user/sipp-3.6.0/sipp' -i '10.106.158.81' -p '5060' -mp '38879' -t 't1' -sf '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml' -recv_timeout '5000' -r '1' -l '1' -m '1' -log_file '/tmp/sipp_uas_basic_log_file' -screen_file '/tmp/sipp_uas_basic_screen_file' -trace_msg -trace_logs -trace_screen '10.106.158.31':'5060'"

2020-04-17 21:35:06,125 MainThread [DEBUG] pysipp launch.py:71 : registering fd '5' for pid '20158'
2020-04-17 21:35:06,129 MainThread [DEBUG] pysipp launch.py:63 : launching cmd:
"'/home/ec2-user/sipp-3.6.0/sipp' -i '10.106.158.81' -p '5060' -rsa '10.106.158.31':'5060' -mp '34516' -t 't1' -sf '/home/ec2-user/did-testing/scenarios/call/sipp_uac_invite_with_sdp.xml' -recv_timeout '5000' -r '1' -l '1' -m '1' -log_file '/tmp/sipp_uac_invite_with_sdp_log_file' -screen_file '/tmp/sipp_uac_invite_with_sdp_screen_file' -trace_msg -trace_logs -trace_screen '10.106.158.81':'5060'"

2020-04-17 21:35:06,132 MainThread [DEBUG] pysipp launch.py:71 : registering fd '6' for pid '20159'
2020-04-17 21:35:06,136 Thread-1 [DEBUG] pysipp launch.py:86 : started waiter for procs OrderedDict([(5, <subprocess.Popen object at 0x7ff595460f10>), (6, <subprocess.Popen object at 0x7ff59541c350>)])
2020-04-17 21:35:06,136 Thread-1 [DEBUG] pysipp launch.py:92 : received hangup for pairs '[(6, 16)]'
2020-04-17 21:35:06,137 Thread-1 [DEBUG] pysipp launch.py:97 : collecting streams for <subprocess.Popen object at 0x7ff59541c350>
2020-04-17 21:35:06,137 Thread-1 [WARNING] pysipp launch.py:150 : sent signal '10' to cmd ''/home/ec2-user/sipp-3.6.0/sipp' -i '10.106.158.81' -p '5060' -mp '38879' -t 't1' -sf '/home/ec2-user/did-testing/scenarios/call/sipp_uas_basic.xml' -recv_timeout '5000' -r '1' -l '1' -m '1' -log_file '/tmp/sipp_uas_basic_log_file' -screen_file '/tmp/sipp_uas_basic_screen_file' -trace_msg -trace_logs -trace_screen '10.106.158.31':'5060'' with pid '20158'
2020-04-17 21:35:06,138 Thread-1 [DEBUG] pysipp launch.py:92 : received hangup for pairs '[(5, 16)]'
2020-04-17 21:35:06,138 Thread-1 [DEBUG] pysipp launch.py:97 : collecting streams for <subprocess.Popen object at 0x7ff595460f10>
2020-04-17 21:35:06,138 Thread-1 [DEBUG] pysipp launch.py:103 : terminating waiter thread
2020-04-17 21:35:06,138 MainThread [WARNING] pysipp report.py:52 : stderr for 'sipp_uas_basic' @ ('10.106.158.81', '5060')
b"Resolving remote host '10.106.158.31'... Done.\n"

2020-04-17 21:35:06,149 MainThread [WARNING] pysipp report.py:75 : 'screen_file' contents for 'sipp_uas_basic' @ ('10.106.158.81', '5060'):
------------------------------ Scenario Screen -------- [1-9]: Change Screen --
Timestamp: Fri Apr 17 21:35:06 2020

Port Total-time Total-calls Transport
5060 0.00 s 0 TCP

0 new calls during 0.000 s period 0 ms scheduler resolution
0 calls Peak was 0 calls, after 0 s
0 Running, 2 Paused, 0 Woken up
0 dead call msg (discarded)
0 open sockets

                             Messages  Retrans   Timeout   Unexpected-Msg

----------> INVITE 0 0 0 0
<---------- 180 0 0
<---------- 200 0 0 0
----------> ACK E-RTD1 0 0 0 0

----------> BYE 0 0 0 0
<---------- 200 0 0
[ 4000ms] Pause 0 0
------- Waiting for active calls to end. Press [q] again to force exit. -------

----------------------------- Statistics Screen ------- [1-9]: Change Screen --
Start Time | 2020-04-17 21:35:06.128652 1587159306.128652
Last Reset Time | 2020-04-17 21:35:06.137408 1587159306.137408
Current Time | 2020-04-17 21:35:06.137468 1587159306.137468
-------------------------+---------------------------+--------------------------
Counter Name | Periodic value | Cumulative value
-------------------------+---------------------------+--------------------------
Elapsed Time | 00:00:00:000000 | 00:00:00:008000
Call Rate | 0.000 cps | 0.000 cps
-------------------------+---------------------------+--------------------------
Incoming call created | 0 | 0
OutGoing call created | 0 | 0
Total Call created | | 0
Current Call | 0 |
-------------------------+---------------------------+--------------------------
Successful call | 0 | 0
Failed call | 0 | 0
-------------------------+---------------------------+--------------------------
Response Time 1 | 00:00:00:000000 | 00:00:00:000000
Call Length | 00:00:00:000000 | 00:00:00:000000
------- Waiting for active calls to end. Press [q] again to force exit. -------

---------------------------- Repartition Screen ------- [1-9]: Change Screen --
Average Response Time Repartition 1
0 ms <= n < 10 ms : 0
10 ms <= n < 20 ms : 0
20 ms <= n < 30 ms : 0
30 ms <= n < 40 ms : 0
40 ms <= n < 50 ms : 0
50 ms <= n < 100 ms : 0
100 ms <= n < 150 ms : 0
150 ms <= n < 200 ms : 0
n >= 200 ms : 0
Average Call Length Repartition
0 ms <= n < 10 ms : 0
10 ms <= n < 50 ms : 0
50 ms <= n < 100 ms : 0
100 ms <= n < 500 ms : 0
500 ms <= n < 1000 ms : 0
1000 ms <= n < 5000 ms : 0
5000 ms <= n < 10000 ms : 0
n >= 10000 ms : 0
------- Waiting for active calls to end. Press [q] again to force exit. -------

2020-04-17 21:35:06,159 MainThread [WARNING] pysipp report.py:52 : stderr for 'sipp_uac_invite_with_sdp' @ ('10.106.158.81', '5060')
b"Resolving remote host '10.106.158.81'... Done.\n2020-04-17\t21:35:06.135102\t1587159306.135102: Unable to bind main socket, errno = 98 (Address already in use)\n"

2020-04-17 21:35:06,169 MainThread [WARNING] pysipp report.py:75 : 'screen_file' contents for 'sipp_uac_invite_with_sdp' @ ('10.106.158.81', '5060'):

Traceback (most recent call last):
File "../pysipp-test.py", line 18, in
scen() # run uac and uas synchronously to completion
File "/usr/local/lib/python3.7/site-packages/pysipp/agent.py", line 417, in call
raise_exc=raise_exc, **kwargs
File "/usr/local/lib/python3.7/site-packages/pluggy/hooks.py", line 289, in call
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 68, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/local/lib/python3.7/site-packages/pluggy/manager.py", line 62, in
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/usr/local/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/usr/local/lib/python3.7/site-packages/pysipp/init.py", line 250, in pysipp_run_protocol
finalize(cmds2procs, raise_exc=raise_exc)
File "/usr/local/lib/python3.7/site-packages/pysipp/init.py", line 228, in finalize
raise SIPpFailure(msg)
pysipp.SIPpFailure: Some agents failed
'sipp_uas_basic' with exit code 0 -> All calls were successful
'sipp_uac_invite_with_sdp' with exit code 254 -> Connection Error: socket already in use

@goodboy
Copy link
Member

goodboy commented May 26, 2020

@divinj sorry I haven't been around; very busy with other projects atm.

Here's the error I get, both Agents are trying to use 5060.

Yeah, because you're setting the local_port value to be the same on both agents in the scenario:

#!/usr/bin/python3
import pysipp
#pysipp.utils.log_to_stderr("DEBUG")
print("helloworld")
sipp_options={
'call_count' : 1,
#'info_file' : 'scenarios/register.csv',
'local_host' :'10.106.158.81',
'local_port' :'5060',
'transport' : 't1',
'remote_host' : '10.106.158.31',
'remote_port': '5060',
'trace_message' : True
}
scen = pysipp.scenario(dirpath='/home/ec2-user/did-testing/scenarios/call/',defaults=sipp_options,proxyaddr=('10.106.158.31', 5060))

Questions:
How do I change the params in individual sipp agents when using a scenario?

The main thing you're missing is setting the uas srcaddr to a specific value (if you wanted to get fancy you could just launch the uas at the start and read out the random socket that was allocated by the OS and then register that with your registrar - see the data insertion attributes).

There are a couple different ways to do this:

  • you can write so called pysipp_conf.py files in your xml scenario directories just like in this test. The pysipp_conf.py file is loaded when the directories are scanned for scripts and you can define any of the special hooks inside this file. Note that the files are loaded when pysipp_load_scendir() is called; which is called here inside walk().
  • you can set your uas (server that accepts the call) properties using any of these attributes manually in your top level code

Maybe, I have to use the Async Scenario Launching, as I want to run the Second and Third together. Call from third xml will hit the second xml.

You can invoke the agents in sequence manually instead of using a pysipp.scenario which invokes them in sequence without much control of the timing/logic. Checkout the pysipp_order_agents() hook to possibly do this using a scenario.

It seems what you really want is a synchronous-staged running of each agent like you've done with pysipp.client() (look at pysipp.server() as well). Doing async scenario launching though should work for your register then receive callback test. I've done some work to try and add async support for waiting on agents in #55 which would likely make writing your scenario much easier but until then using the (async) agent launching manually should work.

uac = pysipp.client(destaddr=('10.106.158.31',5060),defaults=sipp_options)
uac.local_host='10.106.158.81'
uac.local_port='5060'
# if you wanted to get fancy make the below script accept a register port variable and fill it in using the 
uac.scen_file = '/home/ec2-user/did-testing/scenarios/sipp_uac_register.xml'
uac.scen_name = None
uac.info_file='/home/ec2-user/did-testing/scenarios/register.csv'
uac.transport='t1'


# this is script which will accept inbound call
uas = pysipp.server(srcaddr=('10.106.158.81', 5061))

uac_2 = pysipp.client(destaddr=('10.106.158.31',5060),defaults=sipp_options)

# run agents
uac()  # register with port
finalize = uas(block=False)  # spawn uas to accept calls
uac_2()  # make call
finalize()  # wait on uas to complete

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants