def METHOD_NAME(asterisk_mock, srv, caplog):
    attrs = {
        "login.return_value": 42,
        "originate.return_value": 42,
        "close.side_effect": ManagerSocketException("something failed"),
    }
    asterisk_mock.return_value = Mock(**attrs)
    module = load_module_from_file("mqttwarn/services/asterisk.py")
    item = Item(
        config={
            "host": "asterisk.example.org",
            "port": 5038,
            "username": "foobar",
            "password": "bazqux",
            "extension": 2222,
            "context": "default",
        },
        target="test",
        addrs=["SIP/avaya/", "0123456789"],
        message="⚽ Notification message ⚽",
    )
    outcome = module.plugin(srv, item)
    assert asterisk_mock.mock_calls == [
        call(),
        call().connect("asterisk.example.org", 5038),
        call().login("foobar", "bazqux"),
        call().originate(
            "SIP/avaya/0123456789",
            2222,
            context="default",
            priority="1",
            caller_id=2222,
            variables={"text": "⚽ Notification message ⚽"},
        ),
        call().logoff(),
        call().close(),
    ]
    assert outcome is True