diff -urN asterisk-1.2.18.orig/channels/chan_sip.c asterisk-1.2.18/channels/chan_sip.c --- asterisk-1.2.18.orig/channels/chan_sip.c 2007-04-25 01:05:06.000000000 +0900 +++ asterisk-1.2.18/channels/chan_sip.c 2007-06-26 10:15:53.547559968 +0900 @@ -439,7 +439,7 @@ static struct sched_context *sched; static struct io_context *io; -static int *sipsock_read_id; +static int *sipsock_read_id = NULL; #define SIP_MAX_HEADERS 64 /*!< Max amount of SIP headers to read */ #define SIP_MAX_LINES 64 /*!< Max amount of lines in SIP attachment (like SDP) */ @@ -11621,8 +11621,12 @@ sip_do_reload(); /* Change the I/O fd of our UDP socket */ - if (sipsock > -1) - sipsock_read_id = ast_io_change(io, sipsock_read_id, sipsock, NULL, 0, NULL); + if (sipsock > -1) { + if (sipsock_read_id) + sipsock_read_id = ast_io_change(io, sipsock_read_id, sipsock, NULL, 0, NULL); + else + sipsock_read_id = ast_io_add(io, sipsock, sipsock_read, AST_IO_IN, NULL); + } } /* Check for interfaces needing to be killed */ ast_mutex_lock(&iflock);