diff options
author | Doubango Telecom <github@doubango.org> | 2016-08-12 03:35:24 +0200 |
---|---|---|
committer | Doubango Telecom <github@doubango.org> | 2016-08-12 03:35:24 +0200 |
commit | 5b7ffef95a9f358fc3448bc71546d05363cae382 (patch) | |
tree | 2ab6be50ade04e39ef8dedc5ebafe23e895624ba | |
parent | a35d94460560cce23ddb54b055b8e4298ad77309 (diff) | |
download | doubango-5b7ffef95a9f358fc3448bc71546d05363cae382.zip doubango-5b7ffef95a9f358fc3448bc71546d05363cae382.tar.gz |
Forward display name from the stack to all SIP messages
-rwxr-xr-x | tinySIP/src/dialogs/tsip_dialog.c | 1 | ||||
-rwxr-xr-x | tinySIP/src/transports/tsip_transport.c | 2 | ||||
-rwxr-xr-x | tinySIP/src/tsip.c | 4 | ||||
-rwxr-xr-x | tinySIP/src/tsip_uri.c | 14 |
4 files changed, 15 insertions, 6 deletions
diff --git a/tinySIP/src/dialogs/tsip_dialog.c b/tinySIP/src/dialogs/tsip_dialog.c index 3f23f0e..b110d9e 100755 --- a/tinySIP/src/dialogs/tsip_dialog.c +++ b/tinySIP/src/dialogs/tsip_dialog.c @@ -277,6 +277,7 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m tsk_list_foreach(item, self->ss->caps) { tsk_params_add_param(&TSIP_HEADER(request->Contact)->params, TSK_PARAM(item->data)->name, TSK_PARAM(item->data)->value); } + tsk_strupdate(&(request->Contact->uri->display_name), TSIP_DIALOG_GET_STACK(self)->identity.display_name); } break; diff --git a/tinySIP/src/transports/tsip_transport.c b/tinySIP/src/transports/tsip_transport.c index feec0df..f807d51 100755 --- a/tinySIP/src/transports/tsip_transport.c +++ b/tinySIP/src/transports/tsip_transport.c @@ -248,7 +248,7 @@ int tsip_transport_msg_update_aor(tsip_transport_t* self, tsip_message_t *msg) /* === Host and port === */ if(msg->Contact && msg->Contact->uri) { - tsk_strupdate(&(msg->Contact->uri->scheme), self->scheme); + tsk_strupdate(&(msg->Contact->uri->scheme), self->scheme); msg->Contact->uri->host_type = TNET_SOCKET_TYPE_IS_IPV6(self->type) ? host_ipv6 : host_ipv4; /* for serializer ...who know? */ tsk_params_add_param(&msg->Contact->uri->params, "transport", self->protocol); diff --git a/tinySIP/src/tsip.c b/tinySIP/src/tsip.c index 1db31d3..3e1a9c6 100755 --- a/tinySIP/src/tsip.c +++ b/tinySIP/src/tsip.c @@ -89,6 +89,9 @@ static int __tsip_stack_set(tsip_stack_t *self, va_list* app) /* (const char*)NAME_STR */ const char* NAME_STR = va_arg(*app, const char*); tsk_strupdate(&self->identity.display_name, NAME_STR); + if (self->identity.impu) { + tsk_strupdate(&self->identity.impu->display_name, NAME_STR); + } break; } case tsip_pname_impu: @@ -98,6 +101,7 @@ static int __tsip_stack_set(tsip_stack_t *self, va_list* app) if(!tsk_strnullORempty(URI_STR)) { tsip_uri_t *uri = tsip_uri_parse(URI_STR, tsk_strlen(URI_STR)); if(uri) { + tsk_strupdate(&uri->display_name, self->identity.display_name); if(curr == tsip_pname_impu) { TSK_OBJECT_SAFE_FREE(self->identity.impu); self->identity.impu = uri; diff --git a/tinySIP/src/tsip_uri.c b/tinySIP/src/tsip_uri.c index 2fd3a0b..0120979 100755 --- a/tinySIP/src/tsip_uri.c +++ b/tinySIP/src/tsip_uri.c @@ -156,11 +156,15 @@ char* tsip_uri_tostring(const tsip_uri_t *uri, tsk_bool_t with_params, tsk_bool_ tsip_uri_t *tsip_uri_clone(const tsip_uri_t *uri, tsk_bool_t with_params, tsk_bool_t quote) { tsip_uri_t *newuri = tsk_null; - tsk_buffer_t *output = tsk_buffer_create_null(); - if((tsip_uri_serialize(uri, with_params, quote, output)) == 0) { - newuri = tsip_uri_parse(output->data, output->size); - } - TSK_OBJECT_SAFE_FREE(output); + if (uri) { + tsk_buffer_t *output = tsk_buffer_create_null(); + if((tsip_uri_serialize(uri, with_params, quote, output)) == 0) { + if ((newuri = tsip_uri_parse(output->data, output->size))) { + tsk_strupdate(&newuri->display_name, uri->display_name); + } + } + TSK_OBJECT_SAFE_FREE(output); + } return newuri; } |