Hello,
I am not sure if curl is converting \r into the single corresponding char. Can you try to write the xml in a file, where you ensure the \r\n are the corresponding chars -- one option would be to do it with echo, like:
echo -e "first line\r\nsecond line\r\n..." >/tmp/data.xml
and then use curl with the parameter to read data from file.
I also pushed a small patch to master branch that is printing the hexa code of the character which is wrong, so should be easier to troubleshoot -- maybe you can test with it.
Cheers, Daniel
On 24.01.19 11:25, Володимир Іванець wrote:
Hello Daniel,
According to Wireshark they are. I attached packet pactures for two attempts. Hope they will help to identify the problem. First one has "\n" and second "\r\n"
First PUBLISH was generated by pua.publish like so:
/# curl -H "Content-Type: text/xml" -X POST -d "<?xml version='1.0' ?><methodCall><methodName>pua.publish</methodName><params><param><value><string>sip:100-test@172.16.30.151 <mailto:sip%3A100-test@172.16.30.151></string></value></param><param><value><string>15</string></value></param><param><value><string>message-summary</string></value></param><param><value><string>application/simple-message-summary</string></value></param><param><value><string>.</string></value></param><param><value><string>.</string></value></param><param><value><string>sip:127.0.0.1:5060;transport=udp</string></value></param><param><value><string>Content-Length: 91</string></value></param><param><value><string>Messages-Waiting: yes/ /Message-Account: sip:100-test@172.16.30.151 <mailto:sip%3A100-test@172.16.30.151>/ /Voice-Message: 1/2 (0/0)/ /</string></value></param></params></methodCall>" http://172.16.30.151:5060/XML_RPC/ / / / Jan 24 12:05:07 test kamailio: 3(27128) ERROR: presence_mwi [add_events.c:110]: mwi_publ_handl(): check of body <Messages-Waiting: yes Jan 24 12:05:07 test kamailio: Message-Account: sip:100-test@172.16.30.151 <mailto:sip%3A100-test@172.16.30.151> Jan 24 12:05:07 test kamailio: Voice-Message: 1/2 (0/0) Jan 24 12:05:07 test kamailio: > failed at character number 22 Jan 24 12:05:07 test kamailio: 3(27128) ERROR: presence [publish.c:480]: ki_handle_publish_uri(): in event specific publish handling /
For second I tried adding "\r" to to the end of each line:
/# curl -H "Content-Type: text/xml" -X POST -d "<?xml version='1.0' ?><methodCall><methodName>pua.publish</methodName><params><param><value><string>sip:100-test@172.16.30.151 <mailto:sip%3A100-test@172.16.30.151></string></value></param><param><value><string>15</string></value></param><param><value><string>message-summary</string></value></param><param><value><string>application/simple-message-summary</string></value></param><param><value><string>.</string></value></param><param><value><string>.</string></value></param><param><value><string>sip:127.0.0.1:5060;transport=udp</string></value></param><param><value><string>Content-Length: 97</string></value></param><param><value><string>Messages-Waiting: yes\r/ /Message-Account: sip:100-test@172.16.30.151 <mailto:sip%3A100-test@172.16.30.151>\r/ /Voice-Message: 1/2 (0/0)\r/ /</string></value></param></params></methodCall>" http://172.16.30.151:5060/XML_RPC/ / / / Jan 24 12:10:59 test kamailio: 2(27127) ERROR: presence_mwi [add_events.c:110]: mwi_publ_handl(): check of body <Messages-Waiting: yes\r Jan 24 12:10:59 test kamailio: Message-Account: sip:100-test@172.16.30.151 <mailto:sip%3A100-test@172.16.30.151>\r Jan 24 12:10:59 test kamailio: Voice-Message: 1/2 (0/0)\r Jan 24 12:10:59 test kamailio: > failed at character number 22 Jan 24 12:10:59 test kamailio: 2(27127) ERROR: presence [publish.c:480]: ki_handle_publish_uri(): in event specific publish handling /
Thank you very much!
чт, 24 січ. 2019 о 10:10 Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com> пише:
Hello, are the lines ended by \r\n? Like: /Messages-Waiting: yes\r\n.../ Cheers, Daniel On 22.01.19 16:51, Володимир Іванець wrote:
Hello! I'm trying to process PUBLISH on Kamailio (v. 5.2.1) but constantly getting "500 Server Internal Error" responce. For packet body: /Messages-Waiting: yes/ /Message-Account: sip:100-test@172.16.30.151 <mailto:sip%3A100-test@172.16.30.151>/ /Voice-Message: 1/2/ / / ... debug output is: /kamailio: 2(27127) DEBUG: presence [event_list.c:348]: search_event(): start event= [message-summary/6]/ /kamailio: 2(27127) DEBUG: presence [publish.c:351]: ki_handle_publish_uri(): SIP-If-Match header not found/ /kamailio: 2(27127) DEBUG: presence [presentity.c:88]: generate_ETag(): etag= a.1548164100.27127.7.0 / 22/ /kamailio: 2(27127) DEBUG: presence [publish.c:360]: ki_handle_publish_uri(): new etag = a.1548164100.27127.7.0/ /kamailio: 2(27127) DEBUG: presence [publish.c:385]: ki_handle_publish_uri(): Expires header found, value= 16/ /kamailio: 2(27127) ERROR: presence_mwi [add_events.c:110]: mwi_publ_handl(): check of body <Messages-Waiting: yes/ /kamailio: Message-Account: sip:100-test@172.16.30.151 <mailto:sip%3A100-test@172.16.30.151>/ /kamailio: Voice-Message: 1/2/ /kamailio: > failed at character number 22/ /kamailio: 2(27127) ERROR: presence [publish.c:480]: ki_handle_publish_uri(): in event specific publish handling/ / / I'm not sure, but it appears to me that check in line 95 from https://github.com/kamailio/kamailio/blob/5.2/src/modules/presence_mwi/add_events.c is not passing. I was trying to add "\n" and "\r" to the end of each string but I always had failure on character number 22. Does anyone know how exactly PUBLISH packet body should look like? Thanks a lot! _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com> www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda> Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com <http://www.kamailioworld.com> Kamailio Advanced Training - Mar 4-6, 2019 in Berlin; Mar 25-27, 2019, in Washington, DC, USA -- www.asipto.com <http://www.asipto.com>