diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-04-11 16:01:25 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-04-11 16:01:25 +0000 |
commit | ad38a9955900ad10e036ab551f11281f5a7cee4c (patch) | |
tree | b7941704868830326b835a70e9746e418458ab41 /channels/chan_sip.c | |
parent | c0b547d3793bc8ef10352fb0074dffb5d790eb1d (diff) |
If someone sets the "useragent" option in sip.conf to be empty, then don't add
the User-Agent header at all. It is an optional header, anyway. Also, the bug
report says that some of Japan's SIP providers don't allow it for some weird
reason. (issue #9488, reported by makoto, fixed by me)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@61476 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index db2e4b700..f3d6edfc6 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4168,7 +4168,8 @@ static int respprep(struct sip_request *resp, struct sip_pvt *p, char *msg, stru add_header(resp, "To", ot); copy_header(resp, req, "Call-ID"); copy_header(resp, req, "CSeq"); - add_header(resp, "User-Agent", default_useragent); + if (!ast_strlen_zero(default_useragent)) + add_header(resp, "User-Agent", default_useragent); add_header(resp, "Allow", ALLOWED_METHODS); if (msg[0] == '2' && (p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER)) { /* For registration responses, we also need expiry and @@ -4281,7 +4282,8 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in copy_header(req, orig, "Call-ID"); add_header(req, "CSeq", tmp); - add_header(req, "User-Agent", default_useragent); + if (!ast_strlen_zero(default_useragent)) + add_header(req, "User-Agent", default_useragent); add_header(req, "Max-Forwards", DEFAULT_MAX_FORWARDS); if (p->rpid) @@ -5058,7 +5060,8 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho add_header(req, "Contact", p->our_contact); add_header(req, "Call-ID", p->callid); add_header(req, "CSeq", tmp); - add_header(req, "User-Agent", default_useragent); + if (!ast_strlen_zero(default_useragent)) + add_header(req, "User-Agent", default_useragent); add_header(req, "Max-Forwards", DEFAULT_MAX_FORWARDS); if (p->rpid) add_header(req, "Remote-Party-ID", p->rpid); @@ -5671,7 +5674,8 @@ static int transmit_register(struct sip_registry *r, int sipmethod, char *auth, add_header(&req, "To", to); add_header(&req, "Call-ID", p->callid); add_header(&req, "CSeq", tmp); - add_header(&req, "User-Agent", default_useragent); + if (!ast_strlen_zero(default_useragent)) + add_header(&req, "User-Agent", default_useragent); add_header(&req, "Max-Forwards", DEFAULT_MAX_FORWARDS); |