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


Java Message类代码示例

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


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

示例1: reflectCauseOnEffect

import javax.sip.message.Message; //导入依赖的package包/类
/**
 * Copies and possibly modifies information from a given SIP
 * <tt>Message</tt> into another SIP <tt>Message</tt> (the first of
 * which is being thought of as the cause for the existence of the second
 * and the second is considered the effect of the first for the sake of
 * clarity in the most common of use cases).
 * <p>
 * The Referred-By header and its optional token are common examples of such
 * information which is to be copied without modification by the referee
 * from the REFER <tt>Request</tt> into the resulting <tt>Request</tt>
 * to the refer target.
 * </p>
 *
 * @param cause the SIP <tt>Message</tt> from which the information is
 * to be copied
 * @param effect the SIP <tt>Message</tt> into which the information is
 * to be copied
 */
private void reflectCauseOnEffect(javax.sip.message.Message cause,
                                  javax.sip.message.Message effect)
{

    /*
     * Referred-By (which comes from a referrer) should be copied to the
     * refer target without tampering.
     *
     * TODO Apart from Referred-By, its token should also be copied if
     * present.
     */
    Header referredBy = cause.getHeader(ReferredByHeader.NAME);

    if (referredBy != null)
    {
        effect.setHeader(referredBy);
    }
}
 
开发者ID:zhaozw,项目名称:android-1,代码行数:37,代码来源:SipMessageFactory.java

示例2: addAllowEventsHeader

import javax.sip.message.Message; //导入依赖的package包/类
/**
 * Creates a list of known events and add them to the value of
 * Allow-Events header
 * @param message the message to set the newly created header
 * @throws ParseException error on creating header
 */
private void addAllowEventsHeader(Message message)
    throws ParseException
{
    Iterable<String> knownEventsList = provider.getKnownEventsList();

    AllowEventsList eventsList = new AllowEventsList();

    synchronized (knownEventsList)
    {
        for (String event : knownEventsList)
        {
            eventsList.add(
                (AllowEvents)provider.getHeaderFactory()
                    .createAllowEventsHeader(event));
        }
    }

    message.setHeader(eventsList);
}
 
开发者ID:jitsi,项目名称:jitsi,代码行数:26,代码来源:ClientCapabilities.java

示例3: testAgainstRIMsgContent

import javax.sip.message.Message; //导入依赖的package包/类
private void testAgainstRIMsgContent( Message tiMsg, Message riMsg ) {

       // Test equality using RI definition of equals
       assertEquals( riMsg.getHeader( ContentLengthHeader.NAME ), tiMsg.getHeader( ContentLengthHeader.NAME ) );
       assertEquals( riMsg.getHeader( ContentTypeHeader.NAME ), tiMsg.getHeader( ContentTypeHeader.NAME ) );
       assertEquals( riMsg.getContent(), tiMsg.getContent() );
   }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:8,代码来源:MessageFactoryTest.java

示例4: startConversation

import javax.sip.message.Message; //导入依赖的package包/类
void startConversation(Message response, Transaction clientTransaction)
		throws SipException, SdpParseException, SdpException, IOException,
		NoDataSourceException, NoProcessorException, InterruptedException,
		NotConfiguredError, NotRealizedError, NoDataSinkException,
		InvalidSessionAddressException, UnknownHostException {
	super.startConversation(response, clientTransaction);
	DialogicAudioMessage message = (DialogicAudioMessage) messages.elementAt(0);
	transmitter.playSound("file:///" + message.getWaveFile());

}
 
开发者ID:davidrudder23,项目名称:OpenNotification,代码行数:11,代码来源:SipOutgoing.java

示例5: startConversation

import javax.sip.message.Message; //导入依赖的package包/类
void startConversation(Message response,
		Transaction clientTransaction) throws SipException,
		SdpParseException, SdpException, IOException,
		NoDataSourceException, NoProcessorException, InterruptedException,
		NotConfiguredError, NotRealizedError, NoDataSinkException,
		InvalidSessionAddressException, UnknownHostException {
	super.startConversation(response, clientTransaction);
	
	dtmfThread = new DTMFThread(this, transmitter);
	
	transmitter.addControllerListener(this);
	transmitter.playSound ("file://"+diaMessage.getWaveFilename());
}
 
开发者ID:davidrudder23,项目名称:OpenNotification,代码行数:14,代码来源:SipIVR.java

示例6: startConversation

import javax.sip.message.Message; //导入依赖的package包/类
void startConversation(Message response,
		Transaction clientTransaction) throws SipException,
		SdpParseException, SdpException, IOException,
		NoDataSourceException, NoProcessorException, InterruptedException,
		NotConfiguredError, NotRealizedError, NoDataSinkException,
		InvalidSessionAddressException, UnknownHostException {
	System.out.println("Starting conversation");

	String sdpData = new String(response.getRawContent());
	SdpFactory sdpFactory = new SdpFactory();
	SessionDescription sessionDescription = sdpFactory
			.createSessionDescription(sdpData);
	Vector mediaDescriptions = sessionDescription
			.getMediaDescriptions(true);
	for (int mdNum = 0; mdNum < mediaDescriptions.size(); mdNum++) {
		MediaDescription mediaDescription = (MediaDescription) mediaDescriptions
				.elementAt(mdNum);
		Media media = mediaDescription.getMedia();
		String proto = media.getProtocol();
		String type = media.getMediaType();
		int port = media.getMediaPort();

		Vector formats = media.getMediaFormats(true);

		if (formats.size() < 1) {
			BrokerFactory.getLoggingBroker().logWarn(
					"In SIP outbound call: No audio formats");
		}
		int sdpFormat = SdpConstants.PCMU;
		try {
			sdpFormat = Integer.parseInt((String) formats.elementAt(0));
		} catch (NumberFormatException nfExc) {
			nfExc.printStackTrace();
		}

		startReceiver(localMediaPort);
		transmitter = new RtpTransmitter(remoteHost, port, sdpFormat);
	}
}
 
开发者ID:davidrudder23,项目名称:OpenNotification,代码行数:40,代码来源:SipInboundCall.java

示例7: fireUnknownMessageReceived

import javax.sip.message.Message; //导入依赖的package包/类
void fireUnknownMessageReceived(Message message) {
    UnknownMessageEvent evt = new UnknownMessageEvent(message);
    for (int i = listeners.size() - 1; i >= 0; i--) {
        ((CommunicationsListener) listeners.get(i))
                .receivedUnknownMessage(evt);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:SipManager.java

示例8: fireCallRejectedLocally

import javax.sip.message.Message; //导入依赖的package包/类
public void fireCallRejectedLocally(String reason, Message invite, Call call) {
    CallRejectedEvent evt = new CallRejectedEvent(reason, invite, call);
    for (int i = listeners.size() - 1; i >= 0; i--) {
        ((CommunicationsListener) listeners.get(i))
                .callRejectedLocally(evt);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:SipManager.java

示例9: fireCallRejectedRemotely

import javax.sip.message.Message; //导入依赖的package包/类
void fireCallRejectedRemotely(String reason, Message invite, Call call) {
    CallRejectedEvent evt = new CallRejectedEvent(reason, invite, call);
    for (int i = listeners.size() - 1; i >= 0; i--) {
        ((CommunicationsListener) listeners.get(i))
                .callRejectedRemotely(evt);
    }

}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:9,代码来源:SipManager.java

示例10: beforeMessage

import javax.sip.message.Message; //导入依赖的package包/类
public void beforeMessage(Message message) {
	callAnalyzer.enter(interceptorCheckpoint);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:4,代码来源:CallAnalysisInterceptor.java

示例11: parseInvite

import javax.sip.message.Message; //导入依赖的package包/类
public void parseInvite(Message message, Dialog d, ServerTransaction trans)
{
	sipDialog = d;
	inviteTransaction = trans;
	parseSDP(new String(message.getRawContent()), true);
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:7,代码来源:CallSession.java

示例12: attachScSpecifics

import javax.sip.message.Message; //导入依赖的package包/类
/**
 * Attaches to <tt>message</tt> headers and object params that we'd like to
 * be present in absolutely all messages we create (like for example the
 * user agent header, the contact header or the provider message object
 * tag).
 *
 * @param message the message that we'd like to tag
 * @return returns a reference to <tt>message</tt> for convenience reasons.
 */
private Message attachScSpecifics(Message message)
{
    SipApplicationData.setApplicationData(message,
                    SipApplicationData.KEY_SERVICE, this.protocolProvider);

    //the jain-sip semantics allow the application to "forget" attaching a
    //To tag to a response so let's make sure we do this here
    if(message instanceof Response)
    {
        FromHeader from = (FromHeader)message.getHeader(From.NAME);
        String fromTag = (from == null) ? null : from.getTag();
        Response response = (Response)message;

        //if there's a from tag and this is a non-failure response,
        //that still doesn't have a To tag, then we are adding a to tag.
        if(fromTag != null && fromTag.trim().length() > 0
            && response.getStatusCode() > 100
            && response.getStatusCode() < 300)
        {
            attachToTag(response, null);
        }
    }

    //add a contact header.
    attachContactHeader(message);


    // If this is a SIP request (other than ACK) then let's try to
    // pre-authenticate it.
    if(message instanceof Request
       && !Request.ACK.equals(((Request)message).getMethod()))
    {
        preAuthenticateRequest((Request)message);
    }

    // User Agent
    UserAgentHeader userAgentHeader
                = protocolProvider.getSipCommUserAgentHeader();

    //beware: if UA header generation failed for some reason, we don't want
    //it to mess up the entire request.
    if (userAgentHeader != null)
    {
        message.setHeader(userAgentHeader);
    }

    return message;
}
 
开发者ID:zhaozw,项目名称:android-1,代码行数:58,代码来源:SipMessageFactory.java

示例13: attachContactHeader

import javax.sip.message.Message; //导入依赖的package包/类
/**
 * The method tries to determine an address that would be reachable by the
 * destination of <tt>message</tt> and then creates a <tt>ContactHeader</tt>
 * out of it and attaches it to the <tt>message</tt>. The method takes into
 * account both <tt>Request</tt>s and <tt>Response</tt>s. The method
 * is meant to be used only for messages that have been otherwise
 * initialized (in particular the Request URI in requests or the Via
 * headers in responses.). The method is only meant for use by
 * <tt>attachScSpecifics()</tt>. Any requests and responses created through
 * this message factory would go through <tt>attachScSpecifics</tt> so they
 * don't need to explicitly call this method.
 *
 * @param message the message that we'd like to attach a
 * <tt>ContactHeader</tt> to.
 *
 * @return a reference to the <tt>message</tt> that was also passed as
 * a parameter in order to allow for more agility when using the method.
 */
private Message attachContactHeader(Message message)
{
    if(message instanceof Request)
    {
        Request request = (Request)message;

        SipURI requestURI = (SipURI)request.getRequestURI();

        request.setHeader(protocolProvider.getContactHeader(requestURI));
        return request;
    }
    else
    {
        Response response = (Response)message;

        ViaHeader via = (ViaHeader)response.getHeader(ViaHeader.NAME);
        SipURI intendedDestinationURI;

        String transport = via.getTransport();

        String host = via.getHost();
        int port = via.getPort();

        try
        {
            intendedDestinationURI = protocolProvider.getAddressFactory()
                .createSipURI(null, host);
            intendedDestinationURI.setPort(port);

            if(transport != null)
                intendedDestinationURI.setTransportParam(transport);
        }
        catch (ParseException e)
        {
            if (logger.isDebugEnabled())
                logger.debug(via + " does not seem to be a valid header.");

            FromHeader from = (FromHeader)response.getHeader(From.NAME);
            intendedDestinationURI = (SipURI)from.getAddress().getURI();
        }

        ContactHeader contactHeader
            = protocolProvider.getContactHeader(intendedDestinationURI);

        response.setHeader(contactHeader);

        return response;
    }
}
 
开发者ID:zhaozw,项目名称:android-1,代码行数:68,代码来源:SipMessageFactory.java

示例14: createInviteRequest

import javax.sip.message.Message; //导入依赖的package包/类
/**
 * Creates an invite request destined for <tt>callee</tt> and reflects
 * any possible non-null cause (e.g. a Refer request causing a transfer) on
 * the newly created request.
 *
 * @param toAddress the sip address of the callee that the request is meant
 * for.
 * @param cause the SIP <tt>Message</tt> from which the information is
 * to be copied or <tt>null</tt> if there is no cause to be reflected (
 * e.g. a refer request).
 *
 * @return a newly created sip <tt>Request</tt> destined for
 * <tt>callee</tt>.
 *
 * @throws OperationFailedException with the corresponding code if creating
 *             the request fails.
 * @throws IllegalArgumentException if <tt>toAddress</tt> does not appear
 * to be a valid destination.
 */
public Request createInviteRequest( Address                   toAddress,
                                    javax.sip.message.Message cause)
    throws OperationFailedException, IllegalArgumentException
{
    Request invite = createInviteRequest(toAddress);

    /*
     * Whatever the cause of the outgoing call is, reflect the appropriate
     * information from it into the INVITE request (and do it elsewhere
     * because this method is already long enough and difficult to grasp).
     */
    if (cause != null)
    {
        reflectCauseOnEffect(cause, invite);
    }

    return invite;
}
 
开发者ID:zhaozw,项目名称:android-1,代码行数:38,代码来源:SipMessageFactory.java

示例15: inviteCompleted

import javax.sip.message.Message; //导入依赖的package包/类
/**
 * Notifies this <tt>MethodProcessorListener</tt> that the procedure for
 * handling an INVITE or reINVITE SIP <tt>Request</tt> has completed and it
 * is appropriate to determine whether the remote <tt>CallPeer</tt> is a
 * conference focus.
 *
 * @param sourceCallPeer the <tt>CallPeer</tt> with which the procedure for
 * handling an INVITE or reINVITE SIP <tt>Request</tt> has finished
 * negotiating
 * @param remoteMessage the remote SIP <tt>Message</tt> which was received,
 * processed and which prompted sending a specific local SIP
 * <tt>Message</tt>
 * @param localMessage the local SIP <tt>Message</tt> which was sent to the
 * <tt>CallPeer</tt> as part of the processing of its remote SIP
 * <tt>Message</tt>
 */
private void inviteCompleted(
        CallPeerSipImpl sourceCallPeer,
        Message remoteMessage,
        Message localMessage)
{
    ContactHeader contactHeader
        = (ContactHeader) remoteMessage.getHeader(ContactHeader.NAME);
    boolean conferenceFocus = false;

    if (contactHeader != null)
    {
        /*
         * The javadoc says that ContactHeader#getParameter(String) will
         * return an empty string for a flag but it does not and returns
         * null.
         */
        Iterator<?> parameterNameIter
            = contactHeader.getParameterNames();

        while (parameterNameIter.hasNext())
            if ("isfocus"
                    .equalsIgnoreCase(parameterNameIter.next().toString()))
            {
                conferenceFocus = true;
                break;
            }
    }

    sourceCallPeer.addCallPeerListener(callPeerStateListener);
    sourceCallPeer.setConferenceFocus(conferenceFocus);

    if (sourceCallPeer.isConferenceFocus() && sourceCallPeer.getState() ==
        CallPeerState.CONNECTED)
    {
        ConferenceSubscriberSubscription subscription
            = new ConferenceSubscriberSubscription(
                sourceCallPeer);

        try
        {
            subscriber.subscribe(subscription);
        }
        catch (OperationFailedException ofe)
        {
            logger
                .error(
                    "Failed to create or send a conference subscription to "
                    + sourceCallPeer, ofe);
        }
    }
}
 
开发者ID:zhaozw,项目名称:android-1,代码行数:68,代码来源:OperationSetTelephonyConferencingSipImpl.java


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