--- chan_sip.bak 2012-07-16 15:50:00.000000000 -0400 +++ chan_sip.c 2012-09-24 23:01:54.965718570 -0400 @@ -767,6 +767,7 @@ static int apeerobjs = 0; /*!< Autoc static int regobjs = 0; /*!< Registry objects */ /* }@ */ +static int rtregsonly = 0; /*!< Realtime registrations only */ static struct ast_flags global_flags[3] = {{0}}; /*!< global SIP_ flags */ static int global_t38_maxdatagram; /*!< global T.38 FaxMaxDatagram override */ @@ -4715,7 +4716,7 @@ static void update_peer(struct sip_peer { int rtcachefriends = ast_test_flag(&p->flags[1], SIP_PAGE2_RTCACHEFRIENDS); if (sip_cfg.peer_rtupdate && - (p->is_realtime || rtcachefriends)) { + (p->is_realtime || rtcachefriends || rtregsonly)) { realtime_update_peer(p->name, &p->addr, p->username, p->fullcontact, p->useragent, expire, p->deprecated_username, p->lastms); } } @@ -30570,6 +30571,7 @@ static const struct ast_data_entry sip_d /*! \brief PBX load module - initialization */ static int load_module(void) { + int res; ast_verbose("SIP channel loading...\n"); /* the fact that ao2_containers can't resize automatically is a major worry! */ @@ -30686,7 +30688,7 @@ static int load_module(void) /* And start the monitor for the first time */ restart_monitor(); - ast_realtime_require_field(ast_check_realtime("sipregs") ? "sipregs" : "sippeers", + res = ast_realtime_require_field(ast_check_realtime("sipregs") ? "sipregs" : "sippeers", "name", RQ_CHAR, 10, "ipaddr", RQ_CHAR, INET6_ADDRSTRLEN - 1, "port", RQ_UINTEGER2, 5, @@ -30697,7 +30699,9 @@ static int load_module(void) "useragent", RQ_CHAR, 20, "lastms", RQ_INTEGER4, 11, SENTINEL); - + + /* Allow realtime registrations without realtime peers */ + rtregsonly = !res && ast_check_realtime("sipregs") && !ast_check_realtime("sippeers"); sip_register_tests(); network_change_event_subscribe();