local.ua
Class UserAgent

java.lang.Object
  |
  +--org.zoolu.sip.call.CallListenerAdapter
        |
        +--local.ua.UserAgent
All Implemented Interfaces:
org.zoolu.sip.call.CallListener, org.zoolu.sip.call.ExtendedCallListener

public class UserAgent
extends org.zoolu.sip.call.CallListenerAdapter

Simple 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.


Field Summary
protected  MediaLauncher audio_app
          Audio application
protected  org.zoolu.sip.call.ExtendedCall call
          Call
protected  org.zoolu.sip.call.ExtendedCall call_transfer
          Call transfer
protected  UserAgentListener listener
          UserAgent listener
protected  java.lang.String local_session
          Local sdp
protected  org.zoolu.sip.provider.SipProvider sip_provider
          SipProvider
protected  UserAgentProfile user_profile
          UserAgentProfile
protected  MediaLauncher video_app
          Video application
 
Constructor Summary
UserAgent(org.zoolu.sip.provider.SipProvider sip_provider, UserAgentProfile user_profile, UserAgentListener listener)
          Costructs a UA with a default media port
 
Method Summary
 void accept()
          Closes an ongoing, incoming, or pending call
 void addMediaDescriptor(java.lang.String media, int port, int avp, java.lang.String codec, int rate)
          Adds a media to the SDP
 void call(java.lang.String target_url)
          Makes a new call (acting as UAC).
protected  void changeStatus(java.lang.String state)
          Changes the call state
protected  void closeMediaApplication()
          Close the Media Application
 java.lang.String getSessionDescriptor()
          Gets the local SDP
protected  java.lang.String getStatus()
          Gets the call state
 void hangup()
          Closes an ongoing, incoming, or pending call
 void initSessionDescriptor()
          Inits the local SDP (no media spec)
protected  void launchMediaApplication()
          Launches the Media Application (currently, the RAT audio tool)
 void listen()
          Waits for an incoming call (acting as UAS).
 void onCallAccepted(org.zoolu.sip.call.Call call, java.lang.String sdp, org.zoolu.sip.message.Message resp)
          Callback function called when arriving a 2xx (call accepted)
 void onCallCanceling(org.zoolu.sip.call.Call call, org.zoolu.sip.message.Message cancel)
          Callback function that may be overloaded (extended).
 void onCallClosed(org.zoolu.sip.call.Call call, org.zoolu.sip.message.Message resp)
          Callback function called when arriving a response after a BYE request (call closed)
 void onCallClosing(org.zoolu.sip.call.Call call, org.zoolu.sip.message.Message bye)
          Callback function called when arriving a BYE request
 void onCallConfirmed(org.zoolu.sip.call.Call call, java.lang.String sdp, org.zoolu.sip.message.Message ack)
          Callback function called when arriving an ACK method (call confirmed)
 void onCallIncoming(org.zoolu.sip.call.Call call, org.zoolu.sip.address.NameAddress callee, org.zoolu.sip.address.NameAddress caller, java.lang.String sdp, org.zoolu.sip.message.Message invite)
          Callback function called when arriving a new INVITE method (incoming call)
 void onCallModifying(org.zoolu.sip.call.Call call, java.lang.String sdp, org.zoolu.sip.message.Message invite)
          Callback function called when arriving a new Re-INVITE method (re-inviting/call modify)
 void onCallRedirection(org.zoolu.sip.call.Call call, java.lang.String reason, java.util.Vector contact_list, org.zoolu.sip.message.Message resp)
          Callback function called when arriving a 3xx (call redirection)
 void onCallRefused(org.zoolu.sip.call.Call call, java.lang.String reason, org.zoolu.sip.message.Message resp)
          Callback function called when arriving a 4xx (call failure)
 void onCallReInviteAccepted(org.zoolu.sip.call.Call call, java.lang.String sdp, org.zoolu.sip.message.Message resp)
          Callback function called when arriving a 2xx (re-invite/modify accepted)
 void onCallReInviteRefused(org.zoolu.sip.call.Call call, java.lang.String reason, org.zoolu.sip.message.Message resp)
          Callback function called when arriving a 4xx (re-invite/modify failure)
 void onCallRinging(org.zoolu.sip.call.Call call, org.zoolu.sip.message.Message resp)
          Callback function that may be overloaded (extended).
 void onCallTimeout(org.zoolu.sip.call.Call call)
          Callback function called when the invite expires
 void onCallTransfer(org.zoolu.sip.call.ExtendedCall call, org.zoolu.sip.address.NameAddress refer_to, org.zoolu.sip.address.NameAddress refered_by, org.zoolu.sip.message.Message refer)
          Callback function called when arriving a new REFER method (transfer request)
 void onCallTransferAccepted(org.zoolu.sip.call.ExtendedCall call, org.zoolu.sip.message.Message resp)
          Callback function called when a call transfer is accepted.
 void onCallTransferFailure(org.zoolu.sip.call.ExtendedCall call, java.lang.String reason, org.zoolu.sip.message.Message notify)
          Callback function called when a call transfer is NOT sucessfully completed
 void onCallTransferRefused(org.zoolu.sip.call.ExtendedCall call, java.lang.String reason, org.zoolu.sip.message.Message resp)
          Callback function called when a call transfer is refused.
 void onCallTransferSuccess(org.zoolu.sip.call.ExtendedCall call, org.zoolu.sip.message.Message notify)
          Callback function called when a call transfer is successfully completed
 void redirect(java.lang.String redirection)
          Redirects an incoming call
 void setAcceptTime(int accept_time)
          Sets the automatic answer time (default is -1 that means no auto accept mode)
 void setAudio(boolean enable)
          Enables audio
 void setHangupTime(int time)
          Sets the automatic hangup time (default is 0, that corresponds to manual hangup mode)
 void setNoOfferMode(boolean nooffer)
          Sets the no offer mode for the invite (default is false)
 void setReceiveOnlyMode(boolean r_only)
          Sets the receive only mode
 void setRecvFile(java.lang.String file_name)
          Sets the recv file
 void setRedirection(java.lang.String url)
          Sets the redirection url (default is null, that is no redircetion)
 void setSendFile(java.lang.String file_name)
          Sets the send file
 void setSendOnlyMode(boolean s_only)
          Sets the send only mode
 void setSendToneMode(boolean s_tone)
          Sets the send tone mode
 void setSessionDescriptor(java.lang.String sdp)
          Sets the local SDP
 void setVideo(boolean enable)
          Enables video
protected  boolean statusIs(java.lang.String state)
          Checks the call state
 
Methods inherited from class org.zoolu.sip.call.CallListenerAdapter
onCallReInviteTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

user_profile

protected UserAgentProfile user_profile
UserAgentProfile

sip_provider

protected org.zoolu.sip.provider.SipProvider sip_provider
SipProvider

call

protected org.zoolu.sip.call.ExtendedCall call
Call

call_transfer

protected org.zoolu.sip.call.ExtendedCall call_transfer
Call transfer

audio_app

protected MediaLauncher audio_app
Audio application

video_app

protected MediaLauncher video_app
Video application

local_session

protected java.lang.String local_session
Local sdp

listener

protected UserAgentListener listener
UserAgent listener
Constructor Detail

UserAgent

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

changeStatus

protected void changeStatus(java.lang.String state)
Changes the call state

statusIs

protected boolean statusIs(java.lang.String state)
Checks the call state

getStatus

protected java.lang.String getStatus()
Gets the call state

setAcceptTime

public void setAcceptTime(int accept_time)
Sets the automatic answer time (default is -1 that means no auto accept mode)

setHangupTime

public void setHangupTime(int time)
Sets the automatic hangup time (default is 0, that corresponds to manual hangup mode)

setRedirection

public void setRedirection(java.lang.String url)
Sets the redirection url (default is null, that is no redircetion)

setNoOfferMode

public void setNoOfferMode(boolean nooffer)
Sets the no offer mode for the invite (default is false)

setAudio

public void setAudio(boolean enable)
Enables audio

setVideo

public void setVideo(boolean enable)
Enables video

setReceiveOnlyMode

public void setReceiveOnlyMode(boolean r_only)
Sets the receive only mode

setSendOnlyMode

public void setSendOnlyMode(boolean s_only)
Sets the send only mode

setSendToneMode

public void setSendToneMode(boolean s_tone)
Sets the send tone mode

setSendFile

public void setSendFile(java.lang.String file_name)
Sets the send file

setRecvFile

public void setRecvFile(java.lang.String file_name)
Sets the recv file

getSessionDescriptor

public java.lang.String getSessionDescriptor()
Gets the local SDP

setSessionDescriptor

public void setSessionDescriptor(java.lang.String sdp)
Sets the local SDP

initSessionDescriptor

public void initSessionDescriptor()
Inits the local SDP (no media spec)

addMediaDescriptor

public void addMediaDescriptor(java.lang.String media,
                               int port,
                               int avp,
                               java.lang.String codec,
                               int rate)
Adds a media to the SDP

call

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

listen

public void listen()
Waits for an incoming call (acting as UAS).

hangup

public void hangup()
Closes an ongoing, incoming, or pending call

accept

public void accept()
Closes an ongoing, incoming, or pending call

redirect

public void redirect(java.lang.String redirection)
Redirects an incoming call

launchMediaApplication

protected void launchMediaApplication()
Launches the Media Application (currently, the RAT audio tool)

closeMediaApplication

protected void closeMediaApplication()
Close the Media Application

onCallIncoming

public void onCallIncoming(org.zoolu.sip.call.Call call,
                           org.zoolu.sip.address.NameAddress callee,
                           org.zoolu.sip.address.NameAddress caller,
                           java.lang.String sdp,
                           org.zoolu.sip.message.Message invite)
Callback function called when arriving a new INVITE method (incoming call)
Overrides:
onCallIncoming in class org.zoolu.sip.call.CallListenerAdapter

onCallModifying

public void onCallModifying(org.zoolu.sip.call.Call call,
                            java.lang.String sdp,
                            org.zoolu.sip.message.Message invite)
Callback function called when arriving a new Re-INVITE method (re-inviting/call modify)
Overrides:
onCallModifying in class org.zoolu.sip.call.CallListenerAdapter

onCallRinging

public void onCallRinging(org.zoolu.sip.call.Call call,
                          org.zoolu.sip.message.Message resp)
Callback function that may be overloaded (extended). Called when arriving a 180 Ringing
Overrides:
onCallRinging in class org.zoolu.sip.call.CallListenerAdapter

onCallAccepted

public void onCallAccepted(org.zoolu.sip.call.Call call,
                           java.lang.String sdp,
                           org.zoolu.sip.message.Message resp)
Callback function called when arriving a 2xx (call accepted)
Overrides:
onCallAccepted in class org.zoolu.sip.call.CallListenerAdapter

onCallConfirmed

public void onCallConfirmed(org.zoolu.sip.call.Call call,
                            java.lang.String sdp,
                            org.zoolu.sip.message.Message ack)
Callback function called when arriving an ACK method (call confirmed)
Overrides:
onCallConfirmed in class org.zoolu.sip.call.CallListenerAdapter

onCallReInviteAccepted

public void onCallReInviteAccepted(org.zoolu.sip.call.Call call,
                                   java.lang.String sdp,
                                   org.zoolu.sip.message.Message resp)
Callback function called when arriving a 2xx (re-invite/modify accepted)
Overrides:
onCallReInviteAccepted in class org.zoolu.sip.call.CallListenerAdapter

onCallReInviteRefused

public void onCallReInviteRefused(org.zoolu.sip.call.Call call,
                                  java.lang.String reason,
                                  org.zoolu.sip.message.Message resp)
Callback function called when arriving a 4xx (re-invite/modify failure)
Overrides:
onCallReInviteRefused in class org.zoolu.sip.call.CallListenerAdapter

onCallRefused

public void onCallRefused(org.zoolu.sip.call.Call call,
                          java.lang.String reason,
                          org.zoolu.sip.message.Message resp)
Callback function called when arriving a 4xx (call failure)
Overrides:
onCallRefused in class org.zoolu.sip.call.CallListenerAdapter

onCallRedirection

public void onCallRedirection(org.zoolu.sip.call.Call call,
                              java.lang.String reason,
                              java.util.Vector contact_list,
                              org.zoolu.sip.message.Message resp)
Callback function called when arriving a 3xx (call redirection)
Overrides:
onCallRedirection in class org.zoolu.sip.call.CallListenerAdapter

onCallCanceling

public void onCallCanceling(org.zoolu.sip.call.Call call,
                            org.zoolu.sip.message.Message cancel)
Callback function that may be overloaded (extended). Called when arriving a CANCEL request
Overrides:
onCallCanceling in class org.zoolu.sip.call.CallListenerAdapter

onCallClosing

public void onCallClosing(org.zoolu.sip.call.Call call,
                          org.zoolu.sip.message.Message bye)
Callback function called when arriving a BYE request
Overrides:
onCallClosing in class org.zoolu.sip.call.CallListenerAdapter

onCallClosed

public void onCallClosed(org.zoolu.sip.call.Call call,
                         org.zoolu.sip.message.Message resp)
Callback function called when arriving a response after a BYE request (call closed)
Overrides:
onCallClosed in class org.zoolu.sip.call.CallListenerAdapter

onCallTimeout

public void onCallTimeout(org.zoolu.sip.call.Call call)
Callback function called when the invite expires
Overrides:
onCallTimeout in class org.zoolu.sip.call.CallListenerAdapter

onCallTransfer

public void onCallTransfer(org.zoolu.sip.call.ExtendedCall call,
                           org.zoolu.sip.address.NameAddress refer_to,
                           org.zoolu.sip.address.NameAddress refered_by,
                           org.zoolu.sip.message.Message refer)
Callback function called when arriving a new REFER method (transfer request)
Overrides:
onCallTransfer in class org.zoolu.sip.call.CallListenerAdapter

onCallTransferAccepted

public void onCallTransferAccepted(org.zoolu.sip.call.ExtendedCall call,
                                   org.zoolu.sip.message.Message resp)
Callback function called when a call transfer is accepted.
Overrides:
onCallTransferAccepted in class org.zoolu.sip.call.CallListenerAdapter

onCallTransferRefused

public void onCallTransferRefused(org.zoolu.sip.call.ExtendedCall call,
                                  java.lang.String reason,
                                  org.zoolu.sip.message.Message resp)
Callback function called when a call transfer is refused.
Overrides:
onCallTransferRefused in class org.zoolu.sip.call.CallListenerAdapter

onCallTransferSuccess

public void onCallTransferSuccess(org.zoolu.sip.call.ExtendedCall call,
                                  org.zoolu.sip.message.Message notify)
Callback function called when a call transfer is successfully completed
Overrides:
onCallTransferSuccess in class org.zoolu.sip.call.CallListenerAdapter

onCallTransferFailure

public void onCallTransferFailure(org.zoolu.sip.call.ExtendedCall call,
                                  java.lang.String reason,
                                  org.zoolu.sip.message.Message notify)
Callback function called when a call transfer is NOT sucessfully completed
Overrides:
onCallTransferFailure in class org.zoolu.sip.call.CallListenerAdapter