📄 uacallinfo.cxx
字号:
/* ==================================================================== * The Vovida Software License, Version 1.0 * * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The names "VOCAL", "Vovida Open Communication Application Library", * and "Vovida Open Communication Application Library (VOCAL)" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact vocal@vovida.org. * * 4. Products derived from this software may not be called "VOCAL", nor * may "VOCAL" appear in their name, without prior written * permission of Vovida Networks, Inc. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * ==================================================================== * * This software consists of voluntary contributions made by Vovida * Networks, Inc. and many individuals on behalf of Vovida Networks, * Inc. For more information on Vovida Networks, Inc., please see * <http://www.vovida.org/>. * */static const char* const UaCallInfo_cxx_Version = "$Id: UaCallInfo.cxx,v 1.25 2002/11/09 02:13:08 derekm Exp $";#include "global.h"#include "UaCallInfo.hxx"#include "SipSdp.hxx"#include "SipRecordRoute.hxx"using namespace Vocal;UaCallInfo::UaCallInfo(){ originator = false; contactList = new ContactList; route1List = new RouteList; route2List = new RouteList; xferMsg = 0; ackMsg = 0; ringInvite = 0; ring2Invite = 0; currentContact = 0; localSdp = 0; remoteSdp = 0; local2Sdp = 0; remote2Sdp = 0;}UaCallInfo::~UaCallInfo(){}voidUaCallInfo::setOriginator( const bool yorn ){ originator = yorn;}boolUaCallInfo::isOriginator(){ return originator;}voidUaCallInfo::setCallee( const SipUrl url ){ callee = url;}SipUrlUaCallInfo::getCallee(){ return callee;}Sptr < Contact >UaCallInfo::getContact(){ return currentContact;}voidUaCallInfo::setContact( Sptr < Contact > contact ){ currentContact = contact;}Sptr < ContactList >UaCallInfo::getContactList(){ return contactList;}voidUaCallInfo::addContact( const Sptr < Contact > contact ){ contactList->push_back( contact );}voidUaCallInfo::setContactMsg( Sptr<InviteMsg> msg ){ Sptr < Contact > contact = new Contact( *msg ); // Set as current contact setContact( contact ); // Add to contact list addContact( contact );}voidUaCallInfo::setContactMsg( InviteMsg& msg ){ Sptr < Contact > contact = new Contact( msg ); // Set as current contact setContact( contact ); // Add to contact list addContact( contact );}Sptr < Contact >UaCallInfo::findContact( const SipMsg& msg ){#if 0 ContactList::iterator iter = contactList->begin(); while ( iter != contactList->end() ) { if ( (*(*iter)).computeCallLeg() == msg.computeCallLeg() ) { return (*iter); } iter++; }#else ContactList::iterator iter = contactList->end(); while ( iter != contactList->begin() ) { iter--; if ( (*(*iter)).computeCallLeg() == msg.computeCallLeg() ) { return (*iter); } }#endif return 0;}voidUaCallInfo::removeContact( const Sptr < Contact > contact ){ ContactList::iterator iter = contactList->begin(); while ( iter != contactList->end() ) { if ( *(*iter) == *contact ) { contactList->erase(iter); break; } iter++; } return ;}voidUaCallInfo::clearContactList(){ contactList->clear();}voidUaCallInfo::setCaller( const SipUrl url ){ caller = url;}SipUrlUaCallInfo::getCaller(){ return caller;}voidUaCallInfo::setLocalSdp( const Sptr < SipSdp > sdp ){ localSdp = sdp;}voidUaCallInfo::setRemoteSdp( const Sptr < SipSdp > sdp ){ remoteSdp = sdp;}Sptr < SipSdp >UaCallInfo::getLocalSdp(){ return localSdp;}Sptr < SipSdp >UaCallInfo::getRemoteSdp(){ return remoteSdp;}voidUaCallInfo::setLocal2Sdp( const Sptr < SipSdp > sdp ){ local2Sdp = sdp;}voidUaCallInfo::setRemote2Sdp( const Sptr < SipSdp > sdp ){ remote2Sdp = sdp;}Sptr < SipSdp >UaCallInfo::getLocal2Sdp(){ return local2Sdp;}Sptr < SipSdp >UaCallInfo::getRemote2Sdp(){ return remote2Sdp;}voidUaCallInfo::setRingInvite( Sptr < InviteMsg > invite ){ ringInvite = invite;}Sptr < InviteMsg >UaCallInfo::getRingInvite(){ return ringInvite;}voidUaCallInfo::setRing2Invite( Sptr < InviteMsg > invite ){ ring2Invite = invite;}Sptr < InviteMsg >UaCallInfo::getRing2Invite(){ return ring2Invite;}voidUaCallInfo::setCallerRoute1List( SipRecordRouteList recordrouteList ){ route1List->clear(); SipRecordRouteList::iterator iter = recordrouteList.begin(); while ( iter != recordrouteList.end() ) { Sptr< BaseUrl > baseUrl = (*iter)->getUrl(); if( baseUrl->getType() == TEL_URL ) { cpLog( LOG_ERR, "TEL_URL currently not supported\n" ); assert( 0 ); } // Assume we have a SIP_URL Sptr< SipUrl > sipUrl; sipUrl.dynamicCast( baseUrl ); assert( sipUrl != 0 ); cpLog(LOG_DEBUG, "setCallerRoute1List %s:%s", sipUrl->getHost().logData(), sipUrl->getPort().logData() ); Sptr < SipRoute > route = new SipRoute; route->setUrl( baseUrl ); route1List->insert( route1List->begin(), route ); iter++; }}voidUaCallInfo::setCalleeRoute1List( SipRecordRouteList recordrouteList ){ route1List->clear(); SipRecordRouteList::iterator iter = recordrouteList.begin(); while ( iter != recordrouteList.end() ) { Sptr< BaseUrl > baseUrl = (*iter)->getUrl(); if( baseUrl->getType() == TEL_URL ) { cpLog( LOG_ERR, "TEL_URL currently not supported\n" ); assert( 0 ); } // Assume we have a SIP_URL Sptr< SipUrl > sipUrl; sipUrl.dynamicCast( baseUrl ); assert( sipUrl != 0 ); Sptr< SipRoute > route = new SipRoute; route->setUrl( baseUrl ); cpLog( LOG_DEBUG, "setCalleeRoute1List %s", route->encode().logData() ); route1List->push_back( route ); iter++; }}voidUaCallInfo::addRoute1( const Sptr < SipRoute > sipRoute ){ route1List->push_back( sipRoute );}vector < SipRoute* >UaCallInfo::getRoute1List(){ vector < SipRoute* > siprouteList; RouteList::iterator iter = route1List->begin(); while ( iter != route1List->end() ) { Sptr< BaseUrl > baseUrl = (*iter)->getUrl(); if( baseUrl->getType() == TEL_URL ) { cpLog( LOG_ERR, "TEL_URL currently not supported\n" ); assert( 0 ); } // Assume we have a SIP_URL Sptr< SipUrl > sipUrl; sipUrl.dynamicCast( baseUrl ); assert( sipUrl != 0 ); cpLog( LOG_DEBUG, "getRoute1List %s", sipUrl->encode().logData() ); siprouteList.push_back( new SipRoute( *(*iter) ) ); iter++; } return siprouteList;}voidUaCallInfo::setCallerRoute2List( SipRecordRouteList recordrouteList ){ route2List->clear(); SipRecordRouteList::iterator iter = recordrouteList.begin(); while ( iter != recordrouteList.end() ) { Sptr < SipRoute > route = new SipRoute; route->setUrl( (*iter)->getUrl() ); route2List->insert( route2List->begin(), route ); iter++; }}voidUaCallInfo::setCalleeRoute2List( SipRecordRouteList recordrouteList ){ route2List->clear(); SipRecordRouteList::iterator iter = recordrouteList.begin(); while ( iter != recordrouteList.end() ) { Sptr < SipRoute > route = new SipRoute; route->setUrl( (*iter)->getUrl() ); route2List->push_back( route ); iter++; }}voidUaCallInfo::addRoute2( const Sptr < SipRoute > sipRoute ){ route2List->push_back( sipRoute );}vector < SipRoute* >UaCallInfo::getRoute2List(){ vector < SipRoute* > siprouteList; RouteList::iterator iter = route2List->begin(); while ( iter != route2List->end() ) { siprouteList.push_back( new SipRoute( *(*iter) ) ); iter++; } return siprouteList;}voidUaCallInfo::setXferMsg( Sptr < TransferMsg > msg ){ xferMsg = msg;}Sptr < TransferMsg >UaCallInfo::getXferMsg(){ return xferMsg;}voidUaCallInfo::setAckMsg( Sptr < AckMsg > ack ){ ackMsg = ack;}Sptr < AckMsg >UaCallInfo::getAckMsg(){ return ackMsg;}/* Local Variables: *//* c-file-style: "stroustrup" *//* indent-tabs-mode: nil *//* c-file-offsets: ((access-label . -) (inclass . ++)) *//* c-basic-offset: 4 *//* End: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -