mirror of
https://github.com/jambonz/sbc-inbound.git
synced 2026-07-24 21:01:49 +00:00
write stat for db lookup
This commit is contained in:
+6
-2
@@ -2,7 +2,7 @@ const debug = require('debug')('jambonz:sbc-inbound');
|
||||
const assert = require('assert');
|
||||
const Emitter = require('events');
|
||||
const parseUri = require('drachtio-srf').parseUri;
|
||||
const {nudgeCallCounts} = require('./utils');
|
||||
const {nudgeCallCounts, roundTripTime} = require('./utils');
|
||||
const msProxyIps = process.env.MS_TEAMS_SIP_PROXY_IPS ?
|
||||
process.env.MS_TEAMS_SIP_PROXY_IPS.split(',').map((i) => i.trim()) :
|
||||
[];
|
||||
@@ -135,7 +135,8 @@ module.exports = function(srf, logger) {
|
||||
const identifyAccount = async(req, res, next) => {
|
||||
try {
|
||||
const {siprec, callId} = req.locals;
|
||||
const {getSPForAccount, wasOriginatedFromCarrier, getApplicationForDidAndCarrier} = req.srf.locals;
|
||||
const {getSPForAccount, wasOriginatedFromCarrier, getApplicationForDidAndCarrier, stats} = req.srf.locals;
|
||||
const startAt = process.hrtime();
|
||||
const {
|
||||
fromCarrier,
|
||||
gateway,
|
||||
@@ -144,6 +145,9 @@ module.exports = function(srf, logger) {
|
||||
service_provider_sid,
|
||||
account
|
||||
} = await wasOriginatedFromCarrier(req);
|
||||
const rtt = roundTripTime(startAt);
|
||||
stats.histogram('app.mysql.response_time', rtt, [
|
||||
'query:wasOriginatedFromCarrier', 'app:sbc-inbound']);
|
||||
/**
|
||||
* calls come from 3 sources:
|
||||
* (1) A carrier
|
||||
|
||||
Reference in New Issue
Block a user