Regseconds 2 hours early

For some reason, it seems asterisk registers regseconds two hours early
I’ve checked both servers (asterisk server and sql server) and they show the correct date, and they are in the same time zone (the linux server is set to CEST and the sql server is set to GMT+1) and they both show the same time and date
I use DATEADD to convert unix timestamp to datetime, like this :
DATEADD(SECOND, regseconds, ‘1970-01-01’)

Any suggestions as to what could be wrong?


select from_unixtime(regseconds)

Does it display the same time gap?


select from_unixtime(regseconds)

Does it display the same time gap?[/quote]

I’m using MSSQL, not MySQL so I don’t really have that option :stuck_out_tongue: (although I could switch to MySQL, but I don’t really think that’s a good idea when we have a dedicated MSSQL server)
I’m not really worried about what it displays, I’m more worried about how Asterisk will handle this error, since I can just use 1970-01-01 02:00 instead, and the date will be correct… It seems like it’s an error in the timezone somewhere, but I have no clue where. First I used the wrong timezone for linux or something, since it got the wrong time when using ntdate with GMT +1 (which is what I was 100% certain is the timezone I live in) which gave an error of about 3 hours. I adjusted it to CEST and now it displays the right time in the console, but somehow it seems like something somewhere somehow is subtracting to hours when asterisk records it in realtime…
I don’t know the bottom technical details on what the regseconds actually do, but I’m afraid it might give instability to the clients. Random “sip registration failed” messages or similar.


Regseconds is the expiration of the registration in the database. For example, if the client sent a registration for 3600 seconds, it will usually be the asterisk server time + 1 hour.

You can use an ugly, but functional hack to work around this until you find your timezone problem by using:


In your sip.conf file. Basically, asterisk will ignore registration time and use last known information.

Hope that you can find your timezone issue, as i’ve absolutly no knowledge on MSSQL.

Edit: There’s on thing tho, I’m not 100% sure about this, but the unixtime I think is GMT by default and adjusted by the server timezone. So if it’s read by your Asterisk, there should not be any issues.