⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 taolistenerclient.cpp

📁 基于sipfoundy 公司开发的sipx协议API
💻 CPP
📖 第 1 页 / 共 4 页
字号:
                                                                                int& addedToCall,                                                                                int& remoteIsCallee){        PtEvent::PtEventId      eventId = (PtEvent::PtEventId) rMsg.getTaoObjHandle();        if (!PtEvent::isConnectionEvent(eventId))                return FALSE;        TaoString argList(rMsg.getArgList(), TAOMESSAGE_DELIMITER);        int cnt = argList.getCnt();        if (cnt < 5)                return FALSE;        UtlString callId = argList[0];        int ptr = (int)pListener;        for (int i = 0; i < mListenerCnt; i++)        {                if (mpListeners[i] && mpListeners[i]->mpListenerPtr == ptr)                {                        if (!callId.isNull() && !(mpListeners[i]->mName.isNull()) && callId != mpListeners[i]->mName)                        {                                return FALSE;                        }                        addedToCall = 1;                }        }        PtEvent::PtEventCause cause = (PtEvent::PtEventCause) atoi(argList[4]);        int metaCode = (cnt >= 10) ? atoi(argList[10]) : 0;        int numOldCalls = (cnt > 10) ? (cnt - 11) : 0;        UtlString* oldCallIds = 0;        if (numOldCalls > 0)        {       oldCallIds = new UtlString[numOldCalls];                for (int i = 0; i < numOldCalls; i++)                        oldCallIds[i] = argList[i + 11]; // 1st is the new call        }        int isLocal = atoi(argList[6]);        UtlString addesss;        if (isLocal)                addesss = argList[1];           // local        else                addesss = argList[2];           // remote        int sipResponseCode = atoi(argList[7]);        mpConnEvent->setEventId(eventId);        mpConnEvent->setMetaCode((PtEvent::PtMetaCode)metaCode);        mpConnEvent->setEventAddress(addesss.data());                   // address        mpConnEvent->setEventCallId(callId.data());                     // call id        mpConnEvent->setEventSipResponseCode(sipResponseCode);          // SIP response code        mpConnEvent->setEventSipResponseText(argList[8]);               // SIP response text        mpConnEvent->setEventCause(cause);              // cause        mpConnEvent->setEventNewCallId(argList[10]);            // new call id        mpConnEvent->setEventOldCallIds(numOldCalls, oldCallIds);        mpConnEvent->setEventLocal(isLocal);            // is local?        if (oldCallIds) delete[] oldCallIds;        evId = eventId;        if (cnt > 3)        {                remoteIsCallee = atoi(argList[3]);        }        return TRUE;}UtlBoolean TaoListenerClientTask::getTerminalConnectionEvent(TaoMessage& rMsg,                                                                                PtConnectionListener* pListener,                                                                                int& evId,                                                                                int& addedToCall,                                                                                int& remoteIsCallee){        PtEvent::PtEventId      eventId = (PtEvent::PtEventId) rMsg.getTaoObjHandle();        if (!PtEvent::isTerminalConnectionEvent(eventId))                return FALSE;        TaoString argList(rMsg.getArgList(), TAOMESSAGE_DELIMITER);        int cnt = argList.getCnt();        if (cnt < 7) {                return FALSE;        }        UtlString callId = argList[0];        int ptr = (int)pListener;        for (int i = 0; i < mListenerCnt; i++)        {                if (mpListeners[i] && mpListeners[i]->mpListenerPtr == ptr)                {                        if (!callId.isNull() && !(mpListeners[i]->mName.isNull()) && callId != mpListeners[i]->mName)                        {                                return FALSE;                        }                        addedToCall = 1;                }        }        PtEvent::PtEventCause cause = (PtEvent::PtEventCause) atoi(argList[4]);        int metaCode = (cnt >= 10) ? atoi(argList[10]) : 0;        int numOldCalls = (cnt > 10) ? (cnt - 11) : 0;        UtlString* oldCallIds = 0;        if (numOldCalls > 0)        {       oldCallIds = new UtlString[numOldCalls];                for (int i = 0; i < numOldCalls; i++)                        oldCallIds[i] = argList[i + 11]; // 1st is the new call        }        int isLocal = atoi(argList[6]);        UtlString addesss;        if (isLocal)                addesss = argList[1];           // local        else                addesss = argList[2];           // remote        int sipResponseCode = atoi(argList[7]);        mpTermConnEvent->setEventId(eventId);        mpTermConnEvent->setMetaCode((PtEvent::PtMetaCode)metaCode);        mpTermConnEvent->setEventAddress(addesss.data());                               // address        mpTermConnEvent->setEventTerminal(argList[5]);                  // terminal name        mpTermConnEvent->setEventCallId(callId.data());                                 // call id        mpTermConnEvent->setEventSipResponseCode(sipResponseCode);              // SIP response code        mpTermConnEvent->setEventSipResponseText(argList[8]);   // SIP response text        mpTermConnEvent->setEventCause(cause);                                                  // cause        mpTermConnEvent->setEventNewCallId(argList[10]);                        // new call id        mpTermConnEvent->setEventOldCallIds(numOldCalls, oldCallIds);        mpTermConnEvent->setEventTcLocal(isLocal);                                              // is local?        mpTermConnEvent->setEventLocal(isLocal);                                                // is local?        if (oldCallIds) delete[] oldCallIds;        if (cnt > 3)        {                remoteIsCallee = atoi(argList[3]);        }        evId = eventId;        return TRUE;}#ifdef WV_DEBUGvoid TaoListenerClientTask::getEventName(int eventId, char *name){        switch(eventId)        {                case PtEvent::CONNECTION_CREATED:                        strcpy(name, (char*)"CREATED\0");                        break;                case PtEvent::CONNECTION_ALERTING:                        strcpy(name, (char*)"ALERTING:\0");                        break;                case PtEvent::CONNECTION_DIALING:                        strcpy(name, (char*)"DIALING\0");                        break;                case PtEvent::CONNECTION_ESTABLISHED:                        strcpy(name, (char*)"ESTABLISHED\0");                        break;                case PtEvent::CONNECTION_INITIATED:                        strcpy(name, (char*)"INITIATED\0");                        break;                case PtEvent::CONNECTION_DISCONNECTED:                        strcpy(name, (char*)"DISCONNECTED\0");                        break;                case PtEvent::CONNECTION_FAILED:                        strcpy(name, (char*)"FAILED\0");                        break;                case PtEvent::CONNECTION_NETWORK_ALERTING:                        strcpy(name, (char*)"NETWORK_ALERTING\0");                        break;                case PtEvent::CONNECTION_NETWORK_REACHED:                        strcpy(name, (char*)"NETWORK_REACHED\0");                        break;                case PtEvent::CONNECTION_OFFERED:                        strcpy(name, (char*)"OFFERED\0");                        break;                case PtEvent::CONNECTION_QUEUED:                        strcpy(name, (char*)"QUEUED\0");                        break;                case PtEvent::CONNECTION_UNKNOWN:                        strcpy(name, (char*)"UNKNOWN\0");                        break;                case PtEvent::TERMINAL_CONNECTION_CREATED:                        strcpy(name, (char*)"TC_CREATED\0");                        break;                case PtEvent::TERMINAL_CONNECTION_RINGING:                        strcpy(name, (char*)"TC_RINGING\0");                        break;                case PtEvent::TERMINAL_CONNECTION_HELD:                        strcpy(name, (char*)"TC_HELD\0");                        break;                case PtEvent::TERMINAL_CONNECTION_TALKING:                        strcpy(name, (char*)"TC_TALKING\0");                        break;                case PtEvent::TERMINAL_CONNECTION_DROPPED:                        strcpy(name, (char*)"TC_DROPPED\0");                        break;                case PtEvent::TERMINAL_CONNECTION_IDLE:                        strcpy(name, (char*)"TC_IDLE\0");                        break;                case PtEvent::TERMINAL_CONNECTION_IN_USE:                        strcpy(name, (char*)"TC_IN_USE\0");                        break;                case PtEvent::TERMINAL_CONNECTION_UNKNOWN:                        strcpy(name, (char*)"TC_UNKNOWN\0");                        break;                case PtEvent::CALL_EVENT_TRANSMISSION_ENDED:                        strcpy(name, (char*)"CL_TRANSMISSION_ENDED\0");                        break;                case PtEvent::CALL_ACTIVE:                        strcpy(name, (char*)"CL_ACTIVE\0");                        break;                case PtEvent::CALL_INVALID:                        strcpy(name, (char*)"CL_INVALID\0");                        break;                case PtEvent::CALL_META_CALL_STARTING_STARTED:                        strcpy(name, (char*)"CL_META_STARTING_STARTED\0");                        break;                case PtEvent::CALL_META_CALL_STARTING_ENDED:                        strcpy(name, (char*)"CL_META_STARTING_ENDED\0");                        break;                case PtEvent::CALL_META_CALL_ENDING_STARTED:                        strcpy(name, (char*)"CL_META_ENDING_STARTED\0");                        break;                case PtEvent::CALL_META_CALL_ENDING_ENDED:                        strcpy(name, (char*)"CL_META_ENDING_ENDED\0");                        break;                case PtEvent::SINGLECALL_META_PROGRESS_STARTED:                        strcpy(name, (char*)"CL_META_PROGRESS_STARTED\0");                        break;                case PtEvent::SINGLECALL_META_PROGRESS_ENDED:                        strcpy(name, (char*)"CL_META_PROGRESS_ENDED\0");                        break;                case PtEvent::SINGLECALL_META_SNAPSHOT_STARTED:                        strcpy(name, (char*)"CL_META_SNAPSHOT_STARTED\0");                        break;                case PtEvent::SINGLECALL_META_SNAPSHOT_ENDED:                        strcpy(name, (char*)"CL_META_SNAPSHOT_ENDED\0");                        break;                case PtEvent::CALL_META_ADD_PARTY_STARTED:                        strcpy(name, (char*)"CL_META_ADD_PARTY_STARTED\0");                        break;                case PtEvent::CALL_META_ADD_PARTY_ENDED:                        strcpy(name, (char*)"CL_META_ADD_PARTY_ENDED\0");                        break;                case PtEvent::CALL_META_REMOVE_PARTY_STARTED:                        strcpy(name, (char*)"CL_META_REMOVE_PARTY_STARTED\0");                        break;                case PtEvent::CALL_META_REMOVE_PARTY_ENDED:                        strcpy(name, (char*)"CL_META_REMOVE_PARTY_ENDED\0");                        break;                case PtEvent::MULTICALL_META_MERGE_STARTED:                        strcpy(name, (char*)"CL_META_MERGE_STARTED\0");                        break;                case PtEvent::MULTICALL_META_MERGE_ENDED:                        strcpy(name, (char*)"CL_META_MERGE_ENDED\0");                        break;                case PtEvent::MULTICALL_META_TRANSFER_STARTED:                        strcpy(name, (char*)"CL_META_TRANSFER_STARTED\0");                        break;                case PtEvent::MULTICALL_META_TRANSFER_ENDED:                        strcpy(name, (char*)"CL_META_TRANSFER_ENDED\0");                        break;                default:                        strcpy(name, (char*)"BOGUS EVENT\0");                        break;        }}void TaoListenerClientTask::fireUserEvent(int eventId, int userEventId){        getEventName(eventId, (char*)&name);        USER_EVENT myEv;        myEv.id = (unsigned long)eventId;        strncpy(myEv.name, name, 16);#ifdef _VXWORKS        wvEvent(userEventId, (char*)&myEv, sizeof(USER_EVENT));#endif}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -