[Home]

Summary:ASTERISK-24894: [patch] iax2_poke_noanswer expiration timer too short
Reporter:Y Ateya (yateya)Labels:
Date Opened:2015-03-19 11:37:53Date Closed:2015-04-10 07:37:32
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:13.2.0 Frequency of
Occurrence
Frequent
Related
Issues:
is related toASTERISK-22352 [patch] IAX2 custom qualify timer is not taken into account
Environment:Attachments:( 0) poke_noanswer_duration.diff
Description:POKE is used to check for peer availability, but it is not given enough time to retry in case of packet loss (if qualify time is high).

If qualify time is set to 10 seconds ({{qualify = 1000}} in iax.conf); peer will be UNREACHABLE due to single packet loss.

Here is the code snippet which start timer for poke_noasnwer

{code}
/* Speed up retransmission times for this qualify call */
iaxs[peer->callno]->pingtime = peer->maxms / 4 + 1;
iaxs[peer->callno]->peerpoke = peer;

if (peer->pokeexpire > -1) {
if (!AST_SCHED_DEL(sched, peer->pokeexpire)) {
peer->pokeexpire = -1;
peer_unref(peer);
}
}

/* Queue up a new task to handle no reply */
/* If the host is already unreachable then use the unreachable interval instead */
if (peer->lastms < 0)
peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_noanswer, peer_ref(peer));
else
peer->pokeexpire = iax2_sched_add(sched, DEFAULT_MAXMS * 2, iax2_poke_noanswer, peer_ref(peer));
{code}

In this code, if {{peer->lastms}} is more than 0 (i.e last ping or poke succeeded), {{iax2_poke_noanswer}} will be called if we didn't get POKE reply before {{DEFAULT_MAXMS * 2}} (i.e. 4 seconds).

ping time value {noformat}iaxs[peer->callno]->pingtime = peer->maxms / 4 + 1;{noformat} will be {{10000 / 4 + 1}} (i.e 2.5 seconds).

Since IAX frames are retried {{fr->retrytime = pvt->pingtime * 2;}}, so POKE frame will be retried every 5 seconds!

So a single POKE packet loss will make the peer UNREACHABLE.

To fix this, iax2_poke_noanswer timer shall be long enough allow for proper retries for POKE packet.
Comments:By: Rusty Newton (rnewton) 2015-03-23 09:14:56.856-0500

[~yateya] would you like to provide a patch to speed this along?

https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process

By: Y Ateya (yateya) 2015-03-23 12:21:54.596-0500

Patch to set timer with enough time to allow for multiple retries in case of POKE packet loss.

By: Y Ateya (yateya) 2015-03-23 12:26:51.876-0500

patch added.

By: Rusty Newton (rnewton) 2015-03-26 18:35:39.504-0500

Thanks [~yateya] , now you can get that patch on reviewboard.asterisk.org to speed it along even faster.

From: https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process
{quote}
At this time, it is appropriate to put your patch up for code review. The Asterisk project uses Review Board for peer review of patches - for instructions on how to submit your patch to Review Board, see [Review Board Usage|https://wiki.asterisk.org/wiki/display/AST/Review+Board+Usage].

All users who have signed a license contributor agreement have access to Review Board and are encouraged to participate in the peer review process. This includes not only review of your patch, but review of other patches as well.
{quote}