mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
cleaup of the TCP/TLS socket API:
1) rename 'struct server_args' to 'struct ast_tcptls_session_args', to follow coding guidelines 2) make ast_make_file_from_fd() static and rename it to something that indicates what it really is for (again coding guidelines) 3) rename address variables inside 'struct ast_tcptls_session_args' to be more descriptive (dare i say it... coding guidelines) 4) change ast_tcptls_client_start() to use the new 'remote_address' field of the session args for the destination of the connection, and use the 'local_address' field to bind() the socket to the proper source address, if one is supplied 5) in chan_sip, ensure that we pass in the PP address we are bound to when creating outbound (client) connections, so that our connections will appear from the correct address git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@151101 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/app.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/tcptls.h"
|
||||
#include "asterisk/astobj2.h"
|
||||
|
||||
static const char *app = "ExternalIVR";
|
||||
|
||||
@@ -419,7 +420,7 @@ static int app_exec(struct ast_channel *chan, void *data)
|
||||
}
|
||||
|
||||
if (!strncmp(app_args[0], "ivr://", 6)) {
|
||||
struct server_args ivr_desc = {
|
||||
struct ast_tcptls_session_args ivr_desc = {
|
||||
.accept_fd = -1,
|
||||
.name = "IVR",
|
||||
};
|
||||
@@ -438,9 +439,9 @@ static int app_exec(struct ast_channel *chan, void *data)
|
||||
}
|
||||
|
||||
ast_gethostbyname(hostname, &hp);
|
||||
ivr_desc.sin.sin_family = AF_INET;
|
||||
ivr_desc.sin.sin_port = htons(port);
|
||||
memmove(&ivr_desc.sin.sin_addr.s_addr, hp.hp.h_addr, hp.hp.h_length);
|
||||
ivr_desc.local_address.sin_family = AF_INET;
|
||||
ivr_desc.local_address.sin_port = htons(port);
|
||||
memcpy(&ivr_desc.local_address.sin_addr.s_addr, hp.hp.h_addr, hp.hp.h_length);
|
||||
ser = ast_tcptls_client_start(&ivr_desc);
|
||||
|
||||
if (!ser) {
|
||||
|
Reference in New Issue
Block a user