Dear all,
I'm a newbie for this user mailing group, so my
SMSC/SMPP question may
be repeating. Pls bear with me, thanks in advance :-)
We're putting tegether a SMS application and would
like to use Kannel to
talk to SMSC, and our first attempt connecting to the
SMSC didn't come
through well, and would like to ask for experts of
such problem domain to
advise on the issue. Here are the components related
to our problem:
Kannel: Version 1.1.6
SMSC: Logica
SMPP: Version 3.3
Server (running Kannel & Application): Red Hat 7.2
And there are three sets of information attached at
the end:
1. Capture of Kannel bearer's screen output
2. Kannel.conf used
3. Modified "smsc_smpp.c" code for extra debug
tracking
Here are what we've done and what we've encountered:
1. Installed and tested Kannel 1.1.6 on the Red Hat
7.2.
2. Tested the fake SMSC and test/drive_smpp, both O.K.
3. Modified "kannel.conf" to reflect the operator
SMSC's
network address and etc. (*** Note that instead
of using
system-type = "VMA" in the "kannel.conf" file, the
operator
asked us to use system-type = "TESTMAIL", does
this
matter?)
4. Attached the Linux application server to the
operator's
SMSC over the TCP network. It seemed like there
no
complaint from the SMSC about the login from
Kannel
side, according to Kannel bearer's log text.
5. Sent a SMS message from a handset to this attached
application server with message "sms800 E"
6. The Kannel bearer's log text indicated that it:
SMPP handle_pdu Got DELIVER REPORT
7. But then it followed up with ERROR:
Got DELIV REPORT but couldnt find message
or was not interested in it
8. Modified "smsc_smpp.c" to plug in a few tracking
debug
calls and dump the "respstr" response string in
doubt.
9. Reading the dump of the "respstr", seemed like it
kept
only the "sms800" portion of the SMS message sent.
10. According to the "smsc_smpp.c" code, it seemed to
be looking for the "id:" string which is NOT in
the dump
of "respstr" nor in original SMS message sent.
Here're the my guesses as a newbie:
1. Some filtering setup caused the drop of message
text other than the leading string "sms800", or
2. Some mess-up in the pdu->type or the
pdu->u.delivery_sm.esm_class
3. The "smsc_smpp.c" is for SMPP 3.4 and is NOT
backward compatible
with Logica SMSC of SMPP 3.3.
Can any expert (or experienced sufferer) on this issue
domain please
kindly advise? Do I need to go for Kannel 1.2.0? Or
is there any patch
for this issue? Or other fix approach? Anybody
running into this same
issue?
Sincere thanks in advance for any help.
Cheers, YJ Hong
EnfoSmith, Bangkok, Thailand
---------------------------------------------------------------------------------------------------------------------------
Followings are the capture of the bearer's screen
output:
---------------------------------------------------------------------------------------------------------------------------
up_bearer
2002-07-22 06:00:47 [0] INFO: Debug_lvl = 0, log_file
= <none>, log_lvl = 0
2002-07-22 06:00:47 [0] WARNING: DLR: using default
'internal' for storage type.
2002-07-22 06:00:47 [0] DEBUG: Kannel bearerbox
version `1.1.6'.
System Linux, release 2.4.7-10enterprise, version #1
SMP Thu Sep 6 16:48:20 EDT 2001, machine i686.
Hostname enfosmith2, IP 172.22.100.17.
Libxml version 20417.
Using OpenSSL 0.9.6b [engine] 9 Jul 2001.
Using checking malloc.
2002-07-22 06:00:47 [0] INFO:
----------------------------------------
2002-07-22 06:00:47 [0] INFO: Kannel bearerbox II
version 1.1.6 starting
2002-07-22 06:00:47 [0] DEBUG: HTTP: Opening server at
port 13000.
2002-07-22 06:00:47 [0] DEBUG: Started thread 1
(gwlib/fdset.c:poller)
2002-07-22 06:00:47 [0] DEBUG: Started thread 2
(gwlib/http.c:server_thread)
2002-07-22 06:00:47 [0] DEBUG: Started thread 3
(gw/bb_http.c:httpadmin_run)
2002-07-22 06:00:47 [0] DEBUG: starting smsbox
connection module
2002-07-22 06:00:47 [0] DEBUG: Started thread 4
(gw/bb_boxc.c:smsboxc_run)
2002-07-22 06:00:47 [0] DEBUG: Started thread 5
(gw/smsc_smpp.c:io_thread)
2002-07-22 06:00:47 [0] DEBUG: Started thread 6
(gw/smsc_smpp.c:io_thread)
2002-07-22 06:00:47 [0] DEBUG: Started thread 7
(gw/bb_smscconn.c:sms_router)
2002-07-22 06:00:47 [0] INFO: MAIN: Start-up done,
entering mainloop
2002-07-22 06:00:47 [7] DEBUG: sms_router: time to
sleep
2002-07-22 06:00:47 [0] DEBUG: Started thread 3
(gw/bb_http.c:httpadmin_run)
2002-07-22 06:00:47 [0] DEBUG: starting smsbox
connection module
2002-07-22 06:00:47 [0] DEBUG: Started thread 4
(gw/bb_boxc.c:smsboxc_run)
2002-07-22 06:00:47 [0] DEBUG: Started thread 5
(gw/smsc_smpp.c:io_thread)
2002-07-22 06:00:47 [0] DEBUG: Started thread 6
(gw/smsc_smpp.c:io_thread)
2002-07-22 06:00:47 [0] DEBUG: Started thread 7
(gw/bb_smscconn.c:sms_router)
2002-07-22 06:00:47 [0] INFO: MAIN: Start-up done,
entering mainloop
2002-07-22 06:00:47 [7] DEBUG: sms_router: time to
sleep
2002-07-22 06:00:47 [7] DEBUG: sms_router: list_len =
0
2002-07-22 06:00:52 [4] DEBUG: Started thread 8
(gw/bb_boxc.c:function)
2002-07-22 06:00:52 [8] INFO: Client connected from
<127.0.0.1>
2002-07-22 06:00:52 [8] DEBUG: Started thread 9
(gw/bb_boxc.c:boxc_sender)
.................................................................
.................................................................
.................................................................
2002-07-22 06:36:56 [6] DEBUG:
**********>>>>>>>>>>>>>> SMPP handle_pdu Got DELIVER
REPORT
2002-07-22 06:36:56 [6] DEBUG: Octet string at
0x8224580:
2002-07-22 06:36:56 [6] DEBUG: len: 6
2002-07-22 06:36:56 [6] DEBUG: size: 7
2002-07-22 06:36:56 [6] DEBUG: immutable: 0
2002-07-22 06:36:56 [6] DEBUG: data: 73 6d 73 38 30
30 sms800
2002-07-22 06:36:56 [6] DEBUG: Octet string dump ends.
2002-07-22 06:36:56 [6] DEBUG: 2
2002-07-22 06:36:56 [6] DEBUG: 4
2002-07-22 06:36:56 [6] DEBUG: 6
2002-07-22 06:36:56 [6] DEBUG: 8
2002-07-22 06:36:56 [6] DEBUG: 10
2002-07-22 06:36:56 [6] ERROR: Got DELIV REPORT but
couldnt find message or was not interested in it
---------------------------------------------------------------------------------------------------------------------------
Following is the content of file "kannel.conf" which
was used:
---------------------------------------------------------------------------------------------------------------------------
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
#status-password = foo
#admin-deny-ip = ""
#admin-allow-ip = ""
#log-file = "/tmp/kannel.log"
#log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
unified-prefix = "00358,0"
#access-log = "access.log"
#store-file = "kannel.store"
#ssl-certkey-file = "mycertandprivkeyfile.pem"
# SMSC CONNECTIONS
#group = smsc
#smsc = fake
#smsc-id = FAKE
#port = 10000
#host = localhost
#connect-allow-ip = 127.0.0.1
group = smsc
smsc = smpp
smsc-id = smpp
host = 172.22.100.2
port = 8004
receive-port = 8004
system-type = "TESTMAIL"
address-range = ""
smsc-username = "TEST_006"
smsc-password = "test"
# SMSBOX SETUP
group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
global-sender = 13013
#sendsms-chars = "0123456789 +-"
log-file = "/tmp/smsbox.log"
log-level = 0
access-log = "access.log"
sendsms-chars = "0123456789
+-@.,?_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
# SEND-SMS USERS
group = sendsms-user
username = tester
password = foobar
#user-deny-ip = ""
#user-allow-ip = ""
# this sender is for Kannel relay testing (http_smsc)
group = sendsms-user
username = kannel
password = rL4y
user-deny-ip = "*.*.*.*"
#user-allow-ip = "127.0.0.1"
# this sender is for SMS800 service usage only
group = sendsms-user
username = sms800
password = sms800
user-deny-ip = "*.*.*.*"
#user-allow-ip = "127.0.0.1"
# SERVICES
group = sms-service
keyword = nop
text = "You asked nothing and I did it!"
# this service is for Kannel relay testing, when this
Kannel
# works as relay gateway
group = sms-service
keyword = relay
get-url =
"http://localhost:15130/sms?user=kannel&pass=rL4y&from=%p&to=%P&text=%r"
max-messages = 0
# there should be default always
group = sms-service
keyword = default
text = "No service specified"
# this service is for SMS800 Service testing only
group = sms-service
keyword = sms800
get-url =
"http://enfosmith2/SMS800/v1.0/sms800KannelHttp.cgi?from=%p&to=%P&message=%r"
---------------------------------------------------------------------------------------------------------------------------
Following is the portion of the file "smsc_smpp.c"
which has been adorned with extra debugging
calls for the problem tracking:
---------------------------------------------------------------------------------------------------------------------------
static void handle_pdu(SMPP *smpp, Connection *conn,
SMPP_PDU *pdu,
long *pending_submits)
{
SMPP_PDU *resp;
Octstr *os;
Msg *msg, *dlrmsg=NULL;
long reason;
int idx;
int len;
resp = NULL;
switch (pdu->type) {
case deliver_sm:
/* XXX UDH */
/* bb_smscconn_receive can fail, but we ignore that
since we
have no way to usefull tell the SMS center about
this
(no suitable error code for the deliver_sm_resp is
defined) */
/* got a deliver ack? */
if ((pdu->u.deliver_sm.esm_class == 0x02 ||
pdu->u.deliver_sm.esm_class == 0x04))
{
Octstr *reply, *respstr;
Octstr *msgid = NULL;
Octstr *stat = NULL;
int dlrstat;
long curr=0, vpos=0;
debug("smsc_smpp.handle_pdu",0,"**********>>>>>>>>>>>>>>
SMPP handle_pdu Got DELIVER REPORT\n");
respstr = pdu->u.deliver_sm.short_message;
debug("1",0,(char *) respstr);
octstr_dump(respstr,0);
debug("1",0,(char *) respstr);
/* get server message id */
if ((curr = octstr_search(respstr,
octstr_imm("id:"), 0)) != -1)
{
debug("1",0,"1");
vpos = octstr_search_char(respstr, ' ',curr
);
if ((vpos-curr >0) && (vpos != -1))
msgid = octstr_copy(respstr, curr+3,
vpos-curr-3);
}
else
{
debug("2",0,"2");
msgid = NULL;
}
/* get err & status code */
if ((curr = octstr_search(respstr,
octstr_imm("stat:"), 0)) != -1)
{
debug("3",0,"3");
vpos = octstr_search_char(respstr, ' ',curr
);
if ((vpos-curr >0) && (vpos != -1))
stat = octstr_copy(respstr, curr+5,
vpos-curr-5);
}
else
{
debug("4",0,"4");
stat = NULL;
}
/* we get the following status: DELIVRD,
ACCEPTD,
EXPIRED, DELETED, UNDELIV, UNKNOWN, REJECTD */
if ((stat != NULL) &&
((octstr_compare(stat,octstr_imm("DELIVRD"))==0)
||
(octstr_compare(stat,octstr_imm("ACCEPTD"))==0)))
{
debug("5",0,"5");
dlrstat = DLR_SUCCESS;
}
else {
debug("6",0,"6");
dlrstat = DLR_FAIL;
}
if (msgid !=NULL)
{
Octstr *tmp;
debug("7",0,"7");
tmp =
octstr_format("%ld",strtol(octstr_get_cstr(msgid),NULL,10));
dlrmsg =
dlr_find(octstr_get_cstr(smpp->conn->id),
octstr_get_cstr(tmp), /* smsc message id */
octstr_get_cstr(pdu->u.deliver_sm.destination_addr),
/* destination */
dlrstat);
octstr_destroy(tmp);
}
else {
debug("8",0,"8");
}
if (dlrmsg != NULL)
{
debug("9",0,"9");
reply = octstr_duplicate(respstr);
/* having a / in the text breaks it so lets
replace it with a space */
len = octstr_len(reply);
for(idx=0;idx<len;idx++)
if(octstr_get_char(reply,idx)=='/')
octstr_set_char(reply,idx,'.');
octstr_append_char(reply, '/');
octstr_insert(dlrmsg->sms.msgdata, reply,
0);
octstr_destroy(reply);
bb_smscconn_receive(smpp->conn, dlrmsg);
}
else
{
debug("10",0,"10");
error(0,"Got DELIV REPORT but couldnt find
message or was not interested in it");
}
resp = smpp_pdu_create(deliver_sm_resp,
pdu->u.deliver_sm.sequence_number);
if (msgid != NULL)
octstr_destroy(msgid);
if (stat != NULL)
octstr_destroy(stat);
}
else /* MO-SMS */
{
/* ensure the smsc-id is set */
msg = pdu_to_msg(pdu);
time(&msg->sms.time);
msg->sms.smsc_id =
octstr_duplicate(smpp->conn->id);
(void) bb_smscconn_receive(smpp->conn, msg);
resp = smpp_pdu_create(deliver_sm_resp,
pdu->u.deliver_sm.sequence_number);
}
break;
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com