No worries, I spent good few hours myself to find it. I actually tried to encode/ url-escape the dlr-url but the result were similar:
Here the logs: first case I escaped the entire URL 2010-02-17 19:33:16 [1593] [9] DEBUG: Parsing URL `http://localhost/delivery-report.php?send_history_id=13853213%26to_number%3D353870632346%26type%3D%25d': second case I escaped just & -> %26 2010-02-17 19:56:45 [1593] [9] DEBUG: Parsing URL `http://localhost/delivery-report.php?send_history_id=13853215%26to_number=353870632346%26type=8' Basically what is happening is that instead of GET sending three parameters is just sending one string and the & are represented by %26. Oscar On Thu, Feb 18, 2010 at 1:21 PM, Nikos Balkanas <[email protected]> wrote: > Sorry I thought logs were from smsbox, aka the entrypoint. You should > urlencode your dlr-url. urlencoding is not &->& but &->%26 > > BR, > Nikos > ----- Original Message ----- From: "oscar cassetti" > <[email protected]> > To: <[email protected]> > Sent: Thursday, February 18, 2010 1:15 PM > Subject: Re: XML Post and dlr-url > > > Hi, > > I used both iptraf and a custom script to dump the request and I > verified what I am sending (the XML in the previous email is from > dumping the request I am sending). > However, I agree with you and I trust the logs and even the logs say > the same thing. > The GET you see there is the GET generated by Kannel toward my > endpoint to confirm the delivery. > > I found this bit in the log and it might be useful: The url is not > un-escaped (& appears there) > > 010-02-18 09:42:24 [1168] [9] DEBUG: Parsing URL > `http://localhost/delivery-report.php?send_history_id=13853218&to_number=xxxx&type=8': > 2010-02-18 09:42:24 [1168] [9] DEBUG: Scheme: http:// > 2010-02-18 09:42:24 [1168] [9] DEBUG: Host: localhost > 2010-02-18 09:42:24 [1168] [9] DEBUG: Port: 80 > 2010-02-18 09:42:24 [1168] [9] DEBUG: Username: (null) > 2010-02-18 09:42:24 [1168] [9] DEBUG: Password: (null) > 2010-02-18 09:42:24 [1168] [9] DEBUG: Path: /delivery-report.php > 2010-02-18 09:42:24 [1168] [9] DEBUG: Query: > send_history_id=13853218&to_number=xxxx&type=8 > 2010-02-18 09:42:24 [1168] [9] DEBUG: Fragment: (null) > > I am attaching the log which show step by step all the sequence from > when my XML-POST request is received to when the delivery is > generated. > > Do I need to encode the elements is some way ? > > > Oscar > On Thu, Feb 18, 2010 at 10:34 AM, Nikos Balkanas <[email protected]> > wrote: >> >> Hi, >> >> Please verify what you are sending. Use tcpdump or another sniffer. From >> SMS logs you don't send *any* POSTs, just a GET and an incomplete one at >> that. If it comes to what I trust more, logs or your sayings, I'll go with >> the logs, anythime. >> >> BR, >> Nikos >> >> ----- Original Message ----- >> From: oscar cassetti >> To: [email protected] >> Sent: Thursday, February 18, 2010 12:19 PM >> Subject: Re: XML Post and dlr-url >> Hi All, >> >> Sorry I think I wasn't really precise. >> >> I am using XML-POST to send sms through cgi-bin/sendmessage. Basically >> what I do is very simple. I build the XML request into a string >> and the I send it using an HTTP/POST. To write the XML request I am using >> a Perl library (XML::Writer) which produces a valid XML. >> When I post I specify the Content-type 'text/xml'. >> res = $self->{'UA'}->post( $service_url, 'Content-type' => 'text/xml', >> 'Content' => $xml_str); >> >> Everything works messages are processed and sent correctly and the content >> of the message is escaped and un-escaped correctly. There is only one issue >> with the delivery report. >> >> The problem is that one of the element of the XML-POST >> http://www.kannel.org/download/1.4.3/userguide-1.4.3/userguide.html#POSTXML >> is the url to acknowledge the delivery <dlr-url> </dlr-url>. >> This url in plain text (non XML or HTML encoded) is >> >> http://localhost/delivery-report.php?send_history_id=xxxxx&to_number=xxxxx&type=%d >> When XML::Writer writes the element <dlr-url> it rightly coverts & to >> &. However, Kannel doesn't seem to un-escape the character and as a >> result the url which is used by the smsbox to report the delivery is wrong >> because the & is still & >> >> Below an example of xml which I send to kannel: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <message> >> <submit> >> <da><number>353870xxxxx</number></da> >> <oa><number>35387xxxxxx</number></oa >> ><ud>Test%20send%20%E2%82%AC%20%25%3C%20%3F%20%3E%20%3C%2Fua%3E%20</ud> >> >> <statusrequest> >> <dlr-mask>31</dlr-mask> >> >> <dlr-url>http://localhost/delivery-report.php?send_history_id=13853217&to_number=353870xxxxx6&type=%d</dlr-url></statusrequest> >> >> <!-- request from application to Kannel --> >> <from> >> <username>xxxxxxx</username> >> <password>xxxxxx</password> >> </from> >> </submit> >> </message> >> >> >From the smsbox log you can see that & is not un-escaped; >> >> 9 2d 72 65 GET /delivery-re >> e 64 5f 68 69 port.php?send_hi >> 8 35 33 32 31 story_id=1385321 >> d 62 65 72 3d 7&to_number= >> 6 26 61 6d 70 3538xxxxxxxx& >> 0 2f 31 2e 31 ;type=8 HTTP/1.1 >> 1 6c 68 6f 73 ..Host: localhos >> f 6e 3a 20 6b t..Connection: k >> 5 73 65 72 2d eep-alive..User- >> 5 6c 2f 31 2e Agent: Kannel/1. >> 4.3.... >> >> As I said before I tried to escape the & in HTML/URI way but the result >> was similar. >> >> 47 45 54 20 2f 64 65 6c 69 76 65 72 79 2d 72 65 GET /delivery-re >> 70 6f 72 74 2e 70 68 70 3f 73 65 6e 64 5f 68 69 port.php?send_hi >> 73 74 6f 72 79 5f 69 64 3d 31 33 38 35 33 32 31 story_id=1385321 >> 35 25 32 36 74 6f 5f 6e 75 6d 62 65 72 3d 33 35 5%26to_number=35 >> 33 38 37 30 36 33 32 33 34 36 25 32 36 74 79 70 3870632346%26typ >> 65 3d 38 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f e=8 HTTP/1.1..Ho >> 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 0d 0a 43 st: localhost..C >> 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 2d onnection: keep- >> 61 6c 69 76 65 0d 0a 55 73 65 72 2d 41 67 65 6e alive..User-Agen >> 74 3a 20 4b 61 6e 6e 65 6c 2f 31 2e 34 2e 33 0d t: Kannel/1.4.3. >> > >
