mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp
branchRCL_3
changeset 19 095bea5f582e
parent 12 2eb3b066cc7d
child 20 0ac9a5310753
equal deleted inserted replaced
18:a36789189b53 19:095bea5f582e
    66     {
    66     {
    67     gint ret(TMS_RESULT_SUCCESS);
    67     gint ret(TMS_RESULT_SUCCESS);
    68     TRACE_PRN_FN_ENT;
    68     TRACE_PRN_FN_ENT;
    69     iSession = new TMSCallProxy();
    69     iSession = new TMSCallProxy();
    70 
    70 
    71     if (iSession)
    71     TRACE_PRN_FN_ENT;
    72         {
    72     if (!iSession)
    73         if (iSession->Connect() != TMS_RESULT_SUCCESS)
    73         {
       
    74         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
       
    75         }
       
    76     RET_REASON_IF_ERR(ret);
       
    77 
       
    78     if (iSession->Connect() != TMS_RESULT_SUCCESS)
       
    79         {
       
    80         delete iSession;
       
    81         iSession = NULL;
       
    82         ret = TMS_RESULT_FATAL_ERROR;
       
    83         }
       
    84     else
       
    85         {
       
    86         ret = iSession->CreateCall(TMS_CALL_IP);
       
    87         if (ret != TMS_RESULT_SUCCESS && ret != TMS_RESULT_ALREADY_EXIST)
    74             {
    88             {
       
    89             iSession->Close();
    75             delete iSession;
    90             delete iSession;
    76             iSession = NULL;
    91             iSession = NULL;
    77             ret = TMS_RESULT_FATAL_ERROR;
    92             ret = TMS_RESULT_FATAL_ERROR;
    78             }
    93             }
    79         else
    94         }
    80             {
    95     RET_REASON_IF_ERR(ret);
    81             ret = iSession->CreateCall(TMS_CALL_IP);
       
    82             if (ret != TMS_RESULT_SUCCESS && ret != TMS_RESULT_ALREADY_EXIST)
       
    83                 {
       
    84                 iSession->Close();
       
    85                 delete iSession;
       
    86                 ret = TMS_RESULT_FATAL_ERROR;
       
    87                 }
       
    88             }
       
    89         }
       
    90     else
       
    91         {
       
    92         ret = TMS_RESULT_INSUFFICIENT_MEMORY;
       
    93         }
       
    94     TRACE_PRN_FN_EXT;
    96     TRACE_PRN_FN_EXT;
    95     return ret;
    97     return ret;
    96     }
    98     }
    97 
    99 
    98 TMSCallType TMSIPCallBodyImpl::GetCallType()
   100 TMSCallType TMSIPCallBodyImpl::GetCallType()
    99     {
   101     {
   100     TMSCallType ctype(TMS_CALL_IP);
   102     return TMS_CALL_IP;
   101     return ctype;
       
   102     }
   103     }
   103 
   104 
   104 gint TMSIPCallBodyImpl::GetCallContextId(guint& ctxid)
   105 gint TMSIPCallBodyImpl::GetCallContextId(guint& ctxid)
   105     {
   106     {
   106     gint ret(TMS_RESULT_FEATURE_NOT_SUPPORTED);
   107     gint ret(TMS_RESULT_FEATURE_NOT_SUPPORTED);
   125             if (ret == TMS_RESULT_SUCCESS)
   126             if (ret == TMS_RESULT_SUCCESS)
   126                 {
   127                 {
   127                 ret = AddStreamToList(strm);
   128                 ret = AddStreamToList(strm);
   128                 }
   129                 }
   129             //TODO:Need longer term fix to not destory everything
   130             //TODO:Need longer term fix to not destory everything
   130             //if more the one stream is trying to be created.
   131             //if more than one stream is trying to be created.
   131             else if (ret == TMS_RESULT_ALREADY_EXIST)
   132             else if (ret == TMS_RESULT_ALREADY_EXIST)
   132                 {
   133                 {
   133                 break;
   134                 break;
   134                 }
   135                 }
   135             else
   136             else
   191             }
   192             }
   192         }
   193         }
   193 
   194 
   194     if (itStrm)
   195     if (itStrm)
   195         {
   196         {
       
   197         // Remove stream object from the vector. After removing, the iterator
       
   198         // will point to the next item (if available); so, do NOT attempt
       
   199         // deleting itStrm here! (Will result in KERN-EXEC)
   196         iStreamsVector.erase(itStrm); // Remove from array
   200         iStreamsVector.erase(itStrm); // Remove from array
   197         // Don't delete itStrm as the iterator advanced to the next
       
   198         // item on the list
       
   199         ret = TMSStreamImpl::Delete(strm);
   201         ret = TMSStreamImpl::Delete(strm);
   200         }
   202         }
   201     TRACE_PRN_FN_EXT;
   203     TRACE_PRN_FN_EXT;
   202     return ret;
   204     return ret;
   203     }
   205     }