当前位置: 首页>>代码示例>>C++>>正文


C++ TransactionEntry::GSMState方法代码示例

本文整理汇总了C++中TransactionEntry::GSMState方法的典型用法代码示例。如果您正苦于以下问题:C++ TransactionEntry::GSMState方法的具体用法?C++ TransactionEntry::GSMState怎么用?C++ TransactionEntry::GSMState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TransactionEntry的用法示例。


在下文中一共展示了TransactionEntry::GSMState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MOCStarter


//.........这里部分代码省略.........
        if (TCH==NULL) return;
    }

    // Let the phone know we're going ahead with the transaction.
    LOG(INFO) << "sending CMServiceAccept";
    LCH->send(GSM::L3CMServiceAccept());

    // Get the Setup message.
    // GSM 04.08 5.2.1.2
    GSM::L3Message* msg_setup = getMessage(LCH);
    const GSM::L3Setup *setup = dynamic_cast<const GSM::L3Setup*>(msg_setup);
    if (!setup) {
        if (msg_setup) {
            LOG(WARNING) << "Unexpected message " << *msg_setup;
            delete msg_setup;
        }
        throw UnexpectedMessage();
    }
    LOG(INFO) << *setup;
    // Pull out the L3 short transaction information now.
    // See GSM 04.07 11.2.3.1.3.
    // Set the high bit, since this TI came from the MS.
    unsigned L3TI = setup->TI() | 0x08;
    if (!setup->haveCalledPartyBCDNumber()) {
        // FIXME -- This is quick-and-dirty, not following GSM 04.08 5.
        LOG(WARNING) << "MOC setup with no number";
        // Cause 0x60 "Invalid mandatory information"
        LCH->send(GSM::L3ReleaseComplete(L3TI,0x60));
        LCH->send(GSM::L3ChannelRelease());
        // The SIP side and transaction record don't exist yet.
        // So we're done.
        delete msg_setup;
        return;
    }

    LOG(DEBUG) << "SIP start engine";
    // Get the users sip_uri by pulling out the IMSI.
    //const char *IMSI = mobileID.digits();
    // Pull out Number user is trying to call and use as the sip_uri.
    const char *bcdDigits = setup->calledPartyBCDNumber().digits();

    // Create a transaction table entry so the TCH controller knows what to do later.
    // The transaction on the TCH will be a continuation of this one.
    TransactionEntry *transaction = new TransactionEntry(
        gConfig.getStr("SIP.Proxy.Speech").c_str(),
        mobileID,
        LCH,
        req->serviceType(),
        L3TI,
        setup->calledPartyBCDNumber());
    LOG(DEBUG) << "transaction: " << *transaction;
    gTransactionTable.add(transaction);

    // At this point, we have enough information start the SIP call setup.
    // We also have a SIP side and a transaction that will need to be
    // cleaned up on abort or clearing.

    // Now start a call by contacting asterisk.
    // Engine methods will return their current state.
    // The remote party will start ringing soon.
    LOG(DEBUG) << "starting SIP (INVITE) Calling "<<bcdDigits;
    unsigned basePort = allocateRTPPorts();
    transaction->MOCSendINVITE(bcdDigits,gConfig.getStr("SIP.Local.IP").c_str(),basePort,SIP::RTPGSM610);
    LOG(DEBUG) << "transaction: " << *transaction;

    // Once we can start SIP call setup, send Call Proceeding.
    LOG(INFO) << "Sending Call Proceeding";
    LCH->send(GSM::L3CallProceeding(L3TI));
    transaction->GSMState(GSM::MOCProceeding);
    // Finally done with the Setup message.
    delete msg_setup;

    // The transaction is moving on to the MOCController.
    // If we need a TCH assignment, we do it here.
    LOG(DEBUG) << "transaction: " << *transaction;
    if (veryEarly) {
        // For very early assignment, we need a mode change.
        static const GSM::L3ChannelMode mode(GSM::L3ChannelMode::SpeechV1);
        LCH->send(GSM::L3ChannelModeModify(LCH->channelDescription(),mode));
        GSM::L3Message *msg_ack = getMessage(LCH);
        const GSM::L3ChannelModeModifyAcknowledge *ack =
            dynamic_cast<GSM::L3ChannelModeModifyAcknowledge*>(msg_ack);
        if (!ack) {
            if (msg_ack) {
                LOG(WARNING) << "Unexpected message " << *msg_ack;
                delete msg_ack;
            }
            throw UnexpectedMessage(transaction->ID());
        }
        // Cause 0x06 is "channel unacceptable"
        bool modeOK = (ack->mode()==mode);
        delete msg_ack;
        if (!modeOK) return abortAndRemoveCall(transaction,LCH,GSM::L3Cause(0x06));
        MOCController(transaction,dynamic_cast<GSM::TCHFACCHLogicalChannel*>(LCH));
    } else {
        // For late assignment, send the TCH assignment now.
        // This dispatcher on the next channel will continue the transaction.
        assignTCHF(transaction,LCH,TCH);
    }
}
开发者ID:haristiantosp,项目名称:BBB,代码行数:101,代码来源:CallControl.cpp


注:本文中的TransactionEntry::GSMState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。