Re: [-] Re: non standard message_id breaks DLR

Angus M Wood <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization IBN
Message-ID <oprrqyjw1qa92gwv@localhost>
On Thu, 3 Jul 2003 13:24:31 +0100, David Tully <[email protected]> 
wrote:

> Hey there.
>
> I'm having a bit of a nightmare with this code mod..
>
> I've a program that strips out the bit I need, but I can't figure out how 
> to work with the struct octstr..
> Could someone help me out please?

hi,

IIRC, your message id was presented as  "id:123456/<ACTUAL Message 
ID>/123456", so you should really be looking at adding your modifications 
in to gw/smsc/smsc_smpp.c at around line 750, which reads;

	/* get server message id */
	if ((curr = octstr_search(respstr, octstr_imm("id:"), 0)) != -1) {
		vpos = octstr_search_char(respstr, ' ', curr);
		if ((vpos-curr >0) && (vpos != -1))
			msgid = octstr_copy(respstr, curr+3, vpos-curr-3);
			debug("bb.sms.smpp",0,"SMPP[%s] handle_pdu, got DLR ID=[%s]",
				octstr_get_cstr(smpp->conn->id),octstr_get_cstr(msgid));
	} else {
		msgid = NULL;
	}

Something along the lines of (!untested C!)

/* find the message ID string */
if ((curr = octstr_search(respstr, octstr_imm("id:"), 0)) != -1) {

    /* find the first slash */
    curr = octstr_search_char(respstr, octstr_imm("/"),curr);

    /* find the second slash, our message ID is between them */
    vpos = octstr_search_char(repstr,'/',curr);

    /* copy the data starting at the first slash, of the
       length of the distance between them */ msgid = 
octstr_copy(respstr,curr,vpos-curr);

    debug("bb.sms.smpp",0,"SMPP[%s] handle_pdu, got DLR ID=[%s]",
          octstr_get_cstr(smpp->conn->id),octstr_get_cstr(msgid));


HTH.

Side issue: would it be worth adding regexp support to Kannel? It could 
come in handy in the SMS service selection, this kind of weirdness, etc. 
The PCRE library (www.pcre.org) library makes things quite straightforward. 
Thoughts?



Cheers,
	_Gus


-- 
Angus M Wood
Chief Architect
Inspired Broadcast Networks
http://www.inspiredbroadcast.net/
Out of Home Pay to Play Networked Entertainment
1-7 Livonia Street, London,  W1F 8AD, UK
Tel: +44 (0)20 7478 8280
Mob: +44 (0)7767 393039
Fax: +44 (0)20 7287 0131
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.