imsd, engine: the Messaging status and a received text carry the SIM's operator
A consumer that keeps a number in the form it was written in — a national number, an operator's short code — has to know where it was written before it dials it again: a national number's country, a short code's operator. The own number's country code is not enough for either: countries share a code, and the operators of one country share theirs. The daemon reads the SIM's operator id at bring-up (ModemManager's: MCC then MNC), which names the subscription's country and operator. The Messaging GetStatus gives it as `operator`, from the snapshot `ppi` comes from, and a received text's record and its Received and List dictionaries carry the one the daemon held at receipt, beside `to` — additive keys, as `to` and `ppi` are, and the operator id only, never the IMSI. Tested: tests/Engine, the record round trip with `operator` and a record without it.
This commit is contained in:
parent
c434c8e84d
commit
e39f7e39d6
5 changed files with 30 additions and 18 deletions
|
|
@ -1674,6 +1674,7 @@ int main() {
|
|||
r.id = "ims-sms-in-1792186043-7";
|
||||
r.receivedAt = 1792186043;
|
||||
r.to = "tel:+31612345678";
|
||||
r.simOperator = "20408";
|
||||
r.sms.from = "KPN Service=\n\"x\"";
|
||||
r.sms.text = "Grüße ❤\nline two=three";
|
||||
r.sms.scts = "2026-10-16T22:50:00+02:00";
|
||||
|
|
@ -1688,11 +1689,11 @@ int main() {
|
|||
r.sms.data = {0xDE, 0xAD};
|
||||
r.sms.tpdu = {0x04, 0x0B, 0x91};
|
||||
const std::string text = FormatStoredSms(r);
|
||||
Check(text.starts_with("id=ims-sms-in-1792186043-7\nreceived=1792186043\nto=tel:+31612345678\nfrom=") && text.contains("\nport-dst=2948\nport-src=9200\n") && text.ends_with("\npdu=040b91\n") && !text.contains("Grüße"), "store: the record's shape, the text as hex");
|
||||
Check(text.starts_with("id=ims-sms-in-1792186043-7\nreceived=1792186043\nto=tel:+31612345678\noperator=20408\nfrom=") && text.contains("\nport-dst=2948\nport-src=9200\n") && text.ends_with("\npdu=040b91\n") && !text.contains("Grüße"), "store: the record's shape, the text as hex");
|
||||
auto back = ParseStoredSms(text);
|
||||
Check(back && back->id == r.id && back->receivedAt == r.receivedAt && back->to == r.to && back->sms.from == r.sms.from && back->sms.text == r.sms.text && back->sms.scts == r.sms.scts && back->sms.sc == r.sms.sc && back->sms.msgClass == 0 && back->sms.pid == 0x40 && back->sms.dcs == 0x08 && back->sms.segments == 2 && back->sms.messageWaiting && back->sms.portDst == 2948 && back->sms.portSrc == 9200 && back->sms.data == r.sms.data && back->sms.tpdu == r.sms.tpdu, "store: a full record round-trips");
|
||||
Check(back && back->id == r.id && back->receivedAt == r.receivedAt && back->to == r.to && back->simOperator == r.simOperator && back->sms.from == r.sms.from && back->sms.text == r.sms.text && back->sms.scts == r.sms.scts && back->sms.sc == r.sms.sc && back->sms.msgClass == 0 && back->sms.pid == 0x40 && back->sms.dcs == 0x08 && back->sms.segments == 2 && back->sms.messageWaiting && back->sms.portDst == 2948 && back->sms.portSrc == 9200 && back->sms.data == r.sms.data && back->sms.tpdu == r.sms.tpdu, "store: a full record round-trips");
|
||||
auto minimal = ParseStoredSms("id=x\n");
|
||||
Check(minimal && minimal->id == "x" && minimal->receivedAt == 0 && minimal->to.empty() && !minimal->sms.msgClass && !minimal->sms.portDst && minimal->sms.segments == 1 && minimal->sms.text.empty(), "store: absent keys read as defaults");
|
||||
Check(minimal && minimal->id == "x" && minimal->receivedAt == 0 && minimal->to.empty() && minimal->simOperator.empty() && !minimal->sms.msgClass && !minimal->sms.portDst && minimal->sms.segments == 1 && minimal->sms.text.empty(), "store: absent keys read as defaults");
|
||||
Check(!ParseStoredSms("received=5\nfrom=00\n"), "store: no id, no record");
|
||||
Check(!ParseStoredSms("id=x\ntext=zz\n"), "store: a malformed hex value, no record");
|
||||
Check(!ParseStoredSms("id=x\nreceived=soon\n"), "store: a malformed number, no record");
|
||||
|
|
|
|||
Loading…
Reference in a new issue