/mcplong theCount; if ((m_bUsesPhones) && (m_line2phone.Lookup(hLine,hPhone))) { CtPhone* pPhone = CtPhone::FromHandle((HPHONE)hPhone); if (pPhone! = NULL) { if (m_phoneUseCount.Lookup(hPhone,theCount)) if (theCount>1) { // decrease the number of lines using this phone m_phoneUseCount.SetAt(hPhone,theCount-1); } else { //nobody else is using this phone, so let's remove it. m_deviceID2phone.RemoveKey((long)pPhone->GetDeviceID()); m_phone2line.RemoveKey(hPhone); m_phoneUseCount.RemoveKey(hPhone); //now let's close the phone pPhone->Close(); } } //either way, remove the map entry from line to phone. m_line2phone.RemoveKey(hLine); } return S_OK; } else return S_FALSE; } Cisco Unified TAPI Developers Guide for Cisco Unified Communications Manager, Release 15 and SUs 452 Cisco Unified TAPI Examples CloseLine
