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  
&amp;. 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 &amp;

  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&amp;to_number=353870xxxxx6&amp;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 &amp; 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&amp;to_number=
  6 26 61 6d 70   3538xxxxxxxx&amp
  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.

  Thanks,

  Oscar


  On Thu, Feb 18, 2010 at 6:46 AM, Nikos Balkanas <[email protected]> wrote:

    Hi,

    For Perl questions address a perl group. Besides this is not an XML-POST. 
This is a simple GET with variables in the URL. Additionally you don't seem to 
bind dlr-url at all. You have a lot of issues to resolve, none of them 
apparently with kannel.

    BR,
    Nikos
      ----- Original Message ----- 
      From: oscar cassetti 
      To: [email protected] 
      Sent: Wednesday, February 17, 2010 10:26 PM
      Subject: XML Post and dlr-url


      Hello All,

      I have been stuck on configuring the dlr-url in the XML-POST.  

      To generate the XML I use the Perl Library XML::Writer

      On an Perl script I do something like this 
      #DLR Parameter                                                            
                  
          my $amp = URI::Escape::uri_escape('&') ;
          my $dlr_url     =  
'http://localhost/delivery-report.php?send_history_id='.    
URI::Escape::uri_escape( $message->{'ID'}).      $amp . 'to_number='.       
URI::Escape::uri_escape($number).       $amp . 'type=%d' ;

      And then 
      $xml_doc->dataElement('dlr-url' => $dlr_url );

      At this stage my XML writer has converted the dlr_url in a valid XML 
string.

      However when Kannel is going to use it the string doesn't look decoded.
      See below.

      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.

      I also tried to use $amp = '&'  without HTML escaping but I get a similar 
problem:

      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
      34 26 61 6d 70 3b 74 6f 5f 6e 75 6d 62 65 72 3d   4&amp;to_number=
      33 35 33 38 37 30 36 33 32 33 34 36 26 61 6d 70   353870632346&amp
      3b 74 79 70 65 3d 38 20 48 54 54 50 2f 31 2e 31   ;type=8 HTTP/1.1
      0d 0a 48 6f 73 74 3a 20 6c 6f 63 61 6c 68 6f 73   ..Host: localhos
      74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b   t..Connection: k
      65 65 70 2d 61 6c 69 76 65 0d 0a 55 73 65 72 2d   eep-alive..User-
      41 67 65 6e 74 3a 20 4b 61 6e 6e 65 6c 2f 31 2e   Agent: Kannel/1.
      34 2e 33 0d 0a 0d 0a                              4.3....



      Any idea?



Reply via email to