### Description
I use kazoo and postgres modules on my host. I found that many database operation generates error like ``` 19(150) exec: *** cfgtrace:request_route=[kazoo:consumer-event-presence-dialog-update] c=[//etc/kamailio/presence-role.cfg] l=270 a=32 n=kazoo_pua_publish_presence 17(148) exec: *** cfgtrace:request_route=[kazoo:consumer-event-presence-dialog-update] c=[//etc/kamailio/presence-role.cfg] l=271 a=27 n=pres_refresh_watchers Entity: line 1: parser error : Start tag expected, '<' not found \x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e3c ^ 17(148) ERROR: presence_xml [notify_body.c:551]: agregate_xmls(): while parsing xml body message 17(148) ERROR: presence_xml [notify_body.c:156]: pres_agg_nbody(): while aggregating body 19(150) exec: *** cfgtrace:request_route=[kazoo:consumer-event-presence-dialog-update] c=[//etc/kamailio/presence-role.cfg] l=271 a=27 n=pres_refresh_watchers Entity: line 1: parser error : Start tag expected, '<' not found \x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e3c ^ 19(150) ERROR: presence_xml [notify_body.c:551]: agregate_xmls(): while parsing xml body message 19(150) ERROR: presence_xml [notify_body.c:156]: pres_agg_nbody(): while aggregating body 18(149) exec: *** cfgtrace:request_route=[kazoo:consumer-event-nodes-advertise] c=[//etc/kamailio/nodes-role.cfg] l=66 a=63 n=assign 18(149) exec: *** cfgtrace:request_route=[kazoo:consumer-event-nodes-advertise] c=[//etc/kamailio/nodes-role.cfg] l=74 a=16 n=if 18(149) exec: *** cfgtrace:request_route=[kazoo:consumer-event-nodes-advertise] c=[//etc/kamailio/nodes-role.cfg] l=74 a=16 n=if 18(149) exec: *** cfgtrace:request_route=[kazoo:consumer-event-nodes-advertise] c=[//etc/kamailio/nodes-role.cfg] l=75 a=27 n=mq_add Entity: line 1: parser error : Start tag expected, '<' not found \x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e3c ^ 17(148) ERROR: presence_xml [notify_body.c:551]: agregate_xmls(): while parsing xml body message 17(148) ERROR: presence_xml [notify_body.c:156]: pres_agg_nbody(): while aggregating body Entity: line 1: parser error : Start tag expected, '<' not found \x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e3c ^ 19(150) ERROR: presence_xml [notify_body.c:551]: agregate_xmls(): while parsing xml body message 19(150) ERROR: presence_xml [notify_body.c:156]: pres_agg_nbody(): while aggregating body Entity: line 1: parser error : Start tag expected, '<' not found \x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e3c ^ 17(148) ERROR: presence_xml [notify_body.c:551]: agregate_xmls(): while parsing xml body message 17(148) ERROR: presence_xml [notify_body.c:156]: pres_agg_nbody(): while aggregating body 17(148) exec: *** cfgtrace:request_route=[kazoo:consumer-event-presence-dialog-update] c=[//etc/kamailio/presence-role.cfg] l=276 a=26 n=xlog 17(148) INFO: <script>: 3O75Qw3gqR3ZNla5RfCgQLVW0-8KKbrT|log|finished processing dialog update for sip:2496@rcsnet.ru state confirmed from sip:217.12.247.98:11000 at 1506632313/1506632313/1506632313 Entity: line 1: parser error : Start tag expected, '<' not found \x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e3c ^ ``` After some debugging i found that kamailio wants save to database xml string like this as BLOB object ``` <?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" xmlns:c="urn:ietf:params:xml:ns:pidf:cipid" entity="2496"> <tuple xmlns="urn:ietf:params:xml:ns:pidf" id="t8No1hQnp65U33jS1oqFMgxbIRPq-iFP"><status><basic>open</basic></status></tuple><note xmlns="urn:ietf:params:xml:ns:pidf">On the Phone</note><dm:person xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" id="1">rpid:activitiesrpid:on-the-phone/</rpid:activities>dm:noteOn the Phone</dm:note></dm:person></presence> ``` And later tries to read. But when this XML read reverse conversion of BLOB to string is not take place. And late used BLOB as is. This breaks presentation logic completely.
#### Reproduction
Configure kamailio on kazoo cluster to use PostgreSQL database On phone create subscribe to second
From second phone create new call.
#### Operating System CentOS 7 Linux node2.docker.rcsnet.ru 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux