Thanks for the valuable guidance Rene. I'll give it a shot and afterwards will look into that memory leak issue.
One quick question, above this code the dlr_url is separated by splitting it and picking the first part. Here is the code : parts = octstr_split(msg->sms.dlr_url, octstr_imm("vmsgid=")); msgid = gwlist_extract_first(parts); However, now according to my scenario, I need to extract the last item in the list. I tried this: parts = octstr_split(msg->sms.dlr_url, octstr_imm("vmsgid=")); msgid = gwlist_extract_last(parts); But it throws error: undefined reference to `gwlist_extract_last' Would you happen to know how can I do that, it s a very simple task. Sorry if the question is too stupid :( I'm no C programmer. On Tue, Apr 29, 2014 at 7:23 PM, Rene Kluwen <rene.klu...@chimit.nl> wrote: > I didn’t see the end of your email. > > > > Use: > > > > msg->sms.dlr_url = octstr_format(http://someurl.com/myscript.php?msgid=%s”, > octstr_get_cstr(msgid)); > > > > Btw, in the code that you gave below, there’s a memory leak. > > > > == Rene > > > > *From:* Rene Kluwen [mailto:rene.klu...@chimit.nl] > *Sent:* dinsdag 29 april 2014 15:51 > *To:* 'Saurabh Pandey'; 'users@kannel.org' > *Subject:* RE: SMS ID and DLR-URL concatenation issue > > > > Use octstr_format(http://someurl.com/myscript.php?msgid=%s”, msgid); > > > > This is if msgid is a string. If it is an integer use %d instead of %s. > > > > == Rene > > > > *From:* users [mailto:users-boun...@kannel.org <users-boun...@kannel.org>] > *On Behalf Of *Saurabh Pandey > *Sent:* dinsdag 29 april 2014 13:41 > *To:* users@kannel.org > *Subject:* SMS ID and DLR-URL concatenation issue > > > > Hi everyone, > > this should be very simple for an expert C programmer to fix. I am trying > to edit source of Opensmppbox.c to suit my requirements, but I am very poor > in C. What I had was: > > msg->sms.dlr_url = octstr_create("http://someurl.com/myscript.php"); > > and it was working fine. In my dlr-table this URL was inserted as dlr-url > and was fired when I received DLR. Now what I need is: > > msg->sms.dlr_url = octstr_create("http://someurl.com/myscript.php*?msgid=* > "+*msgid*); > > where msgid is fetched above like this: > > msgid = generate_smppid(msg,box->version); > msgid = octstr_duplicate(msgid); > > *Issue: *How do I append msgid to my dlr url and pass it. I used > strcpy/strcat but it gives me incompatible pointer type errors. > > Please help me here. Thanks a lot in advance. > > -Sam >