源码地带 > 电路图 > 电子资料下载 > 网络 >Java SIP > 查看压缩包源码

Java SIP

源代码在线查看: sipstatus.java

软件大小: 58 K
上传用户: dsjacky
关键词: Java SIP
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*				 * This file was derived from libdissipate, an open source SIP library. The original file 				 * was modified on 1/23/2001.  Please see				 * http://www.div8.net/dissipate for more information.				 *				 * Copyright (c) 2000 Billy Biggs 				 *				 *				 * This library is free software; you can redistribute it and/or modify it				 * under the terms of the GNU Library General Public License as published by				 * the Free Software Foundation; either version 2 of the License, or (at your				 * option) any later version.				 * 				 * This library is distributed in the hope that it will be useful, but WITHOUT				 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or				 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public				 * License for more details.				 * 				 * You should have received a copy of the GNU Library General Public License				 * along with this library; see the file COPYING.LIB.  If not, write to the				 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,				 * MA 02111-1307, USA.				 *				 */				/**				 * class SipStatus				 * 				 * This code has been generated using C2J++				 * C2J++ is based on Chris Laffra's C2J (laffra@watson.ibm.com)				 * Read general disclaimer distributed with C2J++ before using this code				 * For information about C2J++, send mail to Ilya_Tilevich@ibi.com				 */				package org.mitre.jsip;								public class SipStatus				{								    /**				     * SipStatus				     */								  public SipStatus(int code) {				    setCode(code);				  }												  /**				   * setCode				   * @param newcode				   */				  public void setCode(int newcode)				  {				    code = newcode;				    setReasonPhrase( codeString( code ) );				  }								  /**				   * setReasonPhrase				   * @param newreason				   */				  public void setReasonPhrase(String newreason)				  {				    reasonphrase = newreason;				  }								  /**				   * getCode				   * @return int				   */				  public int getCode()				  { return code; }				  				  /**				   * getReasonPhrase				   * @return String				   */				  public String getReasonPhrase()				  { return reasonphrase; }								  /**				   * codeString				   * @param code				   * @return String				   */				  public String codeString(int code)				  {				    switch ( code ) {				    case 0: return "No Response";				      				    case 100: return "Trying";				    case 180: return "Ringing";				    case 181: return "Call is Being Forwarded";				    case 182: return "Queued";				      				    case 200: return "OK";				      				    case 300: return "Multiple Choices";				    case 301: return "Moved Permanently";				    case 302: return "Moved Temporarily";				    case 303: return "See Other";				    case 305: return "Use Proxy";				    case 380: return "Alternative Service";								    case 400: return "Bad Request";				    case 401: return "Unauthorized";				    case 402: return "Payment Required";				    case 403: return "Forbidden";				    case 404: return "Not Found";				    case 405: return "Method Not Allowed";				    case 406: return "Not Acceptable";				    case 407: return "Proxy Authentication Required";				    case 408: return "Request Timeout";				    case 409: return "Conflict";				    case 410: return "Gone";				    case 411: return "Length Required";				    case 413: return "Request Entity Too Large";				    case 414: return "Request-URI Too Large";				    case 415: return "Unsupported Media Type";				    case 420: return "Bad Extension";				    case 480: return "Temporarily not available";				    case 481: return "Call Leg/Transaction Does Not Exist";				    case 482: return "Loop Detected";				    case 483: return "Too Many Hops";				    case 484: return "Address Incomplete";				    case 485: return "Ambiguous";				    case 486: return "Busy Here";				      				    case 500: return "Internal Server Error";				    case 501: return "Not Implemented";				    case 502: return "Bad Gateway";				    case 503: return "Service Unavailable";				    case 504: return "Gateway Time-out";				    case 505: return "SIP Version not supported";				      				    case 600: return "Busy Everywhere";				    case 603: return "Decline";				    case 604: return "Does not exist anywhere";				    case 606: return "Not Acceptable";				    }				    return "Unknown";				  }								  // class variables				  private int code;				  private String reasonphrase;								    /**				     * test method				     */				    public static void main(String[] args) {					// this takes one arg, a code to look up					int code = 500;									try {					    code = Integer.parseInt(args[0]);					} catch (NumberFormatException nfe) {					    System.err.println("Error parsing argument, going with 500");					}									SipStatus status = new SipStatus( code );					System.out.println("Code " + code + " corresponds to ");					System.exit(0);				    }				}							

相关资源