mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
check to see if sub->rtp is allocated. Bug #1040
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -681,7 +681,7 @@ static struct skinny_device {
|
||||
struct skinny_device *next;
|
||||
} *devices = NULL;
|
||||
|
||||
struct skinnysession {
|
||||
static struct skinnysession {
|
||||
pthread_t t;
|
||||
ast_mutex_t lock;
|
||||
struct sockaddr_in sin;
|
||||
@@ -704,8 +704,7 @@ static skinny_req *req_alloc(size_t size)
|
||||
|
||||
static struct skinny_subchannel *find_subchannel_by_line(struct skinny_line *l)
|
||||
{
|
||||
/* Need to figure out how to determine which sub we want */
|
||||
|
||||
/* XXX Need to figure out how to determine which sub we want */
|
||||
struct skinny_subchannel *sub = l->sub;
|
||||
return sub;
|
||||
}
|
||||
@@ -2199,12 +2198,13 @@ static int handle_message(skinny_req *req, struct skinnysession *s)
|
||||
sin.sin_port = htons(port);
|
||||
|
||||
sub = find_subchannel_by_line(s->device->lines);
|
||||
if (sub->rtp) {
|
||||
ast_rtp_set_peer(sub->rtp, &sin);
|
||||
ast_rtp_get_us(sub->rtp, &us);
|
||||
|
||||
printf("us port: %d\n", ntohs(us.sin_port));
|
||||
printf("sin port: %d\n", ntohs(sin.sin_port));
|
||||
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "No RTP structure, this is very bad\n");
|
||||
break;
|
||||
}
|
||||
memset(req, 0, SKINNY_MAX_PACKET);
|
||||
req->len = sizeof(start_media_transmission_message)+4;
|
||||
req->e = START_MEDIA_TRANSMISSION_MESSAGE;
|
||||
@@ -2391,16 +2391,6 @@ static void *do_monitor(void *data)
|
||||
{
|
||||
int res;
|
||||
|
||||
#if 0
|
||||
/* Add an I/O event to our TCP socket */
|
||||
if (skinnysock > -1) {
|
||||
ast_io_add(io, skinnysock, accept_thread, AST_IO_IN, NULL);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Unable to create I/O socket event\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* This thread monitors all the interfaces which are not yet in use
|
||||
(and thus do not have a separate thread) indefinitely */
|
||||
/* From here on out, we die whenever asked */
|
||||
@@ -2626,7 +2616,6 @@ static int reload_config(void)
|
||||
}
|
||||
ast_mutex_unlock(&netlock);
|
||||
|
||||
|
||||
/* and unload the configuration when were done */
|
||||
ast_destroy(cfg);
|
||||
|
||||
@@ -2714,27 +2703,16 @@ int load_module()
|
||||
|
||||
int unload_module()
|
||||
{
|
||||
|
||||
#if 0
|
||||
struct skinny_subchannel *p, *pl;
|
||||
|
||||
ast_channel_unregister(type);
|
||||
ast_verbose("Skinny module unloading\n");
|
||||
|
||||
/* First, take us out of the channel loop */
|
||||
ast_channel_unregister(type);
|
||||
struct skinny_session *session, s;
|
||||
struct skinny_subchannel *sub;
|
||||
struct skinny_line *line = session;
|
||||
|
||||
/* close all IP connections */
|
||||
if (!ast_mutex_lock(&devicelock)) {
|
||||
/* Hangup all interfaces if they have an owner */
|
||||
p = iflist;
|
||||
while(p) {
|
||||
if (p->owner)
|
||||
ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
|
||||
p = p->next;
|
||||
}
|
||||
iflist = NULL;
|
||||
ast_mutex_unlock(&iflock);
|
||||
/* Terminate tcp listener thread */
|
||||
|
||||
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
|
||||
return -1;
|
||||
@@ -2751,7 +2729,6 @@ int unload_module()
|
||||
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ast_mutex_lock(&iflock)) {
|
||||
/* Destroy all the interfaces and free their memory */
|
||||
p = iflist;
|
||||
@@ -2767,9 +2744,14 @@ int unload_module()
|
||||
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ast_rtp_proto_register(&skinny_rtp);
|
||||
ast_cli_register(&cli_show_lines);
|
||||
ast_cli_register(&cli_debug);
|
||||
ast_cli_register(&cli_no_debug);
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
/* if we're still here something was fscked up */
|
||||
return -1;
|
||||
}
|
||||
|
||||
int usecount()
|
||||
|
Reference in New Issue
Block a user