messages, engine: the INVITE's sequence number, session interval and Min-SE are the dialog's
BuildInvite wrote "CSeq: 1 INVITE", "Session-Expires: 1800;refresher=uac" and "Min-SE: 90" as fixed text, and the INVITE's CANCEL, its two ACKs and a PRACK's RAck wrote the 1 again. The three values are fields of the Dialog now, with those defaults, and nothing in the daemon sets them otherwise yet: every message it sends is byte for byte what it was. Tested: the suites (tests/Messages has an INVITE, its CANCEL and its ACKs for a dialog with other values).
This commit is contained in:
parent
e3b94a8415
commit
3d702ec1f1
4 changed files with 37 additions and 12 deletions
|
|
@ -5,7 +5,7 @@
|
|||
Imsd:Messages — the SIP request/response text the engine puts on the wire.
|
||||
|
||||
Every VoLTE message the daemon sends is assembled here from an explicit
|
||||
context and the per-request variables (tags, branches, CSeq) so the builders
|
||||
context and the per-request variables so the builders
|
||||
are pure functions with no hidden state: the engine owns the dialog bookkeeping
|
||||
and the transport owns the socket, this module only formats bytes. That makes
|
||||
each message byte-pinnable — tests/Messages compares a REGISTER pair and an INVITE
|
||||
|
|
@ -333,7 +333,7 @@ export namespace imsd::msg {
|
|||
|
||||
// ---- call dialog ----------------------------------------------------
|
||||
|
||||
// The dialog identity + routing the engine accumulates for one call.
|
||||
// A dialog as the engine keeps it.
|
||||
// For an outgoing call itag is our From tag and dialogTo is learned from
|
||||
// the responses; for an incoming call itag is the To tag we mint,
|
||||
// dialogTo is the caller's From, and both feed BuildInDialog identically
|
||||
|
|
@ -348,6 +348,12 @@ export namespace imsd::msg {
|
|||
std::optional<std::string> remoteTarget; // remote Contact URI
|
||||
std::string localUri; // our URI in this dialog: the UAS takes the
|
||||
// INVITE's To URI; empty = CallerId(c) (UAC)
|
||||
int invCseq = 1; // our INVITE's sequence number: its CANCEL
|
||||
// and its ACK carry it, a PRACK's RAck
|
||||
// names it
|
||||
int sessionExpires = 1800; // the session interval our INVITE asks for
|
||||
// (RFC 4028 4), in seconds
|
||||
int minSe = 90; // the Min-SE our INVITE carries (RFC 4028 5)
|
||||
};
|
||||
|
||||
// The identity we sign our own requests with: the registered public
|
||||
|
|
@ -382,7 +388,8 @@ export namespace imsd::msg {
|
|||
}
|
||||
|
||||
// INVITE with an AMR-WB SDP offer (passed in, built by Imsd:Sdp). MMTEL
|
||||
// ICSI feature tags + sec-agree + session timers, exactly as imsd._send_invite.
|
||||
// ICSI feature tags + sec-agree + session timers, as imsd._send_invite; the
|
||||
// sequence number, the session interval and its minimum are the dialog's.
|
||||
std::string BuildInvite(const Context& c, const Dialog& d, std::string_view sdp, bool precond) {
|
||||
std::string supported = precond ? "100rel, timer, precondition"
|
||||
: "100rel, timer";
|
||||
|
|
@ -394,7 +401,7 @@ export namespace imsd::msg {
|
|||
std::format("From: <{}>;tag={}", FromUri(c, d), d.itag),
|
||||
std::format("To: <{}>", d.ruri),
|
||||
std::format("Call-ID: {}", d.callid),
|
||||
"CSeq: 1 INVITE",
|
||||
std::format("CSeq: {} INVITE", d.invCseq),
|
||||
std::format("Contact: <sip:{}@{}>;+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel\"", ContactUser(c), imsd::util::HostPort(c.local, c.portUs)),
|
||||
"Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, UPDATE, MESSAGE, REFER",
|
||||
std::format("Supported: {}", supported),
|
||||
|
|
@ -406,8 +413,8 @@ export namespace imsd::msg {
|
|||
l.push_back(std::format("Security-Verify: {}", c.securityServer));
|
||||
l.push_back("Proxy-Require: sec-agree");
|
||||
l.push_back("Require: sec-agree");
|
||||
l.push_back("Session-Expires: 1800;refresher=uac");
|
||||
l.push_back("Min-SE: 90");
|
||||
l.push_back(std::format("Session-Expires: {};refresher=uac", d.sessionExpires));
|
||||
l.push_back(std::format("Min-SE: {}", d.minSe));
|
||||
l.push_back("Content-Type: application/sdp");
|
||||
l.push_back(std::format("Content-Length: {}", sdp.size()));
|
||||
l.push_back("");
|
||||
|
|
@ -454,7 +461,7 @@ export namespace imsd::msg {
|
|||
std::format("From: <{}>;tag={}", FromUri(c, d), d.itag),
|
||||
std::format("To: {}", to),
|
||||
std::format("Call-ID: {}", d.callid),
|
||||
"CSeq: 1 ACK",
|
||||
std::format("CSeq: {} ACK", d.invCseq),
|
||||
"Content-Length: 0",
|
||||
};
|
||||
return std::format("{}\r\n", detail::Join(l));
|
||||
|
|
@ -471,7 +478,7 @@ export namespace imsd::msg {
|
|||
std::format("From: <{}>;tag={}", FromUri(c, d), d.itag),
|
||||
std::format("To: {}", toHeader),
|
||||
std::format("Call-ID: {}", d.callid),
|
||||
"CSeq: 1 ACK",
|
||||
std::format("CSeq: {} ACK", d.invCseq),
|
||||
"Content-Length: 0",
|
||||
};
|
||||
return std::format("{}\r\n", detail::Join(l));
|
||||
|
|
@ -487,7 +494,7 @@ export namespace imsd::msg {
|
|||
std::format("From: <{}>;tag={}", FromUri(c, d), d.itag),
|
||||
std::format("To: <{}>", d.ruri),
|
||||
std::format("Call-ID: {}", d.callid),
|
||||
"CSeq: 1 CANCEL",
|
||||
std::format("CSeq: {} CANCEL", d.invCseq),
|
||||
"Content-Length: 0",
|
||||
};
|
||||
return std::format("{}\r\n", detail::Join(l));
|
||||
|
|
|
|||
Loading…
Reference in a new issue