mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
Change how we set the local and remote address.
The code will now only change the address and port. It will not overwrite any other values. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187773 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -312,7 +312,9 @@ struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name, struct sc
|
||||
return NULL;
|
||||
}
|
||||
instance->engine = engine;
|
||||
memcpy(&instance->local_address, sin, sizeof(instance->local_address));
|
||||
instance->local_address.sin_family = AF_INET;
|
||||
instance->local_address.sin_addr = sin->sin_addr;
|
||||
instance->remote_address.sin_family = AF_INET;
|
||||
|
||||
ast_debug(1, "Using engine '%s' for RTP instance '%p'\n", engine->name, instance);
|
||||
|
||||
@@ -350,20 +352,22 @@ struct ast_frame *ast_rtp_instance_read(struct ast_rtp_instance *instance, int r
|
||||
|
||||
int ast_rtp_instance_set_local_address(struct ast_rtp_instance *instance, struct sockaddr_in *address)
|
||||
{
|
||||
memcpy(&instance->local_address, address, sizeof(instance->local_address));
|
||||
instance->local_address.sin_addr = address->sin_addr;
|
||||
instance->local_address.sin_port = address->sin_port;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, struct sockaddr_in *address)
|
||||
{
|
||||
if (&instance->remote_address != address) {
|
||||
memcpy(&instance->remote_address, address, sizeof(instance->remote_address));
|
||||
instance->remote_address.sin_addr = address->sin_addr;
|
||||
instance->remote_address.sin_port = address->sin_port;
|
||||
}
|
||||
|
||||
/* moo */
|
||||
|
||||
if (instance->engine->remote_address_set) {
|
||||
instance->engine->remote_address_set(instance, address);
|
||||
instance->engine->remote_address_set(instance, &instance->remote_address);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user