Skip to main content

Crate wbci

Crate wbci 

Source
Expand description

§wbci — the WBCI 2.0 provider switch, in Rust

When a customer in Germany moves a fixed line to another provider, the two providers agree on the switch over WBCI („WITA Based Carrier Interface“, AK S&P) before any line is touched: the gaining provider (EKPauf) sends a pre-agreement (Vorabstimmung), the losing provider (EKPabg) answers with a binding date or a coded refusal, the gaining provider announces whether it takes over the line, and either side may cancel or postpone — all under working-day deadlines and § 59 TKG.

This crate gives you that protocol as values, without I/O:

You want to…Use
build a request or an answerVorabstimmung, Storno, Terminverschiebung; RuemVa::zustimmung, Abbm::ablehnung, Erlm, AkmTr::uebernahme, Teq::for_anfrage
write or read the XMLPayload::to_xml, Payload::to_soap, Payload::from_xml
know whether the peer will refuse itAnfrage::issues_at, Meldung::issues → Issue
know what is due when, and whydeadline, Calendar
follow a switch through its lifeProcess
answer a pre-agreement as the losing providerpruefung::check
look up a codeMeldungscode
test your gaining-provider side against a simulated losing providersim::Ekpabg

§A switch in twenty lines

use wbci::*;

let ekp = Ekp { auf: "DEU.EKP1".parse()?, abg: "DEU.EKP2".parse()? };
let va = Vorabstimmung {
    id: VorabstimmungsId::allocate(&ekp.auf, 13)?, // DEU.EKP1.V000000013
    kundenwunschtermin: "2027-01-15".parse()?,
    endkunde: Kunde::person(Anrede::Frau, Some(Vorname::new("Erika")?), Nachname::new("Mustermann")?),
    weitere_anschlussinhaber: vec![],
    projekt: None,
    fall: VorabstimmungsFall::KueOrn {
        standort: Standort {
            strassenname: Strassenname::new("Hauptstraße")?,
            hausnummer: Hausnummer::new("12")?,
            hausnummern_zusatz: None,
            postleitzahl: Postleitzahl::new("10115")?,
            ort: Ortsname::new("Berlin")?,
        },
        anschlussidentifikation: None,
    },
    ekp,
};

// Will the peer accept it? Lead times count from when it is sent.
let sent: Timestamp = "2026-11-23T08:00:00Z".parse()?;
let anfrage = Anfrage::from(va.clone());
assert!(anfrage.issues_at(sent, &Calendar::wbci()).is_empty());

// The XML for the peer.
let signatur = SignaturId { issuer: SignaturText::new("CN=Example CA")?, serial: SignaturText::new("4711")? };
let xml = Payload::AnfrageRequest { control: Control::new(sent, signatur), anfrage }.to_xml()?;
assert!(xml.contains("<VorabstimmungsId>DEU.EKP1.V000000013</VorabstimmungsId>"));

// Follow it: once acknowledged, the answer is due within 3 working days.
let mut process = Process::new(Role::EkpAuf, va.clone(), Direction::Sent, sent)?;
process.apply(Direction::Received, sent, Teq::for_anfrage(&va.into(), Meldungscode::Ok))?;
let due = &process.deadlines()[0];
assert_eq!(due.to_string().split(" — ").next(), Some("EKPabg: by Do 26.11.2026 23:59"));

§What is covered

WBCI 2.0 (namespaces http://www.vatm.de/wbci/v1/…, majorRelease 02), with the rules of Anlage 1 „Spezifikation Vorabstimmung“ V5.4.1 and the Arbeitshandbuch WBCI 2.10: all six requests (VA-KUE-MRN, VA-KUE-ORN, VA-RRNP, STR-AUF, STR-AEN from either side, TVS-VA), all six messages (RUEM-VA, ABBM, ERLM, AKM-TR, ABBM-TR, TEQ), the 36 published message codes, every deadline of Anlage 1 §2.5–§2.11.

Not covered, by design: SOAP transport, WS-Security signing, TLS, persistence, the search of your customer database (the pruefung check compares the record you found). Payload::to_soap leaves the header empty for your signer; Control::signatur names the certificate.

§Safety for untrusted input

The reader refuses DTDs, resolves only the five predefined entities, bounds input size, nesting, element count, text length and every repetition, and never panics. Values that may be personal data print redacted in Debug; errors and issues never contain them.

§Interpretations

Where the specifications leave room, this crate decides and says so: working days are Monday to Friday without the nationwide public holidays (Calendar::wbci; the literal „Mo – Fr“ is Calendar::mon_fri); „24 Stunden (bezogen auf Arbeitstage)“ counts 24 hours on working days only; the character set follows the schema’s pattern.

Guides, background and a glossary of the German terms: https://hupe1980.github.io/telco-interop/docs/wbci/.

Unofficial; not affiliated with or endorsed by the AK S&P, VATM or BUGLAS.

Re-exports§

pub use process::Direction;
pub use process::Process;
pub use validate::Issue;
pub use validate::Severity;

Modules§

calendar
Working days (Arbeitstage, AT).
deadline
Deadlines that explain themselves.
process
The life of one pre-agreement, as one party sees it.
pruefung
The losing provider’s check: from a received pre-agreement and your own record of the customer contract, the complete answer — and why.
sim
A simulated losing provider (EKPabg), to test a gaining provider’s side without a partner.
validate
Validation that predicts a peer’s rejection.
xml
XML: reading and writing the four WBCI payloads.

Structs§

Abbm
ABBM (MeldungABBMType).
AbbmTr
ABBM-TR (MeldungABBM_TRType).
Abfragestelle
The operator position of a PBX line, e.g. 0. XSD AbfragestelleType: \d{1,6}.
AenderungsId
The id of a postponement request, e.g. DEU.EKP1.T000000013.
AkmTr
AKM-TR (MeldungAKM_TRType).
Anlagenkopf
The head of a PBX line (OnkzDurchwahlAbfragestelleType).
Calendar
Which days count as working days.
CarrierCode
A carrier: ISO 3166 alpha-3 country code and ITU M.1400 carrier code, e.g. DEU.EKP1.
Control
Control: sent with every request, message and receipt.
Date
A representation of a civil date in the Gregorian calendar.
Durchwahlnummer
The direct-dial number of a PBX line. XSD DurchwahlnummerType: \d{1,8}.
Ekp
The two parties of a switch (Endkundenvertragspartner).
Erlm
ERLM (MeldungERLMType).
Firma
A company (FirmaType).
Firmenname
A company name (firmenname, typed VornameType in the schema): 1–30, collapsed.
Freitext
Free text such as a reason, 1–255 characters, line breaks allowed.
Hausnummer
A house number. XSD HausnummerType: \d{1,4}.
HausnummernZusatz
A house-number suffix, e.g. a. XSD HausnummernZusatzType: 1–6, collapsed.
Identifizierer
The losing provider’s own reference for the order. XSD IdentifiziererType: 1–20.
Kopplungskenner
Couples orders within a project. XSD KopplungskennerType: WBCI charset, 1–30.
LineId
The line identifier of a technical resource, e.g. DEU.EKP1.1754639821.
MeldungKopf
The elements every message except TEQ starts with (AbstractMeldungType).
Meldungstext
The text of a message position. XSD MeldungstextType: 1–255, collapsed.
Nachname
A surname. XSD NachnameType: WBCI charset, 1–30, whitespace collapsed.
Onkz
Ortsnetzkennzahl (area code) without the leading 0, e.g. 30 for Berlin.
OnkzRufnummer
Area code and number (OnkzRufNrType).
Ortsname
A town. XSD OrtsnameType: WBCI charset, 1–40, collapsed.
Person
A natural person (PersonType).
Portierungskennung
A porting identifier from the BNetzA numbering plan, e.g. D001.
Position
A position of a message: a code and its text (AbstractMeldungsPositionType).
PositionAbbm
An ABBM position, which may list numbers (MeldungsPositionABBMType).
PositionRuemVa
A RUEM-VA position, which may carry a corrected address part (MeldungsPositionRUEM_VAType).
Postleitzahl
A German postcode. XSD PostleitzahlType: \d{5}.
ProjektId
A project and optional coupling of orders (ProjektIDType, A1 §2.1.1).
Projektkenner
A project. XSD ProjektkennerType: WBCI charset, 1–30.
Release
majorRelease and minorRelease, two digits each.
RuemVa
RUEM-VA (MeldungRUEM_VAType).
Rufnummer
A subscriber number without the area code. XSD RufnummerType: \d{1,14}.
RufnummernBlock
A bound of a number block of a PBX line. XSD RufnummernBlockType: \d{1,6}.
Rufnummernblock
A block of PBX numbers (RufnummernblockType); always given in full (A1 §2.3).
Rufnummernportierung
What is ported (RufnummernportierungType).
SignaturId
signaturId: identifies the sender’s signing certificate (WBCI 2.0 §10; S/PRI SignaturIdType).
SignaturText
Issuer or serial of the signing certificate. XSD SignatureIssuerType/SignatureSerialIdType.
Standort
The location of the line (StandortType, the TAE of the resource to take over).
Storno
A cancellation (StornoType and its four concrete types).
StornoId
The id of a cancellation request, e.g. DEU.EKP1.S000000013.
Strassenname
A street name. XSD StrassennameType: WBCI charset, 1–40, collapsed.
TechnischeRessource
The technical resource the losing provider names (TechnischeRessourceType).
Technologie
A technology from Anlage 5, e.g. 001 TAL ISDN. XSD TechnologieType: [0-9]{3} .*, 1–25.
Teq
The technical receipt (SystemmeldungTEQType), the synchronous answer to every call.
Terminverschiebung
A postponement by the gaining provider (TerminverschiebungType, A1 §2.11).
Timestamp
An instant in time represented as the number of nanoseconds since the Unix epoch.
ValueError
A value that does not satisfy its schema type.
Vertragsnummer
A WITA contract number. XSD VertragsnummerType: 1–10 characters.
Vorabstimmung
A pre-agreement request (VorabstimmungType and its three concrete types).
VorabstimmungsId
The id of a pre-agreement request, e.g. DEU.EKP1.V000000013.
Vorname
A first name. XSD VornameType: WBCI charset, 1–30, whitespace collapsed.
Zeitstempel
zeitstempel: when the message was sent, with the sender’s UTC offset.

Enums§

AdresseAbweichend
A corrected address part (AdresseAbweichendType, ADA codes 8104–8107).
Anfrage
A request, sent with annehmenAnfrage.
Anrede
Salutation of a person. XSD AnredePersonEnumType.
AnredeFirma
Salutation of a company. XSD AnredeFirmaEnumType.
Anschluss
A single line or a PBX line to port from.
Bezug
What a cancellation or postponement refers to (VorabstimmungsdatenType).
Geschaeftsfall
The business case (Geschäftsfall) of a request; messages repeat the case they answer.
Kunde
The customer or a further line holder (PersonOderFirmaType).
Meldung
A business message, sent with annehmenMeldung.
Meldungscode
A message code (Meldungscode) with its official text.
Meldungstyp
The kind of a message (Meldungstyp).
Payload
One of the four payloads exchanged over WBCI: the body of a SOAP call.
PortierteRufnummern
The numbers the losing provider confirms for porting (RufnummernportierungMeldungType).
Portierungszeitfenster
The time window in which numbers are ported on the switch date (A1 V5.4.1 §3.1).
Role
Which side of a switch a party is on.
StornoArt
The four cancellation types: Aufhebung (cancel for good) or Änderung (cancel to resubmit), by the gaining or the losing provider (A1 §2.9, §2.10).
UebernahmeLeitung
A line the gaining provider takes over (UebernahmeLeitungType).
ValueErrorKind
The facet a ValueError reports.
VorabstimmungsFall
The elements particular to each pre-agreement case.

Constants§

MAX_SEQUENCE
The largest sequence number a request id’s allocate accepts: nine decimal digits.