• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResponseEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: process180

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void process180(ResponseEvent responseEvent) {
	try {
		forwardResponse(responseEvent.getResponse());
	}
	catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:9,代码来源:TestCall.java


示例17: processInvite200

import javax.sip.ResponseEvent; //导入依赖的package包/类
/**
 * @param responseEvent
 * @throws SipException 
 * @throws InvalidArgumentException 
 */
private void processInvite200(ResponseEvent responseEvent,CSeqHeader cseq) throws InvalidArgumentException, SipException {
	// lets ack it ourselves to avoid UAS retransmissions due to
	// forwarding of this response and further UAC Ack
	// note that the app does not handles UAC ACKs
	final Request ack = responseEvent.getDialog().createAck(cseq.getSeqNumber());
	responseEvent.getDialog().sendAck(ack);
	forwardResponse(responseEvent.getResponse());			
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:14,代码来源:TestCall.java


示例18: processResponse

import javax.sip.ResponseEvent; //导入依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {

		Dialog dialog = responseEvent.getDialog();
		if (dialog != null) {
			if (responseEvent.getClientTransaction() == null) {
				// retransmission, drop it
				return;
			}
			TestCall call = (TestCall) dialog.getApplicationData();
			if (call != null) {				
				switch (responseEvent.getResponse().getStatusCode()) {
				case 100:
					// ignore
					break;
				case 180:
					call.process180(responseEvent);
					break;
				case 200:
					call.process200(responseEvent);
					break;	
				default:
					System.err.println("Received unexpected sip response: "+responseEvent.getResponse());
					dialog.setApplicationData(null);
					break;
				}
			} else {
				System.err
						.println("Received response on dialog with id that does not matches a active call: "+responseEvent.getResponse());
			}
		} else {
			System.err.println("Received response without dialog: "+responseEvent.getResponse());
		}
	}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:34,代码来源:Test.java


示例19: 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("Dialog = " + responseReceivedEvent.getDialog());
	logger.info("Dialog State is "
			+ responseReceivedEvent.getDialog().getState());
}
         SipProvider provider = (SipProvider) responseReceivedEvent.getSource();

         try {
         	if (response.getStatusCode() == Response.OK) {
         		if(((CSeqHeader) response.getHeader(CSeqHeader.NAME))
         				.getMethod().equals(Request.INVITE)) {
         			okToInviteReceived = true;
         		}
         	}
         } catch (Exception ex) {
             logger.error(ex);
             ex.printStackTrace();
             fail("unexpected exception");
         }

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


示例20: processResponse

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

    logger.info("Response received : Status Code = " + response.getStatusCode() + " " + cseq);
    logger.info("Response = " + response + " class=" + response.getClass());

    Dialog dialog = responseReceivedEvent.getDialog();
    TestCase.assertNotNull(dialog);

    if (tid != null)
        logger.info("transaction state is " + tid.getState());
    else
        logger.info("transaction = " + tid);

    logger.info("Dialog = " + dialog);

    logger.info("Dialog state is " + dialog.getState());

    try {
        if (response.getStatusCode() == Response.OK) {
            if (cseq.getMethod().equals(Request.INVITE)) {
                TestCase.assertEquals(DialogState.CONFIRMED, dialog.getState());

            } else {
                logger.info("Response method = " + cseq.getMethod());
            }
        }
    } catch (Throwable ex) {
        ex.printStackTrace();
        // System.exit(0);
    }

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ScriptUtils类代码示例发布时间:2022-05-22
下一篇:
Java Messages类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap