2012-02-25 169 views
0

我想通過信道發送和接收短信。我已經設定了一切,沒有錯誤,但仍然無法發送或接收任何短信。 我使用華爲E160調制解調器和Ubuntu 11作爲我的操作系統。 這裏是日誌文件:Kannel:無法發送或接收短信

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 

我receivesms.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']); 

?> 

回答

0

,我的腳本和配置是正確的。我剛纔發現E160調制解調器不適合短信和卡片。有信號丟失,但我不知道爲什麼。我用E173和E220華爲調制解調器,他們工作得很好。