mirror of
https://github.com/jambonz/sbc-inbound.git
synced 2025-12-19 04:37:43 +00:00
reject late media call with 488 and X-Reason (#179)
* reject late media call with 488 and X-Reason * test added * changed X-Reason, clarified test --------- Co-authored-by: Andre Heber <a.heber@cognigy.com>
This commit is contained in:
4
app.js
4
app.js
@@ -240,6 +240,10 @@ srf.invite((req, res) => {
|
|||||||
}
|
}
|
||||||
return session.replaces(req, res);
|
return session.replaces(req, res);
|
||||||
}
|
}
|
||||||
|
if (req.locals.sdp === '') {
|
||||||
|
logger.info('no sdp in invite');
|
||||||
|
return res.send(488, {headers: {'X-Reason': '3pcc INVITEs without SDP are not currently supported'}});
|
||||||
|
}
|
||||||
const session = new CallSession(logger, req, res);
|
const session = new CallSession(logger, req, res);
|
||||||
session.connect();
|
session.connect();
|
||||||
});
|
});
|
||||||
|
|||||||
69
test/scenarios/uac-late-media.xml
Normal file
69
test/scenarios/uac-late-media.xml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||||
|
|
||||||
|
<!-- This program is free software; you can redistribute it and/or -->
|
||||||
|
<!-- modify it under the terms of the GNU General Public License as -->
|
||||||
|
<!-- published by the Free Software Foundation; either version 2 of the -->
|
||||||
|
<!-- License, or (at your option) any later version. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- This program is distributed in the hope that it will be useful, -->
|
||||||
|
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||||
|
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||||
|
<!-- GNU General Public License for more details. -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- You should have received a copy of the GNU General Public License -->
|
||||||
|
<!-- along with this program; if not, write to the -->
|
||||||
|
<!-- Free Software Foundation, Inc., -->
|
||||||
|
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<scenario name="UAC with late media">
|
||||||
|
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||||
|
<!-- generated by sipp. To do so, use [call_id] keyword. -->
|
||||||
|
<send retrans="500">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||||
|
To: sut <sip:[service]@[remote_ip]:[remote_port]>
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 INVITE
|
||||||
|
Contact: sip:sipp@[local_ip]:[local_port]
|
||||||
|
Max-Forwards: 70
|
||||||
|
Subject: Performance Test
|
||||||
|
Content-Type: application/sdp
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<recv response="100" optional="true">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<recv response="488">
|
||||||
|
</recv>
|
||||||
|
|
||||||
|
<send>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||||
|
[last_Via]
|
||||||
|
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
|
||||||
|
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||||
|
Call-ID: [call_id]
|
||||||
|
CSeq: 1 ACK
|
||||||
|
Subject: uac-device-unknown-user
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</send>
|
||||||
|
|
||||||
|
<!-- definition of the response time repartition table (unit is ms) -->
|
||||||
|
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||||
|
|
||||||
|
<!-- definition of the call length repartition table (unit is ms) -->
|
||||||
|
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||||
|
</scenario>
|
||||||
@@ -33,6 +33,10 @@ test('incoming call tests', async(t) => {
|
|||||||
t.ok(obj.calls === 0, 'HTTP GET / works (current call count)')
|
t.ok(obj.calls === 0, 'HTTP GET / works (current call count)')
|
||||||
obj = await getJSON('http://127.0.0.1:3050/system-health');
|
obj = await getJSON('http://127.0.0.1:3050/system-health');
|
||||||
t.ok(obj.calls === 0, 'HTTP GET /system-health works (health check)')
|
t.ok(obj.calls === 0, 'HTTP GET /system-health works (health check)')
|
||||||
|
|
||||||
|
await sippUac('uac-late-media.xml', '172.38.0.30');
|
||||||
|
t.pass('incoming call with no SDP packet is rejected with a 488');
|
||||||
|
|
||||||
await sippUac('uac-pcap-carrier-success.xml', '172.38.0.20');
|
await sippUac('uac-pcap-carrier-success.xml', '172.38.0.20');
|
||||||
t.pass('incoming call from carrier completed successfully');
|
t.pass('incoming call from carrier completed successfully');
|
||||||
|
|
||||||
@@ -68,7 +72,7 @@ test('incoming call tests', async(t) => {
|
|||||||
await waitFor(12);
|
await waitFor(12);
|
||||||
const res = await queryCdrs({account_sid: 'ed649e33-e771-403a-8c99-1780eabbc803'});
|
const res = await queryCdrs({account_sid: 'ed649e33-e771-403a-8c99-1780eabbc803'});
|
||||||
//console.log(`cdrs: ${JSON.stringify(res)}`);
|
//console.log(`cdrs: ${JSON.stringify(res)}`);
|
||||||
t.ok(7 === res.total, 'successfully wrote 7 cdrs for calls');
|
t.ok(8 === res.total, 'successfully wrote 8 cdrs for calls');
|
||||||
|
|
||||||
srf.disconnect();
|
srf.disconnect();
|
||||||
t.end();
|
t.end();
|
||||||
|
|||||||
Reference in New Issue
Block a user