AGProjects / sylk-pushserver

Mobile push notifications for RTC infrastructures
Other
13 stars 8 forks source link

Error in SQL Query Block (save("location")) - Opensips 3.0 #3

Closed hasanr68 closed 3 years ago

hasanr68 commented 3 years ago

Hi all.

Trying to make this work from Opensips 3.0 - getting the following error - any clue what/how to fix please:

Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:2-20: syntax error Jun 15 16:55:47 [12797] # save data required later for push notifications Jun 15 16:55:47 [12797] if ($avp(pn_type) and $avp(pn_token) and $avp(pn_app)) { Jun 15 16:55:47 [12797] $avp(query) = "SELECT token from push_tokens where username = '" + $(tU{s.escape.common}) + "' and domain = '" + $(td{s.escape.common}) + "' and app Jun 15 16:55:47 [12797] ^~~~~~~ Jun 15 16:55:47 [12797] xlog(L_DBG, [CONFIG] REGISTER push SQL query: $avp(query)\n); Jun 15 16:55:47 [12797] avp_db_query($avp(query), "$avp(old_pn_token)"); Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:2-20: bad command!) Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:1-2: bad command!) Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:1-2: bad command!) Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:9-13: bare word found, command calls need '()' Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:9-13: bad command: missing ';'? Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:99-100: bad arguments for command Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:101-107: bad command: missing ';'? Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:3-4: syntax error Jun 15 16:55:47 [12797] CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:541:27-28: bad arguments for command

hasanr68 commented 3 years ago

The three queries in the (save("location") area seems incomplete:

$avp(query) = "SELECT token from push_tokens where username = '" + $(tU{s.escape.common}) + "' and domain = '" + $(td{s.escape.common}) + "' and app

$avp(query) = "INSERT into push_tokens (username, domain, platform, app, token, sip_instance, user_agent, silent) values ('" + $(tU{s.escape.comm

$avp(query) = "UPDATE push_tokens set silent = '" + $(avp(pn_silent){s.escape.common}) + "', last_modified = NOW(), token = '" + $(avp(pn_token){

tijmenNL commented 3 years ago

You're correct. I will add a fix

hasanr68 commented 3 years ago

Thx a lot. Appreciate the help. Also this under [LATE_FORKING]:

INFO($avp(aor) registered contact $avp(uri) while receiving an incoming call);

CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:794:81-82: bad arguments for command

Separate ticket?

tijmenNL commented 3 years ago

No need, I changed it as well

tijmenNL commented 3 years ago

Please check ff41d72fa9c353e6e07296867dd881f92904b403

hasanr68 commented 3 years ago

Great - will check it out and report back :)