summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-12-19 17:13:53 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-12-19 17:13:53 +0000
commit3ccd5dee18dfbd64b01cba68790721680477df19 (patch)
tree00e9575547264fcdc6149a836bf317959dd982fa
parentc061f634da53715c0aa17a450c1177a14fdf4713 (diff)
udptl: Dead code elimination. ast_udptl_bridge was not used.
Removing dead code starting with ast_udptl_bridge() eliminated the code in this change. Note: This code has actually been dead since Asterisk v1.4 when it was first put in. Review: https://reviewboard.asterisk.org/r/3079/ ........ Merged revisions 404354 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404355 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--addons/chan_ooh323.c47
-rw-r--r--channels/chan_sip.c76
-rw-r--r--include/asterisk/udptl.h16
-rw-r--r--main/udptl.c160
4 files changed, 0 insertions, 299 deletions
diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c
index 52c0404a5..ca81f9bfd 100644
--- a/addons/chan_ooh323.c
+++ b/addons/chan_ooh323.c
@@ -92,9 +92,6 @@ static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance
static void ooh323_get_codec(struct ast_channel *chan, struct ast_format_cap *result);
void setup_rtp_remote(ooCallData *call, const char *remoteIp, int remotePort);
-static struct ast_udptl *ooh323_get_udptl_peer(struct ast_channel *chan);
-static int ooh323_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl);
-
static void print_codec_to_cli(int fd, struct ast_codec_pref *pref);
struct ooh323_peer *find_friend(const char *name, int port);
@@ -130,13 +127,6 @@ static struct ast_rtp_glue ooh323_rtp = {
.get_codec = ooh323_get_codec,
};
-static struct ast_udptl_protocol ooh323_udptl = {
- .type = "H323",
- .get_udptl_info = ooh323_get_udptl_peer,
- .set_udptl_peer = ooh323_set_udptl_peer,
-};
-
-
struct ooh323_user;
@@ -3796,7 +3786,6 @@ static int load_module(void)
return 0;
}
ast_rtp_glue_register(&ooh323_rtp);
- ast_udptl_proto_register(&ooh323_udptl);
ast_cli_register_multiple(cli_ooh323, sizeof(cli_ooh323) / sizeof(struct ast_cli_entry));
/* fire up the H.323 Endpoint */
@@ -4233,7 +4222,6 @@ static int unload_module(void)
/* First, take us out of the channel loop */
ast_cli_unregister_multiple(cli_ooh323, sizeof(cli_ooh323) / sizeof(struct ast_cli_entry));
ast_rtp_glue_unregister(&ooh323_rtp);
- ast_udptl_proto_unregister(&ooh323_udptl);
ast_channel_unregister(&ooh323_tech);
#if 0
ast_unregister_atexit(&ast_ooh323c_exit);
@@ -4785,41 +4773,6 @@ void close_rtp_connection(ooCallData *call)
udptl handling functions
*/
-static struct ast_udptl *ooh323_get_udptl_peer(struct ast_channel *chan)
-{
- struct ooh323_pvt *p;
- struct ast_udptl *udptl = NULL;
-
- p = ast_channel_tech_pvt(chan);
- if (!p)
- return NULL;
-
- ast_mutex_lock(&p->lock);
- if (p->udptl)
- udptl = p->udptl;
- ast_mutex_unlock(&p->lock);
- return udptl;
-}
-
-static int ooh323_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl)
-{
- struct ooh323_pvt *p;
-
- p = ast_channel_tech_pvt(chan);
- if (!p)
- return -1;
- ast_mutex_lock(&p->lock);
-
- if (udptl) {
- ast_udptl_get_peer(udptl, &p->udptlredirip);
- } else
- memset(&p->udptlredirip, 0, sizeof(p->udptlredirip));
-
- ast_mutex_unlock(&p->lock);
- /* free(callToken); */
- return 0;
-}
-
void setup_udptl_connection(ooCallData *call, const char *remoteIp,
int remotePort)
{
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8b458ae5f..c9b93b9dc 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1535,8 +1535,6 @@ static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struc
/*------ T38 Support --------- */
static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, int retrans);
-static struct ast_udptl *sip_get_udptl_peer(struct ast_channel *chan);
-static int sip_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl);
static void change_t38_state(struct sip_pvt *p, int state);
/*------ Session-Timers functions --------- */
@@ -3571,13 +3569,6 @@ static struct sip_registry *registry_addref(struct sip_registry *reg, char *tag)
return ASTOBJ_REF(reg); /* Add pointer to registry in packet */
}
-/*! \brief Interface structure with callbacks used to connect to UDPTL module*/
-static struct ast_udptl_protocol sip_udptl = {
- .type = "SIP",
- .get_udptl_info = sip_get_udptl_peer,
- .set_udptl_peer = sip_set_udptl_peer,
-};
-
static void append_history_full(struct sip_pvt *p, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
@@ -32457,67 +32448,6 @@ static int reload_config(enum channelreloadreason reason)
return 0;
}
-static struct ast_udptl *sip_get_udptl_peer(struct ast_channel *chan)
-{
- struct sip_pvt *p;
- struct ast_udptl *udptl = NULL;
-
- p = ast_channel_tech_pvt(chan);
- if (!p) {
- return NULL;
- }
-
- sip_pvt_lock(p);
- if (p->udptl && ast_test_flag(&p->flags[0], SIP_DIRECT_MEDIA)) {
- udptl = p->udptl;
- }
- sip_pvt_unlock(p);
- return udptl;
-}
-
-static int sip_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl)
-{
- struct sip_pvt *p;
-
- /* Lock the channel and the private safely. */
- ast_channel_lock(chan);
- p = ast_channel_tech_pvt(chan);
- if (!p) {
- ast_channel_unlock(chan);
- return -1;
- }
- sip_pvt_lock(p);
- if (p->owner != chan) {
- /* I suppose it could be argued that if this happens it is a bug. */
- ast_debug(1, "The private is not owned by channel %s anymore.\n", ast_channel_name(chan));
- sip_pvt_unlock(p);
- ast_channel_unlock(chan);
- return 0;
- }
-
- if (udptl) {
- ast_udptl_get_peer(udptl, &p->udptlredirip);
- } else {
- memset(&p->udptlredirip, 0, sizeof(p->udptlredirip));
- }
- if (!ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
- if (!p->pendinginvite) {
- ast_debug(3, "Sending reinvite on SIP '%s' - It's UDPTL soon redirected to IP %s\n",
- p->callid, ast_sockaddr_stringify(udptl ? &p->udptlredirip : &p->ourip));
- transmit_reinvite_with_sdp(p, TRUE, FALSE);
- } else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
- ast_debug(3, "Deferring reinvite on SIP '%s' - It's UDPTL will be redirected to IP %s\n",
- p->callid, ast_sockaddr_stringify(udptl ? &p->udptlredirip : &p->ourip));
- ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
- }
- }
- /* Reset lastrtprx timer */
- p->lastrtprx = p->lastrtptx = time(NULL);
- sip_pvt_unlock(p);
- ast_channel_unlock(chan);
- return 0;
-}
-
static int sip_allow_anyrtp_remote(struct ast_channel *chan1, struct ast_rtp_instance *instance, const char *rtptype)
{
struct sip_pvt *p;
@@ -34511,9 +34441,6 @@ static int load_module(void)
/* Register all CLI functions for SIP */
ast_cli_register_multiple(cli_sip, ARRAY_LEN(cli_sip));
- /* Tell the UDPTL subdriver that we're here */
- ast_udptl_proto_register(&sip_udptl);
-
/* Tell the RTP engine about our RTP glue */
ast_rtp_glue_register(&sip_rtp_glue);
@@ -34644,9 +34571,6 @@ static int unload_module(void)
/* Unregister CLI commands */
ast_cli_unregister_multiple(cli_sip, ARRAY_LEN(cli_sip));
- /* Disconnect from UDPTL */
- ast_udptl_proto_unregister(&sip_udptl);
-
/* Disconnect from RTP engine */
ast_rtp_glue_unregister(&sip_rtp_glue);
diff --git a/include/asterisk/udptl.h b/include/asterisk/udptl.h
index 337762c62..456a5adbc 100644
--- a/include/asterisk/udptl.h
+++ b/include/asterisk/udptl.h
@@ -44,15 +44,6 @@ enum ast_t38_ec_modes {
extern "C" {
#endif
-struct ast_udptl_protocol {
- /*! \brief Get UDPTL struct, or NULL if unwilling to transfer */
- struct ast_udptl *(*get_udptl_info)(struct ast_channel *chan);
- /*! \brief Set UDPTL peer */
- int (* const set_udptl_peer)(struct ast_channel *chan, struct ast_udptl *peer);
- const char * const type;
- AST_RWLIST_ENTRY(ast_udptl_protocol) list;
-};
-
struct ast_udptl;
typedef int (*ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data);
@@ -133,13 +124,6 @@ unsigned int ast_udptl_get_far_max_ifp(struct ast_udptl *udptl);
void ast_udptl_setnat(struct ast_udptl *udptl, int nat);
-int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
- struct ast_frame **fo, struct ast_channel **rc);
-
-int ast_udptl_proto_register(struct ast_udptl_protocol *proto);
-
-void ast_udptl_proto_unregister(struct ast_udptl_protocol *proto);
-
void ast_udptl_stop(struct ast_udptl *udptl);
void ast_udptl_init(void);
diff --git a/main/udptl.c b/main/udptl.c
index fa9171742..dac350e3b 100644
--- a/main/udptl.c
+++ b/main/udptl.c
@@ -218,8 +218,6 @@ struct ast_udptl {
udptl_fec_rx_buffer_t rx[UDPTL_BUF_MASK + 1];
};
-static AST_RWLIST_HEAD_STATIC(protos, ast_udptl_protocol);
-
struct udptl_global_options {
unsigned int start; /*< The UDPTL start port */
unsigned int end; /*< The UDPTL end port */
@@ -1186,164 +1184,6 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f)
return 0;
}
-void ast_udptl_proto_unregister(struct ast_udptl_protocol *proto)
-{
- AST_RWLIST_WRLOCK(&protos);
- AST_RWLIST_REMOVE(&protos, proto, list);
- AST_RWLIST_UNLOCK(&protos);
-}
-
-int ast_udptl_proto_register(struct ast_udptl_protocol *proto)
-{
- struct ast_udptl_protocol *cur;
-
- AST_RWLIST_WRLOCK(&protos);
- AST_RWLIST_TRAVERSE(&protos, cur, list) {
- if (cur->type == proto->type) {
- ast_log(LOG_WARNING, "Tried to register same protocol '%s' twice\n", cur->type);
- AST_RWLIST_UNLOCK(&protos);
- return -1;
- }
- }
- AST_RWLIST_INSERT_TAIL(&protos, proto, list);
- AST_RWLIST_UNLOCK(&protos);
- return 0;
-}
-
-static struct ast_udptl_protocol *get_proto(struct ast_channel *chan)
-{
- struct ast_udptl_protocol *cur = NULL;
-
- AST_RWLIST_RDLOCK(&protos);
- AST_RWLIST_TRAVERSE(&protos, cur, list) {
- if (cur->type == ast_channel_tech(chan)->type)
- break;
- }
- AST_RWLIST_UNLOCK(&protos);
-
- return cur;
-}
-
-int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc)
-{
- struct ast_frame *f;
- struct ast_channel *who;
- struct ast_channel *cs[3];
- struct ast_udptl *p0;
- struct ast_udptl *p1;
- struct ast_udptl_protocol *pr0;
- struct ast_udptl_protocol *pr1;
- struct ast_sockaddr ac0;
- struct ast_sockaddr ac1;
- struct ast_sockaddr t0;
- struct ast_sockaddr t1;
- void *pvt0;
- void *pvt1;
- int to;
-
- ast_channel_lock_both(c0, c1);
- pr0 = get_proto(c0);
- pr1 = get_proto(c1);
- if (!pr0) {
- ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", ast_channel_name(c0));
- ast_channel_unlock(c0);
- ast_channel_unlock(c1);
- return -1;
- }
- if (!pr1) {
- ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", ast_channel_name(c1));
- ast_channel_unlock(c0);
- ast_channel_unlock(c1);
- return -1;
- }
- pvt0 = ast_channel_tech_pvt(c0);
- pvt1 = ast_channel_tech_pvt(c1);
- p0 = pr0->get_udptl_info(c0);
- p1 = pr1->get_udptl_info(c1);
- if (!p0 || !p1) {
- /* Somebody doesn't want to play... */
- ast_channel_unlock(c0);
- ast_channel_unlock(c1);
- return -2;
- }
- if (pr0->set_udptl_peer(c0, p1)) {
- ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", ast_channel_name(c0), ast_channel_name(c1));
- memset(&ac1, 0, sizeof(ac1));
- } else {
- /* Store UDPTL peer */
- ast_udptl_get_peer(p1, &ac1);
- }
- if (pr1->set_udptl_peer(c1, p0)) {
- ast_log(LOG_WARNING, "Channel '%s' failed to talk back to '%s'\n", ast_channel_name(c1), ast_channel_name(c0));
- memset(&ac0, 0, sizeof(ac0));
- } else {
- /* Store UDPTL peer */
- ast_udptl_get_peer(p0, &ac0);
- }
- ast_channel_unlock(c0);
- ast_channel_unlock(c1);
- cs[0] = c0;
- cs[1] = c1;
- cs[2] = NULL;
- for (;;) {
- if ((ast_channel_tech_pvt(c0) != pvt0) ||
- (ast_channel_tech_pvt(c1) != pvt1) ||
- (ast_channel_masq(c0) || ast_channel_masqr(c0) || ast_channel_masq(c1) || ast_channel_masqr(c1))) {
- ast_debug(1, "Oooh, something is weird, backing out\n");
- /* Tell it to try again later */
- return -3;
- }
- to = -1;
- ast_udptl_get_peer(p1, &t1);
- ast_udptl_get_peer(p0, &t0);
- if (ast_sockaddr_cmp(&t1, &ac1)) {
- ast_debug(1, "Oooh, '%s' changed end address to %s\n",
- ast_channel_name(c1), ast_sockaddr_stringify(&t1));
- ast_debug(1, "Oooh, '%s' was %s\n",
- ast_channel_name(c1), ast_sockaddr_stringify(&ac1));
- ast_sockaddr_copy(&ac1, &t1);
- }
- if (ast_sockaddr_cmp(&t0, &ac0)) {
- ast_debug(1, "Oooh, '%s' changed end address to %s\n",
- ast_channel_name(c0), ast_sockaddr_stringify(&t0));
- ast_debug(1, "Oooh, '%s' was %s\n",
- ast_channel_name(c0), ast_sockaddr_stringify(&ac0));
- ast_sockaddr_copy(&ac0, &t0);
- }
- who = ast_waitfor_n(cs, 2, &to);
- if (!who) {
- ast_debug(1, "Ooh, empty read...\n");
- /* check for hangup / whentohangup */
- if (ast_check_hangup(c0) || ast_check_hangup(c1))
- break;
- continue;
- }
- f = ast_read(who);
- if (!f) {
- *fo = f;
- *rc = who;
- ast_debug(1, "Oooh, got a %s\n", f ? "digit" : "hangup");
- /* That's all we needed */
- return 0;
- } else {
- if (f->frametype == AST_FRAME_MODEM) {
- /* Forward T.38 frames if they happen upon us */
- if (who == c0) {
- ast_write(c1, f);
- } else if (who == c1) {
- ast_write(c0, f);
- }
- }
- ast_frfree(f);
- }
- /* Swap priority. Not that it's a big deal at this point */
- cs[2] = cs[0];
- cs[0] = cs[1];
- cs[1] = cs[2];
- }
- return -1;
-}
-
static char *handle_cli_udptl_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
switch (cmd) {