Answer the question
In order to leave comments, you need to log in
Parsing black_list Asterisk?
Good afternoon!
Please help me to parse
the Asterisk database and add the
script
. database queries - $res = myQuery($sql, true);
You can execute commands in Asterisk, from a script and parse the response - exec('asterisk -rx "database show" | grep blacklist', $res);
The task is to parse the numbers and put them into the $black_list variable. It
should turn out something like:
$black_list = array('+79999999999' , '+7888888888');
Answer the question
In order to leave comments, you need to log in
preg_match_all('/\/([+0-9])+\s:/', `asterisk -rx "database show" | grep blacklist`, $matches);
$black_list = $matches[1];
preg_match_all('/[+0-9]{12}/', `asterisk -rx "database show" | grep blacklist`, $black_list);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question