Load SIP peers from SQL

I’m trying to set up a voicemail only server with LDAP storage and SQL voicemail users. I found that for pollmailboxes to work, I need a sip peer with that mailbox. If the peer is stored in SQL, pollmailboxes will not work because the peer is not loaded into cache. Setting rtcachefriends does not help as the peer never registers. Is there a way to automatically cache SIP peers from an SQL database?

I don’t believe chan_sip has any built in capacity to do this without explicitly loading them (sip show peer with the load option maybe).

I ended up creating a script using pjsua (pjsip sip client) to attempt a register connection to the server. This populated the cache with the extension. I’ll expand upon this to run a script at startup that reads all SQL peers and caches them this way. If a new user is created I will have it call the script to cache that one peer.

The other thought was to append new peers to sip.conf and reload each time, but the administrators prefer it be in SQL.

Does anybody have any other ideas?