Index: chan_sip.c =================================================================== --- chan_sip.c (revision 207359) +++ chan_sip.c (working copy) @@ -631,6 +631,9 @@ #define SDP_MAX_RTPMAP_CODECS 32 /*!< Maximum number of codecs allowed in received SDP */ +#define DEFAULT_CALLBACK "s" /*!< Default callback extension when register=yes in peer configuration */ +#define DEFAULT_CALLBACKEXPIRY "3600" /*!< Dafault callback expiry when register=yes in peer configuration */ + /*! \brief Global jitterbuffer configuration - by default, jb is disabled */ static struct ast_jb_conf default_jbconf = { @@ -24036,6 +24039,7 @@ struct ast_flags peerflags[2] = {{(0)}}; struct ast_flags mask[2] = {{(0)}}; char callback[256] = ""; + char callbackexpiry[8] = ""; struct sip_peer tmp_peer; const char *srvlookup = NULL; static int deprecation_warning = 1; @@ -24266,6 +24270,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, "callbackexpiry")) { + ast_copy_string(callbackexpiry, v->value, sizeof(callbackexpiry)); } else if (!strcasecmp(v->name, "callcounter")) { peer->call_limit = ast_true(v->value) ? 999 : 0; } else if (!strcasecmp(v->name, "call-limit")) { @@ -24526,9 +24532,11 @@ peer->the_mark = 0; ast_free_ha(oldha); - if (!ast_strlen_zero(callback)) { /* build string from peer info */ + if (!ast_strlen_zero(callback) || !ast_strlen_zero(callbackexpiry)) { /* build string from peer info */ + if (ast_strlen_zero(callback)) {ast_copy_string(callback, DEFAULT_CALLBACK, sizeof(callback));} + if (ast_strlen_zero(callbackexpiry)) {ast_copy_string(callbackexpiry, DEFAULT_CALLBACKEXPIRY, sizeof(callbackexpiry));} 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) { + if (asprintf(®_string, "%s?%s:%s@%s/%s~%s", peer->name, peer->username, peer->remotesecret ? peer->remotesecret : peer->secret, peer->tohost, callback, callbackexpiry) < 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 */