From 0cd9e10d2d1de9ab6a3e2043e03dda2332af1276 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Sat, 10 Jan 2004 20:11:48 +0000 Subject: [PATCH] Reorder events in IAX, make "IAX1" compatibility git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1917 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/channels/chan_iax.c b/channels/chan_iax.c index 091c8a1fc8..aa16c22007 100755 --- a/channels/chan_iax.c +++ b/channels/chan_iax.c @@ -83,7 +83,8 @@ static char mydbname[80]; static char *desc = "Inter Asterisk eXchange"; static char *tdesc = "Inter Asterisk eXchange Drver"; -static char *type = "IAX"; +static char *ctype = "IAX"; +static char *type = "IAX1"; static char context[80] = "default"; @@ -5404,15 +5405,6 @@ int load_module(void) set_config(config,&sin); - if (ast_channel_register(type, tdesc, iax_capability, iax_request)) { - ast_log(LOG_ERROR, "Unable to register channel class %s\n", type); - __unload_module(); - return -1; - } - - if (ast_register_switch(&iax_switch)) - ast_log(LOG_ERROR, "Unable to register IAX switch\n"); - /* Make a UDP socket */ netsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); @@ -5422,6 +5414,8 @@ int load_module(void) } if (bind(netsocket,(struct sockaddr *)&sin, sizeof(sin))) { ast_log(LOG_ERROR, "Unable to bind to %s port %d: %s\n", inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), strerror(errno)); + close(netsocket); + netsocket = -1; return -1; } @@ -5431,6 +5425,21 @@ int load_module(void) if (setsockopt(netsocket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))) ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos); + if (ast_channel_register(type, tdesc, iax_capability, iax_request)) { + ast_log(LOG_ERROR, "Unable to register channel class %s\n", type); + __unload_module(); + return -1; + } + + if (ast_channel_register(ctype, tdesc, iax_capability, iax_request)) { + ast_log(LOG_ERROR, "Unable to register channel class %s\n", type); + __unload_module(); + return -1; + } + + if (ast_register_switch(&iax_switch)) + ast_log(LOG_ERROR, "Unable to register IAX switch\n"); + if (!res) { res = start_network_thread(); if (option_verbose > 1)