diff options
author | Mark Spencer <markster@digium.com> | 2005-02-02 18:37:36 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2005-02-02 18:37:36 +0000 |
commit | 746dbf2c536ed5b8a528f3e5d46657fe105354b0 (patch) | |
tree | 8c5daf08a0cf9940047f08797163b65824d5412b /channels/chan_sip.c | |
parent | d9020bb6fc08214cfba63a5e9683460ea13a82fe (diff) |
Make sure we always transmit the same from line (bug #3492)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4952 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rwxr-xr-x | channels/chan_sip.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index b1a02a2f8..3f8c6c6c0 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -345,7 +345,8 @@ static struct sip_pvt { char useragent[256]; /* User agent in SIP request */ char context[AST_MAX_EXTENSION]; /* Context for this call */ char fromdomain[AST_MAX_EXTENSION]; /* Domain to show in the from field */ - char fromuser[AST_MAX_EXTENSION]; /* Domain to show in the user field */ + char fromuser[AST_MAX_EXTENSION]; /* User to show in the user field */ + char fromname[AST_MAX_EXTENSION]; /* Name to show in the user field */ char tohost[AST_MAX_EXTENSION]; /* Host we should put in the "to" field */ char language[MAX_LANGUAGE]; /* Default language for this call */ char musicclass[MAX_LANGUAGE]; /* Music on Hold class */ @@ -3757,6 +3758,14 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, char *cmd, c /* Allow user to be overridden */ if (!ast_strlen_zero(p->fromuser)) l = p->fromuser; + else /* Save for any further attempts */ + strncpy(p->fromuser, l, sizeof(p->fromuser) - 1); + + /* Allow user to be overridden */ + if (!ast_strlen_zero(p->fromname)) + n = p->fromname; + else /* Save for any further attempts */ + strncpy(p->fromname, n, sizeof(p->fromname) - 1); if ((ourport != 5060) && ast_strlen_zero(p->fromdomain)) snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=as%08x", n, l, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain, ourport, p->tag); @@ -6644,7 +6653,8 @@ static int sip_no_debug(int fd, int argc, char *argv[]) static int reply_digest(struct sip_pvt *p, struct sip_request *req, char *header, char *respheader, char *digest, int digest_len); /*--- do_register_auth: Authenticate for outbound registration ---*/ -static int do_register_auth(struct sip_pvt *p, struct sip_request *req, char *header, char *respheader) { +static int do_register_auth(struct sip_pvt *p, struct sip_request *req, char *header, char *respheader) +{ char digest[1024]; p->authtries++; memset(digest,0,sizeof(digest)); @@ -6662,7 +6672,8 @@ static int do_register_auth(struct sip_pvt *p, struct sip_request *req, char *he } /*--- do_proxy_auth: Add authentication on outbound SIP packet ---*/ -static int do_proxy_auth(struct sip_pvt *p, struct sip_request *req, char *header, char *respheader, char *msg, int init) { +static int do_proxy_auth(struct sip_pvt *p, struct sip_request *req, char *header, char *respheader, char *msg, int init) +{ char digest[1024]; p->authtries++; memset(digest,0,sizeof(digest)); |