Dear all
 
I use OpenSER with the perl extension to publish presence states for non-SIMPLE/PUBLISH capable devices using an outbound proxy. My idea is to send all SIP messages to an outbound-proxy, that forwards them to the respective registrar/SIP proxy. The outbound proxy uses SIP messages (INVITE, BYE, CANCEL...) as triggers to call a perl script that publishes the presence state to a presence agent using PUA_MI.
 
Currently, registrar, presence agent and the publishing functionality are hosted on one machine. But I think that should not have any impact on the whole idea...
 
All what I wanted to do works fine so far, except that after some time, I get MySQL errors. The Perl script does not use the database, only from OpenSER script, actions are called. I posted below some of the error messages I receive and after, the part of my config performing database queries. Does anyone see a obvious mistake in there? I tried OpenSER lastest branch and current trunk, both produce the error after some time.
 
Thanks for your help!
 
Sebastian
 
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_query: error while submitting query
Jul 30 11:07:30 [4329] ERROR:pua:db_update: while querying db table pua
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_query: error while submitting query
Jul 30 11:07:30 [4329] ERROR:xcap_client:query_xcap_update: in sql query
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_delete: error while submitting query
Jul 30 11:07:30 [4329] ERROR:presence:update_db_subs: deleting expired information from database
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_query: error while submitting query
Jul 30 11:07:30 [4329] ERROR:presence:msg_watchers_clean: querying database for expired messages
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:07:30 [4329] ERROR:mysql:db_mysql_query: error while submitting query
Jul 30 11:07:30 [4329] ERROR:presence:msg_presentity_clean: querying database for expired messages
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_query: error while submitting query
Jul 30 11:09:10 [4329] ERROR:pua:db_update: while querying db table pua
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_query: error while submitting query
Jul 30 11:09:10 [4329] ERROR:xcap_client:query_xcap_update: in sql query
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_delete: error while submitting query
Jul 30 11:09:10 [4329] ERROR:presence:update_db_subs: deleting expired information from database
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_query: error while submitting query
Jul 30 11:09:10 [4329] ERROR:presence:msg_watchers_clean: querying database for expired messages
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_submit_query: driver error: Commands out of sync; you can't run this command now
Jul 30 11:09:10 [4329] ERROR:mysql:db_mysql_query: error while submitting query
Jul 30 11:09:10 [4329] ERROR:presence:msg_presentity_clean: querying database for expired messages
 
203         if (uri==myself) {
204                 if (method=="REGISTER") {
205                         # Uncomment this if you want to use digest authentication
206                         if (!www_authorize("IP", "subscriber")) {
207                                 www_challenge("IP", "0");
208                                 exit;
209                         };
210
211                         # query if dialog exists for registering URI
212                         avp_delete("*");
213                         if (avp_db_query("SELECT from_uri,
214                                                  to_uri
215                                           FROM dialog
216                                           WHERE from_uri='$tu' or to_uri='$tu' or from_uri='$tu:5060' or to_uri='$tu:5060'")) {
217                                 #xlog("L_INFO", ">>> Dialog active: caller=$avp(i:1) callee=$avp(i:2)\n");
218                         } else {
219                                 #xlog("L_INFO", ">>> No Dialog active: avp_db_query() returned no records\n");
220                         };
221                         xlog("L_INFO", ">>>>>>>>> REGISTER received ($tu)\n");
222                         if(!is_avp_set("$avp(i:1)")) { # no call active for registering to_uri user
223                                 xlog("L_INFO", ">>>>>>>>> PUBLISHED\n");
224                                 perl_exec("publish");
225                         } else {
226                                 xlog("L_INFO", ">>>>>>>>> NOT PUBLISHED, call active\n");
227                         }
228                         save("location");
229                         exit;
230                 }
231
232                 if(is_method("SUBSCRIBE|PUBLISH")) {
233                         if(is_method("PUBLISH")) {
234                                 if($si == "IP") {
235                                         if (!t_newtran()) {
236                                                 sl_reply_error();
237                                                 exit;
238                                         };
239                                         handle_publish();
240                                         t_release();
241                                 } else {
242                                         sl_send_reply("488","Not Acceptable Here");
243                                 }
244                         } else if(is_method("SUBSCRIBE")) {
245                                 if (!proxy_authorize("", "subscriber")) {
246                                         proxy_challenge("", "1");
247                                         exit;
248                                 };
249                                 handle_subscribe();
250                                 t_release();
251                         };
252                         exit;
253                 };
252                         exit;
253                 };
254
255                 lookup("aliases");
256
257                 # native SIP destinations are handled using our USRLOC DB
258                 if (!lookup("location")) {
259                         sl_send_reply("404", "Not Found");
260                         exit;
261                 } else {
262                         append_hf("P-hint: usrloc applied\r\n");
263                         if(method=="INVITE") {
264                                 # Store Dialog in db
265                                 setflag(5);
266                                 # Session timer
267                                 setflag(6);
268                                 if (sstCheckMin("1")) {
269                                         xlog("L_ERR", "422 Session Timer Too Small reply sent.\n");
270                                         exit;
271                                 }
272                                 xlog("L_INFO", ">>>>>>>>> INVITE received ($fu busy)\n");
273                                 perl_exec("publish");
274                         }
275                 };
276         };