=head1 NAME Net::SIP::NATHelper::Server - server for Net::SIP::NATHelper::Client =head1 DESCRIPTION This module is a wrapper around L and will receive it's instructions from L using RPC via sockets. =head1 CONSTRUCTOR =over 4 =item new ( [ HELPER ], @FDS ) Will create an object which listens on all file descriptors given in FDS for RPC from clients. If HELPER is given and a L object or derived it will be used, otherwise the helper will be created. =back =head1 METHODS =over 4 =item do_command ( FD ) Called when FD is available for reading. Calls B on FD and reads the RPC packet from the resulting file descriptor, executes it and returns result back. Currently implemented commands are "allocate","activate" and "close" which will map to the local methods B, B and B. One might redefine or add commands by changing C<< $self->{commands} >>. The key of this hash reference is the command name and the value is the callback. Unknown commands will be ignored, e.g nothing returned. =item loop This will loop over all file descriptors it gets from B in L and the file descriptors for the RPC sockets. When file descriptors gets available for reading it will execute the callbacks, e.g. forward the RTP data or call B. In regular intervals it will call B from L to expire the RTP sockets and sessions. =item allocate_sockets ( ... ) Calls B of the local L object. Takes and returns the same arguments. =item activate_session ( ... ) Calls B of the local L object. Takes the same arguments and returns 1 if the session was newly activated, -1 if it was activated before and false if activation failed. Updates callbacks into the event loop. =item close_session ( ... ) Calls B of the local L object. Takes the same arguments and returns the number of closed sessions. Updates callbacks into the event loop. =item expire ( ... ) Calls B of the local L object. Takes the same arguments and returns the number of expired sessions. Updates callbacks into the event loop if necessary. =back =head1 BUGS The local event loop should be pluggable, so that other implementations could be used. Right now it's a hard coded loop using select.