FAILURE MAP
← Case archive

FA-19106 / Protocols / Open access

Intercom call-signaling controller: outgoing / busy · case 01

While outgoing, event busy produces connected/open_media instead of idle/report_busy.

Verified by executionVariant 1 · 14 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

In outgoing, the busy handler runs open media and enters connected; it must instead run report busy and enter idle.

VERIFIED REPAIR

In phase outgoing, classify busy as transition to idle and emit report_busy.

Unsuccessful approach: The partial repair chooses idle/report_no_answer, which still violates this phase-specific event contract.

Case contract

For the stipulated Intercom call-signaling controller, initialize the explicitly shown resource registers from seed (1..5), then consume classified events sequentially. After each event return a deep snapshot of phase, resource registers, and cumulative emitted control frames. The explicit ten phase/event rules and their resource effects define admission and response semantics. Unlisted events preserve phase and emit rejection. Payload is the consecutive integers seed through 2*seed+1. Empty event input returns no observations.

Why this case matters

Incorrect event admission now changes concrete queued data, resource ownership, or emitted protocol frames and subsequent trace behavior.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'tx': phase in ('connected','held'), 'rx': phase in ('connected','held'), 'bell': phase=='incoming', 'muted': phase=='held', 'status': [], 'call': seed}
    frames = []
    observed = []
    table = {('idle', 'dial'): ('outgoing', 'send_invitation'), ('outgoing', 'ringing'): ('alerting', 'notify_remote_ring'), ('alerting', 'answered'): ('connected', 'open_media'), ('outgoing', 'busy'): ('connected', 'open_media'), ('idle', 'invitation'): ('incoming', 'ring_local'), ('incoming', 'accept'): ('connected', 'answer_open_media'), ('incoming', 'decline'): ('idle', 'send_decline_stop_ring'), ('connected', 'hold'): ('held', 'mute_send_hold'), ('held', 'resume'): ('connected', 'unmute_send_resume'), ('connected', 'hangup'): ('idle', 'close_media_send_bye')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_invitation':
            frames.append(['INVITE',seed])
        elif action == 'notify_remote_ring':
            r['status'].append('remote_ringing')
        elif action == 'open_media':
            r['tx']=True; r['rx']=True
        elif action == 'report_busy':
            r['status'].append('busy')
        elif action == 'ring_local':
            r['bell']=True
        elif action == 'answer_open_media':
            frames.append(['ANSWER',seed]); r['bell']=False; r['tx']=True; r['rx']=True
        elif action == 'send_decline_stop_ring':
            frames.append(['DECLINE',seed]); r['bell']=False
        elif action == 'mute_send_hold':
            r['muted']=True; frames.append(['HOLD',seed])
        elif action == 'unmute_send_resume':
            r['muted']=False; frames.append(['RESUME',seed])
        elif action == 'close_media_send_bye':
            r['tx']=False; r['rx']=False; frames.append(['BYE',seed])
        elif action == 'open_receive_only':
            r['rx']=True
        elif action == 'report_no_answer':
            r['status'].append('no_answer')
        elif action == 'send_answer_only':
            frames.append(['ANSWER',seed])
        elif action == 'stop_ring_only':
            r['bell']=False
        elif action == 'mute_only':
            r['muted']=True
        elif action == 'send_hold_only':
            frames.append(['HOLD',seed])
        elif action == 'unmute_only':
            r['muted']=False
        elif action == 'send_resume_only':
            frames.append(['RESUME',seed])
        elif action == 'close_media_only':
            r['tx']=False; r['rx']=False
        elif action == 'send_bye_only':
            frames.append(['BYE',seed])
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['INVITE', 1]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 1}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 1}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['ANSWER', 1]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['DECLINE', 1]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 1}, 'frames': [['HOLD', 1]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['RESUME', 1]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['BYE', 1]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['INVITE', 2]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 2}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 2}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['ANSWER', 2]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['DECLINE', 2]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 2}, 'frames': [['HOLD', 2]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['RESUME', 2]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['BYE', 2]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2], ['INVITE', 2]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['INVITE', 3]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 3}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 3}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['ANSWER', 3]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['DECLINE', 3]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 3}, 'frames': [['HOLD', 3]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['RESUME', 3]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['BYE', 3]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['INVITE', 4]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 4}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 4}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['ANSWER', 4]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['DECLINE', 4]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 4}, 'frames': [['HOLD', 4]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['RESUME', 4]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['BYE', 4]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['INVITE', 5]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 5}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 5}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['ANSWER', 5]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['DECLINE', 5]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 5}, 'frames': [['HOLD', 5]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['RESUME', 5]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['BYE', 5]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
idle/dial[{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
outgoing/ringing[{'frames': [], 'phase': 'alerting', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['remote_ringing'], 'tx': False}}][{'frames': [], 'phase': 'alerting', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['remote_ringing'], 'tx': False}}]Passed
alerting/answered[{'frames': [], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
outgoing/busy[{'frames': [], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}]Failed
idle/invitation[{'frames': [], 'phase': 'incoming', 'registers': {'bell': True, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [], 'phase': 'incoming', 'registers': {'bell': True, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
incoming/accept[{'frames': [['ANSWER', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['ANSWER', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
incoming/decline[{'frames': [['DECLINE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['DECLINE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
connected/hold[{'frames': [['HOLD', 1]], 'phase': 'held', 'registers': {'bell': False, 'call': 1, 'muted': True, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['HOLD', 1]], 'phase': 'held', 'registers': {'bell': False, 'call': 1, 'muted': True, 'rx': True, 'status': [], 'tx': True}}]Passed
held/resume[{'frames': [['RESUME', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['RESUME', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
connected/hangup[{'frames': [['BYE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['BYE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
ordered trace 0[{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}, {'frames': [['INVITE', 1], ['reject', [1, 2, 3]]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}, {'frames': [['INVITE', 1], ['reject', [1, 2, 3]], ['reject', [1, 2, 3]]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}]Failed
ordered trace 3[{'frames': [], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}, {'frames': [['reject', [1, 2, 3]]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}, {'frames': [['reject', [1, 2, 3]], ['reject', [1, 2, 3]]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}, {'frames': [['reject', [1, 2, 3]], ['reject', [1, 2, 3]], ['reject', [1, 2, 3]]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}]Failed
empty input[][]Passed
unknown event[{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed

SHA-256 / fadcdf1ce5d51aa87c5f238e15c4af695d2f2e878868fbd6f3d9603475b13de3

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'tx': phase in ('connected','held'), 'rx': phase in ('connected','held'), 'bell': phase=='incoming', 'muted': phase=='held', 'status': [], 'call': seed}
    frames = []
    observed = []
    table = {('idle', 'dial'): ('outgoing', 'send_invitation'), ('outgoing', 'ringing'): ('alerting', 'notify_remote_ring'), ('alerting', 'answered'): ('connected', 'open_media'), ('outgoing', 'busy'): ('idle', 'report_no_answer'), ('idle', 'invitation'): ('incoming', 'ring_local'), ('incoming', 'accept'): ('connected', 'answer_open_media'), ('incoming', 'decline'): ('idle', 'send_decline_stop_ring'), ('connected', 'hold'): ('held', 'mute_send_hold'), ('held', 'resume'): ('connected', 'unmute_send_resume'), ('connected', 'hangup'): ('idle', 'close_media_send_bye')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_invitation':
            frames.append(['INVITE',seed])
        elif action == 'notify_remote_ring':
            r['status'].append('remote_ringing')
        elif action == 'open_media':
            r['tx']=True; r['rx']=True
        elif action == 'report_busy':
            r['status'].append('busy')
        elif action == 'ring_local':
            r['bell']=True
        elif action == 'answer_open_media':
            frames.append(['ANSWER',seed]); r['bell']=False; r['tx']=True; r['rx']=True
        elif action == 'send_decline_stop_ring':
            frames.append(['DECLINE',seed]); r['bell']=False
        elif action == 'mute_send_hold':
            r['muted']=True; frames.append(['HOLD',seed])
        elif action == 'unmute_send_resume':
            r['muted']=False; frames.append(['RESUME',seed])
        elif action == 'close_media_send_bye':
            r['tx']=False; r['rx']=False; frames.append(['BYE',seed])
        elif action == 'open_receive_only':
            r['rx']=True
        elif action == 'report_no_answer':
            r['status'].append('no_answer')
        elif action == 'send_answer_only':
            frames.append(['ANSWER',seed])
        elif action == 'stop_ring_only':
            r['bell']=False
        elif action == 'mute_only':
            r['muted']=True
        elif action == 'send_hold_only':
            frames.append(['HOLD',seed])
        elif action == 'unmute_only':
            r['muted']=False
        elif action == 'send_resume_only':
            frames.append(['RESUME',seed])
        elif action == 'close_media_only':
            r['tx']=False; r['rx']=False
        elif action == 'send_bye_only':
            frames.append(['BYE',seed])
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['INVITE', 1]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 1}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 1}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['ANSWER', 1]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['DECLINE', 1]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 1}, 'frames': [['HOLD', 1]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['RESUME', 1]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['BYE', 1]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['INVITE', 2]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 2}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 2}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['ANSWER', 2]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['DECLINE', 2]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 2}, 'frames': [['HOLD', 2]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['RESUME', 2]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['BYE', 2]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2], ['INVITE', 2]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['INVITE', 3]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 3}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 3}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['ANSWER', 3]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['DECLINE', 3]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 3}, 'frames': [['HOLD', 3]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['RESUME', 3]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['BYE', 3]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['INVITE', 4]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 4}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 4}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['ANSWER', 4]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['DECLINE', 4]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 4}, 'frames': [['HOLD', 4]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['RESUME', 4]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['BYE', 4]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['INVITE', 5]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 5}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 5}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['ANSWER', 5]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['DECLINE', 5]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 5}, 'frames': [['HOLD', 5]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['RESUME', 5]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['BYE', 5]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
idle/dial[{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
outgoing/ringing[{'frames': [], 'phase': 'alerting', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['remote_ringing'], 'tx': False}}][{'frames': [], 'phase': 'alerting', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['remote_ringing'], 'tx': False}}]Passed
alerting/answered[{'frames': [], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
outgoing/busy[{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['no_answer'], 'tx': False}}][{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}]Failed
idle/invitation[{'frames': [], 'phase': 'incoming', 'registers': {'bell': True, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [], 'phase': 'incoming', 'registers': {'bell': True, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
incoming/accept[{'frames': [['ANSWER', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['ANSWER', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
incoming/decline[{'frames': [['DECLINE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['DECLINE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
connected/hold[{'frames': [['HOLD', 1]], 'phase': 'held', 'registers': {'bell': False, 'call': 1, 'muted': True, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['HOLD', 1]], 'phase': 'held', 'registers': {'bell': False, 'call': 1, 'muted': True, 'rx': True, 'status': [], 'tx': True}}]Passed
held/resume[{'frames': [['RESUME', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['RESUME', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
connected/hangup[{'frames': [['BYE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['BYE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
ordered trace 0[{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['no_answer'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['no_answer'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['no_answer', 'no_answer'], 'tx': False}}][{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}]Failed
ordered trace 3[{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['no_answer'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['no_answer'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['no_answer', 'no_answer'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['no_answer', 'no_answer'], 'tx': False}}][{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}]Failed
empty input[][]Passed
unknown event[{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed

SHA-256 / 19b641d63e4202e7b5facf38ef27c283e8df5198fa38780e773626c0e467d338

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'tx': phase in ('connected','held'), 'rx': phase in ('connected','held'), 'bell': phase=='incoming', 'muted': phase=='held', 'status': [], 'call': seed}
    frames = []
    observed = []
    table = {('idle', 'dial'): ('outgoing', 'send_invitation'), ('outgoing', 'ringing'): ('alerting', 'notify_remote_ring'), ('alerting', 'answered'): ('connected', 'open_media'), ('outgoing', 'busy'): ('idle', 'report_busy'), ('idle', 'invitation'): ('incoming', 'ring_local'), ('incoming', 'accept'): ('connected', 'answer_open_media'), ('incoming', 'decline'): ('idle', 'send_decline_stop_ring'), ('connected', 'hold'): ('held', 'mute_send_hold'), ('held', 'resume'): ('connected', 'unmute_send_resume'), ('connected', 'hangup'): ('idle', 'close_media_send_bye')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_invitation':
            frames.append(['INVITE',seed])
        elif action == 'notify_remote_ring':
            r['status'].append('remote_ringing')
        elif action == 'open_media':
            r['tx']=True; r['rx']=True
        elif action == 'report_busy':
            r['status'].append('busy')
        elif action == 'ring_local':
            r['bell']=True
        elif action == 'answer_open_media':
            frames.append(['ANSWER',seed]); r['bell']=False; r['tx']=True; r['rx']=True
        elif action == 'send_decline_stop_ring':
            frames.append(['DECLINE',seed]); r['bell']=False
        elif action == 'mute_send_hold':
            r['muted']=True; frames.append(['HOLD',seed])
        elif action == 'unmute_send_resume':
            r['muted']=False; frames.append(['RESUME',seed])
        elif action == 'close_media_send_bye':
            r['tx']=False; r['rx']=False; frames.append(['BYE',seed])
        elif action == 'open_receive_only':
            r['rx']=True
        elif action == 'report_no_answer':
            r['status'].append('no_answer')
        elif action == 'send_answer_only':
            frames.append(['ANSWER',seed])
        elif action == 'stop_ring_only':
            r['bell']=False
        elif action == 'mute_only':
            r['muted']=True
        elif action == 'send_hold_only':
            frames.append(['HOLD',seed])
        elif action == 'unmute_only':
            r['muted']=False
        elif action == 'send_resume_only':
            frames.append(['RESUME',seed])
        elif action == 'close_media_only':
            r['tx']=False; r['rx']=False
        elif action == 'send_bye_only':
            frames.append(['BYE',seed])
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['INVITE', 1]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 1}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 1}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['ANSWER', 1]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['DECLINE', 1]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 1}, 'frames': [['HOLD', 1]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['RESUME', 1]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['BYE', 1]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 1}, 'frames': [['INVITE', 1], ['INVITE', 1]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 1}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['INVITE', 2]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 2}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 2}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['ANSWER', 2]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['DECLINE', 2]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 2}, 'frames': [['HOLD', 2]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['RESUME', 2]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['BYE', 2]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2], ['INVITE', 2]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 2}, 'frames': [['INVITE', 2], ['INVITE', 2]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 2}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['INVITE', 3]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 3}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 3}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['ANSWER', 3]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['DECLINE', 3]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 3}, 'frames': [['HOLD', 3]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['RESUME', 3]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['BYE', 3]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 3}, 'frames': [['INVITE', 3], ['INVITE', 3], ['INVITE', 3]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 3}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['INVITE', 4]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 4}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 4}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['ANSWER', 4]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['DECLINE', 4]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 4}, 'frames': [['HOLD', 4]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['RESUME', 4]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['BYE', 4]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 4}, 'frames': [['INVITE', 4], ['INVITE', 4], ['INVITE', 4]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 4}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('idle/dial', 'idle', ['dial'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['INVITE', 5]]}]), ('outgoing/ringing', 'outgoing', ['ringing'], [{'phase': 'alerting', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['remote_ringing'], 'call': 5}, 'frames': []}]), ('alerting/answered', 'alerting', ['answered'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': []}]), ('outgoing/busy', 'outgoing', ['busy'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': []}]), ('idle/invitation', 'idle', ['invitation'], [{'phase': 'incoming', 'registers': {'tx': False, 'rx': False, 'bell': True, 'muted': False, 'status': [], 'call': 5}, 'frames': []}]), ('incoming/accept', 'incoming', ['accept'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['ANSWER', 5]]}]), ('incoming/decline', 'incoming', ['decline'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['DECLINE', 5]]}]), ('connected/hold', 'connected', ['hold'], [{'phase': 'held', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': True, 'status': [], 'call': 5}, 'frames': [['HOLD', 5]]}]), ('held/resume', 'held', ['resume'], [{'phase': 'connected', 'registers': {'tx': True, 'rx': True, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['RESUME', 5]]}]), ('connected/hangup', 'connected', ['hangup'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['BYE', 5]]}]), ('ordered trace 0', 'idle', ['dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy'], [{'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}]), ('ordered trace 3', 'outgoing', ['busy', 'dial', 'busy', 'dial', 'busy', 'dial', 'busy', 'dial'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': []}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}, {'phase': 'outgoing', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': ['busy', 'busy', 'busy', 'busy'], 'call': 5}, 'frames': [['INVITE', 5], ['INVITE', 5], ['INVITE', 5], ['INVITE', 5]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'tx': False, 'rx': False, 'bell': False, 'muted': False, 'status': [], 'call': 5}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
idle/dial[{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
outgoing/ringing[{'frames': [], 'phase': 'alerting', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['remote_ringing'], 'tx': False}}][{'frames': [], 'phase': 'alerting', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['remote_ringing'], 'tx': False}}]Passed
alerting/answered[{'frames': [], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
outgoing/busy[{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}][{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}]Passed
idle/invitation[{'frames': [], 'phase': 'incoming', 'registers': {'bell': True, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [], 'phase': 'incoming', 'registers': {'bell': True, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
incoming/accept[{'frames': [['ANSWER', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['ANSWER', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
incoming/decline[{'frames': [['DECLINE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['DECLINE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
connected/hold[{'frames': [['HOLD', 1]], 'phase': 'held', 'registers': {'bell': False, 'call': 1, 'muted': True, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['HOLD', 1]], 'phase': 'held', 'registers': {'bell': False, 'call': 1, 'muted': True, 'rx': True, 'status': [], 'tx': True}}]Passed
held/resume[{'frames': [['RESUME', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}][{'frames': [['RESUME', 1]], 'phase': 'connected', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': True, 'status': [], 'tx': True}}]Passed
connected/hangup[{'frames': [['BYE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['BYE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed
ordered trace 0[{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}][{'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}]Passed
ordered trace 3[{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}][{'frames': [], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy'], 'tx': False}}, {'frames': [['INVITE', 1]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}, {'frames': [['INVITE', 1], ['INVITE', 1]], 'phase': 'outgoing', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': ['busy', 'busy'], 'tx': False}}]Passed
empty input[][]Passed
unknown event[{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}][{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'bell': False, 'call': 1, 'muted': False, 'rx': False, 'status': [], 'tx': False}}]Passed

SHA-256 / dd12687105779c5489b24a58aefe8f933a8fad4682acee15a7fd29ad5e93bb4e

Verification & scope

Bounded offline control-plane abstraction with prescribed initial registers and classified events. Not a named protocol implementation or conformance test; excludes wire parsing, transport retries, physical execution, authentication, crash persistence, and timing. Related event faults share the full corrected controller and evaluation group. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:40:04.528209+00:00.

Case digest / 24b835574b2647fded905f14d806a0491750eea1ff9711484b31b111a9003435