3 |
#include <rutil/DnsUtil.hxx> |
#include <rutil/DnsUtil.hxx> |
4 |
#include <resip/stack/SdpContents.hxx> |
#include <resip/stack/SdpContents.hxx> |
5 |
#include <resip/stack/ConnectionTerminated.hxx> |
#include <resip/stack/ConnectionTerminated.hxx> |
6 |
|
#include <resip/stack/Helper.hxx> |
7 |
#include <resip/dum/AppDialogSetFactory.hxx> |
#include <resip/dum/AppDialogSetFactory.hxx> |
8 |
#include <resip/dum/ClientAuthManager.hxx> |
#include <resip/dum/ClientAuthManager.hxx> |
9 |
#include <resip/dum/KeepAliveManager.hxx> |
#include <resip/dum/KeepAliveManager.hxx> |
31 |
|
|
32 |
#define RESIPROCATE_SUBSYSTEM Subsystem::TEST |
#define RESIPROCATE_SUBSYSTEM Subsystem::TEST |
33 |
|
|
34 |
|
static unsigned int MaxRegistrationRetryTime = 1800; // RFC5626 section 4.5 default |
35 |
|
static unsigned int BaseRegistrationRetryTimeAllFlowsFailed = 30; // RFC5626 section 4.5 default |
36 |
|
static unsigned int BaseRegistrationRetryTime = 90; // RFC5626 section 4.5 default |
37 |
|
|
38 |
class ClientAppDialogSetFactory : public AppDialogSetFactory |
class ClientAppDialogSetFactory : public AppDialogSetFactory |
39 |
{ |
{ |
40 |
public: |
public: |
90 |
mDum(new DialogUsageManager(mStack)), |
mDum(new DialogUsageManager(mStack)), |
91 |
mStackThread(mStack, mSelectInterruptor), |
mStackThread(mStack, mSelectInterruptor), |
92 |
mDumShutdownRequested(false), |
mDumShutdownRequested(false), |
93 |
mDumShutdown(false) |
mDumShutdown(false), |
94 |
|
mRegistrationRetryDelayTime(0) |
95 |
{ |
{ |
96 |
Log::initialize(mLogType, mLogLevel, argv[0]); |
Log::initialize(mLogType, mLogLevel, argv[0]); |
97 |
|
|
363 |
{ |
{ |
364 |
InfoLog(<< "onSuccess(ClientRegistrationHandle): msg=" << msg.brief()); |
InfoLog(<< "onSuccess(ClientRegistrationHandle): msg=" << msg.brief()); |
365 |
mRegHandle = h; |
mRegHandle = h; |
366 |
|
mRegistrationRetryDelayTime = 0; // reset |
367 |
} |
} |
368 |
|
|
369 |
void |
void |
383 |
int |
int |
384 |
BasicClientUserAgent::onRequestRetry(ClientRegistrationHandle h, int retryMinimum, const SipMessage& msg) |
BasicClientUserAgent::onRequestRetry(ClientRegistrationHandle h, int retryMinimum, const SipMessage& msg) |
385 |
{ |
{ |
|
InfoLog(<< "onRequestRetry(ClientRegistrationHandle): msg=" << msg.brief()); |
|
386 |
mRegHandle = h; |
mRegHandle = h; |
387 |
return -1; // Let Profile retry setting take effect |
|
388 |
|
if(mRegistrationRetryDelayTime == 0) |
389 |
|
{ |
390 |
|
mRegistrationRetryDelayTime = BaseRegistrationRetryTimeAllFlowsFailed; // We only have one flow in this test app |
391 |
|
} |
392 |
|
|
393 |
|
// Use back off procedures of RFC 5626 section 4.5 |
394 |
|
mRegistrationRetryDelayTime = resipMin(MaxRegistrationRetryTime, mRegistrationRetryDelayTime * 2); |
395 |
|
|
396 |
|
// return an evenly distributed random number between 50% and 100% of mRegistrationRetryDelayTime |
397 |
|
int retryTime = Helper::jitterValue(mRegistrationRetryDelayTime, 50, 100); |
398 |
|
InfoLog(<< "onRequestRetry(ClientRegistrationHandle): msg=" << msg.brief() << ", retryTime=" << retryTime); |
399 |
|
|
400 |
|
return retryTime; |
401 |
} |
} |
402 |
|
|
403 |
|
|