local.ua
Class CommandLineUA

java.lang.Object
  |
  +--local.ua.CommandLineUA
All Implemented Interfaces:
RegisterAgentListener, UserAgentListener
Direct Known Subclasses:
MiniJukebox

public class CommandLineUA
extends java.lang.Object
implements UserAgentListener, RegisterAgentListener

Simple command-line-based SIP user agent (UA). It includes audio/video applications.

It can use external audio/video tools as media applications. Currently only RAT (Robust Audio Tool) and VIC are supported as external applications.


Constructor Summary
CommandLineUA(org.zoolu.sip.provider.SipProvider sip_provider, UserAgentProfile user_profile)
          Costructs a UA with a default media port
 
Method Summary
 void call(java.lang.String target_url)
          Makes a new call
 void exit()
          Exits
 void listen()
          Receives incoming calls (auto accept)
 void loopRegister(int expire_time, int renew_time, long keepalive_time)
          Periodically registers the contact address with the registrar server.
static void main(java.lang.String[] args)
          The main method.
 void onUaCallAccepted(UserAgent ua)
          When an ougoing call has been accepted
 void onUaCallCancelled(UserAgent ua)
          When an incoming call has been cancelled
 void onUaCallClosed(UserAgent ua)
          When a call has been locally or remotely closed
 void onUaCallFailed(UserAgent ua)
          When an ougoing call has been refused or timeout
 void onUaCallIncoming(UserAgent ua, org.zoolu.sip.address.NameAddress callee, org.zoolu.sip.address.NameAddress caller)
          When a new call is incoming
 void onUaCallRinging(UserAgent ua)
          When an ougoing call is remotly ringing
 void onUaCallTrasferred(UserAgent ua)
          When a call has been trasferred
 void onUaRegistrationFailure(RegisterAgent ra, org.zoolu.sip.address.NameAddress target, org.zoolu.sip.address.NameAddress contact, java.lang.String result)
          When a UA failed on (un)registering.
 void onUaRegistrationSuccess(RegisterAgent ra, org.zoolu.sip.address.NameAddress target, org.zoolu.sip.address.NameAddress contact, java.lang.String result)
          When a UA has been successfully (un)registered.
protected  void printOut(java.lang.String str)
          Print to stantard output.
protected  java.lang.String readLine()
          Read a new line from stantard input.
 void register(int expire_time)
          Register with the registrar server.
 void unregister()
          Unregister with the registrar server
 void unregisterall()
          Unregister all contacts with the registrar server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandLineUA

public CommandLineUA(org.zoolu.sip.provider.SipProvider sip_provider,
                     UserAgentProfile user_profile)
Costructs a UA with a default media port
Method Detail

register

public void register(int expire_time)
Register with the registrar server.
Parameters:
expire_time - expiration time in seconds

loopRegister

public void loopRegister(int expire_time,
                         int renew_time,
                         long keepalive_time)
Periodically registers the contact address with the registrar server.
Parameters:
expire_time - expiration time in seconds
renew_time - renew time in seconds
keepalive_time - keep-alive packet rate (inter-arrival time) in milliseconds

unregister

public void unregister()
Unregister with the registrar server

unregisterall

public void unregisterall()
Unregister all contacts with the registrar server

call

public void call(java.lang.String target_url)
Makes a new call

listen

public void listen()
Receives incoming calls (auto accept)

exit

public void exit()
Exits

onUaCallIncoming

public void onUaCallIncoming(UserAgent ua,
                             org.zoolu.sip.address.NameAddress callee,
                             org.zoolu.sip.address.NameAddress caller)
When a new call is incoming
Specified by:
onUaCallIncoming in interface UserAgentListener

onUaCallRinging

public void onUaCallRinging(UserAgent ua)
When an ougoing call is remotly ringing
Specified by:
onUaCallRinging in interface UserAgentListener

onUaCallAccepted

public void onUaCallAccepted(UserAgent ua)
When an ougoing call has been accepted
Specified by:
onUaCallAccepted in interface UserAgentListener

onUaCallTrasferred

public void onUaCallTrasferred(UserAgent ua)
When a call has been trasferred
Specified by:
onUaCallTrasferred in interface UserAgentListener

onUaCallCancelled

public void onUaCallCancelled(UserAgent ua)
When an incoming call has been cancelled
Specified by:
onUaCallCancelled in interface UserAgentListener

onUaCallFailed

public void onUaCallFailed(UserAgent ua)
When an ougoing call has been refused or timeout
Specified by:
onUaCallFailed in interface UserAgentListener

onUaCallClosed

public void onUaCallClosed(UserAgent ua)
When a call has been locally or remotely closed
Specified by:
onUaCallClosed in interface UserAgentListener

onUaRegistrationSuccess

public void onUaRegistrationSuccess(RegisterAgent ra,
                                    org.zoolu.sip.address.NameAddress target,
                                    org.zoolu.sip.address.NameAddress contact,
                                    java.lang.String result)
When a UA has been successfully (un)registered.
Specified by:
onUaRegistrationSuccess in interface RegisterAgentListener

onUaRegistrationFailure

public void onUaRegistrationFailure(RegisterAgent ra,
                                    org.zoolu.sip.address.NameAddress target,
                                    org.zoolu.sip.address.NameAddress contact,
                                    java.lang.String result)
When a UA failed on (un)registering.
Specified by:
onUaRegistrationFailure in interface RegisterAgentListener

main

public static void main(java.lang.String[] args)
The main method.

readLine

protected java.lang.String readLine()
Read a new line from stantard input.

printOut

protected void printOut(java.lang.String str)
Print to stantard output.