Announcement: JS Library For Asterisk Pattern Matching And Number Manipulation
Home » Asterisk Users » Announcement: JS Library For Asterisk Pattern Matching And Number Manipulation
hi,
If you are using JavaScript for *AGI/ARI/AMI we made small library for asterisk dialplan pattern matching and number manipulation https://www.npmjs.com/package/asterisk-pattern-matching
examples
const { validateNumber } = require(“asterisk-pattern-matching”)
// list of examples, return true or false validateNumber(‘_X.’, 123456789) // true validateNumber(‘_[+0-9].’, 123456789) // true validateNumber(‘_X.’, ‘+123456789’) // false
// function to verify the asterisk pattern truth and parse number by given settings const { parseNumber } = require(“asterisk-pattern-matching”)
// list of examples, function ends at first pattern match const myPatterns = [