gpt4 book ai didi

linux - Kannel:无法发送或接收短信

转载 作者:太空宇宙 更新时间:2023-11-04 04:25:27 31 4
gpt4 key购买 nike

我正在尝试通过 kannel 发送和接收短信。我已经设置了所有内容,没有错误,但仍然无法发送或接收任何短信。我使用华为 E160 调制解调器和 Ubuntu 11 作为我的操作系统。这是日志文件:

2012-02-25 14:25:34 [9913] [0] INFO: HTTP: Opening server at port 13000.
2012-02-25 14:25:34 [9913] [0] INFO: BOXC: 'smsbox-max-pending' not set, using default (100).
2012-02-25 14:25:34 [9913] [0] INFO: Set SMS resend frequency to 60 seconds.
2012-02-25 14:25:34 [9913] [0] INFO: SMS resend retry set to unlimited.
2012-02-25 14:25:34 [9913] [0] INFO: DLR rerouting for smsc id <(null)> disabled.
2012-02-25 14:25:34 [9913] [0] INFO: AT2[/dev/ttyUSB0]: configuration shows modemtype <huawei>
2012-02-25 14:25:34 [9913] [0] INFO: AT2[/dev/ttyUSB0]: read modem definition for <huawei-e160>
2012-02-25 14:25:34 [9913] [6] INFO: AT2[/dev/ttyUSB0]: opening device
2012-02-25 14:25:34 [9913] [0] INFO: Adding interface *
2012-02-25 14:25:34 [9913] [0] INFO: ----------------------------------------
2012-02-25 14:25:34 [9913] [0] INFO: Kannel bearerbox II version 1.4.3 starting
2012-02-25 14:25:34 [9913] [0] INFO: MAIN: Start-up done, entering mainloop
2012-02-25 14:25:34 [9913] [6] INFO: AT2[/dev/ttyUSB0]: Logging in
2012-02-25 14:25:34 [9913] [6] INFO: AT2[/dev/ttyUSB0]: init device
2012-02-25 14:25:34 [9913] [6] INFO: AT2[/dev/ttyUSB0]: speed set to 115200
2012-02-25 14:25:35 [9913] [6] INFO: AT2[/dev/ttyUSB0]: AT SMSC successfully opened.
2012-02-25 14:26:28 [9913] [13] INFO: Client connected from <127.0.0.1>

我的 kannel.conf 文件

group = core
admin-port = 13000
admin-password = 123
status-password = 123
smsbox-port = 13003
wapbox-port = 13004
log-file = "/home/eclipse/kannel_core.log"
log-level = 1
wdp-interface-name = "*"

#group = smsc
#smsc = fake
#port = 1000

group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
log-file = "/home/eclipse/kannel_smsbox.log"
log-level = 1

group = smsc
smsc = at
modemtype = huawei
device = /dev/ttyUSB0
speed=115200
log-level = 0
pin = 1442

group = modems
id = huawei
name = "huawei-e160"
detect-string = "huawei"
init-string = "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
speed = 115200

group = wapbox
bearerbox-host = 127.0.0.1
log-file = "/home/eclipse/kannel_wapbox.log"

group = sendsms-user
username = 123
password = 123
user-allow-ip = "127.0.0.1"

group = sms-service
keyword = default
get-url = "http://localhost/kannel/receivesms.php?sender=%p&amp;text=%b"
accept-x-kannel-headers = true
max-messages = 3
concatenation = true
catch-all = true

我的 receivems.php 文件编码为

<?php

define("DBHOST","localhost",true);

define("DBUSERNAME","root",true);

define("DBPASSWORD","xxxxxx",true);

define("DBNAME","kannel_sms",true);


function insertSms($sender,$text)

{

$con = 'mysql:dbname='.DBNAME.';host='.DBHOST;

try {

$cmd = new PDO($con,DBUSERNAME,DBPASSWORD);
$stmt = $cmd->prepare("INSERT INTO kannel_tuto (number,message) VALUES (:sender,:message)");

$stmt->bindParam(':sender',$sender);
$stmt->bindParam(':message',$text);

$stmt->execute();

$cmd = null;

if($stmt->rowCount()>0)

{

echo "Hello ".$text.". Thank you for your registration.";

}

else

{

echo "Sorry an error has occured";

}

}

catch (PDOException $e) {

echo 'Connection failed: ' . $e->getMessage();
}

}

insertSms($_GET['sender'],$_GET['text']);

?>

最佳答案

正如我上面指出的,我的脚本和配置是正确的。我刚刚发现E160调制解调器不适合短信和kannel。信号丢失,不知道为什么。我使用了 E173 和 E220 华为调制解调器,它们运行良好。

关于linux - Kannel:无法发送或接收短信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9443632/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com