Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 216015) +++ channels/chan_sip.c (arbetskopia) @@ -24119,6 +24119,7 @@ struct ast_flags peerflags[2] = {{(0)}}; struct ast_flags mask[2] = {{(0)}}; char callback[256] = ""; + char regexpiry[8] = ""; struct sip_peer tmp_peer; const char *srvlookup = NULL; static int deprecation_warning = 1; @@ -24349,6 +24350,8 @@ ast_string_field_set(peer, regexten, v->value); } else if (!strcasecmp(v->name, "callbackextension")) { ast_copy_string(callback, v->value, sizeof(callback)); + } else if (!strcasecmp(v->name, "regexpiry")) { + ast_copy_string(regexpiry, v->value, sizeof(regexpiry)); } else if (!strcasecmp(v->name, "callcounter")) { peer->call_limit = ast_true(v->value) ? 999 : 0; } else if (!strcasecmp(v->name, "call-limit")) { @@ -24614,7 +24617,11 @@ ast_free_ha(oldha); if (!ast_strlen_zero(callback)) { /* build string from peer info */ char *reg_string; - if (asprintf(®_string, "%s?%s:%s@%s/%s", peer->name, peer->username, peer->remotesecret ? peer->remotesecret : peer->secret, peer->tohost, callback) < 0) { + int regexpiryval = default_expiry; + if (!ast_strlen_zero(regexpiry)) { + regexpiryval = atoi(regexpiry); + } + if (asprintf(®_string, "%s?%s:%s@%s/%s~%d", peer->name, peer->username, peer->remotesecret ? peer->remotesecret : peer->secret, peer->tohost, callback, regexpiryval) < 0) { ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); } else if (reg_string) { sip_register(reg_string, 0); /* XXX TODO: count in registry_count */