返回列表 發帖

中文 SMS

请问可以用asterisk 或 GSM box 传送中文SMS吗?

如果可以,请指导。

其實只是一個普通的 GPRS Serial port Modem 而已。在 taobao 或 ebay 輕易找到。不同牌子的 modem 互通性很高。

TOP

candenn:
Cool, 謝謝分享,請問 GSM modem 在購買上有要注意什麼?
OSSLab Blog :: VoIP & IT Consultant

TOP

  1. <html>
  2. <body>

  3. <form action="sendsms.php" method="get">
  4. <input name="phone" type="text" />
  5. <input name="msg" type="text" />
  6. <input name="submit" type="submit" />

  7. </form>

  8. </body>
  9. </html>

  10. <?

  11. if($_GET["msg"] != ""){
  12.         sendSmsMessage($_GET["phone"], $_GET["msg"]);
  13. }

  14. function sendSmsMessage($in_phoneNumber, $in_msg)
  15. {

  16. $smsuid = "tester";
  17. $smspwd = "foobar";
  18. $smshost = "localhost";
  19. $smsport = "13013";
  20. $url = '/cgi-bin/sendsms?username=' . $smsuid
  21.       . '&password=' . $smspwd
  22.       . '&charset=UCS-2&coding=2'
  23.       . "&to={$in_phoneNumber}"
  24.       . '&text=' . $in_msg;

  25.    $results = file("http://" . $smshost . ":" . $smsport . $url);

  26. }

  27. ?>
複製代碼
簡單解釋一下。Kannel 是用HTTP 介面來收發 SMS。這個 PHP 是把對方的電話號碼和 SMS message 套在 HTTP 的 URL 中,然後用 HTTP 呼叫 Kannel 的 /cgi-bin/sendsms。

有一個技術要點要留意:中文SMS的通訊編碼是用 UCS-2,而不是我們常用的 UTF-8。

TOP

請分享你的php script

TOP

可以。我是用 Kannel 加一只行 serial port 的GSM Modem 來 send SMS的。

Kannel : http://www.kannel.org

在 asterisk 中的 dialplan 用 AGI 加 PHP 便可以send sms 了。

TOP

返回列表