aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-06-09 21:11:30 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-06-09 21:11:30 +0000
commit6f23c71d755123290c37d384dd7424b7ad11879c (patch)
treefcf2b0545a0b06bbe9e8c8773806af66fb8faaaf
parent644f0e446bb7e7228ddf5aa77c1344d21f23f3cc (diff)
add 'rtignoreexpire' option to allow Realtime addresses to be used regardless of expiration time (bug #4362)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5889 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xchannels/chan_iax2.c5
-rwxr-xr-xchannels/chan_sip.c11
-rwxr-xr-xconfigs/iax.conf.sample4
-rwxr-xr-xconfigs/sip.conf.sample7
4 files changed, 20 insertions, 7 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 8d727b2d6..17d1f347c 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -239,6 +239,7 @@ struct iax2_context {
#define IAX_RTNOUPDATE (1 << 18) /* Don't send a realtime update */
#define IAX_RTAUTOCLEAR (1 << 19) /* erase me on expire */
#define IAX_FORCEJITTERBUF (1 << 20) /* Force jitterbuffer, even when bridged to a channel that can take jitter */
+#define IAX_RTIGNOREREGEXPIRE (1 << 21)
static int global_rtautoclear = 120;
@@ -2579,7 +2580,7 @@ static struct iax2_peer *realtime_peer(const char *peername)
ast_set_flag(peer, IAX_TEMPONLY);
}
- if (dynamic) {
+ if (!ast_test_flag(&globalflags, IAX_RTIGNOREREGEXPIRE) && dynamic) {
time(&nowtime);
if ((nowtime - regseconds) > IAX_DEFAULT_REG_EXPIRE) {
memset(&peer->addr, 0, sizeof(peer->addr));
@@ -8371,6 +8372,8 @@ static int set_config(char *config_file, int reload)
ast_set2_flag((&globalflags), ast_true(v->value), IAX_MESSAGEDETAIL);
else if (!strcasecmp(v->name, "rtcachefriends"))
ast_set2_flag((&globalflags), ast_true(v->value), IAX_RTCACHEFRIENDS);
+ else if (!strcasecmp(v->name, "rtignoreregexpire"))
+ ast_set2_flag((&globalflags), ast_true(v->value), IAX_RTIGNOREREGEXPIRE);
else if (!strcasecmp(v->name, "rtnoupdate"))
ast_set2_flag((&globalflags), ast_true(v->value), IAX_RTNOUPDATE);
else if (!strcasecmp(v->name, "rtautoclear")) {
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 84b23b1ff..7832542e7 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -400,6 +400,7 @@ struct sip_auth {
#define SIP_PAGE2_RTCACHEFRIENDS (1 << 0)
#define SIP_PAGE2_RTNOUPDATE (1 << 1)
#define SIP_PAGE2_RTAUTOCLEAR (1 << 2)
+#define SIP_PAGE2_RTIGNOREREGEXPIRE (1 << 3)
static int global_rtautoclear = 120;
@@ -5181,7 +5182,7 @@ static int parse_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_req
p->expire = -1;
pvt->expiry = expiry;
snprintf(data, sizeof(data), "%s:%d:%d:%s:%s", ast_inet_ntoa(iabuf, sizeof(iabuf), p->addr.sin_addr), ntohs(p->addr.sin_port), expiry, p->username, p->fullcontact);
- if (!ast_test_flag(p, SIP_REALTIME))
+ if (!(ast_test_flag(p, SIP_REALTIME) && ast_test_flag((&p->flags_page2), SIP_PAGE2_RTCACHEFRIENDS)))
ast_db_put("SIP/Registry", p->name, data);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Registered\r\n", p->name);
if (inaddrcmp(&p->addr, &oldsin)) {
@@ -10453,9 +10454,9 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
peer->auth = add_realm_authentication(peer->auth, v->value, v->lineno);
else if (!strcasecmp(v->name, "callerid")) {
ast_callerid_split(v->value, peer->cid_name, sizeof(peer->cid_name), peer->cid_num, sizeof(peer->cid_num));
- } else if (!strcasecmp(v->name, "context"))
+ } else if (!strcasecmp(v->name, "context")) {
ast_copy_string(peer->context, v->value, sizeof(peer->context));
- else if (!strcasecmp(v->name, "fromdomain"))
+ } else if (!strcasecmp(v->name, "fromdomain"))
ast_copy_string(peer->fromdomain, v->value, sizeof(peer->fromdomain));
else if (!strcasecmp(v->name, "usereqphone"))
ast_set2_flag(peer, ast_true(v->value), SIP_USEREQPHONE);
@@ -10593,7 +10594,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int
*/
v=v->next;
}
- if (realtime && ast_test_flag(peer, SIP_DYNAMIC)) {
+ if (realtime && !ast_test_flag((&global_flags_page2), SIP_PAGE2_RTIGNOREREGEXPIRE) && ast_test_flag(peer, SIP_DYNAMIC)) {
time_t nowtime;
time(&nowtime);
@@ -10707,6 +10708,8 @@ static int reload_config(void)
ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_RTCACHEFRIENDS);
} else if (!strcasecmp(v->name, "rtnoupdate")) {
ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_RTNOUPDATE);
+ } else if (!strcasecmp(v->name, "rtignoreregexpire")) {
+ ast_set2_flag((&global_flags_page2), ast_true(v->value), SIP_PAGE2_RTIGNOREREGEXPIRE);
} else if (!strcasecmp(v->name, "rtautoclear")) {
int i = atoi(v->value);
if (i > 0)
diff --git a/configs/iax.conf.sample b/configs/iax.conf.sample
index 5cf8a5be4..f70579cd9 100755
--- a/configs/iax.conf.sample
+++ b/configs/iax.conf.sample
@@ -264,6 +264,10 @@ autokill=yes
;
;rtautoclear=yes
;
+;rtignoreexpire=yes ; when reading a peer from Realtime, if the peer's registration
+ ; has expired based on its registration interval, used the stored
+ ; address information regardless
+
; Guest sections for unauthenticated connection attempts. Just
; specify an empty secret, or provide no secret section.
;
diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample
index c852e1ccb..782d5991f 100755
--- a/configs/sip.conf.sample
+++ b/configs/sip.conf.sample
@@ -174,8 +174,11 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
; as if it had just registered when the registration expires
; the friend will vanish from the configuration until requested
; again. If set to an integer, friends expire
- ; within this number of seconds instead of the
- ; same as the registration interval
+ ; within this number of seconds instead of the
+ ; same as the registration interval
+;rtignoreexpire=yes ; when reading a peer from Realtime, if the peer's registration
+ ; has expired based on its registration interval, used the stored
+ ; address information regardless
[authentication]