Yate Community Forum

General Category => Yate users hangout place => Topic started by: jehanzaib_kiani on August 19, 2014, 02:44:48 AM

Title: no db query after the expires
Post by: jehanzaib_kiani on August 19, 2014, 02:44:48 AM
Hi there,

something i have noticed that the first registration goes fine, but after the expires my soft phone sends the re-registration to yate but i get Not Found.
i am using [user.auth] , [user.register] and [user.unregister] from DB. it works fine when i register first time i have 60 seconds expire time set on my softphone but after this expire my softphone sends the re-register request to yate but the yate response is Not found. It does not happen when i use regfile

any idea please thanks
Title: Re: no db query after the expires
Post by: Monica Tepelus on August 19, 2014, 05:56:55 AM
Hi,

Can you please post a log with sniffer activated?
Title: Re: no db query after the expires
Post by: jehanzaib_kiani on August 20, 2014, 01:55:52 AM
Please see the attached logs
thanks
Title: Re: no db query after the expires
Post by: paulc on August 20, 2014, 06:55:04 AM
Hi!

The register module expects that the UPDATE affects some rows in the database. For MySQL an identical update returns zero affected rows.

Your user.register query seems incorrect, the `expires` column in the database should hold the absolute expire time not the expire interval:

  UPDATE sip_users SET fullcontact='sip/sip:100@xx.xx.xx.xx:9388',expires='60' WHERE username='100'


For MySQL your queries should probably look like:

  [user.register]
  query=UPDATE users SET fullcontact='${data}',expires=DATE_ADD(NOW(), INTERVAL ${expires} SECOND) WHERE username='${username}'
 
  [engine.timer]
  query=UPDATE users SET fullcontact=NULL,expires=NULL WHERE expires IS NOT NULL AND expires<=NOW()

Title: Re: no db query after the expires
Post by: jehanzaib_kiani on August 25, 2014, 01:35:34 AM
woo i think we nailed it ;)
all good much appreciated.