AudioCall.java
Upload User: liulanlin
Upload Date: 2017-12-08
Package Size: 1274k
Code Size: 3k
Category:

VOIP program

Development Platform:

Java

  1. /*
  2.  * CallStatus.java
  3.  *
  4.  * Created on November 25, 2003, 4:03 PM
  5.  */
  6. package gov.nist.applet.phone.ua.call;
  7. import javax.sip.Dialog;
  8. import javax.sip.ServerTransaction;
  9. import javax.sip.address.URI;
  10. import javax.sip.message.Request;
  11. import gov.nist.applet.phone.media.*;
  12. import gov.nist.applet.phone.ua.MessageListener;
  13. /**
  14.  * This class will keep information about an audio call
  15.  * 
  16.  * @author Jean Deruelle <jean.deruelle@nist.gov>
  17.  *
  18.  * <a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a>
  19.  */
  20. public class AudioCall implements Call{    
  21.     private String callStatus=null;
  22.     private String callee=null;
  23.     private Dialog dialog=null;
  24.     private URI url=null;
  25. private Request request=null;
  26. private ServerTransaction serverTransaction=null;
  27.     private MediaManager mediaManager=null;    
  28.     private boolean voiceMessaging=false;
  29.         
  30.     /** Creates a new instance of an audio Call */
  31.     public AudioCall(MessageListener messageListener) {
  32.         callStatus=NOT_IN_A_CALL;
  33.         mediaManager=new MediaManager(messageListener);       
  34.     }
  35.     
  36.     /**
  37.      * Retrieve the current status of the call
  38.      * @return the current status of the call
  39.      */
  40.     public String getStatus(){
  41.         return this.callStatus;
  42.     }
  43.     
  44.     /**
  45.      * Set the current status of the call
  46.      * @param callStatus - the current status of the call
  47.      */
  48.     public void setStatus(String callStatus){
  49.         this.callStatus=callStatus;
  50.     }
  51.     
  52.     /**
  53.      * Retrieve the dialog of the call
  54.      * @return the dialog of the call
  55.      */
  56.     public Dialog getDialog(){
  57.         return this.dialog;
  58.     }
  59.     
  60.     /**
  61.      * Set the dialog of the call
  62.      * @param dialog - the dialog of the call
  63.      */
  64.     public void setDialog(Dialog dialog){
  65.         this.dialog=dialog;
  66.     }
  67.     
  68. /**
  69.  * Retrieve the MediaManager for this call
  70.  * @return the media manager of the call
  71.  */
  72. public MediaManager getMediaManager(){
  73. return mediaManager;
  74. }
  75.     
  76.     /**
  77.      * Set the MediaManager for this call
  78.      * @param mediaManager - the media manager of the call
  79.      */
  80.     public void setMediaManager(MediaManager mediaManager){
  81.         this.mediaManager=mediaManager;
  82.     }
  83.     
  84.     /**
  85.      * Retrieve the callee of this call
  86.      * @return the callee of this call
  87.      */
  88.     public String getCallee(){
  89.         return this.callee;
  90.     }
  91.     
  92.     /**
  93.      * Set the callee of this call
  94.      * @param callee - the callee of this call
  95.      */
  96.     public void setCallee(String callee){
  97.         this.callee=callee;
  98.         this.callee=this.callee.replace('<',' ');
  99.         this.callee=this.callee.replace('>',' ');
  100.         this.callee=this.callee.trim();
  101.         //this.callee=this.callee.substring("sip:".length(),this.callee.length());
  102.     }
  103.     /**
  104.      * enable or not the voice messaging for this call
  105.      * @param voiceMessaging - flag to enable the voice messaging for this call
  106.      */
  107.     public void setVoiceMesaging(boolean voiceMessaging){
  108.      this.voiceMessaging=voiceMessaging;
  109.     }
  110.     /**
  111.      * Return true if the voice messaging is enabled for this call
  112.      * @return true if the voice messaging is enabled for this call
  113.      */
  114.     public boolean getVoiceMessaging(){
  115.      return voiceMessaging;
  116.     }
  117.     
  118. /**
  119.  * Retrieve the url set by a busy to this call
  120.  * @return the url set by a busy to this call
  121.  */
  122. public URI getURL(){
  123. return this.url;
  124. }
  125. /**
  126.  * Set the url set by a busy to this call
  127.  * @param url - the url set by a busy to this call
  128.  */
  129. public void setURL(URI url){
  130. this.url=url;
  131. }
  132. }