[Asterisk-Dev] IAX2 registration and RealTime.

Dmitry Mishchenko arkadia at odessa.net
Sun Jan 9 07:58:45 MST 2005


Hello,

IAX2 registration process comes to processing IAX_COMMAND_REGREQ command two 
times. First time algorithm executed like:
...
register_verify()
registry_authrequest()
..
and second time like
...
register_verify()
update_registry()
..
Call of any of these functions has the call of realtime_peer(peer) at the 
beginning which loads peer data. For one registration we have 4 the same  
SELECT * FROM iaxfriends WHERE name = 'xxx'  queries and one UPDATE query.  

I'm wondering can we reduce DB load somehow? It looks like loaded data being 
used not in an optimal way and we reload them all the time.

Instead of 4 SELECT queries we can easily do only 2, 
loading peer at the beginning of the IAX_COMMAND_REGREQ section and passing 
loaded peer to register_verify() and registry_authrequest().

Does this change make sense?  I would like to hear your comments. May be 
somebody can propose the better way of optimization.

Thanks,
Dmitry



More information about the asterisk-dev mailing list