注册失败后如何更改默认延迟300秒(Pjsua 2 Android)重试注册? [英] How to change default time delay 300 second ( Pjsua 2 Android) retry registration after registration failure?

查看:96
本文介绍了注册失败后如何更改默认延迟300秒(Pjsua 2 Android)重试注册?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在注册失败后更改默认的 pjsua2 重新注册.目前它已设置为 300 秒.我希望设置在注册失败后重试注册到大约 60 秒.

How can i change the default pjsua2 reregistration after registration failure. Currently it has been set to 300 second. I wish to set to retry registration after a registration failure to around 60 second.

我浏览了文档......但有些我无法在示例 android pjsua2 应用程序上实现它们.

i went through documentation ...but some how i am not able to implement them on sample android pjsua2 app.

unsigned timeoutSec 可选的注册间隔,单位为秒.

unsigned timeoutSec Optional interval for registration, in seconds.

如果值为零,将使用默认间隔(PJSUA_REG_INTERVAL,300 秒).

If the value is zero, default interval will be used (PJSUA_REG_INTERVAL, 300 seconds).

unsigned retryIntervalSec 指定自动注册重试间隔注册失败(包括传输问题),在第二个.

unsigned retryIntervalSec Specify interval of auto registration retry upon registration failure (including caused by transport problem), in second.

设置为 0 以禁用自动重新注册.请注意,如果传输失败导致注册重试,第一次重试将在 firstRetryIntervalSec 秒后完成.还请注意,间隔将稍微随机几秒钟(在 reg_retry_random_interval 中指定)以避免所有客户端同时重新注册.

Set to 0 to disable auto re-registration. Note that if the registration retry occurs because of transport failure, the first retry will be done after firstRetryIntervalSec seconds instead. Also note that the interval will be randomized slightly by some seconds (specified in reg_retry_random_interval) to avoid all clients re-registering at the same time.

另见 firstRetryIntervalSec 和 randomRetryIntervalSec 设置.

See also firstRetryIntervalSec and randomRetryIntervalSec settings.

默认:PJSUA_REG_RETRY_INTERVAL

Default: PJSUA_REG_RETRY_INTERVAL

链接:https://www.pjsip.org/docs/book-latest/html/reference.html

推荐答案

您可以使用波纹管代码,阅读注释和设置值取决于您的需要.

You can use bellow code, and read comments and set values depends on your needs.

             accCfg = new AccountConfig();

             /*
             * Specify interval of auto registration retry upon registration failure 
              (including
             * caused by transport problem), in second. Set to 0 to disable auto re- 
             registration.
             * Note that if the registration retry occurs because of transport 
             failure, the first
             * retry will be done after reg_first_retry_interval seconds instead. Also 
             note that
             * the interval will be randomized slightly by some seconds (specified in 
             reg_retry_
             * random_interval) to avoid all clients re-registering at the same time.
             * */
             accCfg.getRegConfig().setFirstRetryIntervalSec(3);
             accCfg.getRegConfig().setRetryIntervalSec(10);

            /*
             * This specifies maximum randomized value to be added/subtracted to/from 
             the
             * registration retry interval specified in reg_retry_interval and
             * reg_first_retry_interval, in second. This is useful to avoid all 
             clients
             * re-registering at the same time. For example, if the registration retry 
             interval
             * is set to 100 seconds and this is set to 10 seconds, the actual 
             registration retry
             * interval will be in the range of 90 to 110 seconds.
             */
            accCfg.getRegConfig().setRandomRetryIntervalSec(7);
            /*
             * Optional interval for registration, in seconds. If the value is zero, 
            default
             * interval will be used (PJSUA_REG_INTERVAL, 300 seconds).
             */
            accCfg.getRegConfig().setTimeoutSec(65);

            /*
             * Specify the number of seconds to refresh the client registration before 
             the
             * registration expires.
             * Default: PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH, 5 seconds
             */
            accCfg.getRegConfig().setDelayBeforeRefreshSec(10);

这篇关于注册失败后如何更改默认延迟300秒(Pjsua 2 Android)重试注册?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆