使用smpp和kannel向操作员发送短信

时间:2013-02-25 16:42:11

标签: ubuntu smpp kannel

我使用ubuntu 10.10

目前我使用此代码

发送带有 clickatell 的短信
 Message = space_to_plus("message de test."),
    Url = io_lib:format("http://api.clickatell.com/http/sendmsg?user=...&password=...&api_id=...&to=216~s&text=~s", [Name, Message]),
    http:request(lists:flatten(Url), sms).

目前我们与运营商Orange

达成协议

我们将通过此运算符

发送短信

短信将使用smpp 3.4和API kannel

发送

我使用以下命令安装kannel:

apt-get install libxml2

apt-get install kannel 

并且为了配置kannel.conf我创建了这个值:

    group = core
    admin-port = 13000
    smsbox-port = 13001
    admin-password = zaibadmin
    status-password = zaibstatus
    log-file = "/var/log/kannel/bearerbox.log"
    log-level = 0
    box-deny-ip = "*.*.*.*"
    box-allow-ip = "127.0.0.1"


group = smsc
smsc = smpp
smsc-id = testsmsc
host = localhost
port = 2775
receive-port = 2775 
smsc-username = 'smppclient'
smsc-password = password
system-type = 'VMA'
service-type = 'test'
interface-version = 34
address-range = ''
msg-id-type = 0





    group = modems
    id = teltonika
    name = "Teltonika E12"
    detect-string = "Undefined"
    enable-mms = true
    init-string = "AT+CNMI=2,2,0,1,1"
    speed = 115200

    group = smsbox
    bearerbox-host = localhost
    sendsms-port = 13013
    global-sender = 13013
    sendsms-chars = "0123456789 +-"
    log-file = "/var/log/kannel/smsbox.log"
    log-level = 0
    access-log = "/var/log/kannel/access.log"

    group = sendsms-user
    username = kannel
    password = kannel
    concatenation = true
    max-messages = 3

    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

我认为我们应该从运算符橙色中获得相同的参数,如:

smsc-username
    smsc-password
    host
    port

当我在浏览器中尝试:

http://10.20.20.26:13000/status?password=zaibstatus

我有:

Kannel bearerbox version `1.4.3'. Build `Apr 6 2010 13:16:08', compiler `4.4.3'. System Linux, release 2.6.32-41-generic, version #90-Ubuntu SMP Tue May 22 11:31:25 UTC 2012, machine i686. Hostname ubuntu, IP 127.0.1.1. Libxml version 2.7.6. Using OpenSSL 0.9.8k 25 Mar 2009. Compiled with MySQL 5.1.41, using MySQL 5.1.63. Using native malloc.

Status: running, uptime 0d 0h 0m 38s

WDP: received 0 (0 queued), sent 0 (0 queued)

SMS: received 0 (0 queued), sent 0 (0 queued), store size -1

SMS: inbound (0.00,0.00,0.00) msg/sec, outbound (0.00,0.00,0.00) msg/sec

DLR: 0 queued, using internal storage

Box connections:
    smsbox:(none), IP 127.0.0.1 (0 queued), (on-line 0d 0h 0m 33s)

SMSC connections:
    testsmsc    SMPP:localhost:2775/2775:'smppclient':'VMA' (re-connecting, rcvd 0, sent 0, failed 0, queued 0 msgs)

当我尝试时:

http://10.20.20.26:13013/cgi-bin/sendsms?username=kannel&password=kannel&to=97919860&text=ZAIB+KANNEL+WORk

我有:

3: Queued for later delivery

可以帮我修正kannel.conf的配置

因为我认为我在此配置中出错了

3 个答案:

答案 0 :(得分:0)

我在网上找到了与kannel.conf文件相关的另一个配置

group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
log-file = "/tmp/kannel.log"
log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"

group=smsc
smsc=smpp
smsc-id=internal
interface-version=34
host=internal.smpp.ddj.co.za
port=9102
system-id=donsmpp
smsc-password=strngpas
system-type=default
transceiver-mode=1

group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
log-level = 0

当然我必须更改以下设置

IP address
 System-id (username)
 Password
 port

我想知道正确的配置

因为我从旧配置中移除了这部分:

group = modems
    id = teltonika
    name = "Teltonika E12"
    detect-string = "Undefined"
    enable-mms = true
    init-string = "AT+CNMI=2,2,0,1,1"
    speed = 115200

 group = sendsms-user
    username = kannel
    password = kannel
    concatenation = true
    max-messages = 3

    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

答案 1 :(得分:0)

在您的状态显示中 SMSC连接:testsmsc处于重新连接状态,这就是为什么它显示状态排队等待以后交付。您需要进行smsc连接在线

答案 2 :(得分:0)

激活 Kannel SMSBox

sudo mkdir -p /var/log/kannel /var/run/kannel /var/spool/kannel/store
sudo chown -R kannel /var/log/kannel /var/run/kannel /var/spool/kannel/store
sudo usermod -a -G dialout kannel

sudo sed -i 's/#START_SMSBOX/START_SMSBOX/' /etc/default/kannel

完成!