#, #FreePBX Asterisk, # ? Telegram!

IM (Instant messaging, ), , . IP Asterisk Telegram .


Telegram

, . , @BotFather. :

  • /newbot - ;
  • Merion Knowledge Base - ;
  • merionkbbot - username ;
  • /setuserpic - ;
   Telegram  Asterisk

API (331754110:AAHkMNalOz5I_Schh2kvj7ONhRcE8HuKV-c), . .

/start - :

   Telegram  Asterisk

, . , . username . :

/join @merionkbbot

, username @. URL web - :

https://api.telegram.org/botXXXXXXXXXXXXXXXXXXXXXXX/getUpdates

XXXXXXXXXXXXXXXXXXXXXX - . :

 chat_id    Telegram

id -4455667. Asterisk.


Asterisk

PHP Asterisk AGI. :

#!/usr/bin/php -q
<?php
require('phpagi.php'); 
$agi = new AGI(); 
$cid = $agi->request['agi_callerid'];
$phoneFieldset = "   : ";
$token = "331754110:AAHkMNalOz5I_Schh2kvj7ONhRcE8HuKV-c";
$chat_id = "-4455667";
$arr = array(
$phoneFieldset => $cid,
);
foreach($arr as $key => $value) {
$txt .= "".$key." ".$value."%0A";
};
fopen("https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text={$txt}","r");
?>

$token $chat_id . telegram.php /var/lib/asterisk/agi-bin/. unix :

chmod 755 /var/lib/asterisk/agi-bin/telegram.php
chown asterisk:asterisk /var/lib/asterisk/agi-bin/telegram.php
dos2unix /var/lib/asterisk/agi-bin/telegram.php
PHP UTF 8 ( BOM).

. SIP . , , :

exten => _.,n,AGI(telegram.php)

, , :

  Asterisk  Telegram

?

 .

P.S. , :)

"",