Ignore:
Timestamp:
Oct 17, 2018 4:38:39 AM (6 years ago)
Author:
nanang
Message:

Close #2158:

  • Added OnCallTransferRequestParam?.newCall to allow application to instantiate a new Call for the new outgoing call in transfer scenario.
  • Also added OnCallReplacedParam?.newCall mainly for informational purpose (that app should instantiate new Call for replace scenario).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/samples/pjsua2_demo.cpp

    r5717 r5899  
    4040     
    4141    virtual void onCallState(OnCallStateParam &prm); 
     42    virtual void onCallTransferRequest(OnCallTransferRequestParam &prm); 
     43    virtual void onCallReplaced(OnCallReplacedParam &prm); 
    4244}; 
    4345 
     
    5557        std::cout << "*** Account is being deleted: No of calls=" 
    5658                  << calls.size() << std::endl; 
     59 
     60        for (std::vector<Call *>::iterator it = calls.begin(); 
     61             it != calls.end(); ) 
     62        { 
     63            delete (*it); 
     64            it = calls.erase(it); 
     65        } 
    5766    } 
    5867     
     
    100109     
    101110    if (ci.state == PJSIP_INV_STATE_DISCONNECTED) { 
    102         myAcc->removeCall(this); 
     111        //myAcc->removeCall(this); 
    103112        /* Delete the call */ 
    104         delete this; 
    105     } 
    106 } 
     113        //delete this; 
     114    } 
     115} 
     116 
     117void MyCall::onCallTransferRequest(OnCallTransferRequestParam &prm) 
     118{ 
     119    /* Create new Call for call transfer */ 
     120    prm.newCall = new MyCall(*myAcc); 
     121} 
     122 
     123void MyCall::onCallReplaced(OnCallReplacedParam &prm) 
     124{ 
     125    /* Create new Call for call replace */ 
     126    prm.newCall = new MyCall(*myAcc, prm.newCallId); 
     127} 
     128 
    107129 
    108130static void mainProg1(Endpoint &ep) throw(Error) 
     
    148170    // Destroy library 
    149171    std::cout << "*** PJSUA2 SHUTTING DOWN ***" << std::endl; 
    150     delete call; 
    151     delete acc; 
     172    delete acc; /* Will delete all calls too */ 
    152173} 
    153174 
     
    347368        ep.libCreate(); 
    348369 
    349         mainProg3(ep); 
     370        mainProg1(ep); 
    350371        ret = PJ_SUCCESS; 
    351372    } catch (Error & err) { 
Note: See TracChangeset for help on using the changeset viewer.