reSIProcate/DialogUsageManager  9680
DialogUsage.cxx
Go to the documentation of this file.
00001 #include "resip/dum/AppDialog.hxx"
00002 #include "resip/dum/AppDialogSet.hxx"
00003 #include "resip/dum/DialogUsage.hxx"
00004 #include "resip/dum/Dialog.hxx"
00005 #include "resip/dum/DialogSet.hxx"
00006 #include "resip/dum/DialogUsageManager.hxx"
00007 #include "rutil/Logger.hxx"
00008 
00009 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
00010 
00011 using namespace resip;
00012 
00013 DialogUsage::Exception::Exception(const Data& msg,const Data& file,int line)
00014    : BaseException(msg, file, line)
00015 {
00016 }
00017 
00018 const char*
00019 DialogUsage::Exception::name() const
00020 {
00021    return "DialogUsage::Exception";
00022 }
00023 
00024 DialogUsage::DialogUsage(DialogUsageManager& dum, Dialog& dialog) :
00025    BaseUsage(dum),
00026    mDialog(dialog)
00027 {
00028 }
00029 
00030 DialogUsage::~DialogUsage()
00031 {
00032    mDialog.possiblyDie();
00033 }
00034 
00035 AppDialogSetHandle 
00036 DialogUsage::getAppDialogSet()
00037 {
00038    return mDialog.mDialogSet.mAppDialogSet->getHandle();
00039 }
00040 
00041 AppDialogHandle 
00042 DialogUsage::getAppDialog()
00043 {
00044    return mDialog.mAppDialog->getHandle();
00045 }
00046 
00047 const NameAddr&
00048 DialogUsage::myAddr() const
00049 {
00050    return mDialog.mLocalNameAddr;
00051 }
00052 
00053 const NameAddr&
00054 DialogUsage::peerAddr() const
00055 {
00056    return mDialog.mRemoteNameAddr;
00057 }
00058 
00059 const NameAddr&
00060 DialogUsage::remoteTarget() const
00061 {
00062    return mDialog.mRemoteTarget;
00063 }
00064 
00065 const DialogId& 
00066 DialogUsage::getDialogId() const
00067 {
00068    return mDialog.getId();
00069 }
00070 
00071 const Data& 
00072 DialogUsage::getCallId() const
00073 {
00074    return mDialog.getId().getCallId();
00075 }
00076 
00077 SharedPtr<UserProfile> 
00078 DialogUsage::getUserProfile() 
00079 {
00080    return mDialog.mDialogSet.getUserProfile();
00081 }
00082 
00083 void 
00084 DialogUsage::send(SharedPtr<SipMessage> msg)
00085 {
00086    // give app an chance to adorn the message.
00087    onReadyToSend(*msg);
00088    mDialog.send(msg);
00089 }
00090 
00091 void
00092 DialogUsage::sendCommand(SharedPtr<SipMessage> message)
00093 {   
00094    mDum.post(new DialogUsageSendCommand(*this, message));
00095 }
00096 
00097 
00098 /*
00099 void 
00100 DialogUsage::send(SipMessage& msg)
00101 {
00102    assert(msg.isResponse() || msg.header(h_RequestLine).method() == ACK);
00103    mDialog.send(msg);
00104 }
00105 */
00106 
00107 /* ====================================================================
00108  * The Vovida Software License, Version 1.0 
00109  * 
00110  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00111  * 
00112  * Redistribution and use in source and binary forms, with or without
00113  * modification, are permitted provided that the following conditions
00114  * are met:
00115  * 
00116  * 1. Redistributions of source code must retain the above copyright
00117  *    notice, this list of conditions and the following disclaimer.
00118  * 
00119  * 2. Redistributions in binary form must reproduce the above copyright
00120  *    notice, this list of conditions and the following disclaimer in
00121  *    the documentation and/or other materials provided with the
00122 
00123  *    distribution.
00124  * 
00125  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00126  *    and "Vovida Open Communication Application Library (VOCAL)" must
00127  *    not be used to endorse or promote products derived from this
00128  *    software without prior written permission. For written
00129  *    permission, please contact vocal@vovida.org.
00130  *
00131  * 4. Products derived from this software may not be called "VOCAL", nor
00132  *    may "VOCAL" appear in their name, without prior written
00133  *    permission of Vovida Networks, Inc.
00134  * 
00135  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00136  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00137  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00138  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00139  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00140  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00141  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00142  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00143  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00144  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00145  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00146  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00147  * DAMAGE.
00148  * 
00149  * ====================================================================
00150  * 
00151  * This software consists of voluntary contributions made by Vovida
00152  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00153  * Inc.  For more information on Vovida Networks, Inc., please see
00154  * <http://www.vovida.org/>.
00155  *
00156  */