Exemplo n.º 1
0
//******************************************************************************
void createMediaTaskandFlowGraph()
{
    // Create foundation Media Task & Flow Graph

    OsSysLog::initialize(0, "mstream");
    OsSysLog::setLoggingPriority(PRI_DEBUG);
    OsSysLog::enableConsoleOutput(true);

    OsConfigDb cfgDb;
    if (cfgDb.loadFromFile("mstream.cfg") == OS_SUCCESS)
        cout << "(Read " << cfgDb.numEntries()
             << " config entries from mstream.cfg)" << endl;

    // Creates a sipXmediaFactoryImpl
    pFactory = sipXmediaFactoryFactory(&cfgDb);

    MpMediaTask* pMediaTask = MpMediaTask::getMediaTask();
    //sleep(0);

    char sdesName[64];
    sprintf(sdesName, "mstream-%d", OsProcess::getCurrentPID());
    cout << "Setting SDES NAME to " << sdesName << endl;

#ifdef INCLUDE_RTCP

    CSourceDescription* pSdes = CSourceDescription::GetLocalSDES();
    pSdes->SetAllComponents(
        /* NAME        */   (unsigned char*)sdesName,
        /* EMAIL       */   (unsigned char*)"",
        /* PHONE       */   (unsigned char*)"",
        /* APPLICATION */   (unsigned char*)"",
        /* LOCATION    */   (unsigned char*)"",
        /* NOTES       */   (unsigned char*)"",
        /* PRIVATE     */   (unsigned char*)"");

#endif

    selectFlowGraph(createFlowGraph());

    if (initialFocus)
    {
        pIf->giveFocus();
        cout << "Gave focus to this interface" << endl;
    }

    {
        SdpCodecList codecList;
        //UtlString codecs = "PCMU PCMA TELEPHONE-EVENT";
        UtlString codecNames = "PCMU";
        codecList.addCodecs(codecNames);

        codecList.getCodecs(numCodecs, pCodecArray);
    } 
}
Exemplo n.º 2
0
void MpTestConfig::initializeCallManager()
{
        UtlString localAddress;
        OsSocket::getHostIp(&localAddress);

        // Enable PCMU, PCMA, Tones/RFC2833
        UtlString codecList("PCMU PCMA TELEPHONE-EVENT");
        SdpCodecList* pCodecList = new SdpCodecList();
        UtlString oneCodec;
        pCodecList->addCodecs(codecList);

         mCallManager = new CallManager(
            FALSE,
            NULL,
            TRUE,                              // early media in 180 ringing
            pCodecList,
            9000,                              // rtp start
            9999,                              // rtp end
            localAddress.data(),
            localAddress.data(),
            mUA,
            0,                                 // sipSessionReinviteTimer
            NULL,                              // mgcpStackTask
            "*****@*****.**",             // defaultCallExtension
            Connection::RING,                  // availableBehavior
            NULL,                              // unconditionalForwardUrl
            -1,                                // forwardOnNoAnswerSeconds
            NULL,                              // forwardOnNoAnswerUrl
            Connection::BUSY,                  // busyBehavior
            NULL,                              // sipForwardOnBusyUrl
            NULL,                              // speedNums
            CallManager::SIP_CALL,             // phonesetOutgoingCallProtocol
            4,                                 // numDialPlanDigits
            CallManager::NEAR_END_HOLD,        // holdType
            5000,                              // offeringDelay
            "",                                // pLocal
            CP_MAXIMUM_RINGING_EXPIRE_SECONDS, // inviteExpiresSeconds
            QOS_LAYER3_LOW_DELAY_IP_TOS,       // expeditedIpTos
            10,                                // maxCalls
            sipXmediaFactoryFactory(NULL),
            SAMLE_RATE);    // CpMediaInterfaceFactory

   mCallManager->start() ;
}