Thanks a lot Rene. perfect solution.
Also I used another gw function to retrieve last item, so that's okay.
Thanks again for your help.


On Wed, Apr 30, 2014 at 4:33 PM, Rene Kluwen <rene.klu...@chimit.nl> wrote:

> Try:
>
>
>
> octstr_format("
> http://someurl.com/somescript.php?mobile=%%p&dlr=%%d&msgid=%s";,
> octstr_get_cstr(msgid));
>
>
>
> This will replace %%p with %p, %%d with %d and %s with the msgid.
>
>
>
> Also: I don’t think gw_extract_last() doesn’t exist in the gw library.
>
>
>
> == Rene
>
>
>
>
>
> *From:* Saurabh Pandey [mailto:sam.it.develo...@gmail.com]
> *Sent:* dinsdag 29 april 2014 16:55
> *To:* Rene Kluwen
> *Cc:* users@kannel.org
> *Subject:* Re: SMS ID and DLR-URL concatenation issue
>
>
>
> Rene my dlr-url contains other parameters also like %d for dlr etc. Also C
> is supposed to replace %d with passed integer value right? So I want this
>
> "http://someurl.com/somescript.php?mobile=%p&dlr=%d&msgid=<i want my id
> here>"
>
> Now, based on your suggestion I did this:
>
> octstr_format("http://someurl.com/somescript.php?mobile=%p&dlr=%d&msgid=%s";,
> octstr_get_cstr(msgid));
>
> compiled just fine, but when got DLR, it panicked:
>
> 2014-04-29 11:44:39 [29025] [12] PANIC: octstr_format format string syntax
> error.
>
> What can I do in this situation? Please help. I appreciate your support.
>
>
>
> On Tue, Apr 29, 2014 at 7:57 PM, Saurabh Pandey <
> sam.it.develo...@gmail.com> wrote:
>
> 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
>
>
>
>
>

Reply via email to