[asterisk-dev] Timers in pjsip
Steve Murphy
murf at parsetree.com
Wed May 3 14:19:49 CDT 2017
Josh--
Many thanks!
I see:
else
msec_time = (1 << (tsx->retransmit_count)) * pjsip_cfg()->tsx.t1;
which doubles the waiting time each try....
and in the UAC code, with a small addition, I get:
if (msec_time > pjsip_cfg()->tsx.t2 &&
tsx->method.id != PJSIP_REGISTER_METHOD &&
tsx->method.id != PJSIP_INVITE_METHOD)
{
msec_time = pjsip_cfg()->tsx.t2;
}
which caps the wait time to 4 sec. for anything but invite,
and *now*, including register.
Which should give me the effect I'm seeking. (avg ~4.5/minute)
I've tested it out, and it works fine. I see the initial xmit, retries
at .5, 1, 2, 4, 8, 16, for a total of 31.5 sec, followed with a 61
second gap, and the process repeats itself. Total cycle time is
92.5 sec. 7 tries in 92.5 sec yields an avg of 4.5/minute.
Again, thanks!
murf
On Tue, May 2, 2017 at 4:17 PM, Joshua Colp <jcolp at digium.com> wrote:
> On Tue, May 2, 2017, at 07:07 PM, Steve Murphy wrote:
>
> <snip>
>
> >
> > I notice that pjsip in asterisk seems to follow the same pattern of
> > retries:
> > first, a half-second wait, then a retry, then a full second wait, then
> > a retry, then a 2 second wait, and several 4-second waits until half a
> > minute or so,
> > and after 60 seconds, (61 seconds?) the cycle starts over.
> >
> > I have spent hours looking for this algorithm first in the asterisk code,
> > then in pjproject.
> > The docs for pjproject say:
> >
> > (section 8.1.2: Timers and Retransmissions)
> >
> > "Application can change the interval value of timers only on a
> > global
> > basis
> > (perhaps even only during compilation)."
> >
> > Any hints as to where this code is located?
>
> The code itself is in the transaction layer of PJSIP at
> pjsip/src/pjsip/sip_transaction.c - specifically the
> tsx_resched_retransmission function.
>
> --
> Joshua Colp
> Digium, Inc. | Senior Software Developer
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - US
> Check us out at: www.digium.com & www.asterisk.org
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
--
Steve Murphy
ParseTree Corporation
57 Lane 17
Cody, WY 82414
✉ murf at parsetree dot com
☎ 307-899-0510
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20170503/a5797bcf/attachment.html>
More information about the asterisk-dev
mailing list