[SR-Users] ERROR: presence not working correctly with Kamailio 3.3.2-1.1 and Postgresql 9.1

Peter Dunkley peter.dunkley at crocodile-rcs.com
Mon Nov 5 15:31:50 CET 2012

Try using the same version of PostgreSQL client library and server.

I believe the default handling of binary blobs changed between PostgreSQL
8.x and 9.x.  This could well explain your problem.

Kamailio works for me with PostgreSQL 9.0 client library and server.



> Hi All,
> I've got a problem with Kamailio 3.3.2-1.1 on CentOS 6.3 with locally
> postgresql 8.4.13-1.el6_3 libraries, connected to a remote
> postgresql91-9.1.6-1PGDP.rhel6 server
> The presence module tries to insert a record in the presentity table,
> with some xml in the body column.
> But the body value in the postgresql table is not represented as a
> string '<?xml ...etc' But encodes as
> '\x3c3f786d6c2076657273696f6e3d27312e302720656e636f64696e673d275554462...etc'
> This gives problems when the presense module is trying to send out a
> notify based on the value in the database.
> With debugging, this gives the error:
> Entity: line 1: parser error : Start tag expected, '<' not found
> x3c3f786d6c2076657273696f6e3d27312e302720656e636f64696e673d275554462d38273f3e3c
> The \x in front of the hex encodes string is not properly interpreted by
> postgresql or kamailio.
> The body column of the table presentity is a bytea column, and I believe
> postgresql 9 outputs these bytea columns a bit differently then
> postgresql 8.
> When I try to run the sql statement:
> insert into presentity
> (domain,username,event,etag,sender,body,received_time,expires ) values
> ('newsip.lifexs.nl','00086','presence','a.1352107949.18632.27.0','','<?xml
> version=''1.0'' encoding=''UTF-',1343534532,1345213723)
> On the postgresql 9.1 server locally, I still get the '\x3c3f786d6c...
> etc' value in the database.
> The bytea_output setting in postgresql 9 is now standard set to 'hex' in
> stead of escape.
> I've changed the bytea_output setting in postgresql.conf to 'escape',
> and then the presence is working without any issues.
> So maybe the database module of postgresql has to be changed to pick up
> these bytea encodings properly?
> Because i think kamailio should work correctly with the default
> postgresql settings.
> With kind regards,
> Robert Verspuy
> --
> *Exa-Omicron*
> Eenspan 8-K
> 3897 AL Zeewolde
> http://exa.nl
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Peter Dunkley
Technical Director
Crocodile RCS Ltd

More information about the sr-users mailing list