Я пытаюсь отправлять и получать SMS через канал. Я установил все, без ошибок, но все равно он не может отправлять или получать смс.
Я использую модем Huawei 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&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']);
?>