diff --git a/bin/generate_test_tt2.py b/bin/generate_test_tt2.py index 74410f64..d3040a8d 100755 --- a/bin/generate_test_tt2.py +++ b/bin/generate_test_tt2.py @@ -202,9 +202,14 @@ class Generator: for jdx, resp in enumerate(scen["responders"]): add_sip(resp, f"scenarios.{idx}.responders.{jdx}") for key in ids[id_dom]: - sip_rule(ids[id_dom][key], f"{id_dom}.{key}", "phone_number") - if "alias_numbers" in ids[id_dom][key]: - for idx, alias in enumerate(ids[id_dom][key]["alias_numbers"]): + subs = ids[id_dom][key] + sip_rule(subs, f"{id_dom}.{key}", "phone_number") + if "pbx_extension" in subs: + sip_rule(subs, f"{id_dom}.{key}", "pbx_extension") + if "pbx_phone_number" in subs: + sip_rule(subs, f"{id_dom}.{key}", "pbx_phone_number") + if "alias_numbers" in subs: + for idx, alias in enumerate(subs["alias_numbers"]): sip_rule( alias, f"{id_dom}.{key}.alias_numbers.{idx}", diff --git a/tests/fixtures/invite_alias_devid/scenario_ids.yml b/tests/fixtures/invite_alias_devid/scenario_ids.yml new file mode 100644 index 00000000..52768ba2 --- /dev/null +++ b/tests/fixtures/invite_alias_devid/scenario_ids.yml @@ -0,0 +1,88 @@ +--- +domains: +- invite_alias_devid_scenarios_pbx_test +extra_info: {} +invite_alias_devid_customerpbx_test: + id: '351' +invite_alias_devid_scenarios_pbx_test: + testuser1002: + ac: '1' + alias_numbers: + - ac: '1' + cc: '43' + phone_number: '4311012' + sn: 1012 + cc: '43' + pbx_extension: 1002 + pbx_phone_number: '43110101002' + phone_number: '4311010' + sn: 1010 + uuid: a56a5f69-8a46-4bb2-87cc-322ff926e09d + testuser1003: + ac: '1' + alias_numbers: + - ac: '1' + cc: '43' + is_devid: 1 + phone_number: '4311013' + sn: 1013 + - ac: '1' + cc: '43' + is_devid: 1 + phone_number: '4311014' + sn: 1014 + - ac: '1' + cc: '43' + is_devid: 1 + phone_number: '4311015' + sn: 1015 + cc: '43' + pbx_extension: 1003 + pbx_phone_number: '43110101003' + phone_number: '4311011' + sn: 1011 + uuid: 489cf47d-ab35-4db4-af3a-fdddbd953bdb +scenarios: +- devid: testuser1003 + domain: invite-alias-devid.scenarios-pbx.test + ip: 10.20.29.2 + mport: 45033 + port: 51613 + responders: + - domain: invite-alias-devid.scenarios-pbx.test + ip: 10.20.29.2 + mport: 45036 + port: 51614 + proto: udp + register: no + username: testuser1003 + username: testuser1003 +- devid: '4311015' + domain: invite-alias-devid.scenarios-pbx.test + ip: 10.20.29.2 + mport: 45039 + port: 51615 + responders: + - domain: invite-alias-devid.scenarios-pbx.test + ip: 10.20.29.2 + mport: 45042 + port: 51616 + proto: udp + register: no + username: testuser1003 + username: testuser1003 +- devid: '4311013' + domain: invite-alias-devid.scenarios-pbx.test + ip: 10.20.29.2 + mport: 45045 + port: 51617 + responders: + - domain: invite-alias-devid.scenarios-pbx.test + ip: 10.20.29.2 + mport: 45048 + port: 51618 + proto: udp + register: yes + username: testuser1003 + username: testuser1002 +server_ip: 192.168.2.109 diff --git a/tests/fixtures/invite_alias_devid/sipp_scenario00.msg b/tests/fixtures/invite_alias_devid/sipp_scenario00.msg new file mode 100644 index 00000000..4e564431 --- /dev/null +++ b/tests/fixtures/invite_alias_devid/sipp_scenario00.msg @@ -0,0 +1,59 @@ +----------------------------------------------- 2021-07-21 10:09:51.690646 +UDP message sent (549 bytes): + +REGISTER sip:testuser1003@invite-alias-devid.scenarios-pbx.test SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51613;branch=z9hG4bK-69218-1-0 +From: ;tag=69218SIPpTag001 +To: "TestBria" +Call-ID: NGCP%invite_alias_devid%///1-69218@10.20.29.2 +CSeq: 1 REGISTER +Contact: "TestBria" ;reg-id=1;+sip.instance="" +Expires: 600 +Max-Forwards: 70 +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:51.713740 +UDP message received [542] bytes : + +SIP/2.0 401 Unauthorized +Via: SIP/2.0/UDP 10.20.29.2:51613;rport=51613;branch=z9hG4bK-69218-1-0 +From: ;tag=69218SIPpTag001 +To: "TestBria" ;tag=95c37a12bff1a2c36d72bf8333176544.78550000 +Call-ID: NGCP%invite_alias_devid%///1-69218@10.20.29.2 +CSeq: 1 REGISTER +WWW-Authenticate: Digest realm="invite-alias-devid.scenarios-pbx.test", nonce="YPfXe2D31k8vzYWeebWNm9pzVadizBRx" +Server: Sipwise NGCP Proxy 9.X +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:51.714091 +UDP message sent (770 bytes): + +REGISTER sip:testuser1003@invite-alias-devid.scenarios-pbx.test SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51613;branch=z9hG4bK-69218-1-3 +From: ;tag=69218SIPpTag001 +To: "TestBria" +Call-ID: NGCP%invite_alias_devid%///1-69218@10.20.29.2 +CSeq: 2 REGISTER +Authorization: Digest username="testuser1003",realm="invite-alias-devid.scenarios-pbx.test",uri="sip:192.168.2.109:5060",nonce="YPfXe2D31k8vzYWeebWNm9pzVadizBRx",response="ec5f0b8bb54121ff931016a5cb5c1d84",algorithm=MD5 +Contact: "TestBria" ;reg-id=1;+sip.instance="" +Expires: 600 +Max-Forwards: 70 +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:51.763172 +UDP message received [583] bytes : + +SIP/2.0 200 OK +Via: SIP/2.0/UDP 10.20.29.2:51613;rport=51613;branch=z9hG4bK-69218-1-3 +From: ;tag=69218SIPpTag001 +To: "TestBria" ;tag=95c37a12bff1a2c36d72bf8333176544.78550000 +Call-ID: NGCP%invite_alias_devid%///1-69218@10.20.29.2 +CSeq: 2 REGISTER +Contact: ;expires=600;received="sip:10.20.29.2:51613";+sip.instance="";reg-id=1 +Server: Sipwise NGCP Proxy 9.X +Content-Length: 0 + + diff --git a/tests/fixtures/invite_alias_devid/sipp_scenario00_test.yml.tt2 b/tests/fixtures/invite_alias_devid/sipp_scenario00_test.yml.tt2 new file mode 100644 index 00000000..2aec9039 --- /dev/null +++ b/tests/fixtures/invite_alias_devid/sipp_scenario00_test.yml.tt2 @@ -0,0 +1,15 @@ +messages: +- - 'SIP/2.0 401 Unauthorized' + - 'From: ;tag=[\w-]+' + - 'To: "TestBria" ;tag=[\w-]+' + - 'CSeq: \d+ REGISTER' + - 'WWW-Authenticate: Digest realm="invite-alias-devid.scenarios-pbx.test", nonce="[^"]+"' + - 'Server: Sipwise NGCP Proxy' + - 'Content-Length: 0' +- - 'SIP/2.0 200 OK' + - 'From: ;tag=[\w-]+' + - 'To: "TestBria" ;tag=[\w-]+' + - 'CSeq: \d+ REGISTER' + - 'Contact: ;expires=\d+;received="sip:[% scenarios.0.ip %]:[% scenarios.0.port %]";\+sip.instance="";reg-id=1' + - 'Server: Sipwise NGCP Proxy' + - 'Content-Length: 0' diff --git a/tests/fixtures/invite_alias_devid/sipp_scenario01.msg b/tests/fixtures/invite_alias_devid/sipp_scenario01.msg new file mode 100644 index 00000000..72f30e89 --- /dev/null +++ b/tests/fixtures/invite_alias_devid/sipp_scenario01.msg @@ -0,0 +1,59 @@ +----------------------------------------------- 2021-07-21 10:09:51.898095 +UDP message sent (529 bytes): + +REGISTER sip:4311015@invite-alias-devid.scenarios-pbx.test SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51615;branch=z9hG4bK-69260-1-0 +From: ;tag=69260SIPpTag001 +To: "TestBria" +Call-ID: NGCP%invite_alias_devid%///1-69260@10.20.29.2 +CSeq: 1 REGISTER +Contact: "TestBria" ;reg-id=1;+sip.instance="" +Expires: 600 +Max-Forwards: 70 +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:51.916251 +UDP message received [532] bytes : + +SIP/2.0 401 Unauthorized +Via: SIP/2.0/UDP 10.20.29.2:51615;rport=51615;branch=z9hG4bK-69260-1-0 +From: ;tag=69260SIPpTag001 +To: "TestBria" ;tag=95c37a12bff1a2c36d72bf8333176544.78550000 +Call-ID: NGCP%invite_alias_devid%///1-69260@10.20.29.2 +CSeq: 1 REGISTER +WWW-Authenticate: Digest realm="invite-alias-devid.scenarios-pbx.test", nonce="YPfXe2D31k8vzYWeebWNm9pzVadizBRx" +Server: Sipwise NGCP Proxy 9.X +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:51.917466 +UDP message sent (745 bytes): + +REGISTER sip:4311015@invite-alias-devid.scenarios-pbx.test SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51615;branch=z9hG4bK-69260-1-3 +From: ;tag=69260SIPpTag001 +To: "TestBria" +Call-ID: NGCP%invite_alias_devid%///1-69260@10.20.29.2 +CSeq: 2 REGISTER +Authorization: Digest username="4311015",realm="invite-alias-devid.scenarios-pbx.test",uri="sip:192.168.2.109:5060",nonce="YPfXe2D31k8vzYWeebWNm9pzVadizBRx",response="aa4238f968fc7501ebf30e01ba1fcd44",algorithm=MD5 +Contact: "TestBria" ;reg-id=1;+sip.instance="" +Expires: 600 +Max-Forwards: 70 +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:51.956840 +UDP message received [568] bytes : + +SIP/2.0 200 OK +Via: SIP/2.0/UDP 10.20.29.2:51615;rport=51615;branch=z9hG4bK-69260-1-3 +From: ;tag=69260SIPpTag001 +To: "TestBria" ;tag=95c37a12bff1a2c36d72bf8333176544.78550000 +Call-ID: NGCP%invite_alias_devid%///1-69260@10.20.29.2 +CSeq: 2 REGISTER +Contact: ;expires=600;received="sip:10.20.29.2:51615";+sip.instance="";reg-id=1 +Server: Sipwise NGCP Proxy 9.X +Content-Length: 0 + + diff --git a/tests/fixtures/invite_alias_devid/sipp_scenario01_test.yml.tt2 b/tests/fixtures/invite_alias_devid/sipp_scenario01_test.yml.tt2 new file mode 100644 index 00000000..037b6ca7 --- /dev/null +++ b/tests/fixtures/invite_alias_devid/sipp_scenario01_test.yml.tt2 @@ -0,0 +1,15 @@ +messages: +- - 'SIP/2.0 401 Unauthorized' + - 'From: ;tag=[\w-]+' + - 'To: "TestBria" ;tag=[\w-]+' + - 'CSeq: \d+ REGISTER' + - 'WWW-Authenticate: Digest realm="invite-alias-devid.scenarios-pbx.test", nonce="[^"]+"' + - 'Server: Sipwise NGCP Proxy' + - 'Content-Length: 0' +- - 'SIP/2.0 200 OK' + - 'From: ;tag=[\w-]+' + - 'To: "TestBria" ;tag=[\w-]+' + - 'CSeq: \d+ REGISTER' + - 'Contact: ;expires=\d+;received="sip:[% scenarios.1.ip %]:[% scenarios.1.port %]";\+sip.instance="";reg-id=1' + - 'Server: Sipwise NGCP Proxy' + - 'Content-Length: 0' diff --git a/tests/fixtures/invite_alias_devid/sipp_scenario02.msg b/tests/fixtures/invite_alias_devid/sipp_scenario02.msg new file mode 100644 index 00000000..3b09fb38 --- /dev/null +++ b/tests/fixtures/invite_alias_devid/sipp_scenario02.msg @@ -0,0 +1,192 @@ +----------------------------------------------- 2021-07-21 10:09:52.094700 +UDP message sent (603 bytes): + +INVITE sip:4311013@invite-alias-devid.scenarios-pbx.test SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51617;branch=z9hG4bK-69270-1-0 +From: ;tag=69270SIPpTag001 +To: +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 1 INVITE +Contact: +Max-Forwards: 70 +Content-Type: application/sdp +Content-Length: 144 + +v=0 +o=user1 53655765 2353687637 IN IP4 10.20.29.2 +s=- +c=IN IP4 10.20.29.2 +t=0 0 +m=audio 45045 RTP/AVP 8 +a=rtpmap:8 PCMA/8000 +a=ptime:50 + +----------------------------------------------- 2021-07-21 10:09:52.096166 +UDP message received [355] bytes : + +SIP/2.0 100 Trying +Via: SIP/2.0/UDP 10.20.29.2:51617;branch=z9hG4bK-69270-1-0;rport=51617 +From: ;tag=69270SIPpTag001 +To: +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 1 INVITE +Server: Sipwise NGCP LB 9.X +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:52.122652 +UDP message received [543] bytes : + +SIP/2.0 407 Proxy Authentication Required +Via: SIP/2.0/UDP 10.20.29.2:51617;rport=51617;branch=z9hG4bK-69270-1-0 +From: ;tag=69270SIPpTag001 +To: ;tag=95c37a12bff1a2c36d72bf8333176544.78550000 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 1 INVITE +Proxy-Authenticate: Digest realm="invite-alias-devid.scenarios-pbx.test", nonce="YPfXfGD31lDQkVog3SD+rscjcgj8+37q" +Server: Sipwise NGCP Proxy 9.X +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:52.124363 +UDP message sent (481 bytes): + +ACK sip:4311013@invite-alias-devid.scenarios-pbx.test:5060 SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51617;rport=51617;branch=z9hG4bK-69270-1-0 +From: ;tag=69270SIPpTag001 +To: ;tag=95c37a12bff1a2c36d72bf8333176544.78550000 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 1 ACK +Contact: +Max-Forwards: 70 +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:52.630636 +UDP message sent (830 bytes): + +INVITE sip:4311013@invite-alias-devid.scenarios-pbx.test SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51617;branch=z9hG4bK-69270-1-5 +From: ;tag=69270SIPpTag001 +To: +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 2 INVITE +Contact: +Max-Forwards: 70 +Proxy-Authorization: Digest username="testuser1002",realm="invite-alias-devid.scenarios-pbx.test",uri="sip:192.168.2.109:5060",nonce="YPfXfGD31lDQkVog3SD+rscjcgj8+37q",response="6ca5c4b2e29b13fd2a98328229b9747a",algorithm=MD5 +Content-Type: application/sdp +Content-Length: 144 + +v=0 +o=user1 53655765 2353687637 IN IP4 10.20.29.2 +s=- +c=IN IP4 10.20.29.2 +t=0 0 +m=audio 45045 RTP/AVP 8 +a=rtpmap:8 PCMA/8000 +a=ptime:50 + +----------------------------------------------- 2021-07-21 10:09:52.632189 +UDP message received [355] bytes : + +SIP/2.0 100 Trying +Via: SIP/2.0/UDP 10.20.29.2:51617;branch=z9hG4bK-69270-1-5;rport=51617 +From: ;tag=69270SIPpTag001 +To: +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 2 INVITE +Server: Sipwise NGCP LB 9.X +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:53.122322 +UDP message received [988] bytes : + +SIP/2.0 180 Ringing +Record-Route: +Record-Route: +Record-Route: +Via: SIP/2.0/UDP 10.20.29.2:51617;rport=51617;branch=z9hG4bK-69270-1-5 +From: ;tag=69270SIPpTag001 +To: ;tag=77722426-60F7D650000F131C-FCD98700 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 2 INVITE +Content-Length: 0 +P-Asserted-Identity: "1003" +Contact: + + +----------------------------------------------- 2021-07-21 10:09:53.769802 +UDP message received [1192] bytes : + +SIP/2.0 200 OK +Record-Route: +Record-Route: +Record-Route: +Via: SIP/2.0/UDP 10.20.29.2:51617;rport=51617;branch=z9hG4bK-69270-1-5 +From: ;tag=69270SIPpTag001 +To: ;tag=77722426-60F7D650000F131C-FCD98700 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 2 INVITE +Content-Type: application/sdp +Content-Length: 176 +P-Asserted-Identity: "1003" +Contact: + +v=0 +o=user1 53655765 2353687637 IN IP4 192.168.2.109 +s=- +c=IN IP4 192.168.2.109 +t=0 0 +m=audio 30224 RTP/AVP 8 +a=rtpmap:8 PCMA/8000 +a=sendrecv +a=rtcp:30225 +a=ptime:50 + +----------------------------------------------- 2021-07-21 10:09:53.770040 +UDP message sent (905 bytes): + +ACK sip:ngcp-lb@192.168.2.109:5060;ngcpct=7369703a3132372e302e302e313a353038303b707278726f7574653d31 SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51617;branch=z9hG4bK-69270-1-10 +From: ;tag=69270SIPpTag001 +To: ;tag=77722426-60F7D650000F131C-FCD98700 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +Route: , , +CSeq: 2 ACK +Contact: +Max-Forwards: 70 +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:55.284075 +UDP message sent (905 bytes): + +BYE sip:ngcp-lb@192.168.2.109:5060;ngcpct=7369703a3132372e302e302e313a353038303b707278726f7574653d31 SIP/2.0 +Via: SIP/2.0/UDP 10.20.29.2:51617;branch=z9hG4bK-69270-1-14 +From: ;tag=69270SIPpTag001 +To: ;tag=77722426-60F7D650000F131C-FCD98700 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 3 BYE +Contact: +Route: , , +Max-Forwards: 70 +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:55.459601 +UDP message received [818] bytes : + +SIP/2.0 200 OK +Record-Route: +Record-Route: +Record-Route: +Via: SIP/2.0/UDP 10.20.29.2:51617;rport=51617;branch=z9hG4bK-69270-1-14 +From: ;tag=69270SIPpTag001 +To: ;tag=77722426-60F7D650000F131C-FCD98700 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2 +CSeq: 3 BYE +Content-Length: 0 +P-Asserted-Identity: "1003" + + diff --git a/tests/fixtures/invite_alias_devid/sipp_scenario02_test.yml.tt2 b/tests/fixtures/invite_alias_devid/sipp_scenario02_test.yml.tt2 new file mode 100644 index 00000000..7f7bfb49 --- /dev/null +++ b/tests/fixtures/invite_alias_devid/sipp_scenario02_test.yml.tt2 @@ -0,0 +1,60 @@ +messages: +- - 'SIP/2.0 100 Trying' + - 'From: ;tag=[\w-]+' + - 'To: ' + - 'CSeq: \d+ INVITE' + - 'Server: Sipwise NGCP LB' + - 'Content-Length: 0' +- - 'SIP/2.0 407 Proxy Authentication Required' + - 'From: ;tag=[\w-]+' + - 'To: ;tag=[\w-]+' + - 'CSeq: \d+ INVITE' + - 'Proxy-Authenticate: Digest realm="invite-alias-devid.scenarios-pbx.test", nonce="[^"]+"' + - 'Server: Sipwise NGCP Proxy' + - 'Content-Length: 0' +- - 'SIP/2.0 100 Trying' + - 'From: ;tag=[\w-]+' + - 'To: ' + - 'CSeq: \d+ INVITE' + - 'Server: Sipwise NGCP LB' + - 'Content-Length: 0' +- - 'SIP/2.0 180 Ringing' + - 'Record-Route: ' + - 'Record-Route: ' + - 'Record-Route: ' + - 'From: ;tag=[\w-]+' + - 'To: ;tag=[\w-]+' + - 'CSeq: \d+ INVITE' + - 'Content-Length: 0' + - 'P-Asserted-Identity: "[% invite_alias_devid_scenarios_pbx_test.testuser1003.pbx_extension %]" ' + - 'Contact: ' +- - 'SIP/2.0 200 OK' + - 'Record-Route: ' + - 'Record-Route: ' + - 'Record-Route: ' + - 'From: ;tag=[\w-]+' + - 'To: ;tag=[\w-]+' + - 'CSeq: \d+ INVITE' + - 'Content-Type: application/sdp' + - 'Content-Length: \d+' + - 'P-Asserted-Identity: "[% invite_alias_devid_scenarios_pbx_test.testuser1003.pbx_extension %]" ' + - 'Contact: ' + - 'v=0' + - 'o=user1 \d+ \d+ IN IP4 [% server_ip %]' + - 's=-' + - 'c=IN IP4 [% server_ip %]' + - 't=0 0' + - 'm=audio \d+ RTP/AVP 8' + - 'a=rtpmap:8 PCMA/8000' + - 'a=sendrecv' + - 'a=rtcp:\d+' + - 'a=ptime:50' +- - 'SIP/2.0 200 OK' + - 'Record-Route: ' + - 'Record-Route: ' + - 'Record-Route: ' + - 'From: ;tag=[\w-]+' + - 'To: ;tag=[\w-]+' + - 'CSeq: \d+ BYE' + - 'Content-Length: 0' + - 'P-Asserted-Identity: "[% invite_alias_devid_scenarios_pbx_test.testuser1003.pbx_extension %]" ' diff --git a/tests/fixtures/invite_alias_devid/sipp_scenario_responder02.msg b/tests/fixtures/invite_alias_devid/sipp_scenario_responder02.msg new file mode 100644 index 00000000..a3695d9a --- /dev/null +++ b/tests/fixtures/invite_alias_devid/sipp_scenario_responder02.msg @@ -0,0 +1,118 @@ +----------------------------------------------- 2021-07-21 10:09:53.040439 +UDP message received [1358] bytes : + +INVITE sip:4311013@10.20.29.2:51618 SIP/2.0 +Record-Route: +Record-Route: +Record-Route: +Via: SIP/2.0/UDP 192.168.2.109;branch=z9hG4bK3719.e4f67a4d3714130414bfb5086b794fe8.0 +Via: SIP/2.0/UDP 127.0.0.1:5062;rport=5062;branch=z9hG4bK3719.5f5bf84d137f4d9a7a1993ec5ffa5298.0 +Via: SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKfMNkma83;rport=5080 +From: ;tag=62A32CAE-60F7D650000F16F8-3DBCD700 +To: +CSeq: 436 INVITE +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2_pbx-1 +Max-Forwards: 69 +P-Asserted-Identity: +Content-Type: application/sdp +Content-Length: 176 +Contact: + +v=0 +o=user1 53655765 2353687637 IN IP4 192.168.2.109 +s=- +c=IN IP4 192.168.2.109 +t=0 0 +m=audio 30238 RTP/AVP 8 +a=rtpmap:8 PCMA/8000 +a=sendrecv +a=rtcp:30239 +a=ptime:50 + +----------------------------------------------- 2021-07-21 10:09:53.040949 +UDP message sent (604 bytes): + +SIP/2.0 180 Ringing +Via: SIP/2.0/UDP 192.168.2.109;branch=z9hG4bK3719.e4f67a4d3714130414bfb5086b794fe8.0, SIP/2.0/UDP 127.0.0.1:5062;rport=5062;branch=z9hG4bK3719.5f5bf84d137f4d9a7a1993ec5ffa5298.0, SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKfMNkma83;rport=5080 +From: ;tag=62A32CAE-60F7D650000F16F8-3DBCD700 +To: ;tag=69179SIPpTag011 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2_pbx-1 +CSeq: 436 INVITE +Contact: +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:53.551672 +UDP message sent (1149 bytes): + +SIP/2.0 200 OK +Via: SIP/2.0/UDP 192.168.2.109;branch=z9hG4bK3719.e4f67a4d3714130414bfb5086b794fe8.0, SIP/2.0/UDP 127.0.0.1:5062;rport=5062;branch=z9hG4bK3719.5f5bf84d137f4d9a7a1993ec5ffa5298.0, SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKfMNkma83;rport=5080 +From: ;tag=62A32CAE-60F7D650000F16F8-3DBCD700 +To: ;tag=69179SIPpTag011 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2_pbx-1 +CSeq: 436 INVITE +Record-Route: , , +Contact: +Content-Type: application/sdp +Content-Length: 144 + +v=0 +o=user1 53655765 2353687637 IN IP4 10.20.29.2 +s=- +c=IN IP4 10.20.29.2 +t=0 0 +m=audio 45048 RTP/AVP 8 +a=rtpmap:8 PCMA/8000 +a=ptime:50 + +----------------------------------------------- 2021-07-21 10:09:53.831546 +UDP message received [1083] bytes : + +ACK sip:10.20.29.2:51618;transport=UDP SIP/2.0 +Record-Route: +Record-Route: +Record-Route: +Via: SIP/2.0/UDP 192.168.2.109;branch=z9hG4bK3719.ec7f65832c6f5519f388dc5aa53d3891.0 +Via: SIP/2.0/UDP 127.0.0.1:5062;rport=5062;branch=z9hG4bK3719.94cf4b0acb3198d8af2f8e7c23890083.0 +Via: SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKsvGu6alZ;rport=5080 +From: ;tag=62A32CAE-60F7D650000F16F8-3DBCD700 +To: ;tag=69179SIPpTag011 +CSeq: 436 ACK +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2_pbx-1 +Max-Forwards: 68 +Content-Length: 0 +Contact: + + +----------------------------------------------- 2021-07-21 10:09:55.418778 +UDP message received [1028] bytes : + +BYE sip:10.20.29.2:51618;transport=UDP SIP/2.0 +Record-Route: +Record-Route: +Record-Route: +Via: SIP/2.0/UDP 192.168.2.109;branch=z9hG4bK4719.8ebdcd25907288e7994ffd0cb7a8ff64.0 +Via: SIP/2.0/UDP 127.0.0.1:5062;rport=5062;branch=z9hG4bK4719.eb1f6743bf7d7349c088854c444d5963.0 +Via: SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKBkZ0.aU2;rport=5080 +From: ;tag=62A32CAE-60F7D650000F16F8-3DBCD700 +To: ;tag=69179SIPpTag011 +CSeq: 437 BYE +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2_pbx-1 +Max-Forwards: 68 +P-Asserted-Identity: +Content-Length: 0 + + +----------------------------------------------- 2021-07-21 10:09:55.419047 +UDP message sent (600 bytes): + +SIP/2.0 200 OK +Via: SIP/2.0/UDP 192.168.2.109;branch=z9hG4bK4719.8ebdcd25907288e7994ffd0cb7a8ff64.0, SIP/2.0/UDP 127.0.0.1:5062;rport=5062;branch=z9hG4bK4719.eb1f6743bf7d7349c088854c444d5963.0, SIP/2.0/UDP 127.0.0.1:5080;received=127.0.0.1;branch=z9hG4bKBkZ0.aU2;rport=5080 +From: ;tag=62A32CAE-60F7D650000F16F8-3DBCD700 +To: ;tag=69179SIPpTag011 +Call-ID: NGCP%invite_alias_devid%///1-69270@10.20.29.2_pbx-1 +CSeq: 437 BYE +Contact: +Content-Length: 0 + + diff --git a/tests/fixtures/invite_alias_devid/sipp_scenario_responder02_test.yml.tt2 b/tests/fixtures/invite_alias_devid/sipp_scenario_responder02_test.yml.tt2 new file mode 100644 index 00000000..0eb54ee8 --- /dev/null +++ b/tests/fixtures/invite_alias_devid/sipp_scenario_responder02_test.yml.tt2 @@ -0,0 +1,40 @@ +messages: +- - 'INVITE sip:[% scenarios.2.devid %]@[% scenarios.2.responders.0.ip %]:[% scenarios.2.responders.0.port %] SIP/2.0' + - 'Record-Route: ' + - 'Record-Route: ' + - 'Record-Route: ' + - 'From: ;tag=[\w-]+' + - 'To: ' + - 'CSeq: \d+ INVITE' + - 'P-Asserted-Identity: ' + - 'Content-Type: application/sdp' + - 'Content-Length: \d+' + - 'Contact: ' + - 'v=0' + - 'o=user1 \d+ \d+ IN IP4 [% server_ip %]' + - 's=-' + - 'c=IN IP4 [% server_ip %]' + - 't=0 0' + - 'm=audio \d+ RTP/AVP 8' + - 'a=rtpmap:8 PCMA/8000' + - 'a=sendrecv' + - 'a=rtcp:\d+' + - 'a=ptime:50' +- - 'ACK sip:[% scenarios.2.responders.0.ip %]:[% scenarios.2.responders.0.port %];transport=UDP SIP/2.0' + - 'Record-Route: ' + - 'Record-Route: ' + - 'Record-Route: ' + - 'From: ;tag=[\w-]+' + - 'To: ;tag=[\w-]+' + - 'CSeq: \d+ ACK' + - 'Content-Length: 0' + - 'Contact: ' +- - 'BYE sip:[% scenarios.2.responders.0.ip %]:[% scenarios.2.responders.0.port %];transport=UDP SIP/2.0' + - 'Record-Route: ' + - 'Record-Route: ' + - 'Record-Route: ' + - 'From: ;tag=[\w-]+' + - 'To: ;tag=[\w-]+' + - 'CSeq: \d+ BYE' + - 'P-Asserted-Identity: ' + - 'Content-Length: 0' diff --git a/tests/test_generate_test_tt2.py b/tests/test_generate_test_tt2.py index 18bd5155..e7811d52 100644 --- a/tests/test_generate_test_tt2.py +++ b/tests/test_generate_test_tt2.py @@ -261,3 +261,30 @@ def test_mix_resp(generate_test_tt2_file, caplog): TT2_FILE.format("mix", "_responder00"), res.out_file ) assert res.returncode == 0 + + +def test_ok_invite_alias_devid(generate_test_tt2_file, caplog): + caplog.set_level(logging.DEBUG) + for i in range(0, 3): + res = generate_test_tt2_file( + IDS_FILE.format("invite_alias_devid"), + MSG_FILE.format("invite_alias_devid", f"0{i}"), + ) + + assert check_filecontent( + TT2_FILE.format("invite_alias_devid", f"0{i}"), res.out_file + ) + assert res.returncode == 0 + + +def test_invite_alias_devid_resp(generate_test_tt2_file, caplog): + caplog.set_level(logging.DEBUG) + res = generate_test_tt2_file( + IDS_FILE.format("invite_alias_devid"), + MSG_FILE.format("invite_alias_devid", "_responder02"), + ) + + assert check_filecontent( + TT2_FILE.format("invite_alias_devid", "_responder02"), res.out_file + ) + assert res.returncode == 0