local.ua
Class CommandLinePA

java.lang.Object
  |
  +--local.ua.CommandLinePA
All Implemented Interfaces:
PresenceAgentListener, RegisterAgentListener

public class CommandLinePA
extends java.lang.Object
implements PresenceAgentListener, RegisterAgentListener

Simple command-line Presence Agent (PA). It allows a user to subscribe for a presence service and/or respond to subscription requests, using a command-line interface.


Constructor Summary
CommandLinePA(org.zoolu.sip.provider.SipProvider sip_provider, UserAgentProfile user_profile)
          Costructs a new CommandLinePA.
 
Method Summary
static void main(java.lang.String[] args)
          The main method.
 void onPaNotificationFailure(PresenceAgent pa, org.zoolu.sip.address.NameAddress recipient, java.lang.String reason)
          When a subscription request successes.
 void onPaNotificationRequest(PresenceAgent pa, org.zoolu.sip.address.NameAddress recipient, org.zoolu.sip.address.NameAddress notifier, java.lang.String state, java.lang.String content_type, java.lang.String body)
          When a new NOTIFY is received.
 void onPaSubscriptionRequest(PresenceAgent pa, org.zoolu.sip.address.NameAddress presentity, org.zoolu.sip.address.NameAddress watcher)
          When a new SUBSCRIBE is received.
 void onPaSubscriptionSuccess(PresenceAgent pa, org.zoolu.sip.address.NameAddress presentity)
          When a subscription request successes.
 void onPaSubscriptionTerminated(PresenceAgent pa, org.zoolu.sip.address.NameAddress presentity, java.lang.String reason)
          When a subscription terminates.
 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 subscribe(java.lang.String presentity)
          Register with the registrar server.
 void unregister()
          Unregister with the registrar server
 void unregisterall()
          Unregister all contacts with the registrar server
 void unsubscribe(java.lang.String presentity)
          Register with the registrar server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandLinePA

public CommandLinePA(org.zoolu.sip.provider.SipProvider sip_provider,
                     UserAgentProfile user_profile)
Costructs a new CommandLinePA.
Method Detail

subscribe

public void subscribe(java.lang.String presentity)
Register with the registrar server.

unsubscribe

public void unsubscribe(java.lang.String presentity)
Register with the registrar server.

register

public void register(int expire_time)
Register with the registrar server.

unregister

public void unregister()
Unregister with the registrar server

unregisterall

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

onPaSubscriptionRequest

public void onPaSubscriptionRequest(PresenceAgent pa,
                                    org.zoolu.sip.address.NameAddress presentity,
                                    org.zoolu.sip.address.NameAddress watcher)
When a new SUBSCRIBE is received.
Specified by:
onPaSubscriptionRequest in interface PresenceAgentListener

onPaSubscriptionSuccess

public void onPaSubscriptionSuccess(PresenceAgent pa,
                                    org.zoolu.sip.address.NameAddress presentity)
When a subscription request successes.
Specified by:
onPaSubscriptionSuccess in interface PresenceAgentListener

onPaSubscriptionTerminated

public void onPaSubscriptionTerminated(PresenceAgent pa,
                                       org.zoolu.sip.address.NameAddress presentity,
                                       java.lang.String reason)
When a subscription terminates.
Specified by:
onPaSubscriptionTerminated in interface PresenceAgentListener

onPaNotificationRequest

public void onPaNotificationRequest(PresenceAgent pa,
                                    org.zoolu.sip.address.NameAddress recipient,
                                    org.zoolu.sip.address.NameAddress notifier,
                                    java.lang.String state,
                                    java.lang.String content_type,
                                    java.lang.String body)
When a new NOTIFY is received.
Specified by:
onPaNotificationRequest in interface PresenceAgentListener

onPaNotificationFailure

public void onPaNotificationFailure(PresenceAgent pa,
                                    org.zoolu.sip.address.NameAddress recipient,
                                    java.lang.String reason)
When a subscription request successes.
Specified by:
onPaNotificationFailure in interface PresenceAgentListener

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.