通过api kannel和smpp 3.4发送短信

时间:2013-02-25 11:11:53

标签: ubuntu smpp kannel

我想通过API kannel和smpp 3.4发送短信

我用:

安装kannel
apt-get install   KANNEL 

现在我在文件kannel.conf

中有这个值
#
# Sample configuration file for Kannel bearerbox on Debian.
# See the documentation for explanations of fields.
#

# HTTP administration is disabled by default. Make sure you set the
# password if you enable it.

group = core
admin-port = 13000
admin-password = bar
admin-deny-ip = "*.*.*.*"
admin-allow-ip = ""
wapbox-port = 13002
wdp-interface-name = "*"
log-file = "/var/log/kannel/bearerbox.log"
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"

group = wapbox
bearerbox-host = localhost
log-file = "/var/log/kannel/wapbox.log"

我尝试使用

修改文件/etc/kannel/kannel.conf
# Syed Jahanzaib
    # http://aacable.wordpress.com
    # aacable [at] hotmail.com

    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 = at
    modemtype = teltonika
    device = /dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)
    speed = 19200
    my-number = 92568253 # (put your sim number, not necessary)

    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

但是当我在浏览器中测试时:

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 9m 7s

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

No boxes connected

SMSC connections:
    unknown    AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly, it will not work and you will get error in logs that unable to connect to device)] (connecting, rcvd 0, sent 0, failed 0, queued 0 msgs)

我想知道kannel.conf的每个参数

具体来说:

group = smsc
        smsc = at
        modemtype = teltonika
        device = /dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)

但是当我在浏览器中测试时:

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

我有:

  3: Queued for later delivery

日志我在文件中有这个值: bearerbox.log

 2013-02-22 07:39:41 [14035] [0] INFO: Added logfile `/var/log/kannel/bearerbox.log' with level `0'.
2013-02-22 07:39:41 [14035] [0] INFO: HTTP: Opening server at port 13000.
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 1 (gwlib/fdset.c:poller)
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 2 (gwlib/http.c:server_thread)
2013-02-22 07:39:41 [14035] [1] DEBUG: Thread 1 (gwlib/fdset.c:poller) maps to pid 14035.
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 3 (gw/bb_http.c:httpadmin_run)
2013-02-22 07:39:41 [14035] [0] DEBUG: starting UDP sender/receiver module
2013-02-22 07:39:41 [14035] [0] INFO: Adding interface *
2013-02-22 07:39:41 [14035] [2] DEBUG: Thread 2 (gwlib/http.c:server_thread) maps to pid 14035.
2013-02-22 07:39:41 [14035] [0] DEBUG: udpc_create: Bound to UDP <0.0.0.0:9200>
2013-02-22 07:39:41 [14035] [3] DEBUG: Thread 3 (gw/bb_http.c:httpadmin_run) maps to pid 14035.
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 4 (gw/bb_udp.c:udp_receiver)
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 5 (gw/bb_udp.c:udp_sender)
2013-02-22 07:39:41 [14035] [4] DEBUG: Thread 4 (gw/bb_udp.c:udp_receiver) maps to pid 14035.
2013-02-22 07:39:41 [14035] [0] DEBUG: udpc_create: Bound to UDP <0.0.0.0:9201>
2013-02-22 07:39:41 [14035] [5] DEBUG: Thread 5 (gw/bb_udp.c:udp_sender) maps to pid 14035.
2013-02-22 07:39:41 [14035] [6] DEBUG: Thread 6 (gw/bb_udp.c:udp_receiver) maps to pid 14035.
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 6 (gw/bb_udp.c:udp_receiver)
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 7 (gw/bb_udp.c:udp_sender)
2013-02-22 07:39:41 [14035] [7] DEBUG: Thread 7 (gw/bb_udp.c:udp_sender) maps to pid 14035.
2013-02-22 07:39:41 [14035] [0] DEBUG: starting wapbox connection module
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 8 (gw/bb_boxc.c:wdp_to_wapboxes)
2013-02-22 07:39:41 [14035] [8] DEBUG: Thread 8 (gw/bb_boxc.c:wdp_to_wapboxes) maps to pid 14035.
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 9 (gw/bb_boxc.c:wapboxc_run)
2013-02-22 07:39:41 [14035] [0] DEBUG: starting WDP router
2013-02-22 07:39:41 [14035] [9] DEBUG: Thread 9 (gw/bb_boxc.c:wapboxc_run) maps to pid 14035.
2013-02-22 07:39:41 [14035] [0] DEBUG: Started thread 10 (gw/bearerbox.c:wdp_router)
2013-02-22 07:39:41 [14035] [0] INFO: ----------------------------------------
2013-02-22 07:39:41 [14035] [0] INFO: Kannel bearerbox II version 1.4.3 starting
2013-02-22 07:39:41 [14035] [0] INFO: MAIN: Start-up done, entering mainloop
2013-02-22 07:39:41 [14035] [10] DEBUG: Thread 10 (gw/bearerbox.c:wdp_router) maps to pid 14035.
2013-02-22 07:39:42 [14035] [9] INFO: Client connected from <127.0.0.1> 
2013-02-22 07:39:42 [14035] [9] DEBUG: Started thread 11 (gw/bb_boxc.c:function)
2013-02-22 07:39:42 [14035] [11] DEBUG: Thread 11 (gw/bb_boxc.c:function) maps to pid 14035.
2013-02-22 07:39:42 [14035] [11] DEBUG: setting up systems for new wapbox
2013-02-22 07:39:42 [14035] [11] DEBUG: Started thread 12 (gw/bb_boxc.c:boxc_sender)
2013-02-22 07:39:42 [14035] [12] DEBUG: Thread 12 (gw/bb_boxc.c:boxc_sender) maps to pid 14035.
2013-02-25 01:16:38 [14035] [11] INFO: Connection closed by the box <127.0.0.1>
2013-02-25 01:16:38 [14035] [12] DEBUG: send_msg: sending msg to box: <127.0.0.1>
2013-02-25 01:16:38 [14035] [12] DEBUG: Thread 12 (gw/bb_boxc.c:boxc_sender) terminates.
2013-02-25 01:16:38 [14035] [11] DEBUG: Thread 11 (gw/bb_boxc.c:function) terminates.
2013-02-25 01:16:38 [14035] [0] WARNING: Killing signal or HTTP admin command received, shutting down...
2013-02-25 01:16:38 [14035] [0] DEBUG: Shutting down Kannel...
2013-02-25 01:16:38 [14035] [0] DEBUG: shutting down smsc
2013-02-25 01:16:38 [14035] [0] DEBUG: shutting down udp
2013-02-25 01:16:38 [14035] [0] DEBUG: udp_shutdown: Starting avalanche
2013-02-25 01:16:38 [14035] [6] DEBUG: Thread 6 (gw/bb_udp.c:udp_receiver) terminates.
2013-02-25 01:16:38 [14035] [4] DEBUG: Thread 4 (gw/bb_udp.c:udp_receiver) terminates.
2013-02-25 01:16:38 [14035] [8] DEBUG: wdp_to_wapboxes: destroying lists
2013-02-25 01:16:38 [14035] [8] DEBUG: Thread 8 (gw/bb_boxc.c:wdp_to_wapboxes) terminates.
2013-02-25 01:16:39 [14035] [9] DEBUG: Thread 9 (gw/bb_boxc.c:wapboxc_run) terminates.
2013-02-25 01:16:39 [14035] [10] DEBUG: udp_die: removing producers from udp-lists
2013-02-25 01:16:39 [14035] [0] INFO: All flow threads have died, killing core
2013-02-25 01:16:39 [14035] [10] DEBUG: Thread 10 (gw/bearerbox.c:wdp_router) terminates.
2013-02-25 01:16:39 [14035] [7] DEBUG: Thread 7 (gw/bb_udp.c:udp_sender) terminates.
2013-02-25 01:16:39 [14035] [5] DEBUG: Thread 5 (gw/bb_udp.c:udp_sender) terminates.
2013-02-25 01:16:39 [14035] [0] DEBUG: Waiting for 2 (gwlib/http.c:server_thread) to terminate
2013-02-25 01:16:39 [14035] [3] DEBUG: HTTP: No clients with requests, quitting.
2013-02-25 01:16:39 [14035] [3] DEBUG: Thread 3 (gw/bb_http.c:httpadmin_run) terminates.
2013-02-25 01:16:39 [14035] [2] DEBUG: Thread 2 (gwlib/http.c:server_thread) terminates.
2013-02-25 01:16:39 [14035] [1] DEBUG: Thread 1 (gwlib/fdset.c:poller) terminates.
2013-02-25 01:16:39 [14035] [0] INFO: Total WDP messages: received 0, sent 0
2013-02-25 01:16:39 [14035] [0] INFO: Total SMS messages: received 0, sent 0
2013-02-25 01:16:39 [14035] [0] DEBUG: Immutable octet strings: 77.
2013-02-25 02:16:14 [15173] [0] INFO: Added logfile `/var/log/kannel/bearerbox.log' with level `0'.
2013-02-25 02:16:14 [15173] [0] INFO: HTTP: Opening server at port 13000.
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 1 (gwlib/fdset.c:poller)
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 2 (gwlib/http.c:server_thread)
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 3 (gw/bb_http.c:httpadmin_run)
2013-02-25 02:16:14 [15173] [2] DEBUG: Thread 2 (gwlib/http.c:server_thread) maps to pid 15173.
2013-02-25 02:16:14 [15173] [3] DEBUG: Thread 3 (gw/bb_http.c:httpadmin_run) maps to pid 15173.
2013-02-25 02:16:14 [15173] [1] DEBUG: Thread 1 (gwlib/fdset.c:poller) maps to pid 15173.
2013-02-25 02:16:14 [15173] [0] DEBUG: starting UDP sender/receiver module
2013-02-25 02:16:14 [15173] [0] INFO: Adding interface *
2013-02-25 02:16:14 [15173] [0] DEBUG: udpc_create: Bound to UDP <0.0.0.0:9200>
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 4 (gw/bb_udp.c:udp_receiver)
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 5 (gw/bb_udp.c:udp_sender)
2013-02-25 02:16:14 [15173] [4] DEBUG: Thread 4 (gw/bb_udp.c:udp_receiver) maps to pid 15173.
2013-02-25 02:16:14 [15173] [0] DEBUG: udpc_create: Bound to UDP <0.0.0.0:9201>
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 6 (gw/bb_udp.c:udp_receiver)
2013-02-25 02:16:14 [15173] [5] DEBUG: Thread 5 (gw/bb_udp.c:udp_sender) maps to pid 15173.
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 7 (gw/bb_udp.c:udp_sender)
2013-02-25 02:16:14 [15173] [6] DEBUG: Thread 6 (gw/bb_udp.c:udp_receiver) maps to pid 15173.
2013-02-25 02:16:14 [15173] [0] DEBUG: starting wapbox connection module
2013-02-25 02:16:14 [15173] [7] DEBUG: Thread 7 (gw/bb_udp.c:udp_sender) maps to pid 15173.
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 8 (gw/bb_boxc.c:wdp_to_wapboxes)
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 9 (gw/bb_boxc.c:wapboxc_run)
2013-02-25 02:16:14 [15173] [0] DEBUG: starting WDP router
2013-02-25 02:16:14 [15173] [0] DEBUG: Started thread 10 (gw/bearerbox.c:wdp_router)
2013-02-25 02:16:14 [15173] [0] INFO: ----------------------------------------
2013-02-25 02:16:14 [15173] [0] INFO: Kannel bearerbox II version 1.4.3 starting
2013-02-25 02:16:14 [15173] [9] DEBUG: Thread 9 (gw/bb_boxc.c:wapboxc_run) maps to pid 15173.
2013-02-25 02:16:14 [15173] [10] DEBUG: Thread 10 (gw/bearerbox.c:wdp_router) maps to pid 15173.
2013-02-25 02:16:14 [15173] [8] DEBUG: Thread 8 (gw/bb_boxc.c:wdp_to_wapboxes) maps to pid 15173.
2013-02-25 02:16:14 [15173] [0] INFO: MAIN: Start-up done, entering mainloop
2013-02-25 02:18:07 [15173] [0] WARNING: Killing signal or HTTP admin command received, shutting down...
2013-02-25 02:18:07 [15173] [0] DEBUG: Shutting down Kannel...
2013-02-25 02:18:07 [15173] [0] DEBUG: shutting down smsc
2013-02-25 02:18:07 [15173] [0] DEBUG: shutting down udp
2013-02-25 02:18:07 [15173] [0] DEBUG: udp_shutdown: Starting avalanche
2013-02-25 02:18:07 [15173] [6] DEBUG: Thread 6 (gw/bb_udp.c:udp_receiver) terminates.
2013-02-25 02:18:07 [15173] [4] DEBUG: Thread 4 (gw/bb_udp.c:udp_receiver) terminates.
2013-02-25 02:18:07 [15173] [8] DEBUG: wdp_to_wapboxes: destroying lists
2013-02-25 02:18:07 [15173] [8] DEBUG: Thread 8 (gw/bb_boxc.c:wdp_to_wapboxes) terminates.
2013-02-25 02:18:07 [15173] [9] DEBUG: Thread 9 (gw/bb_boxc.c:wapboxc_run) terminates.
2013-02-25 02:18:07 [15173] [10] DEBUG: udp_die: removing producers from udp-lists
2013-02-25 02:18:07 [15173] [10] DEBUG: Thread 10 (gw/bearerbox.c:wdp_router) terminates.
2013-02-25 02:18:07 [15173] [5] DEBUG: Thread 5 (gw/bb_udp.c:udp_sender) terminates.
2013-02-25 02:18:07 [15173] [7] DEBUG: Thread 7 (gw/bb_udp.c:udp_sender) terminates.
2013-02-25 02:18:07 [15173] [0] INFO: All flow threads have died, killing core
2013-02-25 02:18:07 [15173] [0] DEBUG: Waiting for 2 (gwlib/http.c:server_thread) to terminate
2013-02-25 02:18:07 [15173] [3] DEBUG: HTTP: No clients with requests, quitting.
2013-02-25 02:18:07 [15173] [3] DEBUG: Thread 3 (gw/bb_http.c:httpadmin_run) terminates.
2013-02-25 02:18:07 [15173] [0] PANIC: Cannot die by its own will
2013-02-25 02:18:07 [15173] [2] DEBUG: Thread 2 (gwlib/http.c:server_thread) terminates.
2013-02-25 02:18:07 [15173] [0] PANIC: bearerbox(gw_panic+0xcd) [0x80d21ed]
2013-02-25 02:18:07 [15173] [0] PANIC: bearerbox() [0x80548f0]
2013-02-25 02:18:07 [15173] [0] PANIC: [0x277400]
2013-02-25 02:18:07 [15173] [0] PANIC: bearerbox(http_close_all_ports+0x2e) [0x80cb81e]
2013-02-25 02:18:07 [15173] [0] PANIC: bearerbox(httpadmin_stop+0xb) [0x805a05b]
2013-02-25 02:18:07 [15173] [0] PANIC: bearerbox(main+0x9fc) [0x805568c]
2013-02-25 02:18:07 [15173] [0] PANIC: /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0xdc8bd6]
2013-02-25 02:18:07 [15173] [0] PANIC: bearerbox() [0x8053f51]
2013-02-25 02:24:59 [15280] [0] INFO: Added logfile `/var/log/kannel/bearerbox.log' with level `0'.
2013-02-25 02:24:59 [15280] [0] INFO: HTTP: Opening server at port 13000.
2013-02-25 02:24:59 [15280] [0] DEBUG: Started thread 1 (gwlib/fdset.c:poller)
2013-02-25 02:24:59 [15280] [1] DEBUG: Thread 1 (gwlib/fdset.c:poller) maps to pid 15280.
2013-02-25 02:24:59 [15280] [0] DEBUG: Started thread 2 (gwlib/http.c:server_thread)
2013-02-25 02:24:59 [15280] [0] DEBUG: Started thread 3 (gw/bb_http.c:httpadmin_run)
2013-02-25 02:24:59 [15280] [2] DEBUG: Thread 2 (gwlib/http.c:server_thread) maps to pid 15280.
2013-02-25 02:24:59 [15280] [0] DEBUG: starting smsbox connection module
2013-02-25 02:24:59 [15280] [3] DEBUG: Thread 3 (gw/bb_http.c:httpadmin_run) maps to pid 15280.
2013-02-25 02:24:59 [15280] [0] INFO: BOXC: 'smsbox-max-pending' not set, using default (100).
2013-02-25 02:24:59 [15280] [0] DEBUG: Started thread 4 (gw/bb_boxc.c:sms_to_smsboxes)
2013-02-25 02:24:59 [15280] [4] DEBUG: Thread 4 (gw/bb_boxc.c:sms_to_smsboxes) maps to pid 15280.
2013-02-25 02:24:59 [15280] [0] DEBUG: Started thread 5 (gw/bb_boxc.c:smsboxc_run)
2013-02-25 02:24:59 [15280] [5] DEBUG: Thread 5 (gw/bb_boxc.c:smsboxc_run) maps to pid 15280.
2013-02-25 02:24:59 [15280] [0] INFO: Set SMS resend frequency to 60 seconds.
2013-02-25 02:24:59 [15280] [0] INFO: SMS resend retry set to unlimited.
2013-02-25 02:24:59 [15280] [0] DEBUG: smsbox MO concatenated message handling enabled
2013-02-25 02:24:59 [15280] [0] INFO: DLR rerouting for smsc id <(null)> disabled.
2013-02-25 02:24:59 [15280] [0] INFO: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: configuration shows modemtype <teltonika>
2013-02-25 02:24:59 [15280] [0] DEBUG: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: Reading modem definitions from </etc/kannel/kannel.conf>
2013-02-25 02:24:59 [15280] [0] DEBUG: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: Found <1> modems in config
2013-02-25 02:24:59 [15280] [0] INFO: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: read modem definition for <Teltonika E12>
2013-02-25 02:24:59 [15280] [0] DEBUG: Started thread 6 (gw/smsc/smsc_at.c:at2_device_thread)
2013-02-25 02:24:59 [15280] [0] DEBUG: Started thread 7 (gw/bb_smscconn.c:sms_router)
2013-02-25 02:24:59 [15280] [0] INFO: ----------------------------------------
2013-02-25 02:24:59 [15280] [0] INFO: Kannel bearerbox II version 1.4.3 starting
2013-02-25 02:24:59 [15280] [0] INFO: MAIN: Start-up done, entering mainloop
2013-02-25 02:24:59 [15280] [0] DEBUG: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: start called
2013-02-25 02:24:59 [15280] [7] DEBUG: Thread 7 (gw/bb_smscconn.c:sms_router) maps to pid 15280.
2013-02-25 02:24:59 [15280] [6] DEBUG: Thread 6 (gw/smsc/smsc_at.c:at2_device_thread) maps to pid 15280.
2013-02-25 02:24:59 [15280] [6] INFO: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: opening device
2013-02-25 02:24:59 [15280] [6] ERROR: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: open failed! ERRNO=2
2013-02-25 02:24:59 [15280] [6] ERROR: System error 2: No such file or directory
2013-02-25 02:24:59 [15280] [6] ERROR: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: at2_device_thread: open_at2_device failed.
2013-02-25 02:24:59 [15280] [6] ERROR: System error 2: No such file or directory
2013-02-25 02:24:59 [15280] [6] ERROR: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: Couldn't connect (retrying in 10 seconds).
2013-02-25 02:24:59 [15280] [6] INFO: AT2[/dev/ttyACM0 # change this to match your port, it could ACM1 , if you dont set it correctly,  it will not work and you will get error in logs that unable to connect to device)]: opening device
................................
..................................

0 个答案:

没有答案