当前位置: 首页>>代码示例>>Java>>正文


Java ResponseEvent类代码示例

本文整理汇总了Java中javax.sip.ResponseEvent的典型用法代码示例。如果您正苦于以下问题:Java ResponseEvent类的具体用法?Java ResponseEvent怎么用?Java ResponseEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResponseEvent类属于javax.sip包,在下文中一共展示了ResponseEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process200

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void process200(ResponseEvent responseEvent) {
	try {
		final CSeqHeader cSeqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME); 			
		if (cSeqHeader.getMethod().equals(Request.INVITE)) {
			processInvite200(responseEvent,cSeqHeader);
		}
		else if (cSeqHeader.getMethod().equals(Request.BYE)) {
			processBye200(responseEvent);
		}
		else {
			System.err.println("Unexpected response: "+responseEvent.getResponse());
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:17,代码来源:TestCall.java

示例2: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        TxTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:25,代码来源:Shootme.java

示例3: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    Response response = (Response) responseReceivedEvent.getResponse();
    System.out.println("GOT RESPONSE:" + response.getStatusCode());
    this.statusCode = response.getStatusCode();
    if(responseReceivedEvent.getClientTransaction() == null) {
    	return;
    }
    try {
        if (response.getStatusCode() == Response.OK
                && ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
                        .getMethod().equals(Request.INVITE)) {            	
        	System.out.println("Not Sending ACK to test dialog timeout");            	
        }
    } catch (Exception ex) {
        ex.printStackTrace();

        TxTimeoutTest.fail(
                "Shootist: Exception on process respons/send info", ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:Shootist.java

示例4: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        DialogTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:25,代码来源:Shootme.java

示例5: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    Response response = (Response) responseReceivedEvent.getResponse();
    System.out.println("GOT RESPONSE:" + response.getStatusCode());
    if(responseReceivedEvent.getClientTransaction() == null) {
    	return;
    }
    try {
        if (response.getStatusCode() == Response.OK
                && ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
                        .getMethod().equals(Request.INVITE)) {            	
        	System.out.println("Not Sending ACK to test dialog timeout");            	
        }
    } catch (Exception ex) {
        ex.printStackTrace();

        DialogTimeoutTest.fail(
                "Shootist: Exception on process respons/send info", ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:21,代码来源:Shootist.java

示例6: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        DialogTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:ShootmeNotImplementingListener.java

示例7: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
    try {
        Response response = responseEvent.getResponse();
        Dialog dialog = responseEvent.getDialog();
        this.lastResponseTable.put(dialog, response);
         ServerTransaction serverTransaction = (ServerTransaction)responseEvent.getClientTransaction().getApplicationData();
        Request stRequest = serverTransaction.getRequest();
        Response newResponse = this.messageFactory.createResponse(response.getStatusCode(),stRequest);
        SipProvider provider = (SipProvider)responseEvent.getSource();
        SipProvider peerProvider = this.getPeerProvider(provider);
        ListeningPoint peerListeningPoint = peerProvider.getListeningPoint("udp");
        ContactHeader peerContactHeader = ((ListeningPointExt)peerListeningPoint).createContactHeader();
        newResponse.setHeader(peerContactHeader);
        serverTransaction.sendResponse(newResponse);
    } catch (Exception ex) {
        ex.printStackTrace();
        BackToBackUserAgentTest.fail("Unexpected exception");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:20,代码来源:BackToBackUserAgent.java

示例8: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    try {
        if (responseReceivedEvent.getResponse().getStatusCode() == Response.OK) {
            this.sawOk = true;
            Dialog dialog = responseReceivedEvent.getDialog();
            long cseq = ((CSeqHeader) responseReceivedEvent.getResponse().getHeader(
                    CSeqHeader.NAME)).getSeqNumber();
            Request ack = dialog.createAck(cseq);
            dialog.sendAck(ack);
        }
    } catch (Exception ex) {
        fail("Unexpected exception");

    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:17,代码来源:TransactionAlreadyExistsExceptionTest.java

示例9: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    logger.info("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    logger.info("Response received with client transaction id " + tid + ":\n"
            + response.getStatusCode());
    if (tid == null) {
        logger.info("Stray response -- dropping ");
        return;
    }
    logger.info("transaction state is " + tid.getState());
    logger.info("Dialog = " + tid.getDialog());
    if (tid.getDialog() != null)
        logger.info("Dialog State is " + tid.getDialog().getState());

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:18,代码来源:DeliverNotifyBefore202Test.java

示例10: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    try {
        if ( responseReceivedEvent.getResponse().getStatusCode() == Response.OK) {
            this.sawOk = true;
        Dialog dialog = responseReceivedEvent.getDialog();
        long cseq = ((CSeqHeader) responseReceivedEvent.getResponse()
                .getHeader(CSeqHeader.NAME)).getSeqNumber();
        Request ack = dialog.createAck(cseq);
        dialog.sendAck(ack);
        }
    } catch (Exception ex) {
        fail("Unexpected exception");

    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:17,代码来源:DeliverRequestEventWithBadHeaderTest.java

示例11: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
    Response response = responseEvent.getResponse();
    int code = response.getStatusCode();
    if (code == 180) {
        try {

            o_received180 = true;
            Request cancel = responseEvent.getClientTransaction().createCancel();
            ClientTransaction cancelTX = provider.getNewClientTransaction(cancel);
            cancelTX.sendRequest();
            System.out.println("Send CANCEL:\n" + cancel);
            o_sentCancel = true;

        } catch (SipException e) {
            e.printStackTrace();
            doFail(doMessage(e));
        }
    } else if (code == 200) {
        System.out.println("Receive Cancel200");
        o_receiver200Cancel = true;
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:NoAutoDialogTest.java

示例12: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
	CSeqHeader cseq = (CSeqHeader) responseReceivedEvent.getResponse().getHeader(CSeqHeader.NAME);
	String method = cseq.getMethod();
	if(method.equals(Request.INVITE)) {
		if ( responseReceivedEvent.getResponse().getStatusCode() == Response.OK) {
			Dialog d = responseReceivedEvent.getDialog();
			try {
				Request ack = d.createAck(1);
				sipProvider.sendRequest(ack);
			} catch (Exception e) {
				e.printStackTrace();
				fail("Error sending ACK");
			}
		}
	} else if(method.equals(Request.BYE)){
		okByeReceived = true;
	}
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:19,代码来源:WebsocketSelfTest.java

示例13: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    logger.info("Got a response:" + response.getStatusCode()
            + ':' + response.getHeader( CSeqHeader.NAME ) );

    logger.info("Response received with client transaction id " + tid
            + ": " + response.getStatusCode()  );
    if (tid == null) {
        logger.info("Stray response -- dropping ");
        return;
    }
    logger.info("transaction state is " + tid.getState());
    logger.info("Dialog = " + tid.getDialog());
    if ( tid.getDialog () != null )
        logger.info("Dialog State is " + tid.getDialog().getState());

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:20,代码来源:Referrer.java

示例14: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    ClientTransaction tid = responseReceivedEvent.getClientTransaction();
    CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);

    System.out.println("Response received : Status Code = "
            + response.getStatusCode() + " " + cseq);
    if (tid == null) {
        System.out.println("Stray response -- dropping ");
        return;
    }
    System.out.println("transaction state is " + tid.getState());
    System.out.println("Dialog = " + tid.getDialog());
    System.out.println("Dialog State is " + tid.getDialog().getState());

    // responses are OKs for SUBSCRIBE. Do nothing

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:20,代码来源:Subscriber.java

示例15: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
	Response response = responseEvent.getResponse();
	BrokerFactory.getLoggingBroker().logDebug("Process Response in Sip Handler "+response);

	String method = ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod();
	
	if (response.getStatusCode() == Response.OK)  {
		if (method.equals(Request.REGISTER)) {
			setRegistered(true);
		}
	}
	
	if (response.getStatusCode() == 401) {
		handleAuthorization(responseEvent, response, method);
	} else if (response.getStatusCode() == 407) {
		handleProxyAuthorization(responseEvent, response, method);
	}  
	for (int i = 0; i < responseListeners.size(); i++) {
		ResponseListener listener = (ResponseListener) responseListeners
				.elementAt(i);
		listener.handleResponse(responseEvent);
	}
}
 
开发者ID:davidrudder23,项目名称:OpenNotification,代码行数:24,代码来源:SipHandler.java


注:本文中的javax.sip.ResponseEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。