{"id":265569,"date":"2015-09-14T14:03:06","date_gmt":"2015-09-14T10:03:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=265569"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=265569","title":{"rendered":"Asterisk \u0438 Truecaller. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u0438 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0432\u043e\u043d\u043a\u0430\u0445"},"content":{"rendered":"<br \/>\n<h4>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h4>\n<p>  TrueCaller \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0438\u043c\u0435\u043d\u0438 \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0432\u043e\u043d\u043a\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043f\u0430\u043c\u0430. \u041d\u0430 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430\u0445 \u0441 CyanogenOS 12.1 \u043e\u043d \u0432\u0448\u0438\u0442 \u0432 \u0448\u0442\u0430\u0442\u043d\u0443\u044e \u0437\u0432\u043e\u043d\u0438\u043b\u043a\u0443. <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435, \u0442\u043e \u0432\u0430\u0448\u0430 \u043a\u043d\u0438\u0433\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043b\u0438\u0442\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Truecaller&#8217;\u0430. <br \/>  \u00a0<br \/>  \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 1.6 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043c\u0438\u0440\u0443. \u0412\u044b\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u0437 \u0431\u0430\u0437\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/www.truecaller.com\/unlist\">https:\/\/www.truecaller.com\/unlist<\/a>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041f\u0440\u0438\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u043c Truecaller \u043a Asterisk&#8217;\u0443 <\/h4>\n<p>  \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 Truecaller&#8217;\u0430 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u043c\u044f \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0412\u0445\u043e\u0434 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u0438. \u0414\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0412\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 (\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b Oauth).<\/p>\n<p>  1. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u0411\u0414 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0437\u0432\u043e\u043d\u0438\u0432\u0448\u0438\u0445 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 truecaller&#8217;\u0430.<br \/>  2. \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u043e\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442 truecaller.com \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435, \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f.<br \/>  3. \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 truecaller.com \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0442\u044c \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u043c\u0435\u043d\u0438 \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430.<br \/>   \u00a0<br \/>  \u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 PHP \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0434 AGI \u0438 \u043e\u0431\u0449\u0435\u0439 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0411\u0414 \u0432 MySQL:<\/p>\n<pre><code class=\"sql\">USE asterisk;  CREATE TABLE asterisk.phonebook (   id int(11) NOT NULL AUTO_INCREMENT,   create_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,   number varchar(20) NOT NULL,   name varchar(80) NOT NULL,   temporary_contact tinyint(1) NOT NULL DEFAULT 1,   PRIMARY KEY (id) ) ENGINE = INNODB AUTO_INCREMENT = 9 AVG_ROW_LENGTH = 8192 CHARACTER SET utf8 COLLATE utf8_general_ci; <\/code><\/pre>\n<p>  PHP \u0441\u043a\u0440\u0438\u043f\u0442 \/var\/lib\/asterisk\/agi-bin\/phonebook.php (\u0434\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 PHP-AGI, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043a\u0430\u043d\u0430\u043b\u0430 CID_NAME):<\/p>\n<pre><code class=\"php\">#!\/usr\/bin\/php -q &lt;?php\t $error_level = error_reporting(0); set_time_limit(30);  \/\/require('phpagi.php'); \/\/$agi = new AGI();  if (isset($argv[1])) {$num=$argv[1];} else {$num=NULL;} $cookie_file='\/tmp\/asterisk_truecaller_vk.cookie'; $vk = array(&quot;login&quot;=&gt; &quot;\u043b\u043e\u0433\u0438\u043d_\u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435&quot;, &quot;password&quot;=&gt; &quot;\u043f\u0430\u0440\u043e\u043b\u044c_\u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435&quot;); $mysql = array(&quot;hostname&quot; =&gt; &quot;localhost&quot;, &quot;login&quot;=&gt; &quot;root&quot;, &quot;login&quot;=&gt; &quot;root&quot;, &quot;password&quot;=&gt; &quot;\u043f\u0430\u0440\u043e\u043b\u044c_mysql&quot;, &quot;database&quot;=&gt; &quot;asterisk&quot;); \t if (!is_null($num)) { \t$callerid_name=get_num($num,$vk,$mysql,$cookie_file,true); \treturn $callerid_name; } else { \techo &quot;\u041d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\\n&quot;; \t\/\/$agi-&gt;set_variable(&quot;CID_NAME&quot;, &quot;&quot;); \treturn false; }  \/\/ \u043f\u043e\u0438\u0441\u043a \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 truecaller function get_num($num,$vk,$mysql,$cookie_file,$isauth) { \t\/\/ \u0438\u0449\u0435\u043c \u0432 \u0441\u0432\u043e\u0435\u0439 \u0431\u0430\u0437\u0435 \tmysql_connect($mysql['hostname'],$mysql['login'],$mysql['password']);  \tmysql_select_db($mysql['database']) or die(mysql_error()); \tmysql_query(&quot;SET NAMES 'utf8'&quot;); mysql_query(&quot;SET CHARACTER SET 'utf8'&quot;); mysql_query(&quot;SET SESSION collation_connection = 'utf8_general_ci'&quot;); \t \t$query = &quot;SELECT * FROM phonebook WHERE `number`=$num&quot;; \t$res = mysql_query($query); \t$count = mysql_num_rows($res); \tif ($count&gt;0) \twhile ($row=mysql_fetch_array($res))  \t{  \t\t$name=$row['name']; \t\techo &quot;\u041d\u0430\u0439\u0434\u0435\u043d \u043a\u043e\u043d\u0442\u0430\u043a\u0442 \u0432 MySQL '&quot;.$name.&quot;'\\n&quot;; \t\t\/\/$agi-&gt;set_variable(&quot;CID_NAME&quot;, &quot;$name&quot;); \t\treturn $name; \t} \tmysql_close(); \t \t\/\/ \u0438\u0449\u0435\u043c \u0432 truecaller \tif ($isauth) \t{ \t\t$ch = curl_init(); \t\tcurl_setopt($ch, CURLOPT_URL, 'http:\/\/www.truecaller.com\/ru\/'.$num );  \t\tcurl_setopt($ch, CURLOPT_HEADER, 1); \t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); \t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); \t\tcurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); \t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); \t\tcurl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); \t\tcurl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);\t \t\t$data = curl_exec($ch); \t\tcurl_close($ch);\t \t\t \t\tif (preg_match(&quot;\/You need to sign in to view the result\/i&quot;, $data)) { \t\t    echo &quot;\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f TC\\n&quot;; \t\t  \t$isauth = oauth_vk($vk, $cookie_file); \t\t  \tget_num($num,$vk,$mysql,$cookie_file,$isauth); \t\t  \t \t\t} else { \t\t    preg_match(&quot;\/&lt;div class=\\&quot;detailView__nameText\\&quot;&gt;\\n\\s*(.+)\\s\\n\\s*&lt;\\\/div&gt;\/i&quot;, $data, $matches);  \t\t    if (count($matches)&gt;0)  \t\t    { \t\t\t    $name=$matches[1];  \t\t\t    echo &quot;\u041d\u0430\u0439\u0434\u0435\u043d \u043a\u043e\u043d\u0442\u0430\u043a\u0442 \u0432 TC '&quot;.$name.&quot;'\\n&quot;; \t\t\t     \t\t\t\tmysql_connect($mysql['hostname'],$mysql['login'],$mysql['password']);  \t\t\t\tmysql_select_db($mysql['database']) or die(mysql_error()); \t\t\t\tmysql_query(&quot;SET NAMES 'utf8'&quot;); mysql_query(&quot;SET CHARACTER SET 'utf8'&quot;); mysql_query(&quot;SET SESSION collation_connection = 'utf8_general_ci'&quot;); \t\t\t\t$query = &quot;INSERT INTO phonebook (`name`,`number`) VALUE ('&quot;.$name.&quot;','&quot;.$num.&quot;')&quot;; \t\t\t\t$res = mysql_query($query); \t\t\t\tmysql_close();\t\t\t     \t\t\t     \t\t\t    \/\/$agi-&gt;set_variable(&quot;CID_NAME&quot;, &quot;$name&quot;); \t\t\t    return $name; \t\t    } else { \t\t    \techo &quot;\u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0432 TC \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b\\n&quot;; \t\t    \t\/\/$agi-&gt;set_variable(&quot;CID_NAME&quot;, &quot;&quot;); \t\t    \treturn false; \t\t    } \t\t}\t \t} \telse \t{ \t\techo &quot;\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f TC \u043d\u0435 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\\n&quot;; \t\t\/\/$agi-&gt;set_variable(&quot;CID_NAME&quot;, &quot;&quot;); \t\treturn false; \t} }  \/\/ \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043d\u043e\u043f\u043a\u0443 &quot;\u0437\u0430\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435&quot; function oauth_vk($vk, $cookie_file) { \tunlink($cookie_file); \t \t$ch = curl_init(); \tcurl_setopt($ch, CURLOPT_URL, 'https:\/\/oauth.vk.com\/authorize?client_id=4951501&scope=friends%2Coffline&redirect_uri=http%3A%2F%2Fwww.truecaller.com%2Fsign-in%2Fvk&response_type=code&state=KKoLuT0vbWEOXfqIW9C0yAvoX7uoEDszIrVOxYSr'); \tcurl_setopt($ch, CURLOPT_HEADER, 1); \tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); \tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); \tcurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); \tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); \tcurl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043a\u0443\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b  \tcurl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);\t \t$data = curl_exec($ch); \tcurl_close($ch); \t \tpreg_match(&quot;\/&lt;form method=\\&quot;post\\&quot; action=\\&quot;(.+)\\&quot;&gt;\/i&quot;, $data, $matches); if (count($matches)&gt;0) $action=$matches[1];  \tpreg_match(&quot;\/&lt;input type=\\&quot;hidden\\&quot; name=\\&quot;_origin\\&quot; value=\\&quot;(.+)\\&quot;&gt;\/i&quot;, $data, $matches); if (count($matches)&gt;0) $origin=$matches[1]; \tpreg_match(&quot;\/&lt;input type=\\&quot;hidden\\&quot; name=\\&quot;ip_h\\&quot; value=\\&quot;(.+)\\&quot; \\\/&gt;\/i&quot;, $data, $matches); if (count($matches)&gt;0) $ip_h=$matches[1]; \tpreg_match(&quot;\/&lt;input type=\\&quot;hidden\\&quot; name=\\&quot;lg_h\\&quot; value=\\&quot;(.+)\\&quot; \\\/&gt;\/i&quot;, $data, $matches); if (count($matches)&gt;0) $lg_h=$matches[1]; \tpreg_match(&quot;\/&lt;input type=\\&quot;hidden\\&quot; name=\\&quot;to\\&quot; value=\\&quot;(.+)\\&quot;&gt;\/i&quot;, $data, $matches); if (count($matches)&gt;0) $to=$matches[1];  \tif (isset($action) && isset($origin) && isset($ip_h) && isset($lg_h) && isset($to)) \t{\t \t\t$ch = curl_init(); \t\tcurl_setopt($ch, CURLOPT_URL, $action ); \t\tcurl_setopt($ch, CURLOPT_HEADER, 1); \t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); \t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); \t\tcurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); \t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); \t\tcurl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); \t\tcurl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); \t\tcurl_setopt($ch, CURLOPT_POST, 1); \t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, array( \t\t    '_origin'=&gt;$origin, \t\t    'ip_h'=&gt;$ip_h, \t\t    'lg_h'=&gt;$lg_h, \t\t    'to'=&gt;$to, \t\t    'email'=&gt;$vk['login'], \t\t    'pass'=&gt;$vk['password'] \t\t));\t \t\t$data = curl_exec($ch); \t\tcurl_close($ch); \t\t \t\tpreg_match('\/Location: (http\\:\\\/\\\/www\\.truecaller\\.com\\\/sign\\-in\\\/vk\\?code\\=.+)\\&state.+\/', $data, $matches); if (count($matches)&gt;0) $location=$matches[1]; \t\t \t\tif (isset($location)) \t\t{ \t\t\t$ch = curl_init(); \t\t\tcurl_setopt($ch, CURLOPT_URL, $location); \t\t\tcurl_setopt($ch, CURLOPT_HEADER, 1); \t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); \t\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); \t\t\tcurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); \t\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); \t\t\tcurl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); \t\t\tcurl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);\t \t\t\t$data = curl_exec($ch); \t\t\tcurl_close($ch); \t\t\t \t\t\tif (preg_match(&quot;\/\\&lt;title\\&gt;Signed In \\|\u00a0Truecaller\\&lt;\\\/title\\&gt;\/i&quot;, $data)) { \t\t\t    echo &quot;\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f VK \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\\n&quot;; \t\t\t  \treturn true; \t\t\t} else { \t\t\t    echo &quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 VK \/ \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438\\n&quot;; \t\t\t    return false; \t\t    }\t \t\t} else { \t\t    echo &quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 VK \/ \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f location \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430\\n&quot;; \t\t    return false; \t\t} \t} else { \t    echo &quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 VK \/ \u043d\u0435 \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b action='&quot;.$action.&quot;', origin='&quot;.$origin.&quot;', ip_h='&quot;.$ip_h.&quot;', lg_h='&quot;.$lg_h.&quot;', to='&quot;.$to.&quot;'\\n&quot;; \t    return false; \t}\t\t }  ?&gt;  <\/code><\/pre>\n<p>  \u0423 \u043c\u0435\u043d\u044f \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d \u043d\u0430 LUA, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 extensions.lua:<\/p>\n<pre><code class=\"lua\">local call = {} call.cid_num = channel[&quot;CALLERID(num)&quot;]:get() call.cid_name = &quot;&quot;  -- \u0438\u0449\u0435\u043c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432 \u0431\u0430\u0437\u0435 local handle = io.popen(&quot;\/var\/lib\/asterisk\/agi-bin\/phonebook.php &quot;..call.cid_num) local founded_name = handle:read(&quot;*a&quot;) handle:close() app.Noop(founded_name) _, _, call.cid_name = string.find(founded_name,&quot;\u041d\u0430\u0439\u0434\u0435\u043d%s\u043a\u043e\u043d\u0442\u0430\u043a\u0442%s\u0432.+%s'(.+)'&quot;) channel[&quot;CALLERID(name)&quot;]:set(call.cid_name)  <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0435\u0442 \u0443\u0447\u0435\u0442\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043f\u0430\u043c \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u043a\u0430\u043a \u00ab\u043e\u0431\u0437\u043e\u0440\u043d\u0430\u044f\u00bb \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u043e\u043b\u044c \u0447\u0443\u0434\u0435\u0441\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Truecaller \u0441 \u0432\u0430\u0448\u0435\u0439 PBX.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/266807\/\"> http:\/\/habrahabr.ru\/post\/266807\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h4>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h4>\n<p>  TrueCaller \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0438\u043c\u0435\u043d\u0438 \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0432\u043e\u043d\u043a\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u043f\u0430\u043c\u0430. \u041d\u0430 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0430\u0445 \u0441 CyanogenOS 12.1 \u043e\u043d \u0432\u0448\u0438\u0442 \u0432 \u0448\u0442\u0430\u0442\u043d\u0443\u044e \u0437\u0432\u043e\u043d\u0438\u043b\u043a\u0443. <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u0435, \u0442\u043e \u0432\u0430\u0448\u0430 \u043a\u043d\u0438\u0433\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043b\u0438\u0442\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Truecaller&#8217;\u0430. <br \/>  \u00a0<br \/>  \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 1.6 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043c\u0438\u0440\u0443. \u0412\u044b\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u0437 \u0431\u0430\u0437\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/www.truecaller.com\/unlist\">https:\/\/www.truecaller.com\/unlist<\/a>.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-265569","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=265569"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265569\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}