Hello,
if you want to try to fix it inside kamailio.cfg, look at the
subst/replace functions from textops module and once those operations
are done, do msg_apply_changes() from textopsx module.
Cheers,
Daniel
On 25.06.18 16:03, Pali Rohár wrote:
Ah, seems you are right. It is invalid XML. I
have not spotted that when
doing packet dumps.
So I would report bug to linphone project. I (as a user) have no control
on what linphone SIP client send to server...
It looks like that linphone forgot to encode entity="..." and content of
<contact>. Is there any way to "fix" these two problems in kamailio
server? Probably as doing some replace filter in kamailio config file
for incoming packets?
Because current version of linphone is widely used and it would take
time if linphone fixes this issue and users updates current broken
version.
On Monday 25 June 2018 15:47:19 Daniel-Constantin Mierla wrote:
> Hello,
>
> the error is printed because the parsing of the XML body in PUBLISH
> fails -- an invalid XML document. Quickly looking at it:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <presence xmlns="urn:ietf:params:xml:ns:pidf"
> xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
> xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" entity="User
<sip:USER@HOST>">
> <tuple id="sg89ae">
> <status><basic>closed</basic></status>
> <contact priority="0.8">User
<sip:USER@HOST></contact>
> </tuple>
> </presence>
>
>
> the issue likely is the content of the <contact>...</contact>, it has
> <sip:...> which is an opening tag from XML point of view. Either encode
> < and > there, or put the sip address without them.
>
> Cheers,
> Daniel
>
> On 23.06.18 22:21, Pali Rohár wrote:
>> Hi!
>>
>> I'm using linphone 3.6.1 as SIP client and Kamailio 4.4.4 as proxy
>> server and registrar.
>>
>> And every time I try to change online status (presence) in linphone
>> client, I see following error messages in kamailio server log:
>>
>> ERROR: presence_xml [add_events.c:167]: xml_publ_handl(): bad body format
>> ERROR: presence [publish.c:443]: handle_publish(): in event specific publish
handling
>> ERROR: tm [t_reply.c:533]: _reply_light(): ERROR: _reply_light: can't
generate 500 reply when a final 415 was sent out
>> ERROR: sl [sl.c:269]: send_reply(): failed to reply stateful (tm)
>> ERROR: presence [utils_func.c:146]: send_error_reply(): sending 500 Server
Internal Error reply
>> ERROR: presence [publish.c:492]: handle_publish(): failed to send error reply
>>
>> So it looks like kamailio is not able to parse presence change which is
>> linphone doing. I captured traffic via tcpdump what linphone sends:
>>
>> 21:58:58.704792 IP (tos 0x68, ttl 64, id 64109, offset 0, flags [DF], proto UDP
(17), length 32)
>> LINPHONE_IP_ADDRESS.5060 > KAMAILIO_IP_ADDRESS.5060: SIP
>> 21:58:58.704919 IP (tos 0x68, ttl 64, id 64110, offset 0, flags [DF], proto UDP
(17), length 752)
>> LINPHONE_IP_ADDRESS.5060 > KAMAILIO_IP_ADDRESS.5060: SIP, length: 724
>> PUBLISH sip:USER@HOST SIP/2.0
>> Via: SIP/2.0/UDP LINPHONE_IP_ADDRESS:5060;rport;branch=z9hG4bK2049418743
>> From: User <sip:USER@HOST>;tag=184282924
>> To: User <sip:USER@HOST>
>> Call-ID: 1435474953
>> CSeq: 26 PUBLISH
>> Content-Type: application/pidf+xml
>> Max-Forwards: 70
>> User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
>> Expires: 600
>> Event: presence
>> Content-Length: 353
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <presence xmlns="urn:ietf:params:xml:ns:pidf"
xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" entity="User
<sip:USER@HOST>">
>> <tuple id="sg89ae">
>> <status><basic>closed</basic></status>
>> <contact priority="0.8">User
<sip:USER@HOST></contact>
>> </tuple>
>> </presence>
>> 21:58:58.710097 IP (tos 0x10, ttl 53, id 10255, offset 0, flags [none], proto UDP
(17), length 473)
>> KAMAILIO_IP_ADDRESS.5060 > LINPHONE_IP_ADDRESS.5060: SIP, length: 445
>> SIP/2.0 407 Proxy Authentication Required
>> Via: SIP/2.0/UDP
LINPHONE_IP_ADDRESS:5060;rport=5060;branch=z9hG4bK2049418743;received=EXTERNAL_IP_ADDRESS
>> From: User <sip:USER@HOST>;tag=184282924
>> To: User <sip:USER@HOST>;tag=515cb47c4c34ffa85b598d6b25676122.744d
>> Call-ID: 1435474953
>> CSeq: 26 PUBLISH
>> Proxy-Authenticate: Digest realm="HOST",
nonce="NONCE"
>> Server: kamailio (4.4.4 (x86_64/linux))
>> Content-Length: 0
>>
>> 21:58:58.718147 IP (tos 0x68, ttl 64, id 64111, offset 0, flags [DF], proto UDP
(17), length 940)
>> LINPHONE_IP_ADDRESS.5060 > KAMAILIO_IP_ADDRESS.5060: SIP, length: 912
>> PUBLISH sip:USER@HOST SIP/2.0
>> Via: SIP/2.0/UDP LINPHONE_IP_ADDRESS:5060;rport;branch=z9hG4bK1165141043
>> From: User <sip:USER@HOST>;tag=184282924
>> To: User <sip:USER@HOST>
>> Call-ID: 1435474953
>> CSeq: 27 PUBLISH
>> Proxy-Authorization: Digest username="USER",
realm="HOST", nonce="NONCE", uri="sip:USER@HOST",
response="RESP", algorithm=MD5
>> Content-Type: application/pidf+xml
>> Max-Forwards: 70
>> User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
>> Expires: 600
>> Event: presence
>> Content-Length: 353
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <presence xmlns="urn:ietf:params:xml:ns:pidf"
xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" entity="User
<sip:USER@HOST>">
>> <tuple id="sg89ae">
>> <status><basic>closed</basic></status>
>> <contact priority="0.8">User
<sip:USER@HOST></contact>
>> </tuple>
>> </presence>
>>
>> 21:58:58.781668 IP (tos 0x10, ttl 53, id 10259, offset 0, flags [none], proto UDP
(17), length 380)
>> KAMAILIO_IP_ADDRESS.5060 > LINPHONE_IP_ADDRESS.5060: SIP, length: 352
>> SIP/2.0 415 Unsupported media type
>> Via: SIP/2.0/UDP
LINPHONE_IP_ADDRESS:5060;rport=5060;branch=z9hG4bK1165141043;received=EXTERNAL_IP_ADDRESS
>> From: User <sip:USER@HOST>;tag=184282924
>> To: User <sip:USER@HOST>;tag=97d8e785fdf42bf9622a64c13c504961-3901
>> Call-ID: 1435474953
>> CSeq: 27 PUBLISH
>> Server: kamailio (4.4.4 (x86_64/linux))
>> Content-Length: 0
>>
>> I replaced ip addresses in packets by KAMAILIO_IP_ADDRESS,
>> LINPHONE_IP_ADDRESS and EXTERNAL_IP_ADDRESS strings and also SIP account
>> by USER@HOST. Maybe it helps you.
>>
>> Any idea why kamailio refuse presence update and reports those error
>> into error log?
>>
>> Or is there any special setting which is needed for linphone or other
>> SIP clients for online status / presence support?
>>
>>
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users(a)lists.kamailio.org
>>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users