Отправка sms через gsm-шлюз Openvox

Первым делом заходим в сам gsm-шлюз
Открываем возможность управления астериском через AMI

OpenVox web

OpenVox web



Качаем 2 файла phpagi-asmanager.php, phpagi.php с http://eder.us/projects/phpagi/ в /var/lib/asterisk/agi-bin/

Создаем скрипт отправки

<?php
echo "SMS send";
$text = "Тестове повідомлення";#YOUR MESSAGE
include("/var/lib/asterisk/agi-bin/phpagi-asmanager.php");
$agi=new AGI_AsteriskManager;
 
$vst_host="10.0.0.1"; #YOUR VOXSTACK GSM GATEWAY IP ADDRESS
$vst_user="admin"; #Corresponding to your GSM gateway API settings
$vst_pwd="admin"; #Corresponding to your GSM gateway API settings
$vst_port="5038"; #Corresponding to your GSM gateway API settings

$agi_status=$agi->connect($vst_host.":".$vst_port,$vst_user,$vst_pwd);
if(!$agi_status)
  {
    $msg="Failed to connected Asterisk,exit..";
    exit(0);
  }
    $type="gsm";
    $method="send";
    $sync="sms";
    $span="5"; #YOUR SIMcard for sending sms
    $destination="0501112233"; #YOUR DESTINATION NUMBER
    $message=mb_convert_encoding($text, "utf-8", mb_detect_encoding($text)); #if text in russian
    $timeout="30";
    $id="12345";
 
$agi->Command("$type $method $sync $span $destination \"$message\" $timeout $id");
    exit(0);
?>
  1. No comments yet.

  1. No trackbacks yet.

You must be logged in to post a comment.