Skip to content

Commit

Permalink
qrouting: Improve PDD accuracy
Browse files Browse the repository at this point in the history
In case a 200 OK arrives without any 180/183 beforehand, we must also
take care to bump up the PDD accordingly, since the user on the UAC side
did not hear any audio feedback until the call was answered!
  • Loading branch information
liviuchircu committed Feb 12, 2020
1 parent d05cf2a commit 50f1719
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions modules/qrouting/qr_acc.c
Expand Up @@ -237,8 +237,8 @@ void qr_check_reply_tmcb(struct cell *cell, int type, struct tmcb_params *ps)
lock_get(trans_prop->prop_lock);

/* compute the PDD _at most once_ */
if (!(trans_prop->state & QR_TM_100RCVD)) {
trans_prop->state |= QR_TM_100RCVD;
if (!(trans_prop->state & QR_TM_180_RCVD)) {
trans_prop->state |= QR_TM_180_RCVD;
lock_release(trans_prop->prop_lock);

if ((pdd_tm = get_elapsed_time(trans_prop->invite, 'm')) < 0) {
Expand All @@ -257,6 +257,18 @@ void qr_check_reply_tmcb(struct cell *cell, int type, struct tmcb_params *ps)
LM_ERR("negative setup time\n");
return;
}

/* if there was no 180/183, count PDD using the 200 OK! */
lock_get(trans_prop->prop_lock);
if (!(trans_prop->state & QR_TM_180_RCVD)) {
trans_prop->state |= QR_TM_180_RCVD;
lock_release(trans_prop->prop_lock);

qr_add_pdd(trans_prop->gw, pdd_tm);
} else {
lock_release(trans_prop->prop_lock);
}

qr_add_setup(trans_prop->gw, st);

qr_add_200OK(trans_prop->gw);
Expand Down
2 changes: 1 addition & 1 deletion modules/qrouting/qr_acc.h
Expand Up @@ -29,7 +29,7 @@
#include "qr_stats.h"
#include "../drouting/dr_api.h"

#define QR_TM_100RCVD (1<<0)
#define QR_TM_180_RCVD (1<<0)

extern struct tm_binds tmb;
extern struct dlg_binds dlgcb;
Expand Down

0 comments on commit 50f1719

Please sign in to comment.