Changes between Version 5 and Version 6 of pjsip-doc/call
- Timestamp:
- Feb 10, 2014 11:28:04 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
pjsip-doc/call
v5 v6 8 8 Subclassing the Call Class 9 9 ------------------------------------ 10 To use the Call class, normally application SHOULD create its own subclass, such as:: 10 To use the Call class, normally application SHOULD create its own subclass, such as: 11 12 .. code-block:: c++ 11 13 12 14 class MyCall : public Call … … 31 33 Making Outgoing Calls 32 34 -------------------------------------- 33 Making outgoing call is simple, just invoke makeCall() method of the Call object. Assuming you have the Account object as acc variable and destination URI string in dest_uri, you can initiate outgoing call with the snippet below:: 35 Making outgoing call is simple, just invoke makeCall() method of the Call object. Assuming you have the Account object as acc variable and destination URI string in dest_uri, you can initiate outgoing call with the snippet below: 36 37 .. code-block:: c++ 34 38 35 39 Call *call = new MyCall(*acc); … … 47 51 Incoming calls are reported as onIncomingCall() of the Account class. You must derive a class from the Account class to handle incoming calls. 48 52 49 Below is a sample code of the callback implementation:: 53 Below is a sample code of the callback implementation: 54 55 .. code-block:: c++ 50 56 51 57 void MyAccount::onIncomingCall(OnIncomingCallParam &iprm) … … 53 59 Call *call = new MyCall(*this, iprm.callId); 54 60 CallOpParam prm; 55 prm.statusCode = (pjsip_status_code)200;61 prm.statusCode = PJSIP_SC_OK; 56 62 call->answer(prm); 57 63 } … … 67 73 Call disconnection event is a special event since once the callback that reports this event returns, the call is no longer valid and any operations invoked to the call object will raise error exception. Thus, it is recommended to delete the call object inside the callback. 68 74 69 The call disconnection is reported in onCallState() method of Call and it can be detected as follows:: 75 The call disconnection is reported in onCallState() method of Call and it can be detected as follows: 76 77 .. code-block:: c++ 70 78 71 79 void MyCall::onCallState(OnCallStateParam &prm) … … 84 92 Below is a sample code to connect the call to the sound device when the media is active:: 85 93 94 .. code-block:: c++ 95 86 96 void MyCall::onCallMediaState(OnCallMediaStateParam &prm) 87 97 { … … 89 99 // Iterate all the call medias 90 100 for (unsigned i = 0; i < ci.media.size(); i++) { 91 if ( getMedia(i)) { // Check if the media is valid101 if (ci.media[i].type==PJMEDIA_TYPE_AUDIO && getMedia(i)) { 92 102 AudioMedia *aud_med = (AudioMedia *)getMedia(i); 93 103