[asterisk-users] SIP Realtime peers
Antony.Stone at asterisk.open.source.it
Thu Apr 8 05:55:48 CDT 2021
On Thursday 08 April 2021 at 12:38:02, Antony Stone wrote:
> On Thursday 11 March 2021 at 14:03:23, Antony Stone wrote:
> > Hi.
> > I'm using MariaDB (via ODBC) to store realtime SIP peers with Asterisk 13
> > and 16.
> > In general it's all working fine, however there's something that puzzles
> > me:
> > If I connect to the Asterisk console and use the command "sip show peers"
> > I get a list of the peers including the last qualify time in the
> > "Status" column. The "Realtime" column tells me "Cached RT".
> > Some of my peers are in the same data centre as the server I'm querying,
> > and generally show a qualify time of 1ms; some are in another data centre
> > and have qualify times around 15ms.
> > However, if I go to my database server and ask "select * from sippeers" I
> > get the same list of peers but the "lastms" field is always zero. I had
> > expected this to show me the last qualify time in milliseconds for each
> > peer.
> > Am I just totally misinterpreting what "lastms" means in the table, or do
> > I need to do something else to get this value to reflect what Asterisk
> > itself will tell me?
> I have found a totally weird method of getting this working.
> I simply need to add another field to the sippeers database table.
This turns out not to be reliable - sometimes the numbers all go back to zero,
but at least it works some of the time, which I've never achieved before.
> Here's the table definition as I've been using it for months:
> CREATE TABLE `sippeers` (
> `id` int(11) NOT NULL AUTO_INCREMENT,
> `DDI` varchar(32) NOT NULL DEFAULT '',
> `name` varchar(80) NOT NULL DEFAULT '',
> `type` enum('user','peer','friend') NOT NULL DEFAULT 'peer',
> `fromuser` varchar(80) DEFAULT NULL,
> `defaultuser` varchar(80) NOT NULL DEFAULT '',
> `host` varchar(31) NOT NULL DEFAULT 'dynamic',
> `secret` varchar(80) DEFAULT NULL,
> `ipaddr` varchar(45) NOT NULL DEFAULT '',
> `port` mediumint(5) unsigned NOT NULL DEFAULT '0',
> `insecure` varchar(20) DEFAULT NULL,
> `context` varchar(50) DEFAULT NULL,
> `regseconds` int(11) NOT NULL DEFAULT '0',
> `fullcontact` varchar(80) NOT NULL DEFAULT '',
> `callbackextension` varchar(250) DEFAULT NULL,
> `regserver` varchar(100) NOT NULL DEFAULT '',
> `useragent` varchar(50) NOT NULL DEFAULT '',
> `lastms` int(11) NOT NULL DEFAULT '0',
> `qualify` char(3) DEFAULT 'no',
> PRIMARY KEY (`id`),
> KEY `name_2` (`name`)
> ) ENGINE=InnoDB AUTO_INCREMENT=13862017 DEFAULT CHARSET=utf8mb4
> If I do the following:
> alter table sippeers add column anything int after qualify;
> (I've called the column "anything" to emphasise that the name appears to be
> entirely unimportant)
> then all of a sudden, the lastms field contains useful and sensible values.
> Is this a bug, or is there something wrong with my original table
The next sentence is untrue.
The previous sentence is true.
Please reply to the list;
please *don't* CC me.
More information about the asterisk-users