亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? presentitymanager.java

?? It is Java for SIP phone
?? JAVA
字號:
/* * PresentityManager.java *  * Created on Mar 22, 2004 * */package gov.nist.applet.phone.ua.presence;import gov.nist.applet.phone.ua.Configuration;import gov.nist.applet.phone.ua.MessageListener;import gov.nist.applet.phone.ua.MessengerManager;import gov.nist.applet.phone.ua.pidf.parser.XMLpidfParser;import java.text.ParseException;import java.util.ArrayList;import java.util.Enumeration;import java.util.Hashtable;import javax.sip.ClientTransaction;import javax.sip.Dialog;import javax.sip.InvalidArgumentException;import javax.sip.ListeningPoint;import javax.sip.ServerTransaction;import javax.sip.SipException;import javax.sip.address.Address;import javax.sip.address.AddressFactory;import javax.sip.address.SipURI;import javax.sip.header.CSeqHeader;import javax.sip.header.CallIdHeader;import javax.sip.header.ContentTypeHeader;import javax.sip.header.ExpiresHeader;import javax.sip.header.FromHeader;import javax.sip.header.Header;import javax.sip.header.HeaderFactory;import javax.sip.header.MaxForwardsHeader;import javax.sip.header.RouteHeader;import javax.sip.header.ToHeader;import javax.sip.header.ViaHeader;import javax.sip.message.MessageFactory;import javax.sip.message.Request;import javax.sip.message.Response;/** * This class manage the presence of the application, i.e subscriptions and  * notifications *  * @author Jean Deruelle <jean.deruelle@nist.gov> * * <a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a> */public class PresentityManager {	private Hashtable subscriberList = null;	private MessengerManager sipMeetingManager=null;	private MessageListener messageListener=null;	private Configuration configuration=null;	/**	 * 	 */	public PresentityManager(MessengerManager sipMeetingManager) {		subscriberList=new Hashtable();			this.sipMeetingManager=sipMeetingManager;		this.messageListener=sipMeetingManager.getMessageListener();		this.configuration=this.messageListener.getConfiguration();	}	/**	 * Retrieve a subscriber by his address	 * @param subscriberAddress - the subscriber address	 * @return the subscriber	 */	public Subscriber getSubscriber(String subscriberAddress){		return (Subscriber)subscriberList.get(subscriberAddress);	}		/**	 * Add a subscriber to our subscriber list	 * @param subscriber - subscriber to add	 */	public void addSubscriber(Subscriber subscriber){		Subscriber subscriberFromList=			(Subscriber)subscriberList.get(subscriber.getAddress());		if(subscriberFromList==null)			subscriberList.put(subscriber.getAddress(),subscriber);		else{			System.out.println("Already in list put the dialog to"+				subscriber.getDialog());			subscriberFromList.setDialog(subscriber.getDialog());					}		System.out.println(subscriber.getAddress()+" has been added to your contacts.");		System.out.println(subscriber.getDialog());	}	/**	 * Remove a subscriber to our subscriber list	 * @param subscriber - subscriber to remove	 */	public void removeSubscriber(String subscriber){				subscriberList.remove(subscriber);		System.out.println(subscriber+" has been removed from your contacts.");	}		/**	 * The user has accepted to add the contact to his contact list	 * So we send an ok	 * @param subscriber - the subscriber for who we are going to send an ok	 */	public void acceptSubscribe(String subscriberAddress){		Subscriber subscriber=(Subscriber)subscriberList.get(subscriberAddress);		Dialog dialog=subscriber.getDialog();		if (!dialog.isServer()) {			System.out.println("Problem : it's a client transaction");            		}		ServerTransaction serverTransaction=			(ServerTransaction) dialog.getFirstTransaction();		Request request=serverTransaction.getRequest();		Response response=null;		try{			response=MessageListener.messageFactory.createResponse(Response.OK,request);			ToHeader toHeader=(ToHeader)response.getHeader(ToHeader.NAME);			if (toHeader.getTag()==null)				toHeader.setTag(new Integer((int)(Math.random() * 10000)).toString());		}		catch(ParseException pe){			pe.printStackTrace();		}		try{			serverTransaction.sendResponse(response);		}		catch(SipException se){			se.printStackTrace();		}		messageListener.sipMeetingManager.getPresentityManager().			sendNotifyToSubscriber(									subscriber,									"open",									"online");	}	/**	 * The user has declined to add the contact to his contact list	 * So we send a DECLINE	 * @param subscriber - the subscriber for who we are going to send an DECLINE	 */    	public void declineSubscribe(String subscriberAddress){		Subscriber subscriber=(Subscriber)subscriberList.get(subscriberAddress);		Dialog dialog=subscriber.getDialog();		if (!dialog.isServer()) {			System.out.println("Problem : it's a client transaction");            		}		ServerTransaction serverTransaction=			(ServerTransaction) dialog.getFirstTransaction();		Request request=serverTransaction.getRequest();		Response response=null;		try{			response=MessageListener.messageFactory.createResponse(Response.DECLINE,request);		}		catch(ParseException pe){			pe.printStackTrace();		}		try{			serverTransaction.sendResponse(response);		}		catch(SipException se){			se.printStackTrace();		}		subscriberList.remove(subscriber.getAddress());	}	/**	 * Send a notification of the presence status of the application to all 	 * subscribers	 * @param status - status of the presence	 * @param subStatus - subStatus of the presence	 */	public void sendNotifyToAllSubscribers(String status,String subStatus) {		try{			 // We have to get all our subscribers and send them a NOTIFY!			 System.out.println("DEBUG, IMNotifyProcessing, sendNotifyToAllSuscribers(),"+			 " we have to notify our SUBSCRIBERS: let's send a NOTIFY for each one "+			 "of them (subscribersList: "+subscriberList.size()+")!!!");			Enumeration e=subscriberList.elements();			while(e.hasMoreElements()) {				Subscriber subscriber=(Subscriber)e.nextElement();                				String subscriberName=subscriber.getAddress();            				String contactAddress= configuration.contactIPAddress+":"+					configuration.listeningPort;				String xmlBody=null;				if (!status.equals("closed") )                					xmlBody=XMLpidfParser.createXMLBody(status,subStatus,subscriberName,					contactAddress);            				Dialog dialog=subscriber.getDialog();				if (dialog==null) {					System.out.println("ERROR, sendNotifyToAllSubscribers(), Pb to "+					"retrieve the dialog, NOTIFY not sent!");				}				else					sendNotify(xmlBody,dialog);			 }		}		catch (Exception ex) {			ex.printStackTrace();		} 	}	/**	 * Send a notification of the presence status of the application to a 	 * subscriber	 * @param subscriber - the subscriber to notify	 * @param status - the new presence status of the application	 * @param subStatus - the new presence substatus of the application	 */	public void sendNotifyToSubscriber(Subscriber subscriber,String status,String subStatus){		String subscriberName=subscriber.getAddress();            		String contactAddress= configuration.contactIPAddress+":"+			configuration.listeningPort;		String xmlBody=null;		if (!status.equals("closed") )                			xmlBody=XMLpidfParser.createXMLBody(status,subStatus,subscriberName,			contactAddress);		Dialog dialog=subscriber.getDialog();		if (dialog==null) {			System.out.println("ERROR, sendNotifyToAllSubscribers(), PB to "+			"retrieve the dialog, NOTIFY not sent!");		}		else			sendNotify(xmlBody,dialog);	}	/**	 * Send a notify from a dialog	 * @param body -  the body of the notify	 * @param dialog - the dialog form which the notify will be created	 */	public void sendNotify(String body,Dialog dialog) {		try{			// We send the NOTIFY!!!        			// we create the Request-URI: the one of the proxy			HeaderFactory headerFactory=MessageListener.headerFactory;			AddressFactory addressFactory=MessageListener.addressFactory;			MessageFactory messageFactory=MessageListener.messageFactory;			//SipProvider sipProvider=imUA.getSipProvider();        			String transport=configuration.signalingTransport;			String proxyAddress=configuration.outboundProxy;			int proxyPort=configuration.proxyPort;        			SipURI requestURI=null;			if (proxyAddress!=null) {				 requestURI=addressFactory.createSipURI(null,proxyAddress);				 requestURI.setPort(proxyPort);				 requestURI.setTransportParam(transport);			}			else {				System.out.println("DEBUG, IMNotifyProcessing, sendNotify(), request-uri is null");				return;			}               			Address localAddress=dialog.getLocalParty();			Address remoteAddress=dialog.getRemoteParty();                    			FromHeader fromHeader=headerFactory.createFromHeader(localAddress,dialog.getLocalTag());			ToHeader toHeader=headerFactory.createToHeader(remoteAddress,dialog.getRemoteTag());        			int cseq=dialog.getLocalSequenceNumber();			CSeqHeader cseqHeader=headerFactory.createCSeqHeader(cseq,"NOTIFY");            			CallIdHeader callIdHeader=dialog.getCallId();			//Listening Point			ListeningPoint listeningPoint = messageListener.sipProvider.getListeningPoint();    			  			//ViaHeader			ArrayList viaHeaders = null;        			viaHeaders = new ArrayList();			try {				ViaHeader viaHeader = MessageListener.headerFactory.createViaHeader(					configuration.contactIPAddress,					listeningPoint.getPort(),					listeningPoint.getTransport(),					null					);				viaHeaders.add(viaHeader);			}			catch (ParseException ex) {				//Shouldn't happen				ex.printStackTrace();			}			catch (InvalidArgumentException ex) {				//Should never happen				System.out.println("The application is corrupt");                			}        			// MaxForwards header:			MaxForwardsHeader maxForwardsHeader=headerFactory.createMaxForwardsHeader(70);        			Request request=null;			ClientTransaction clientTransaction=null;			if (body==null) {            				request=messageFactory.createRequest(requestURI,"NOTIFY",				callIdHeader,cseqHeader,fromHeader,toHeader,viaHeaders,maxForwardsHeader);           				// We have to add an Expires-Header of 0!!!				ExpiresHeader expiresHeader=headerFactory.createExpiresHeader(0);				request.setHeader(expiresHeader);            			}			else {				body=body+"\r\n";				// Content-Type:				ContentTypeHeader contentTypeHeader=headerFactory.createContentTypeHeader(				"application","xpidf+xml");            				request=messageFactory.createRequest(requestURI,"NOTIFY",				callIdHeader,cseqHeader,fromHeader,toHeader,viaHeaders,maxForwardsHeader				,contentTypeHeader,body);               			}         			//Route Header			SipURI routeURI=null;			try{				routeURI=MessageListener.addressFactory.createSipURI(					  null,					  configuration.outboundProxy);			}			catch(ParseException pe){				pe.printStackTrace();			}			routeURI.setPort(configuration.proxyPort);			try {				routeURI.setTransportParam(configuration.signalingTransport);			}			catch(ParseException pe){				pe.printStackTrace();			}			RouteHeader routeHeader = MessageListener.headerFactory.createRouteHeader(				MessageListener.addressFactory.createAddress(routeURI));			           			request.addHeader(routeHeader);					// WE have to add a new Header: "Subscription-State"			System.out.println("DEBUG, sendNotify(), We add the Subscription-State"+			" header to the request");			Header header=headerFactory.createHeader("Subscription-State","active");			request.setHeader(header);        			// WE have to add a new Header: "Event"			header=headerFactory.createHeader("Event","presence");			request.setHeader(header);        			// ProxyAuthorization header if not null:			//ProxyAuthorizationHeader proxyAuthHeader=imUA.getProxyAuthorizationHeader();			//if (proxyAuthHeader!=null) 				//request.setHeader(proxyAuthHeader);        			clientTransaction=messageListener.sipProvider.getNewClientTransaction(request);			dialog.sendRequest(clientTransaction);        			System.out.println("DEBUG, sendNotify(),"+			" NOTIFY sent:\n" );			System.out.println(request.toString());		}		catch (Exception ex) {			ex.printStackTrace();		}	}                	    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品久久久久| 依依成人综合视频| 成人综合在线观看| 国产精品欧美一级免费| 99久久精品免费| 亚洲啪啪综合av一区二区三区| 不卡的电视剧免费网站有什么| 国产精品三级av在线播放| 在线综合亚洲欧美在线视频| 欧美日韩免费观看一区二区三区| 欧美日韩一区视频| 免费高清不卡av| 国产天堂亚洲国产碰碰| 99re亚洲国产精品| 亚洲成人精品在线观看| 亚洲精品一区二区三区四区高清| 国产精品自拍一区| 亚洲欧美另类综合偷拍| 在线成人高清不卡| 国产精品99久久不卡二区| 综合分类小说区另类春色亚洲小说欧美| 99re这里只有精品6| 日韩黄色小视频| 国产欧美精品日韩区二区麻豆天美| 91免费版在线| 男女性色大片免费观看一区二区| 久久久国产一区二区三区四区小说| 91网站在线观看视频| 午夜欧美在线一二页| 久久婷婷国产综合国色天香| 色综合天天综合| 精品一区二区三区香蕉蜜桃| 亚洲欧美日韩国产成人精品影院| 7777精品伊人久久久大香线蕉完整版| 国产精品一区一区三区| 亚洲韩国精品一区| 国产欧美一区二区三区鸳鸯浴 | 欧美日韩国产中文| 国产伦理精品不卡| 亚洲成人免费电影| 国产精品不卡一区| 欧美不卡一二三| 色中色一区二区| 国产成人一区二区精品非洲| 首页国产欧美久久| 亚洲男女一区二区三区| 国产性天天综合网| 91精品国模一区二区三区| 9久草视频在线视频精品| 久热成人在线视频| 亚洲成人动漫精品| 亚洲精品免费在线| 中文字幕乱码一区二区免费| 日韩三级.com| 欧美天堂亚洲电影院在线播放| 国产精品77777| 蜜臀av一区二区| 亚洲国产精品天堂| 亚洲香蕉伊在人在线观| 亚洲欧美综合色| 国产亚洲欧美在线| xvideos.蜜桃一区二区| 日韩欧美国产一区二区在线播放| 欧美三级午夜理伦三级中视频| 不卡的av网站| 国产成人精品免费| 丰满放荡岳乱妇91ww| 国产精品伊人色| 久久99精品久久久久久动态图 | 91精品国产一区二区| 欧美日韩五月天| 欧美日本韩国一区| 欧美三级资源在线| 欧美剧情电影在线观看完整版免费励志电影| 99久久精品国产精品久久| 成人妖精视频yjsp地址| 国产成人高清在线| 成人h精品动漫一区二区三区| 国产成人福利片| 成人av在线一区二区| 成人国产免费视频| 99久久99久久久精品齐齐| 91视频.com| 欧美亚洲一区二区三区四区| 在线观看日韩精品| 欧美丝袜第三区| 日韩亚洲欧美一区| 精品三级在线看| 日本一区二区三区国色天香 | 欧美成人三级在线| 久久久久久毛片| 国产精品嫩草影院com| 亚洲欧洲精品一区二区精品久久久 | 亚洲视频你懂的| 伊人一区二区三区| 天堂久久一区二区三区| 美女免费视频一区二区| 国产在线视频精品一区| 成人黄色在线网站| 欧美三级中文字幕在线观看| 日韩午夜激情电影| 欧美国产精品一区二区| 玉米视频成人免费看| 日韩国产一区二| 国产一区日韩二区欧美三区| 不卡一区二区三区四区| 欧美视频在线观看一区二区| 日韩欧美的一区二区| 国产精品久久福利| 亚洲妇熟xx妇色黄| 国产精品一二三区| 欧美性受xxxx黑人xyx| 精品国产免费一区二区三区四区| 欧美激情在线免费观看| 亚洲一区二区在线视频| 久久97超碰色| 91美女片黄在线观看| 日韩欧美高清一区| 亚洲精品成人少妇| 国精品**一区二区三区在线蜜桃| 99国产欧美久久久精品| 666欧美在线视频| 国产精品素人一区二区| 午夜精品爽啪视频| 成人高清视频免费观看| 欧美久久久久久久久中文字幕| 中文字幕精品一区| 六月丁香婷婷久久| 欧美性猛交xxxx黑人交| 国产日韩欧美精品一区| 午夜精品123| 成人一区二区三区视频在线观看 | 一本色道久久综合精品竹菊| 精品久久久久久久久久久久久久久久久| 国产精品色在线观看| 日av在线不卡| 色94色欧美sute亚洲13| 久久久美女艺术照精彩视频福利播放| 一区二区三区精品在线| 国产精品一品二品| 日韩欧美一区二区在线视频| 亚洲人成伊人成综合网小说| 国产乱一区二区| 538在线一区二区精品国产| 亚洲色大成网站www久久九九| 国产曰批免费观看久久久| 欧美日韩国产综合一区二区| 日韩一区中文字幕| 国产激情一区二区三区| 欧美大片在线观看| 青青青爽久久午夜综合久久午夜| 91免费精品国自产拍在线不卡 | 91精品国产综合久久久蜜臀粉嫩| 亚洲免费在线看| 成人黄色电影在线| 欧美国产日韩亚洲一区| 国产精品 日产精品 欧美精品| 欧美一区二区三区四区在线观看| 一区二区三区国产精华| av毛片久久久久**hd| 国产精品传媒入口麻豆| 高清在线观看日韩| 国产色产综合色产在线视频| 国产在线观看免费一区| 日韩午夜精品视频| 久久国产剧场电影| 欧美电影精品一区二区| 麻豆国产欧美日韩综合精品二区 | 国产成人免费视| 久久久精品免费网站| 国产一区二区在线视频| 日韩欧美综合在线| 精品影院一区二区久久久| 日韩欧美国产综合一区 | 成人高清视频在线观看| 国产精品毛片久久久久久| 成人午夜在线播放| 国产精品乱码一区二三区小蝌蚪| 国产999精品久久| 中文字幕欧美一| 在线免费观看成人短视频| 亚洲综合成人在线视频| 在线免费观看日本一区| 天天亚洲美女在线视频| 精品捆绑美女sm三区| 国产乱码一区二区三区| 国产女主播一区| 日本精品免费观看高清观看| 亚洲综合成人在线| 91精品国产91久久久久久一区二区| 日韩高清一区在线| 精品国产免费视频| 99麻豆久久久国产精品免费| 一区二区三区在线视频免费| 制服.丝袜.亚洲.另类.中文| 国内精品视频666| 亚洲人成电影网站色mp4| 在线电影一区二区三区| 国产.精品.日韩.另类.中文.在线.播放| 欧美国产欧美综合|