add_verb
add_verb
Add a verb to the main section of the current SWML document. The verb is validated
against the SWML schema (or a registered custom handler) before being appended. Raises
SchemaValidationError if validation is enabled and the verb config is invalid.
SWMLService also auto-generates convenience methods for every verb defined in the SWML
schema (e.g., service.play(url=...), service.connect(to=...)). These call add_verb
internally. Use add_verb directly when you need to pass a pre-built config dictionary
or work with custom verbs.
Parameters
verb_name
The SWML verb name (e.g., "answer", "play", "ai", "hangup", "connect").
config
Configuration dictionary for the verb. Most verbs accept a dict of parameters.
The sleep verb is a special case that accepts a direct int value representing
milliseconds.
Returns
bool — True if the verb was added successfully, False if the config type was
invalid (non-dict for non-sleep verbs).