summaryrefslogtreecommitdiff
path: root/res/res_pjsip/pjsip_global_headers.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-03-11 15:18:55 +0000
committerRichard Mudgett <rmudgett@digium.com>2015-03-11 15:18:55 +0000
commit737064bfa4c6edb651c7d8d1efac780086cb9f6b (patch)
treeac935c2641421c3a61e8ce728e8dfe18ad58ee7e /res/res_pjsip/pjsip_global_headers.c
parentbc357c1d7efd2fc7fce8c21fd472f437a9f6a7df (diff)
res_pjsip: Fixed invalid empty Server and User-Agent SIP headers.
Setting pjsip.conf useragent to an empty string results in an empty SIP header being sent. * Made not add an empty SIP header item to the global SIP headers list. Review: https://reviewboard.asterisk.org/r/4467/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip/pjsip_global_headers.c')
-rw-r--r--res/res_pjsip/pjsip_global_headers.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/res/res_pjsip/pjsip_global_headers.c b/res/res_pjsip/pjsip_global_headers.c
index 057b0c3d0..735008dcc 100644
--- a/res/res_pjsip/pjsip_global_headers.c
+++ b/res/res_pjsip/pjsip_global_headers.c
@@ -121,18 +121,22 @@ static void remove_header(struct header_list *headers, const char *to_remove)
static int add_header(struct header_list *headers, const char *name, const char *value, int replace)
{
- struct header *to_add;
+ struct header *to_add = NULL;
- to_add = alloc_header(name, value);
- if (!to_add) {
- return -1;
+ if (!ast_strlen_zero(value)) {
+ to_add = alloc_header(name, value);
+ if (!to_add) {
+ return -1;
+ }
}
AST_RWLIST_WRLOCK(headers);
if (replace) {
remove_header(headers, name);
}
- AST_LIST_INSERT_TAIL(headers, to_add, next);
+ if (to_add) {
+ AST_LIST_INSERT_TAIL(headers, to_add, next);
+ }
AST_RWLIST_UNLOCK(headers);
return 0;