messages, imsd: P-Access-Network-Info in responses and in requests within a dialog
imsd named the serving cell in its REGISTERs, the reg-event SUBSCRIBE, an INVITE and a MESSAGE. TS 24.229 5.1.2A.1.1 and 5.1.2A.2 have a UE insert the header into a request within a dialog as well, and into a response within a dialog, to a request for a dialog and to a standalone method: not into a CANCEL nor into a response to one, and into an ACK at its choice. A PRACK and a BYE carry it now, and every response imsd builds but a 100 Trying, the 200 to a CANCEL and the transport's 400 to a request cut short. The server ports (the protected ports' TCP listeners and UDP sockets) take a request from any source (AGENTS.md §12), and the header is the phone's cell. What they send in answer keeps it only on the two paths of the SA pair the shell has on record, and loses it anywhere else. Tested: the suites, and the daemon of this commit on the workstation against a stand-in network that asks it from both sides of those paths (the fp6 journal's 2026-12-04-pani-in-dialog capture, bench/), and on the dev phone on KPN, where its answers to a text's two requests and a call's 180 and 200 carried the header inside the SA pair (the journal's 2026-12-04-imsd-1.2.7-range-on-dev-phone capture).
This commit is contained in:
parent
6d05aaed0d
commit
a65724a252
11 changed files with 460 additions and 38 deletions
|
|
@ -21,7 +21,10 @@
|
|||
// one cipher. The two REGISTERs once more on an identity an ISIM holds: the
|
||||
// pinned ones with the card's names in place of the derived ones. The INVITE,
|
||||
// its CANCEL and its ACKs once more for a dialog with another sequence number,
|
||||
// session interval and Min-SE than the pinned 1, 1800 and 90. Then the
|
||||
// session interval and Min-SE than the pinned 1, 1800 and 90. Which
|
||||
// messages carry P-Access-Network-Info where the cell is known, and that the
|
||||
// PRACK, the BYE and the responses that carry it carry none where it is not.
|
||||
// Then the
|
||||
// SMS over IP shapes: the
|
||||
// +g.3gpp.smsip Contact tag behind Context::smsOverIp, the MESSAGE carrying
|
||||
// an RP-DATA to the service centre and the one carrying an RP-ACK to the
|
||||
|
|
@ -423,11 +426,11 @@ int main() {
|
|||
Check(prack.contains("To: <sip:1233@x>;tag=remote99\r\n"), "PRACK To has remote tag");
|
||||
Check(prack.contains("CSeq: 2 PRACK\r\n"), "PRACK CSeq");
|
||||
Check(prack.contains("RAck: 42 1 INVITE\r\n"), "PRACK RAck");
|
||||
Check(prack.ends_with("Content-Length: 0\r\n\r\n"), "PRACK empty body");
|
||||
Check(prack.ends_with("RAck: 42 1 INVITE\r\nP-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\nContent-Length: 0\r\n\r\n"), "PRACK: P-Access-Network-Info after its RAck, an empty body");
|
||||
|
||||
std::string bye = BuildInDialog(c, d, "BYE", 3, "byebranch");
|
||||
Check(bye.starts_with("BYE sip:termgw@2001:db8::9 SIP/2.0\r\n"), "BYE line");
|
||||
Check(bye.contains("CSeq: 3 BYE\r\n"), "BYE CSeq");
|
||||
Check(bye.ends_with("CSeq: 3 BYE\r\nP-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\nContent-Length: 0\r\n\r\n"), "BYE: its CSeq, then P-Access-Network-Info");
|
||||
|
||||
std::string ack = BuildAck2xx(c, d, "ackbranch", "<ignored>");
|
||||
Check(ack.starts_with("ACK sip:termgw@2001:db8::9 SIP/2.0\r\n"), "ACK 2xx target");
|
||||
|
|
@ -438,6 +441,12 @@ int main() {
|
|||
Check(cancel.starts_with(std::format("CANCEL {} SIP/2.0\r\n", d.ruri)), "CANCEL request-URI = ruri");
|
||||
Check(cancel.contains("branch=z9hG4bKib;rport\r\n"), "CANCEL reuses INVITE branch");
|
||||
Check(cancel.contains("CSeq: 1 CANCEL\r\n"), "CANCEL CSeq copies INVITE");
|
||||
// RFC 7315 5.7: the header appears in no ACK and no CANCEL
|
||||
Check(!ack.contains("P-Access-Network-Info") && !cancel.contains("P-Access-Network-Info") && !BuildAckNon2xx(c, d, "<sip:x@y>;tag=z").contains("P-Access-Network-Info"), "neither ACK nor the CANCEL carries P-Access-Network-Info");
|
||||
// where the cell is not known the in-dialog requests carry none either
|
||||
Context n = MakeCtx();
|
||||
n.panInfo.clear();
|
||||
Check(BuildInDialog(n, d, "PRACK", 2, "prbranch", rack).ends_with("RAck: 42 1 INVITE\r\nContent-Length: 0\r\n\r\n") && BuildInDialog(n, d, "BYE", 3, "byebranch").ends_with("CSeq: 3 BYE\r\nContent-Length: 0\r\n\r\n"), "no cell known: PRACK and BYE without the header");
|
||||
}
|
||||
{
|
||||
// non-2xx ACK uses the INVITE branch + registration route + resp To
|
||||
|
|
@ -478,12 +487,21 @@ int main() {
|
|||
Check(r.contains("Via: SIP/2.0/TCP [a::1]:45061;branch=z9hG4bKother\r\n"), "200 echoes Via");
|
||||
Check(r.contains("Call-ID: xyz@far\r\n"), "200 echoes Call-ID");
|
||||
Check(r.contains("CSeq: 7 BYE\r\n"), "200 echoes CSeq");
|
||||
Check(r.ends_with("Content-Length: 0\r\n\r\n"), "200 empty body");
|
||||
Check(r.ends_with("CSeq: 7 BYE\r\nP-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\nContent-Length: 0\r\n\r\n"), "200 to a BYE: P-Access-Network-Info after the echoed five, an empty body");
|
||||
// with an SDP answer: our Contact + application/sdp appear
|
||||
std::string r2 = BuildResponse200(c, req, Sdp);
|
||||
Check(r2.contains("Content-Type: application/sdp\r\n"), "200 w/ SDP content-type");
|
||||
Check(r2.contains("Contact: <sip:001010123456789@[2001:db8::db43]:45062>\r\n"), "200 w/ SDP includes our Contact");
|
||||
Check(r2.ends_with(Sdp), "200 w/ SDP body");
|
||||
Check(r2.contains("CSeq: 7 BYE\r\nP-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\nContact: "), "200 w/ SDP: P-Access-Network-Info before our Contact");
|
||||
// TS 24.229 5.1.2A.1.1, 5.1.2A.2: "(except CANCEL responses)"
|
||||
std::string cancelReq = req;
|
||||
cancelReq.replace(0, 3, "CANCEL");
|
||||
cancelReq.replace(cancelReq.find("CSeq: 7 BYE"), 11, "CSeq: 7 CANCEL");
|
||||
Check(BuildResponse200(c, cancelReq).ends_with("CSeq: 7 CANCEL\r\nContent-Length: 0\r\n\r\n"), "200 to a CANCEL: no P-Access-Network-Info");
|
||||
Context n = MakeCtx();
|
||||
n.panInfo.clear();
|
||||
Check(BuildResponse200(n, req).ends_with("CSeq: 7 BYE\r\nContent-Length: 0\r\n\r\n") && !BuildResponse200(n, req, Sdp).contains("P-Access-Network-Info"), "no cell known: the 200 without the header");
|
||||
}
|
||||
|
||||
// ---- s53 oracle diff: UUID Contact user-part + User-Agent ------------
|
||||
|
|
@ -569,7 +587,9 @@ int main() {
|
|||
"Call-ID: in1@net\r\n"
|
||||
"CSeq: 9 MESSAGE\r\n"
|
||||
"Content-Length: 0\r\n\r\n";
|
||||
Eq(BuildResponse(c, inbound, 488, "Not Acceptable Here", "T488"),
|
||||
Context noCell = MakeCtx();
|
||||
noCell.panInfo.clear();
|
||||
Eq(BuildResponse(noCell, inbound, 488, "Not Acceptable Here", "T488"),
|
||||
"SIP/2.0 488 Not Acceptable Here\r\n"
|
||||
"Via: SIP/2.0/UDP [2001:db8::105]:6000;branch=z9hG4bKnet1\r\n"
|
||||
"Via: SIP/2.0/UDP [2001:db8::77]:5060;branch=z9hG4bKgw0\r\n"
|
||||
|
|
@ -578,6 +598,16 @@ int main() {
|
|||
"Call-ID: in1@net\r\n"
|
||||
"CSeq: 9 MESSAGE\r\n"
|
||||
"Content-Length: 0\r\n\r\n", "a 488 for an inbound MESSAGE echoes every Via and tags To");
|
||||
Eq(BuildResponse(c, inbound, 488, "Not Acceptable Here", "T488"),
|
||||
"SIP/2.0 488 Not Acceptable Here\r\n"
|
||||
"Via: SIP/2.0/UDP [2001:db8::105]:6000;branch=z9hG4bKnet1\r\n"
|
||||
"Via: SIP/2.0/UDP [2001:db8::77]:5060;branch=z9hG4bKgw0\r\n"
|
||||
"From: <sip:ipsmgw@ims>;tag=N1\r\n"
|
||||
"To: <sip:me@ims>;tag=T488\r\n"
|
||||
"Call-ID: in1@net\r\n"
|
||||
"CSeq: 9 MESSAGE\r\n"
|
||||
"P-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\n"
|
||||
"Content-Length: 0\r\n\r\n", "and where the cell is known, P-Access-Network-Info after its CSeq");
|
||||
const std::string tagged = "MESSAGE sip:me@ims SIP/2.0\r\nVia: SIP/2.0/UDP [2001:db8::105]:6000;branch=z9hG4bKnet2\r\nFrom: <sip:ipsmgw@ims>;tag=N2\r\nTo: <sip:me@ims>;tag=had\r\nCall-ID: in2@net\r\nCSeq: 1 MESSAGE\r\nContent-Length: 0\r\n\r\n";
|
||||
Check(BuildResponse(c, tagged, 200, "OK", "unused").contains("\r\nTo: <sip:me@ims>;tag=had\r\n"), "a To that already carries a tag is echoed as it is");
|
||||
// the 400 to a request whose datagram ended before its body did (RFC 3261 18.3), built from what imsd::sip::CutShortRequest gives of it
|
||||
|
|
@ -598,6 +628,7 @@ int main() {
|
|||
"CSeq: 9 MESSAGE\r\n"
|
||||
"Content-Length: 0\r\n\r\n", "its 400 echoes every Via and tags To with sixteen hex digits of the MD5 of the secret and the header section");
|
||||
Eq(BuildBadRequest(imsd::sip::CutShortRequest(cut + "s").value_or(""), secret), BuildBadRequest(head, secret), "the same request cut short elsewhere draws the same 400, tag and all");
|
||||
Check(!BuildBadRequest(head, secret).contains("P-Access-Network-Info"), "the 400 is built without the registration's context: no P-Access-Network-Info");
|
||||
const auto toTag = [](std::string_view r) { const std::size_t at = r.find(";tag=", r.find("\r\nTo: ")); return r.substr(at, r.find("\r\n", at) - at); };
|
||||
const std::string r1 = BuildBadRequest(head, secret);
|
||||
std::string other = cut;
|
||||
|
|
@ -644,6 +675,18 @@ int main() {
|
|||
"i: call3@net\r\n"
|
||||
"CSeq: 1 INVITE\r\n"
|
||||
"l: 0\r\n\r\n";
|
||||
Eq(BuildInviteResponse(noCell, invite, 180, "Ringing", "T180"),
|
||||
"SIP/2.0 180 Ringing\r\n"
|
||||
"Via: SIP/2.0/TCP [2001:db8::105]:6000;branch=z9hG4bKnet3\r\n"
|
||||
"Via: SIP/2.0/UDP [2001:db8::77]:5060;branch=z9hG4bKgw3\r\n"
|
||||
"Record-Route: <sip:[2001:db8::105]:6000;lr>\r\n"
|
||||
"From: <sip:caller@ims>;tag=N3\r\n"
|
||||
"To: <sip:me@ims>;tag=T180\r\n"
|
||||
"Call-ID: call3@net\r\n"
|
||||
"CSeq: 1 INVITE\r\n"
|
||||
"Contact: <sip:001010123456789@[2001:db8::db43]:45062>\r\n"
|
||||
"Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, UPDATE, MESSAGE, REFER\r\n"
|
||||
"Content-Length: 0\r\n\r\n", "a 180 for an INVITE echoes every Via and the Record-Route, tags To and carries our Contact and Allow");
|
||||
const std::string ringing = BuildInviteResponse(c, invite, 180, "Ringing", "T180");
|
||||
Eq(ringing,
|
||||
"SIP/2.0 180 Ringing\r\n"
|
||||
|
|
@ -656,7 +699,21 @@ int main() {
|
|||
"CSeq: 1 INVITE\r\n"
|
||||
"Contact: <sip:001010123456789@[2001:db8::db43]:45062>\r\n"
|
||||
"Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, UPDATE, MESSAGE, REFER\r\n"
|
||||
"Content-Length: 0\r\n\r\n", "a 180 for an INVITE echoes every Via and the Record-Route, tags To and carries our Contact and Allow");
|
||||
"P-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\n"
|
||||
"Content-Length: 0\r\n\r\n", "and where the cell is known, P-Access-Network-Info after them");
|
||||
{
|
||||
const std::array<std::string, 2> reliable = {"Require: 100rel", "RSeq: 1"};
|
||||
Check(BuildInviteResponse(c, invite, 180, "Ringing", "T180", std::nullopt, reliable).ends_with("Require: 100rel\r\nRSeq: 1\r\nP-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\nContent-Length: 0\r\n\r\n"), "a reliable 180: P-Access-Network-Info after its Require and RSeq");
|
||||
Check(BuildInviteResponse(c, invite, 100, "Trying", "unused").ends_with("CSeq: 1 INVITE\r\nContent-Length: 0\r\n\r\n"), "a 100 Trying carries none");
|
||||
Check(BuildInviteResponse(c, invite, 486, "Busy Here", "T486").ends_with("CSeq: 1 INVITE\r\nP-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\nContent-Length: 0\r\n\r\n"), "and a 486");
|
||||
Check(BuildInviteResponse(c, invite, 200, "OK", "T200", "v=0\r\n").ends_with("P-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=0010112340ABCDE0\r\nContent-Type: application/sdp\r\nContent-Length: 5\r\n\r\nv=0\r\n"), "and a 200 with its answer, before the Content-Type");
|
||||
Check(!BuildInviteResponse(noCell, invite, 100, "Trying", "unused").contains("P-Access-Network-Info") && !BuildInviteResponse(noCell, invite, 200, "OK", "T200", "v=0\r\n").contains("P-Access-Network-Info"), "no cell known: a 100 and a 200 without the header");
|
||||
Check(BuildInviteResponse(noCell, invite, 180, "Ringing", "T180", std::nullopt, reliable).ends_with("Require: 100rel\r\nRSeq: 1\r\nContent-Length: 0\r\n\r\n") && BuildInviteResponse(noCell, invite, 486, "Busy Here", "T486").ends_with("CSeq: 1 INVITE\r\nContent-Length: 0\r\n\r\n"), "no cell known: a reliable 180 and a 486 without it");
|
||||
// the exception is for a response to a CANCEL, not for one to a request that names the method
|
||||
std::string allowing = invite;
|
||||
allowing.insert(allowing.find("Content-Length:"), "Allow: INVITE, ACK, CANCEL, BYE\r\n");
|
||||
Check(BuildInviteResponse(c, allowing, 180, "Ringing", "T180") == ringing, "an INVITE whose Allow names CANCEL is answered like any other");
|
||||
}
|
||||
Eq(BuildInviteResponse(c, compactInvite, 180, "Ringing", "T180"), ringing, "a 180 for an INVITE in compact form is the one for its long form");
|
||||
Eq(BuildInviteResponse(c, compactInvite, 486, "Busy Here", "T486"), BuildInviteResponse(c, invite, 486, "Busy Here", "T486"), "and so is a 486");
|
||||
Check(BuildInviteResponse(c, invite, 486, "Busy Here", "T486").contains("\r\nTo: <sip:me@ims>;tag=T486\r\n") && !BuildInviteResponse(c, invite, 486, "Busy Here", "T486").contains("Record-Route"), "a 486 tags To and returns no Record-Route");
|
||||
|
|
|
|||
Loading…
Reference in a new issue