|new ( %ARGS )||
Creates new Net::SIP::Simple object.
It will return the new object for further operations, but the object itself will contain back references to itself in the form of callbacks into the eventloop and dispatcher. This means that that object will not self-destroy, but you need to call <B>cleanupB> if you want it to go away.
%ARGS can be:
cleanup Cleans up object, removes legs it added from the dispatcher. Needs to be called if you want to destroy the object, because it will not self-destroy (see <B>newB>). error ( ERROR ) Either sets current error (used internally) or returns last error. loop ( [ TIMEOUT, @STOPVAR ] ) Calls the event loops (key <B>loopB> in constructor> <B>loopB> method. TIMEOUT is the timeout for the loop in seconds. If not given it will not stop because of timeout. @STOPVAR is a list of scalar references, will stop the loop if any of these references contains TRUE. See method <B>loopB> in Net::SIP::Dispatcher::Eventloop for more details.
The order of TIMEOUT or the STOPVARs is insignificant, e.g. if it finds a reference it will use it as stopvar, otherwise its used as timeout.
add_timer ( WHEN, CALLBACK, [ REPEAT ] ) Calls same method from the Net::SIP::Dispatcher object in $self. See there for details on arguments. rtp ( METHOD,@ARGS ) Calls the method METHOD in Net::SIP::Simple::RTP with arguments @ARGS. Currently only does this and thus works as a shortcut. In the future one might add more ways to find the right method for RTP handling (e.g. plugins or similar). register ( %ARGS ) Registers the user agent. %ARGS can have the key <B>registrarB> which has precedence over the same key in the constructor. <B>legB> specifies the leg where the register request will be send through. If not given it will pick the right leg.
If <B>cb_finalB> is specified it is a callback usable by <B>invoke_callbackB> in Net::SIP::Util which will be called, once the registration is completed (e.g. it succeeded or failed). If no <B>cb_finalB> is specified the method will wait, until the registration is completed and return either the expires time given by the registrar or () if registration failed.
All other keys, like <B>contactB>, <B>expiresB>, <B>resp40xB>, <B>authB> will be forwarded to method <B>registerB> in Net::SIP::Endpoint. <B>fromB> and <B>authB> will be used from %ARGS or if not in %ARGS from the constructor.
invite ( CTX,%ARGS ) Creates a new call and invites peer. Creates a new Net::SIP::Simple::Call object with context CTX and creates an INVITE request for this call using %ARGS. See <B>reinviteB> in Net::SIP::Simple::Call for more info on %ARGS.
CTX can be address of peer or context hash containing the address.
Returns with the newly created Net::SIP::Simple::Call object, which can later be used for reINVITEs or BYE etc.
listen ( %ARGS ) Sets up waiting on all legs in $self for incoming calls, e.g. new INVITE requests. All other incoming packets will be dropped. If a call comes in a new Net::SIP::Simple::Call object will be created using %ARGS.
If %ARGS contain auth_* keys an Authorizer will be added before the listener. See Net::SIP::Authorize for the keys, e.g. auth_user2pass will be forwarded as user2pass etc to the authorizer.
Special keys not described in Net::SIP::Simple::Call:
filter A callback usable by <B>invoke_callbackB> in Net::SIP::Util which gets called with the value of the <B>FromB> header and the Net::SIP::Request object from the incoming request. If the callback returns TRUE the call gets accepted, otherwise not. cb_create Callback which will be called on accepting the call. Will be called with CALL,REQUEST,LEG,FROM where CALL is the newly created Net::SIP::Simple::Call object, REQUEST the creating Net::SIP::Request packet, LEG the incoming leg and FROM the "ip:port" of the sender.
Must return TRUE or the call gets not answered.
cb_established Callback which will be called, after the call is established, e.g. after receiving the ACK from the peer. Will be invoked with OK and the Net::SIP::Simple::Call object as argument. cb_cleanup Callback which will be called when the call gets closed to clean up allocated resources. Will be invoked with the Net::SIP::Simple::Call object as argument. create_auth ( %ARGS ) Sets up authorization. See Net::SIP::Authorize for the meaning of %ARGS. The returned object should be used together with other objects within create_chain. create_registrar ( %ARGS ) Sets up a simple registrar using Net::SIP::Registrar. See there for the meaning of %ARGS. create_stateless_proxy ( %ARGS ) Sets up a simple proxy using Net::SIP::StatelessProxy. See there for the meaning of %ARGS. create_chain ( OBJECTS, %ARGS ) Sets up a chain using Net::SIP::ReceiveChain. See there for the meaning of OBJECT and %ARGS.
|perl v5.20.3||NET::SIP::SIMPLE (3)||2012-04-17|