From f98f457727a7525b696c4cff88d0a3c808456c87 Mon Sep 17 00:00:00 2001 From: Olle Johansson Date: Mon, 30 Oct 2006 19:56:14 +0000 Subject: Change name of "contact" setting to "callback" which better reflects what it is to the person that configures asterisk. That we use it internally in the contact header is a totally different story. Still not convinced this is a good option. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46489 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 29 +++++++++++++++-------------- configs/sip.conf.sample | 8 ++++---- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 6544972a3..fbe7ed1d6 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1125,7 +1125,7 @@ struct sip_registry { AST_STRING_FIELD(hostname); /*!< Domain or host we register to */ AST_STRING_FIELD(secret); /*!< Password in clear text */ AST_STRING_FIELD(md5secret); /*!< Password in md5 */ - AST_STRING_FIELD(contact); /*!< Contact extension */ + AST_STRING_FIELD(callback); /*!< Contact extension */ AST_STRING_FIELD(random); ); int portno; /*!< Optional port override */ @@ -4413,7 +4413,7 @@ static int sip_register(char *value, int lineno) char username[256] = ""; char *hostname=NULL, *secret=NULL, *authuser=NULL; char *porta=NULL; - char *contact=NULL; + char *callback=NULL; if (!value) return -1; @@ -4435,11 +4435,11 @@ static int sip_register(char *value, int lineno) *authuser++ = '\0'; } /* split host[:port][/contact] */ - contact = strchr(hostname, '/'); - if (contact) - *contact++ = '\0'; - if (ast_strlen_zero(contact)) - contact = "s"; + callback = strchr(hostname, '/'); + if (callback) + *callback++ = '\0'; + if (ast_strlen_zero(callback)) + callback = "s"; porta = strchr(hostname, ':'); if (porta) { *porta++ = '\0'; @@ -4462,7 +4462,7 @@ static int sip_register(char *value, int lineno) regobjs++; ASTOBJ_INIT(reg); - ast_string_field_set(reg, contact, contact); + ast_string_field_set(reg, callback, callback); if (username) ast_string_field_set(reg, username, username); if (hostname) @@ -7156,7 +7156,8 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char * if (!ast_strlen_zero(r->username)) ast_string_field_set(p, username, r->username); /* Save extension in packet */ - ast_string_field_set(p, exten, r->contact); + if (!ast_strlen_zero(r->callback)) + ast_string_field_set(p, exten, r->callback); /* check which address we should use in our contact header @@ -15643,7 +15644,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str time_t regseconds = 0; struct ast_flags peerflags[2] = {{(0)}}; struct ast_flags mask[2] = {{(0)}}; - char contact[256] = ""; + char callback[256] = ""; if (!realtime) @@ -15779,8 +15780,8 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str ast_copy_string(peer->language, v->value, sizeof(peer->language)); } else if (!strcasecmp(v->name, "regexten")) { ast_copy_string(peer->regexten, v->value, sizeof(peer->regexten)); - } else if (!strcasecmp(v->name, "contact")) { - ast_copy_string(contact, v->value, sizeof(contact)); + } else if (!strcasecmp(v->name, "callbackextension")) { + ast_copy_string(callback, v->value, sizeof(callback)); } else if (!strcasecmp(v->name, "call-limit")) { peer->call_limit = atoi(v->value); if (peer->call_limit < 0) @@ -15873,10 +15874,10 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str reg_source_db(peer); ASTOBJ_UNMARK(peer); ast_free_ha(oldha); - if (!ast_strlen_zero(contact)) { /* build string from peer info */ + if (!ast_strlen_zero(callback)) { /* build string from peer info */ char *reg_string; - asprintf(®_string, "%s:%s@%s/%s", peer->username, peer->secret, peer->tohost, contact); + asprintf(®_string, "%s:%s@%s/%s", peer->username, peer->secret, peer->tohost, callback); if (reg_string) { sip_register(reg_string, 0); /* XXX TODO: count in registry_count */ free(reg_string); diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index cfbe1dda4..1d79cb303 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -192,10 +192,10 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; host is either a host name defined in DNS or the name of a section defined ; below. ; -; A similar effect can be achieved by adding a "contact" option in a peer section. +; A similar effect can be achieved by adding a "callbackextension" option in a peer section. ; this is equivalent to having the following line in the general section: ; -; register => username:secret@host/contact +; register => username:secret@host/callbackextension ; ; and more readable because you don't have to write the parameters in two places ; (note that the "port" is ignored - this is a bug that should be fixed). @@ -450,7 +450,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; sendrpid ; outboundproxy ; rfc2833compensate -; contact +; callbackextension ;[sip_proxy] ; For incoming calls only. Example: FWD (Free World Dialup) @@ -479,7 +479,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ;host=sip.provider1.com ;username=4015552299 ; how your provider knows you ;secret=youwillneverguessit -;contact=123 ; tell asterisk to register as username:secret@host/contact +;callbackextension=123 ; Register with this server and require calls coming back to this extension ;------------------------------------------------------------------------------ ; Definitions of locally connected SIP devices -- cgit v1.2.3