Skip to content

Let filters take a block, evaluated on connect - #24

Closed
henrikbjorn wants to merge 4 commits into
sched-commandsfrom
lazy-filters
Closed

henrikbjorn wants to merge 4 commits into
sched-commandsfrom
lazy-filters

Conversation

@henrikbjorn

@henrikbjorn henrikbjorn commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

filters "Header" => value runs when the class body loads, before an app may know a value it filters on. Now filters also takes a block. The block runs on the listener when the connection starts, and returns the same kind of hash:

class Connection < Librevox::Listener::Inbound
  filters do
    { "variable_baritone_app" => Baritone.app.name }
  end
end

The hash form works as before.

Stacked on #23.

filters 'Header' => value runs when the class body loads, before an app
may know a value it filters on. filters { { 'Header' => value } } now
works too: the block runs on the listener when the connection starts.
@henrikbjorn henrikbjorn self-assigned this Oct 1, 2026
filters { { 'Header' => value } } read oddly. A lambda value, the way
Rails defers a scope, keeps the hash form:
filters 'Header' => -> { value }. The lambda runs on the listener when
the connection starts.
@henrikbjorn henrikbjorn changed the title Let filters take a block, evaluated on connect Let a filter value be a lambda, evaluated on connect Oct 1, 2026
@henrikbjorn henrikbjorn changed the title Let a filter value be a lambda, evaluated on connect Let filters take a block, evaluated on connect Oct 1, 2026
sched_del now returns how many tasks FreeSWITCH deleted, read from its
"+OK Deleted: <count>" reply, so callers check a number instead of
matching the reply text.
@henrikbjorn

Copy link
Copy Markdown
Member Author

Folded into #25, which collects these changes in one PR.

@henrikbjorn henrikbjorn closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant