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


Java CallIdHeader类代码示例

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


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

示例1: getHeadersToOmmitOnResponseCopy

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
private static Set<String> getHeadersToOmmitOnResponseCopy() {
	if (HEADERS_TO_OMMIT_ON_RESPONSE_COPY == null) {
		final Set<String> set = new HashSet<String>();
		set.add(RouteHeader.NAME);
		set.add(RecordRouteHeader.NAME);
		set.add(ViaHeader.NAME);
		set.add(CallIdHeader.NAME);
		set.add(CSeqHeader.NAME);
		set.add(ContactHeader.NAME);
		set.add(FromHeader.NAME);
		set.add(ToHeader.NAME);
		set.add(ContentLengthHeader.NAME);
		HEADERS_TO_OMMIT_ON_RESPONSE_COPY = Collections.unmodifiableSet(set);
	}
	return HEADERS_TO_OMMIT_ON_RESPONSE_COPY;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:17,代码来源:TestCall.java

示例2: sendMultipleContactRegistration

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public void sendMultipleContactRegistration() throws Exception {
     	Address fromAddress = addressFactory.createAddress("[email protected]:5070");
     	ContactHeader contactHeader1 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5070"));
 		ContactHeader contactHeader2 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5080"));
 		
 		
CallIdHeader callId = provider.getNewCallId();			
CSeqHeader cSeq = headerFactory.createCSeqHeader(1l, Request.REGISTER);
FromHeader from = headerFactory.createFromHeader(fromAddress, "1234");
ToHeader to = headerFactory.createToHeader(addressFactory.createAddress("[email protected]"+host+":"+SERVER_PORT), null);
List via = Arrays.asList(((ListeningPointImpl)provider.getListeningPoint(testProtocol)).getViaHeader());			
MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(10);
 		
 		URI requestURI = addressFactory.createURI("sip:[email protected]"+host+":"+SERVER_PORT);
 		Request request = messageFactory.createRequest(requestURI, Request.REGISTER, callId, cSeq, from, to, via, maxForwards);
 		    		
 		request.setRequestURI(requestURI);
 		request.addHeader(contactHeader1);
 		request.addHeader(contactHeader2);
 		ClientTransaction ctx = this.provider.getNewClientTransaction(request);
 		ctx.sendRequest();
     }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:MultipleContactsTest.java

示例3: sendInviteWithRPort

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public void sendInviteWithRPort() throws Exception {
     	Address fromAddress = addressFactory.createAddress("[email protected]:5070");
     	ContactHeader contactHeader1 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5070"));
 		ContactHeader contactHeader2 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5080"));
 		
 		
CallIdHeader callId = provider.getNewCallId();			
CSeqHeader cSeq = headerFactory.createCSeqHeader(1l, Request.INVITE);
FromHeader from = headerFactory.createFromHeader(fromAddress, "1234");
ToHeader to = headerFactory.createToHeader(addressFactory.createAddress("[email protected]"+host+":"+SERVER_PORT), null);
ViaHeader via = ((ListeningPointImpl)provider.getListeningPoint(testProtocol)).getViaHeader();
via.setRPort();
List vias = Arrays.asList(via);			
MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(10);
 		
 		URI requestURI = addressFactory.createURI("sip:[email protected]"+host+":"+SERVER_PORT);
 		Request request = messageFactory.createRequest(requestURI, Request.INVITE, callId, cSeq, from, to, vias, maxForwards);
 		System.out.println(request);
 		assertTrue(request.toString().indexOf("rport=") == -1);    		
 		
 		request.setRequestURI(requestURI);
 		request.addHeader(contactHeader1);
 		request.addHeader(contactHeader2);
 		ClientTransaction ctx = this.provider.getNewClientTransaction(request);
 		ctx.sendRequest();
     }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:27,代码来源:ViaRPortTest.java

示例4: getCallId

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public CallIdHeader getCallId() {
    // jeand : we save the header in a string form and reparse it, help GC
    // for dialogs updated not too often
    if (callIdHeader == null && callIdHeaderString != null) {
        try {
            this.callIdHeader = (CallIdHeader) new CallIDParser(
                    callIdHeaderString).parse();
        } catch (ParseException e) {
            logger.logError(
                    "error reparsing the call id header", e);
        }            
    }
    return this.callIdHeader;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:15,代码来源:SIPDialog.java

示例5: equals

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public boolean equals( Object other ) {

        if (this==other) return true;

        if (other instanceof CallIdHeader) {
            final CallIdHeader o = (CallIdHeader) other;
            return this.getCallId().equalsIgnoreCase( o.getCallId() );
        }
        return false;
    }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:11,代码来源:CallID.java

示例6: getNewCallId

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public CallIdHeader getNewCallId() {
    String callId = Utils.getInstance().generateCallIdentifier(this.getListeningPoint()
            .getIPAddress());
    CallID callid = new CallID();
    try {
        callid.setCallId(callId);
    } catch (java.text.ParseException ex) {
    }
    return callid;

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

示例7: MakeRequest

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
/**
 * 
 * @param sipManager - SipManager object
 * @param to - To identifies receiver IP
 * @param message Message that should be send
 * @return Return SIP Message.
 * @throws ParseException
 * @throws InvalidArgumentException
 */
public Request MakeRequest(SipManager sipManager, String to, String message) throws ParseException, InvalidArgumentException {
	AddressFactory addressFactory = sipManager.addressFactory;
	sipManager.setCseqNumber((long)sipManager.getCseqNumber()+1l);
	Address fromNameAddress = addressFactory.createAddress("sip:"+ SipManager.sipUserName + "@"+ SipManager.registrarIp);
	FromHeader fromHeader = sipManager.headerFactory.createFromHeader(fromNameAddress, "SyMPHOnY");
	URI toAddress = sipManager.addressFactory.createURI(to);
	Address toNameAddress = sipManager.addressFactory.createAddress(toAddress);
	ToHeader toHeader = sipManager.headerFactory.createToHeader(toNameAddress, null);
	URI requestURI = sipManager.addressFactory.createURI(to);
	ArrayList<ViaHeader> viaHeaders = sipManager.createViaHeader();
	CallIdHeader callIdHeader = sipManager.sipProvider.getNewCallId();
	CSeqHeader cSeqHeader = sipManager.headerFactory.createCSeqHeader(sipManager.getCseqNumber(),Request.MESSAGE);
	MaxForwardsHeader maxForwards = sipManager.headerFactory
			.createMaxForwardsHeader(70);
	Request request = sipManager.messageFactory.createRequest(requestURI,
			Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
			toHeader, viaHeaders, maxForwards);
	SupportedHeader supportedHeader = sipManager.headerFactory
			.createSupportedHeader("replaces, outbound");
	request.addHeader(supportedHeader);
	SipURI routeUri = sipManager.addressFactory.createSipURI(null,
			SipManager.proxyIp);
	routeUri.setTransportParam(SipManager.transport);
	routeUri.setLrParam();
	routeUri.setPort(SipManager.proxyPort);

	Address routeAddress = sipManager.addressFactory
			.createAddress(routeUri);
	RouteHeader route = sipManager.headerFactory
			.createRouteHeader(routeAddress);
	request.addHeader(route);
	ContentTypeHeader contentTypeHeader = sipManager.headerFactory
			.createContentTypeHeader("text", "plain");
	request.setContent(message, contentTypeHeader);
	System.out.println(request);
	return request;

}
 
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:48,代码来源:MessageMessage.java

示例8: getCallId

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public final String getCallId()
{
	CallIdHeader header = (CallIdHeader) response.getHeader(CallIdHeader.NAME);
	if (header == null)
		return "null";
	return header.getCallId();
}
 
开发者ID:lmangani,项目名称:Reaper,代码行数:8,代码来源:ResponseMessage.java

示例9: getCallId

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public final String getCallId()
{
	CallIdHeader header = (CallIdHeader) request.getHeader(CallIdHeader.NAME);
	if (header == null)
		return "null";
	return header.getCallId();
}
 
开发者ID:lmangani,项目名称:Reaper,代码行数:8,代码来源:RequestMessage.java

示例10: handleRequest

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public void handleRequest(RequestEvent requestEvent) {
	super.handleRequest(requestEvent);
	Request request = requestEvent.getRequest();
	BrokerFactory.getLoggingBroker().logDebug("Got request in SipOutgoing "+request);
	String method = ((CSeqHeader) request.getHeader(CSeqHeader.NAME))
			.getMethod();
	if (method.equals(Request.BYE)) {
		if (messages.size() > 0) {
			BrokerFactory.getLoggingBroker().logDebug(
					"Got BYE, removing message");
			DialogicAudioMessage message = (DialogicAudioMessage) messages
					.elementAt(0);
			if (message != null) {
				CallIdHeader callIDHeader = (CallIdHeader) request
						.getHeader("Call-ID");
				BrokerFactory.getLoggingBroker().logDebug(
						"Message's call id = " + message.getCallID());
				BrokerFactory.getLoggingBroker().logDebug(
						"Response's call id = " + callIDHeader.getCallId());
				if (message.getCallID().equals(callIDHeader.getCallId())) {
					messages.remove(0);
				}
			}
		}
		if (messages.size() > 0) {
			playNextMessage();
		}
	}
}
 
开发者ID:davidrudder23,项目名称:OpenNotification,代码行数:30,代码来源:SipOutgoing.java

示例11: readMessageSipHeaderLines

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
private boolean readMessageSipHeaderLines(InputStream inputStream, boolean isPreviousLineCRLF) throws IOException {
	boolean crlfReceived = false;
	String line = readLine(inputStream); // This gives us a full line or if it didn't fit in the byte check it may give us part of the line
	if(partialLineRead) {
		partialLine = partialLine + line; // If we are reading partial line again we must concatenate it with the previous partial line to reconstruct the full line
	} else {
		line = partialLine + line; // If we reach the end of the line in this chunk we concatenate it with the partial line from the previous buffer to have a full line
		partialLine = ""; // Reset the partial line so next time we will concatenate empty string instead of the obsolete partial line that we just took care of
		if(!line.equals(CRLF)) { // CRLF indicates END of message headers by RFC
			message.append(line); // Collect the line so far in the message buffer (line by line)
               String lineIgnoreCase = line.toLowerCase();
               // contribution from Alexander Saveliev compare to lower case as RFC 3261 states (7.3.1 Header Field Format) states that header fields are case-insensitive
			if(lineIgnoreCase.startsWith(ContentLengthHeader.NAME.toLowerCase())) { // naive Content-Length header parsing to figure out how much bytes of message body must be read after the SIP headers
				contentLength = Integer.parseInt(line.substring(
						ContentLengthHeader.NAME.length()+1).trim());
			} else if(lineIgnoreCase.startsWith(CallIdHeader.NAME.toLowerCase())) { // naive Content-Length header parsing to figure out how much bytes of message body must be read after the SIP headers
				callId = line.substring(
						CallIdHeader.NAME.length()+1).trim();
			}
		} else {				
			if(isPreviousLineCRLF) {
           		// Handling keepalive ping (double CRLF) as defined per RFC 5626 Section 4.4.1
               	// sending pong (single CRLF)
               	if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
                       logger.logDebug("KeepAlive Double CRLF received, sending single CRLF as defined per RFC 5626 Section 4.4.1");
                       logger.logDebug("~~~ setting isPreviousLineCRLF=false");
                   }

               	crlfReceived = false;

               	try {
					sipMessageListener.sendSingleCLRF();
				} catch (Exception e) {						
					logger.logError("A problem occured while trying to send a single CLRF in response to a double CLRF", e);
				}                	                	
           	} else {
           		crlfReceived = true;
               	if (logger.isLoggingEnabled(LogLevels.TRACE_DEBUG)) {
                   	logger.logDebug("Received CRLF");
                   }
               	if(sipMessageListener != null && 
               			sipMessageListener instanceof ConnectionOrientedMessageChannel) {
               		((ConnectionOrientedMessageChannel)sipMessageListener).cancelPingKeepAliveTimeoutTaskIfStarted();
               	}
           	}
			if(message.length() > 0) { // if we havent read any headers yet we are between messages and ignore CRLFs
				readingMessageBodyContents = true;
				readingHeaderLines = false;
				partialLineRead = false;
				message.append(CRLF); // the parser needs CRLF at the end, otherwise fails TODO: Is that a bug?
				if(logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
					logger.logDebug("Content Length parsed is " + contentLength);
				}

				contentReadSoFar = 0;
				messageBody = new byte[contentLength];
			}
		}			
	}
	return crlfReceived;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:62,代码来源:NioPipelineParser.java

示例12: getCallIdHeader

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
public CallIdHeader getCallIdHeader() {
    return this.callIdHeader;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:4,代码来源:SIPMessage.java

示例13: auditDialogs

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
/**
 * Audits SIP dialogs for leaks - Compares the dialogs in the dialogTable
 * with a list of Call IDs passed by the application. - Dialogs that are not
 * known by the application are leak suspects. - Kill the dialogs that are
 * still around after the timer specified.
 *
 * @return Audit report, null if no dialog leaks were found
 */
private String auditDialogs(Set activeCallIDs, long leakedDialogTimer) {
    String auditReport = "  Leaked dialogs:\n";
    int leakedDialogs = 0;
    long currentTime = System.currentTimeMillis();

    // Make a shallow copy of the dialog list.
    // This copy will remain intact as leaked dialogs are removed by the
    // stack.
    LinkedList dialogs;
    synchronized (dialogTable) {
        dialogs = new LinkedList(dialogTable.values());
    }

    // Iterate through the dialogDialog, get the callID of each dialog and
    // check if it's in the
    // list of active calls passed by the application. If it isn't, start
    // the timer on it.
    // If the timer has expired, kill the dialog.
    Iterator it = dialogs.iterator();
    while (it.hasNext()) {
        // Get the next dialog
        SIPDialog itDialog = (SIPDialog) it.next();

        // Get the call id associated with this dialog
        CallIdHeader callIdHeader = (itDialog != null ? itDialog
                .getCallId() : null);
        String callID = (callIdHeader != null ? callIdHeader.getCallId()
                : null);

        // Check if the application knows about this call id
        if (itDialog != null && callID != null
                && !activeCallIDs.contains(callID)) {
            // Application doesn't know anything about this dialog...
            if (itDialog.auditTag == 0) {
                // Mark this dialog as suspect
                itDialog.auditTag = currentTime;
            } else {
                // We already audited this dialog before. Check if his
                // time's up.
                if (currentTime - itDialog.auditTag >= leakedDialogTimer) {
                    // Leaked dialog found
                    leakedDialogs++;

                    // Generate report
                    DialogState dialogState = itDialog.getState();
                    String dialogReport = "dialog id: "
                            + itDialog.getDialogId()
                            + ", dialog state: "
                            + (dialogState != null ? dialogState.toString()
                                    : "null");
                    auditReport += "    " + dialogReport + "\n";

                    // Kill it
                    itDialog.setState(SIPDialog.TERMINATED_STATE);
                    if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG))
                        logger.logDebug("auditDialogs: leaked "
                                + dialogReport);
                }
            }
        }
    }

    // Return final report
    if (leakedDialogs > 0) {
        auditReport += "    Total: " + Integer.toString(leakedDialogs)
                + " leaked dialogs detected and removed.\n";
    } else {
        auditReport = null;
    }
    return auditReport;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:80,代码来源:SIPTransactionStack.java

示例14: sendRequest

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
void sendRequest(String method) {
    System.out.println("====Send " + method);
    try {
        cSeqHeader = headerFactory.createCSeqHeader(1L, method);

        // Create a new CallId header
        CallIdHeader callIdHeader = sipProvider.getNewCallId();

        int fromTag = 1000 + hashCode();

        fromHeader = headerFactory.createFromHeader(fromNameAddress,
                new Integer(fromTag).toString());
        String sdpData = "v=0\r\n"
                + "o=4855 13760799956958020 13760799956958020"
                + " IN IP4  129.6.55.78\r\n" + "s=mysession session\r\n"
                + "p=+46 8 52018010\r\n" + "c=IN IP4  129.6.55.78\r\n"
                + "t=0 0\r\n" + "m=audio 6022 RTP/AVP 0 4 18\r\n"
                + "a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:4 G723/8000\r\n"
                + "a=rtpmap:18 G729A/8000\r\n" + "a=ptime:20\r\n";
        // Create ViaHeaders
        ArrayList viaHeaders = new ArrayList();
        ViaHeader viaHeader = headerFactory.createViaHeader(myAddress,
                listeningPoint.getPort(), transport, null);

        // add via headers
        viaHeaders.add(viaHeader);
        Request request = messageFactory.createRequest(requestURI,
                method, callIdHeader, cSeqHeader, fromHeader,
                toHeader, viaHeaders, maxForwards);

        request.setHeader(contactHeader);
        request.setContent(sdpData, contentTypeHeader);
        // Create the client transaction.
        ClientTransaction inviteTid = sipProvider
                .getNewClientTransaction(request);
        if(!protocolObjects.autoDialog) {
        	dialog = sipProvider.getNewDialog(inviteTid);
        }
        System.out.println("inviteTid = " + inviteTid + " sipDialog = "
                + inviteTid.getDialog());

        // send the request out.
        inviteTid.sendRequest();
    } catch (Exception ex) {
        System.out.println("Fail to sendInviteRequest with SipException:\n"
                + ex.getMessage());
        TxTimeoutTest.fail(
                "Shootist: Failed to send invite: ", ex);

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

示例15: sendInviteRequest

import javax.sip.header.CallIdHeader; //导入依赖的package包/类
void sendInviteRequest() {
    System.out.println("====Send INVITE");
    try {
        cSeqHeader = headerFactory.createCSeqHeader(1L, Request.INVITE);

        // Create a new CallId header
        CallIdHeader callIdHeader = sipProvider.getNewCallId();

        int fromTag = 1000 + hashCode();

        fromHeader = headerFactory.createFromHeader(fromNameAddress,
                new Integer(fromTag).toString());
        String sdpData = "v=0\r\n"
                + "o=4855 13760799956958020 13760799956958020"
                + " IN IP4  129.6.55.78\r\n" + "s=mysession session\r\n"
                + "p=+46 8 52018010\r\n" + "c=IN IP4  129.6.55.78\r\n"
                + "t=0 0\r\n" + "m=audio 6022 RTP/AVP 0 4 18\r\n"
                + "a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:4 G723/8000\r\n"
                + "a=rtpmap:18 G729A/8000\r\n" + "a=ptime:20\r\n";
        // Create ViaHeaders
        ArrayList viaHeaders = new ArrayList();
        ViaHeader viaHeader = headerFactory.createViaHeader(myAddress,
                listeningPoint.getPort(), transport, null);

        // add via headers
        viaHeaders.add(viaHeader);
        Request request = messageFactory.createRequest(requestURI,
                Request.INVITE, callIdHeader, cSeqHeader, fromHeader,
                toHeader, viaHeaders, maxForwards);

        request.setHeader(contactHeader);
        request.setContent(sdpData, contentTypeHeader);
        // Create the client transaction.
        ClientTransaction inviteTid = sipProvider
                .getNewClientTransaction(request);
        if(!protocolObjects.autoDialog) {
        	dialog = sipProvider.getNewDialog(inviteTid);
        }
        System.out.println("inviteTid = " + inviteTid + " sipDialog = "
                + inviteTid.getDialog());

        // send the request out.
        inviteTid.sendRequest();
    } catch (Exception ex) {
        System.out.println("Fail to sendInviteRequest with SipException:\n"
                + ex.getMessage());
        DialogTimeoutTest.fail(
                "Shootist: Failed to send invite: ", ex);

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


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