Esempio n. 1
0
void Message::print(std::ostream& os) const
{
    os << "STUN[" << methodString() << ":" << transactionID();
    for (unsigned i = 0; i < _attrs.size(); i++)
        os << ":" << _attrs[i]->typeString();
    os << "]";
}
Esempio n. 2
0
std::string Message::toString() const
{
    std::ostringstream os;
    os << "STUN[" << methodString() << ":" << transactionID();
    for (unsigned i = 0; i < _attrs.size(); i++)
        os << ":" << _attrs[i]->typeString();
    os << "]";
    return os.str();
}
Esempio n. 3
0
void SipDialog::setRequestData(SipMessage& request, const char* method)
{
    UtlString methodString(method ? method : "");
    if(methodString.isNull())
    {
        request.getRequestMethod(&methodString);
    }

    // The request URI should be the remote contact
    UtlString remoteContact;
    // Use getUri() to get the contact in addr-spec format.
    // (mRemoteContact should have no field parameters, but if it has
    // URI parameters, toString would add <...>, which are not allowed
    // in URIs.)
    mRemoteContact.getUri(remoteContact);

    // If the remote contact is empty, use the remote request uri
    if (remoteContact.compareTo("sip:") == 0)
    {
         Os::Logger::instance().log(FAC_ACD, PRI_DEBUG, "SipDialog::setRequestData - using remote request uri %s",
                       msRemoteRequestUri.data());
         request.setSipRequestFirstHeaderLine(methodString, msRemoteRequestUri);
    }
    else
    {
         request.setSipRequestFirstHeaderLine(methodString, remoteContact);
    }

    // The local field is the From field
    UtlString fromField;
    mLocalField.toString(fromField);
    request.setRawFromField(fromField);

    // The remote field is the To field
    UtlString toField;
    mRemoteField.toString(toField);
    request.setRawToField(toField);

    // Get the next local Cseq, the method should already be set
    getNextLocalCseq();
    request.setCSeqField(mLastLocalCseq, methodString);

    // Set the route header according to the route set
    if(!mRouteSet.isNull())
    {
        request.setRouteField(mRouteSet);
    }

    // Set the call-id
    request.setCallIdField(*this);
}
Esempio n. 4
0
void SipDialog::setRequestData(SipMessage& request, const char* method)
{
    UtlString methodString(method ? method : "");
    if(methodString.isNull())
    {
        request.getRequestMethod(&methodString);
    }
    // The request URI should be the remote contact
    UtlString remoteContact;
    mRemoteContact.removeAngleBrackets();
    mRemoteContact.removeUrlParameters();
    mRemoteContact.toString(remoteContact);
    
    // If the remote contact is empty, use the remote request uri
    if (remoteContact.compareTo("sip:") == 0)
    {
         OsSysLog::add(FAC_ACD, PRI_DEBUG, "SipDialog::setRequestData - using remote request uri %s",
                       msRemoteRequestUri.data());
         request.setSipRequestFirstHeaderLine(methodString, msRemoteRequestUri);
    }
    else
    {
        // Need to convert the remoteContact to a URI as it may be in
        // name-addr format
        Url remoteContactUrl(remoteContact);
        UtlString remoteContactInUriFormat;
        remoteContactUrl.getUri(remoteContactInUriFormat);
        OsSysLog::add(FAC_ACD, PRI_DEBUG, 
                      "SipDialog::setRequestData - remoteContact: \"%s\" URI formated: \"%s\"",
                      remoteContact.data(), remoteContactInUriFormat.data());
        request.setSipRequestFirstHeaderLine(methodString, remoteContactInUriFormat);
    }

    // The local field is the From field
    UtlString fromField;
    mLocalField.toString(fromField);
    request.setRawFromField(fromField);

    // The remote field is the To field
    UtlString toField;
    mRemoteField.toString(toField);
    request.setRawToField(toField);

    // Get the next local Cseq, the method should already be set
    getNextLocalCseq();
    request.setCSeqField(mLastLocalCseq, methodString);

    // Set the route header according to the route set
    if(!mRouteSet.isNull())
    {
        request.setRouteField(mRouteSet);
    }

    // Set the call-id
    request.setCallIdField(*this);

    // Set the contact to the incoming request URI
    if(!msLocalRequestUri.isNull())
    {
       request.setContactField(msLocalRequestUri);
    }
}
Esempio n. 5
0
http::Method Request::method() const
{
    return http::getMethod(methodString());
}