VoIPSignal.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:85k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  *  VoIPSignal.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  Coding Template header file
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  *------------------------------------------------------------------------------
  152.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  153.  *============================================================================
  154.  ****************************************************************************/
  155. #include "MMI_features.h"
  156. #ifdef __MMI_VOIP__
  157. #include "stdC.h"
  158. #include "L4Dr1.h"
  159. #include "DebugInitDef.h"
  160. #include "mmi_trc.h"    /* debug info */
  161. #include "GlobalMenuItems.h"
  162. #include "GlobalScrEnum.h"
  163. #include "CustMenuRes.h"
  164. #include "CustDataRes.h"
  165. #include "ProtocolEvents.h"
  166. #include "CommonScreens.h"
  167. #include "SettingProfile.h"
  168. #include "EventsGprot.h"
  169. #include "wgui_categories_popup.h"
  170. #include "wgui_categories_inputs.h"
  171. #include "wgui_categories_util.h"
  172. #include "NVRAMEnum.h"
  173. #include "NVRAMProt.h"
  174. #include "NVRAMType.h"
  175. #include "custom_nvram_editor_data_item.h"
  176. #include "custom_data_account.h"
  177. #include "CallManagementStruct.h"
  178. #include "CallManagementGprot.h"
  179. #include "CallsGprots.h"
  180. #include "DateTimeGprot.h"
  181. #include "PhoneBookGprot.h"
  182. #include "TimerEvents.h"
  183. #include "VolumeHandler.h"
  184. #include "VoIPDef.h"
  185. #include "VoIPGProt.h"
  186. #include "VoIPProt.h"
  187. #ifdef SIP_CONFORMANCE_TEST
  188. /*****************************************************************************
  189.  * FUNCTION
  190.  *  mmi_voip_entry_option_query_check
  191.  * DESCRIPTION
  192.  *  Determine target's URI and get ready to process option query action.
  193.  * PARAMETERS
  194.  *  void
  195.  * RETURNS
  196.  *  void
  197.  *****************************************************************************/
  198. void mmi_voip_entry_option_query_check(void)
  199. {
  200.     /*----------------------------------------------------------------*/
  201.     /* Local Variables                                                */
  202.     /*----------------------------------------------------------------*/
  203.     
  204.     /*----------------------------------------------------------------*/
  205.     /* Code Body                                                      */
  206.     /*----------------------------------------------------------------*/
  207.     if (pfnUnicodeStrlen((S8*) g_voip_cntx_p->call_misc_info.dispUri))
  208.     {
  209.         mmi_voip_parse_uri(g_voip_cntx_p->call_misc_info.dispUri);
  210.         memset(g_voip_cntx_p->call_misc_info.inputUri, 0, VOIP_URI_LEN);
  211.         UnicodeNToAnsii(
  212.             (S8*) g_voip_cntx_p->call_misc_info.inputUri,
  213.             (S8*) g_voip_cntx_p->call_misc_info.dispUri,
  214.             (VOIP_URI_LEN * ENCODING_LENGTH));
  215.         if (mmi_voip_validate_uri(g_voip_cntx_p->call_misc_info.dispUri) == TRUE)
  216.         {
  217.             mmi_voip_set_processing_parameter(
  218.                 STR_GLOBAL_SEARCHING,
  219.                 STR_ID_VOIP_PROCESSING,
  220.                 IMG_GLOBAL_PROGRESS,
  221.                 0,
  222.                 0,
  223.                 0,
  224.                 0,
  225.                 0,
  226.                 0);
  227.             mmi_voip_entry_processing_screen();
  228.             mmi_voip_option_query_req();
  229.         }
  230.         else
  231.         {
  232.             DisplayPopup(
  233.                 (U8*)GetString(STR_ID_VOIP_INVALID_USERNAME),
  234.                 IMG_GLOBAL_UNFINISHED,
  235.                 1,
  236.                 UI_POPUP_NOTIFYDURATION_TIME,
  237.                 ERROR_TONE);
  238.         }
  239.     }
  240.     else    /* not allow to query an empty number */
  241.     {
  242.         DisplayPopup(
  243.             (U8*)GetString(STR_ID_VOIP_EMPTY_USERNAME),
  244.             IMG_GLOBAL_UNFINISHED,
  245.             1,
  246.             UI_POPUP_NOTIFYDURATION_TIME,
  247.             ERROR_TONE);
  248.     }
  249. }
  250. #endif /* SIP_CONFORMANCE_TEST */
  251. /*****************************************************************************
  252.  * FUNCTION
  253.  *  mmi_voip_pre_dial
  254.  * DESCRIPTION
  255.  *  Determine to dial or not based on current state.
  256.  * PARAMETERS
  257.  *  void
  258.  * RETURNS
  259.  *  void
  260.  *****************************************************************************/
  261. void mmi_voip_pre_dial(void)
  262. {
  263.     /*----------------------------------------------------------------*/
  264.     /* Local Variables                                                */
  265.     /*----------------------------------------------------------------*/
  266.     /*----------------------------------------------------------------*/
  267.     /* Code Body                                                      */
  268.     /*----------------------------------------------------------------*/
  269.     /* check register state */
  270.     if (g_voip_cntx_p->reg_state_info == MMI_VOIP_REG_STATE)
  271.     {
  272.         /* cannot dial voip call when gsm call exists */
  273.         if (GetTotalCallCount() != 0)
  274.         {
  275.             mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_NOT_ALLOW_TO_DIAL), IMG_GLOBAL_UNFINISHED);
  276.         #if 0
  277. /* under construction !*/
  278. /* under construction !*/
  279. /* under construction !*/
  280. /* under construction !*/
  281. /* under construction !*/
  282. /* under construction !*/
  283.         #endif
  284.             if (g_voip_cntx_p->call_setting_info.saved_setting.autoRedial == TRUE)
  285.             {
  286.                 /* in case it is redialing, redialing screen should be deleted */
  287.                 PRINT_INFORMATION(("n[mmi_voip_pre_dial] Redialing Process Aborts because of Incoming GSM Calln"));
  288.                 mmi_voip_entry_abort_redial();
  289.             }
  290.             return;
  291.         }
  292.         /* check call boundary */
  293.         if ((mmi_voip_is_codec_compatible(g_voip_cntx_p->call_setting_info.codecEnum, FALSE)) &&
  294.             (g_voip_cntx_p->call_list_info.numTotal < MMI_VOIP_MAX_NUM_CALL))
  295.         {
  296.             mmi_voip_entry_dial();
  297.         }
  298.         else /* current codec does not support or call boundary exceeds */
  299.         {
  300.             mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_NOT_ALLOW_TO_DIAL), IMG_GLOBAL_UNFINISHED);
  301.         #if 0
  302. /* under construction !*/
  303. /* under construction !*/
  304. /* under construction !*/
  305. /* under construction !*/
  306. /* under construction !*/
  307. /* under construction !*/
  308.         #endif
  309.             DeleteScreenIfPresent(SCR_ID_VOIP_CALL_EDITOR_OPTION); /* go back to call editor screen */
  310.         }
  311.     }
  312.     else if (g_voip_cntx_p->reg_state_info == MMI_VOIP_DEREG_STATE)
  313.     {
  314.         /* in case user intends to dial sos originally but change his mind after login */
  315.         g_voip_cntx_p->call_misc_info.isSOS = FALSE;
  316.         if (g_voip_cntx_p->call_setting_info.saved_setting.autoRedial == TRUE)
  317.         {
  318.             /* in case receiving deregister_ind in redialing process */
  319.             PRINT_INFORMATION(("n[mmi_voip_pre_dial] Redialing Process Aborts because of Not Registern"));
  320.             mmi_voip_entry_abort_redial();
  321.         }
  322.         mmi_voip_entry_login_confirm();
  323.     }
  324.     else /* g_voip_cntx_p->reg_state_info == MMI_VOIP_PROCESS_STATE */
  325.     {
  326.         /* in case user intends to dial sos originally but change his mind after login */
  327.         g_voip_cntx_p->call_misc_info.isSOS = FALSE;
  328.         if (g_voip_cntx_p->call_setting_info.saved_setting.autoRedial == TRUE)
  329.         {
  330.             /* in case receiving deregister_ind in redialing process */
  331.             PRINT_INFORMATION(("n[mmi_voip_pre_dial] Redialing Process Aborts because of Register Ongoingn"));
  332.             mmi_voip_entry_abort_redial();
  333.         }
  334.         mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_PROCESSING), IMG_GLOBAL_UNFINISHED);
  335.     #if 0
  336. /* under construction !*/
  337. /* under construction !*/
  338. /* under construction !*/
  339. /* under construction !*/
  340. /* under construction !*/
  341. /* under construction !*/
  342.     #endif
  343.         DeleteScreenIfPresent(SCR_ID_VOIP_CALL_EDITOR_OPTION); /* go back to call editor screen */
  344.     }
  345. }
  346. /*****************************************************************************
  347.  * FUNCTION
  348.  *  mmi_voip_entry_dial
  349.  * DESCRIPTION
  350.  *  Entry function of VoIPNew CallOptionDial
  351.  * PARAMETERS
  352.  *  void
  353.  * RETURNS
  354.  *  void
  355.  *****************************************************************************/
  356. void mmi_voip_entry_dial(void)
  357. {
  358.     /*----------------------------------------------------------------*/
  359.     /* Local Variables                                                */
  360.     /*----------------------------------------------------------------*/
  361.     U8 *unicodeOwner = OslMalloc(VOIP_URI_LEN * ENCODING_LENGTH);
  362.     S32 profIndex = g_voip_cntx_p->prof_setting_info.actprofIndex;
  363.     S32 activecallId = 0;
  364.     /*----------------------------------------------------------------*/
  365.     /* Code Body                                                      */
  366.     /*----------------------------------------------------------------*/
  367.     if ((!pfnUnicodeStrcmp((S8*)g_voip_cntx_p->call_misc_info.dispUri, (S8*)sos112)) ||
  368.         (!pfnUnicodeStrcmp((S8*)g_voip_cntx_p->call_misc_info.dispUri, (S8*)sos911)) ||
  369.         (g_voip_cntx_p->call_misc_info.isSOS == TRUE))
  370.     {
  371.         /* emergency number should not apply auto redial */
  372.         if (g_voip_cntx_p->call_misc_info.isSOS == TRUE)
  373.         {
  374.             memset(g_voip_cntx_p->call_misc_info.dispUri, 0, (VOIP_URI_LEN * ENCODING_LENGTH));
  375.             pfnUnicodeStrcpy((S8*)g_voip_cntx_p->call_misc_info.dispUri, (S8*)sos112);
  376.             g_voip_cntx_p->call_misc_info.isSOS = FALSE;
  377.         }        
  378.         mmi_voip_entry_dial_sos();
  379.         return;
  380.     }
  381.     if (pfnUnicodeStrlen((S8*)g_voip_cntx_p->call_misc_info.dispUri))
  382.     {
  383.         MMI_ASSERT(g_voip_cntx_p->call_misc_info.dispUri[VOIP_URI_LEN * ENCODING_LENGTH - 2] == '' && g_voip_cntx_p->call_misc_info.dispUri[VOIP_URI_LEN * ENCODING_LENGTH - 1] == '');
  384.         mmi_voip_parse_uri(g_voip_cntx_p->call_misc_info.dispUri);
  385.         memset(unicodeOwner, 0, (VOIP_URI_LEN * ENCODING_LENGTH));
  386.         AnsiiNToUnicodeString(
  387.             (S8*)unicodeOwner, 
  388.             (S8*)g_voip_cntx_p->prof_setting_info.saved_prof[profIndex].acct_info.username, 
  389.             VOIP_URI_LEN);
  390.         if (mmi_voip_is_owner_number(g_voip_cntx_p->call_misc_info.dispUri, unicodeOwner) == TRUE)
  391.         {
  392.             mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_CANNOT_DIAL_OWNER), IMG_GLOBAL_UNFINISHED);
  393.         #if 0
  394. /* under construction !*/
  395. /* under construction !*/
  396. /* under construction !*/
  397. /* under construction !*/
  398. /* under construction !*/
  399. /* under construction !*/
  400.         #endif
  401.             DeleteScreenIfPresent(SCR_ID_VOIP_CALL_EDITOR_OPTION); /* go back to call editor screen */
  402.         }
  403.         else /* normal call */
  404.         {
  405.             if (mmi_voip_validate_uri(g_voip_cntx_p->call_misc_info.dispUri) == TRUE)
  406.             {
  407.                 memset(g_voip_cntx_p->call_misc_info.inputUri, 0, VOIP_URI_LEN);
  408.                 UnicodeNToAnsii(
  409.                     (S8*)g_voip_cntx_p->call_misc_info.inputUri,
  410.                     (S8*)g_voip_cntx_p->call_misc_info.dispUri,
  411.                     (VOIP_URI_LEN * ENCODING_LENGTH));
  412.                 if (g_voip_cntx_p->call_setting_info.saved_setting.autoRedial == TRUE)
  413.                 {
  414.                     MMI_ASSERT(g_voip_cntx_p->call_misc_info.inputUri[VOIP_URI_LEN - 1] == '');
  415.                     memcpy(g_voip_cntx_p->call_redial_info.redialUri, g_voip_cntx_p->call_misc_info.inputUri, VOIP_URI_LEN);
  416.                 }
  417.                 /* set all rtp directions as inactive before action */
  418.                 mmi_voip_switch_rtp(TRUE, -1, -1);
  419.                 mmi_voip_entry_outgoing_call();
  420.                 activecallId = mmi_voip_get_active_call_id();
  421.                 if (activecallId != -1)
  422.                 {
  423.                     mmi_voip_hold_and_dial_req(activecallId);
  424.                 }
  425.                 else
  426.                 {
  427.                     mmi_voip_dial_req();
  428.                 }
  429.             }
  430.             else
  431.             {
  432.                 mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_INVALID_USERNAME), IMG_GLOBAL_UNFINISHED);
  433.             #if 0
  434. /* under construction !*/
  435. /* under construction !*/
  436. /* under construction !*/
  437. /* under construction !*/
  438. /* under construction !*/
  439. /* under construction !*/
  440.             #endif
  441.                 DeleteScreenIfPresent(SCR_ID_VOIP_CALL_EDITOR_OPTION); /* go back to call editor screen */
  442.             }
  443.         }
  444.         OslMfree(unicodeOwner);
  445.     }
  446.     else /* not allow to dial an empty number */
  447.     {
  448.         mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_EMPTY_USERNAME), IMG_GLOBAL_UNFINISHED);
  449.     #if 0
  450. /* under construction !*/
  451. /* under construction !*/
  452. /* under construction !*/
  453. /* under construction !*/
  454. /* under construction !*/
  455. /* under construction !*/
  456.     #endif
  457.         DeleteScreenIfPresent(SCR_ID_VOIP_CALL_EDITOR_OPTION); /* go back to call editor screen */
  458.     }
  459. }
  460. /*****************************************************************************
  461.  * FUNCTION
  462.  *  mmi_voip_entry_redial
  463.  * DESCRIPTION
  464.  *  Entry function when redial timer expires.
  465.  * PARAMETERS
  466.  *  void
  467.  * RETURNS
  468.  *  void
  469.  *****************************************************************************/
  470. void mmi_voip_entry_redial(void)
  471. {
  472.     StopTimer(VOIP_AUTOREDIAL_TIMER);
  473.     MMI_ASSERT(g_voip_cntx_p->call_redial_info.redialUri[VOIP_URI_LEN - 1] == '');
  474.     AnsiiNToUnicodeString((S8*)g_voip_cntx_p->call_misc_info.dispUri, (S8*)g_voip_cntx_p->call_redial_info.redialUri, VOIP_URI_LEN);
  475.     g_voip_cntx_p->call_redial_info.currAttempt++;
  476.     mmi_voip_pre_dial();
  477. }
  478. /*****************************************************************************
  479.  * FUNCTION
  480.  *  mmi_voip_entry_save_phonebook
  481.  * DESCRIPTION
  482.  *  Entry function of VoIPNew CallOptionSave to Phonebook
  483.  * PARAMETERS
  484.  *  void
  485.  * RETURNS
  486.  *  void
  487.  *****************************************************************************/
  488. void mmi_voip_entry_save_phonebook(void)
  489. {
  490.     /*----------------------------------------------------------------*/
  491.     /* Local Variables                                                */
  492.     /*----------------------------------------------------------------*/
  493.     /*----------------------------------------------------------------*/
  494.     /* Code Body                                                      */
  495.     /*----------------------------------------------------------------*/
  496.     /* save dtmf digits to phonebook in call */
  497.     if (GetExitScrnID() == SCR_ID_VOIP_DTMF_EDITOR)
  498.     {
  499.         SaveNumberFromIdleScrn((S8*)g_voip_cntx_p->call_misc_info.dispDtmf, 0);
  500.     }
  501.     /* save uri address to phonebook in call */
  502.     else
  503.     {
  504.         /* cannot save empty uri address to phonebook */
  505.         if (pfnUnicodeStrlen((S8*)g_voip_cntx_p->call_misc_info.dispUri))
  506.         {
  507.             mmi_phb_save_entry_for_service_field((S8*)g_voip_cntx_p->call_misc_info.dispUri, MMI_PHB_ENTER_FROM_VOIP);
  508.         }
  509.         else
  510.         {
  511.             mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_EMPTY_USERNAME), IMG_GLOBAL_UNFINISHED);
  512.         #if 0
  513. /* under construction !*/
  514. /* under construction !*/
  515. /* under construction !*/
  516. /* under construction !*/
  517. /* under construction !*/
  518. /* under construction !*/
  519.         #endif
  520.             DeleteScreenIfPresent(SCR_ID_VOIP_CALL_EDITOR_OPTION); /* go back to call editor screen */
  521.         }
  522.     }
  523. }
  524. /*****************************************************************************
  525.  * FUNCTION
  526.  *  mmi_voip_entry_sos
  527.  * DESCRIPTION
  528.  *  Entry function of VoIPNew CallOptionSOS
  529.  * PARAMETERS
  530.  *  void
  531.  * RETURNS
  532.  *  void
  533.  *****************************************************************************/
  534. void mmi_voip_entry_sos(void)
  535. {
  536.     /*----------------------------------------------------------------*/
  537.     /* Local Variables                                                */
  538.     /*----------------------------------------------------------------*/
  539.     /*----------------------------------------------------------------*/
  540.     /* Code Body                                                      */
  541.     /*----------------------------------------------------------------*/
  542.     g_voip_cntx_p->call_misc_info.isSOS = TRUE;
  543.     mmi_voip_pre_dial();
  544. }
  545. /*****************************************************************************
  546.  * FUNCTION
  547.  *  mmi_voip_entry_dial_sos
  548.  * DESCRIPTION
  549.  *  Dial emergency number.
  550.  * PARAMETERS
  551.  *  void
  552.  * RETURNS
  553.  *  void
  554.  *****************************************************************************/
  555. void mmi_voip_entry_dial_sos(void)
  556. {
  557.     /*----------------------------------------------------------------*/
  558.     /* Local Variables                                                */
  559.     /*----------------------------------------------------------------*/
  560.     /*----------------------------------------------------------------*/
  561.     /* Code Body                                                      */
  562.     /*----------------------------------------------------------------*/
  563.     memset(g_voip_cntx_p->call_misc_info.inputUri, 0, VOIP_URI_LEN);
  564.     UnicodeNToAnsii(
  565.         (S8*)g_voip_cntx_p->call_misc_info.inputUri,
  566.         (S8*)g_voip_cntx_p->call_misc_info.dispUri,
  567.         (VOIP_URI_LEN * ENCODING_LENGTH));
  568.     /* set all rtp directions as inactive before action */
  569.     mmi_voip_switch_rtp(TRUE, -1, -1);
  570.     mmi_voip_entry_outgoing_call();
  571.     mmi_voip_dial_sos_req();
  572. }
  573. /*****************************************************************************
  574.  * FUNCTION
  575.  *  mmi_voip_entry_abort_call
  576.  * DESCRIPTION
  577.  *  Abort outgoing call.
  578.  * PARAMETERS
  579.  *  void
  580.  * RETURNS
  581.  *  void
  582.  *****************************************************************************/
  583. void mmi_voip_entry_abort_call(void)
  584. {
  585.     /*----------------------------------------------------------------*/
  586.     /* Local Variables                                                */
  587.     /*----------------------------------------------------------------*/
  588.     S32 callId = 0;
  589.     /*----------------------------------------------------------------*/
  590.     /* Code Body                                                      */
  591.     /*----------------------------------------------------------------*/
  592.     if (g_voip_cntx_p->call_setting_info.saved_setting.autoRedial == TRUE)
  593.     {
  594.         mmi_voip_entry_abort_redial();
  595.     }
  596.     /* END key is disable in processing screen because force release will execute automatically */
  597.     mmi_voip_set_processing_parameter(
  598.         STR_GLOBAL_ABORT,
  599.         STR_ID_VOIP_PROCESSING,
  600.         IMG_GLOBAL_PROGRESS,
  601.         0,
  602.         0,
  603.         0,
  604.         0,
  605.         0,
  606.         0);
  607.     mmi_voip_entry_processing_screen();
  608.     DeleteScreenIfPresent(SCR_ID_VOIP_OUTGOING_CALL);
  609.     /* set all rtp directions as inactive before action */
  610.     mmi_voip_switch_rtp(TRUE, -1, -1);
  611.     callId = mmi_voip_get_outgoing_call_id();
  612.     g_voip_cntx_p->call_misc_info.isAbort = TRUE;
  613.     if (callId != -1)
  614.     {
  615.         mmi_voip_stop_inbandtone();
  616.         mmi_voip_release_req(callId, 0);
  617.         mmi_voip_force_release_req(callId, 0);
  618.     }
  619.     else
  620.     {
  621.         /* progressing_ind is not received yet */
  622.         mmi_voip_release_req(g_voip_cntx_p->call_list_info.maxnumCall, 0);
  623.         mmi_voip_force_release_req(g_voip_cntx_p->call_list_info.maxnumCall, 0);
  624.     }
  625. }
  626. /*****************************************************************************
  627.  * FUNCTION
  628.  *  mmi_voip_entry_abort_redial
  629.  * DESCRIPTION
  630.  *  Abort redialing call.
  631.  * PARAMETERS
  632.  *  void
  633.  * RETURNS
  634.  *  void
  635.  *****************************************************************************/
  636. void mmi_voip_entry_abort_redial(void)
  637. {
  638.     StopTimer(VOIP_AUTOREDIAL_TIMER);
  639.     memset(&g_voip_cntx_p->call_redial_info, 0, sizeof(mmi_voip_call_redial_struct));
  640.     g_voip_cntx_p->call_redial_info.maxAttempt = 3;
  641.     if (GetExitScrnID() == SCR_ID_VOIP_REDIALING_CALL)
  642.     {
  643.         GoBackHistory();
  644.     }
  645.     else
  646.     {
  647.         DeleteScreenIfPresent(SCR_ID_VOIP_REDIALING_CALL);
  648.     }
  649. }
  650. /*****************************************************************************
  651.  * FUNCTION
  652.  *  mmi_voip_entry_answer_call
  653.  * DESCRIPTION
  654.  *  Answer incoming call.
  655.  * PARAMETERS
  656.  *  void
  657.  * RETURNS
  658.  *  void
  659.  *****************************************************************************/
  660. void mmi_voip_entry_answer_call(void)
  661. {
  662.     /*----------------------------------------------------------------*/
  663.     /* Local Variables                                                */
  664.     /*----------------------------------------------------------------*/
  665.     S32 callId = 0;
  666.     /*----------------------------------------------------------------*/
  667.     /* Code Body                                                      */
  668.     /*----------------------------------------------------------------*/
  669.     if (g_voip_cntx_p->call_setting_info.saved_setting.autoAnswer == 2)
  670.     {
  671.         StopTimer(VOIP_AUTOANSWER_TIMER);
  672.     }
  673.     mmi_voip_set_processing_parameter(
  674.         STR_ID_VOIP_ANSWER,
  675.         STR_ID_VOIP_PROCESSING,
  676.         IMG_GLOBAL_PROGRESS,
  677.         0,
  678.         0,
  679.         0,
  680.         0,
  681.         0,
  682.         mmi_voip_entry_release_call);
  683.     mmi_voip_entry_processing_screen();
  684.     DeleteScreenIfPresent(SCR_ID_VOIP_INCOMING_CALL);
  685.     /* set all rtp directions as inactive before action */
  686.     mmi_voip_switch_rtp(TRUE, -1, -1);
  687.     callId = mmi_voip_get_incoming_call_id();
  688.     if (callId != -1)
  689.     {
  690.         /* release all gsm calls before answering voip call */
  691.         if (GetTotalCallCount() != 0)
  692.         {
  693.             g_voip_cntx_p->call_list_info.needConn = MMI_VOIP_CALL_CONN_VOIP;
  694.             mmi_voip_entry_ans_to_disconn_gsm();
  695.         }
  696.         else
  697.         {
  698.             mmi_voip_entry_ans_to_conn_voip();
  699.         }
  700.     }
  701.     else
  702.     {
  703.         MMI_ASSERT(callId != -1);   /* incoming call does not exist */
  704.     }
  705. }
  706. /*****************************************************************************
  707.  * FUNCTION
  708.  *  mmi_voip_entry_ans_to_conn_voip
  709.  * DESCRIPTION
  710.  *  Connect VoIP incoming call. Mainly for the interaction of GSM and VoIP.
  711.  * PARAMETERS
  712.  *  void
  713.  * RETURNS
  714.  *  void
  715.  *****************************************************************************/
  716. void mmi_voip_entry_ans_to_conn_voip(void)
  717. {
  718.     /*----------------------------------------------------------------*/
  719.     /* Local Variables                                                */
  720.     /*----------------------------------------------------------------*/
  721.     S32 mtcallId = 0, activecallId = 0;
  722.     /*----------------------------------------------------------------*/
  723.     /* Code Body                                                      */
  724.     /*----------------------------------------------------------------*/
  725.     mtcallId = mmi_voip_get_incoming_call_id();
  726.     if (mtcallId != -1)
  727.     {
  728.         activecallId = mmi_voip_get_active_call_id();
  729.         if (activecallId != -1)
  730.         {
  731.             mmi_voip_stop_incoming_tone();
  732.             /* ringtone must take effect before critical session is started, otherwise it will be suspended */
  733.             mmi_voip_switch_session(MMI_VOIP_ACTIVE_STATE);
  734.             mmi_voip_hold_and_accept_req(activecallId, mtcallId);
  735.         }
  736.         else
  737.         {
  738.             mmi_voip_stop_incoming_tone();
  739.             /* ringtone must take effect before critical session is started, otherwise it will be suspended */
  740.             mmi_voip_switch_session(MMI_VOIP_ACTIVE_STATE);
  741.             mmi_voip_accept_req(mtcallId);
  742.         }
  743.     }
  744.     else
  745.     {
  746.         MMI_ASSERT(mtcallId != -1); /* incoming call does not exist */
  747.     }
  748. }
  749. /*****************************************************************************
  750.  * FUNCTION
  751.  *  mmi_voip_entry_ans_to_disconn_voip
  752.  * DESCRIPTION
  753.  *  Disconnect VoIP incoming call. Mainly for the interaction of GSM and VoIP.
  754.  * PARAMETERS
  755.  *  void
  756.  * RETURNS
  757.  *  void
  758.  *****************************************************************************/
  759. void mmi_voip_entry_ans_to_disconn_voip(void)
  760. {
  761.     /*----------------------------------------------------------------*/
  762.     /* Local Variables                                                */
  763.     /*----------------------------------------------------------------*/
  764.     
  765.     /*----------------------------------------------------------------*/
  766.     /* Code Body                                                      */
  767.     /*----------------------------------------------------------------*/
  768.     if (g_voip_cntx_p->call_list_info.numTotal == 0)
  769.     {
  770.         /* do nothing */
  771.     }
  772.     else
  773.     {
  774.         /* END key is disable in processing screen because force release will execute automatically */
  775.         mmi_voip_set_processing_parameter(
  776.             STR_ID_VOIP_CALL_END,
  777.             STR_ID_VOIP_PROCESSING,
  778.             IMG_GLOBAL_PROGRESS,
  779.             0,
  780.             0,
  781.             0,
  782.             0,
  783.             0,
  784.             0);
  785.         mmi_voip_entry_processing_screen();
  786.         DeleteScreenIfPresent(SCR_ID_VOIP_PROCESSING);
  787.         mmi_voip_switch_rtp(TRUE, -1, -1);
  788.         mmi_voip_stop_inbandtone();
  789.         mmi_voip_stop_incoming_tone();
  790.         mmi_voip_background_release_all_req();
  791.     }
  792. }
  793. /*****************************************************************************
  794.  * FUNCTION
  795.  *  mmi_voip_entry_reject_call
  796.  * DESCRIPTION
  797.  *  Reject incoming call.
  798.  * PARAMETERS
  799.  *  void
  800.  * RETURNS
  801.  *  void
  802.  *****************************************************************************/
  803. void mmi_voip_entry_reject_call(void)
  804. {
  805.     /*----------------------------------------------------------------*/
  806.     /* Local Variables                                                */
  807.     /*----------------------------------------------------------------*/
  808.     S32 callId = 0;
  809.     /*----------------------------------------------------------------*/
  810.     /* Code Body                                                      */
  811.     /*----------------------------------------------------------------*/
  812.     if (g_voip_cntx_p->call_setting_info.saved_setting.autoAnswer == 2)
  813.     {
  814.         StopTimer(VOIP_AUTOANSWER_TIMER);
  815.     }
  816.     /* END key is disable in processing screen because force release will execute automatically */
  817.     mmi_voip_set_processing_parameter(
  818.         STR_ID_VOIP_REJECT,
  819.         STR_ID_VOIP_PROCESSING,
  820.         IMG_GLOBAL_PROGRESS,
  821.         0,
  822.         0,
  823.         0,
  824.         0,
  825.         0,
  826.         0);
  827.     mmi_voip_entry_processing_screen();
  828.     DeleteScreenIfPresent(SCR_ID_VOIP_INCOMING_CALL);
  829.     /* set all rtp directions as inactive before action */
  830.     mmi_voip_switch_rtp(TRUE, -1, -1);
  831.     callId = mmi_voip_get_incoming_call_id();
  832.     if (callId != -1)
  833.     {
  834.         mmi_voip_stop_incoming_tone();
  835.         mmi_voip_release_req(callId, 0);
  836.         mmi_voip_force_release_req(callId, 0);
  837.     }
  838.     else
  839.     {
  840.         MMI_ASSERT(callId != -1);   /* incoming call does not exist */
  841.     }
  842. }
  843. /*****************************************************************************
  844.  * FUNCTION
  845.  *  mmi_voip_entry_in_call_sendkey
  846.  * DESCRIPTION
  847.  *  Handle SEND key in the active call screen.
  848.  * PARAMETERS
  849.  *  void
  850.  * RETURNS
  851.  *  void
  852.  *****************************************************************************/
  853. void mmi_voip_entry_in_call_sendkey(void)
  854. {
  855.     /*----------------------------------------------------------------*/
  856.     /* Local Variables                                                */
  857.     /*----------------------------------------------------------------*/
  858.     S32 currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  859.     /*----------------------------------------------------------------*/
  860.     /* Code Body                                                      */
  861.     /*----------------------------------------------------------------*/
  862.     if (g_voip_cntx_p->call_list_info.call_info[currhiliteTab].currState == MMI_VOIP_ACTIVE_STATE)
  863.     {
  864.         if (g_voip_cntx_p->call_list_info.numHeld < MMI_VOIP_MAX_HELD_CALL)
  865.         {
  866.             if (g_voip_cntx_p->call_list_info.call_info[currhiliteTab].numDialog == 1)
  867.             {
  868.                 mmi_voip_entry_hold_single();
  869.             }
  870.             else if (g_voip_cntx_p->call_list_info.call_info[currhiliteTab].numDialog == 2)
  871.             {
  872.                 mmi_voip_entry_hold_conference();
  873.             }
  874.             else
  875.             {
  876.                 MMI_ASSERT(0); /* numDialog should be either 1 or 2 */
  877.             }
  878.         }
  879.         else /* 3 held calls exist */
  880.         {
  881.             mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_NOT_ALLOW_TO_HOLD), IMG_GLOBAL_UNFINISHED);
  882.         #if 0
  883. /* under construction !*/
  884. /* under construction !*/
  885. /* under construction !*/
  886. /* under construction !*/
  887. /* under construction !*/
  888. /* under construction !*/
  889.         #endif
  890.         }
  891.     }
  892.     else if (g_voip_cntx_p->call_list_info.call_info[currhiliteTab].currState == MMI_VOIP_HOLD_STATE)
  893.     {
  894.         if (mmi_voip_get_active_call_id() != -1)
  895.         {
  896.             mmi_voip_entry_swap();
  897.         }
  898.         else
  899.         {
  900.             if (g_voip_cntx_p->call_list_info.call_info[currhiliteTab].numDialog == 1)
  901.             {
  902.                 mmi_voip_entry_retrieve_single();
  903.             }
  904.             else if (g_voip_cntx_p->call_list_info.call_info[currhiliteTab].numDialog == 2)
  905.             {
  906.                 mmi_voip_entry_retrieve_conference();
  907.             }
  908.             else
  909.             {
  910.                 MMI_ASSERT(0); /* numDialog should be either 1 or 2 */
  911.             }
  912.         }
  913.     }
  914. }
  915. /*****************************************************************************
  916.  * FUNCTION
  917.  *  mmi_voip_entry_in_call_endkey
  918.  * DESCRIPTION
  919.  *  Handle END key in the active call screen.
  920.  * PARAMETERS
  921.  *  void
  922.  * RETURNS
  923.  *  void
  924.  *****************************************************************************/
  925. void mmi_voip_entry_in_call_endkey(void)
  926. {
  927.     /*----------------------------------------------------------------*/
  928.     /* Local Variables                                                */
  929.     /*----------------------------------------------------------------*/
  930.     S32 currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  931.     /*----------------------------------------------------------------*/
  932.     /* Code Body                                                      */
  933.     /*----------------------------------------------------------------*/
  934.     if (g_voip_cntx_p->call_list_info.call_info[currhiliteTab].numDialog == 1)  /* single call */
  935.     {
  936.         mmi_voip_entry_end_single();
  937.     }
  938.     else if (g_voip_cntx_p->call_list_info.call_info[currhiliteTab].numDialog == 2)     /* conference call */
  939.     {
  940.         mmi_voip_entry_end_conference();
  941.     }
  942.     else
  943.     {
  944.         /* end key is pressed in call editor without any active call existed */
  945.         DisplayIdleScreen();
  946.     }
  947. }
  948. /*****************************************************************************
  949.  * FUNCTION
  950.  *  mmi_voip_entry_sidekey
  951.  * DESCRIPTION
  952.  *  Handle side key for all VoIP call screen.
  953.  * PARAMETERS
  954.  *  void
  955.  * RETURNS
  956.  *  void
  957.  *****************************************************************************/
  958. void mmi_voip_entry_sidekey(void)
  959. {
  960.     /*----------------------------------------------------------------*/
  961.     /* Local Variables                                                */
  962.     /*----------------------------------------------------------------*/
  963.     /*----------------------------------------------------------------*/
  964.     /* Code Body                                                      */
  965.     /*----------------------------------------------------------------*/
  966.     SetKeyHandler(SetKeyPadVolUp, KEY_VOL_UP, KEY_EVENT_UP);
  967.     SetKeyHandler(MMI_dummy_function, KEY_VOL_UP, KEY_EVENT_LONG_PRESS);
  968.     SetKeyHandler(MMI_dummy_function, KEY_VOL_UP, KEY_EVENT_REPEAT);
  969.     SetKeyHandler(SetKeyPadVolDown, KEY_VOL_DOWN, KEY_EVENT_UP);
  970.     SetKeyHandler(MMI_dummy_function, KEY_VOL_DOWN, KEY_EVENT_LONG_PRESS);
  971.     SetKeyHandler(MMI_dummy_function, KEY_VOL_UP, KEY_EVENT_REPEAT);
  972. }
  973. /*****************************************************************************
  974.  * FUNCTION
  975.  *  mmi_voip_pre_send_dtmf
  976.  * DESCRIPTION
  977.  *  Determine to send DTMF or not based on current state.
  978.  * PARAMETERS
  979.  *  void
  980.  * RETURNS
  981.  *  void
  982.  *****************************************************************************/
  983. void mmi_voip_pre_send_dtmf(void)
  984. {
  985.     /*----------------------------------------------------------------*/
  986.     /* Local Variables                                                */
  987.     /*----------------------------------------------------------------*/
  988.     S32 currhiliteTab = 0, callState = MMI_VOIP_IDLE_STATE;
  989.     /*----------------------------------------------------------------*/
  990.     /* Code Body                                                      */
  991.     /*----------------------------------------------------------------*/
  992.     memset(g_voip_cntx_p->call_misc_info.dispDtmf, 0, (MMI_VOIP_DTMF_LEN * ENCODING_LENGTH));
  993.     memset(g_voip_cntx_p->call_misc_info.inputDtmf, 0, MMI_VOIP_DTMF_LEN);
  994.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  995.     callState = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].currState;
  996.     if ((callState == MMI_VOIP_ACTIVE_STATE) && (g_voip_cntx_p->call_misc_info.isDtmf == TRUE))
  997.     {
  998.         mmi_voip_entry_dtmf_editor();
  999.         mmi_voip_send_dtmf_start();
  1000.     }
  1001.     else
  1002.     {
  1003.         SetGroupKeyHandler(MMI_dummy_function, (U16*)VoIPDTMFDigits, MMI_VOIP_MAX_NUM_DIGITS, KEY_EVENT_DOWN);
  1004.         SetGroupKeyHandler(MMI_dummy_function, (U16*)VoIPDTMFDigits, MMI_VOIP_MAX_NUM_DIGITS, KEY_EVENT_UP);
  1005.         SetGroupKeyHandler(MMI_dummy_function, (U16*)VoIPDTMFDigits, MMI_VOIP_MAX_NUM_DIGITS, KEY_EVENT_LONG_PRESS);
  1006.         SetGroupKeyHandler(MMI_dummy_function, (U16*)VoIPDTMFDigits, MMI_VOIP_MAX_NUM_DIGITS, KEY_EVENT_REPEAT);
  1007.     }
  1008. }
  1009. /*****************************************************************************
  1010.  * FUNCTION
  1011.  *  mmi_voip_entry_hold_single
  1012.  * DESCRIPTION
  1013.  *  Entry function of call optionHold Single
  1014.  * PARAMETERS
  1015.  *  void
  1016.  * RETURNS
  1017.  *  void
  1018.  *****************************************************************************/
  1019. void mmi_voip_entry_hold_single(void)
  1020. {
  1021.     /*----------------------------------------------------------------*/
  1022.     /* Local Variables                                                */
  1023.     /*----------------------------------------------------------------*/
  1024.     S32 currhiliteTab = 0, callId = 0;
  1025.     /*----------------------------------------------------------------*/
  1026.     /* Code Body                                                      */
  1027.     /*----------------------------------------------------------------*/
  1028.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1029.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1030.     mmi_voip_set_processing_parameter(
  1031.         STR_ID_VOIP_HOLD_SINGLE,
  1032.         STR_ID_VOIP_PROCESSING,
  1033.         IMG_GLOBAL_PROGRESS,
  1034.         0,
  1035.         0,
  1036.         0,
  1037.         0,
  1038.         0,
  1039.         mmi_voip_entry_release_call);
  1040.     mmi_voip_entry_processing_screen();
  1041.     /* set all rtp directions as inactive before action */
  1042.     mmi_voip_switch_rtp(TRUE, -1, -1);
  1043.     mmi_voip_hold_req(callId);
  1044. }
  1045. /*****************************************************************************
  1046.  * FUNCTION
  1047.  *  mmi_voip_entry_hold_conference
  1048.  * DESCRIPTION
  1049.  *  Entry function of call optionHold Conference
  1050.  * PARAMETERS
  1051.  *  void
  1052.  * RETURNS
  1053.  *  void
  1054.  *****************************************************************************/
  1055. void mmi_voip_entry_hold_conference(void)
  1056. {
  1057.     /*----------------------------------------------------------------*/
  1058.     /* Local Variables                                                */
  1059.     /*----------------------------------------------------------------*/
  1060.     S32 currhiliteTab = 0, callId = 0;
  1061.     /*----------------------------------------------------------------*/
  1062.     /* Code Body                                                      */
  1063.     /*----------------------------------------------------------------*/
  1064.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1065.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1066.     mmi_voip_set_processing_parameter(
  1067.         STR_ID_VOIP_HOLD_CONFERENCE,
  1068.         STR_ID_VOIP_PROCESSING,
  1069.         IMG_GLOBAL_PROGRESS,
  1070.         0,
  1071.         0,
  1072.         0,
  1073.         0,
  1074.         0,
  1075.         mmi_voip_entry_release_call);
  1076.     mmi_voip_entry_processing_screen();
  1077.     /* set all rtp directions as inactive before action */
  1078.     mmi_voip_switch_rtp(TRUE, -1, -1);
  1079.     mmi_voip_hold_req(callId);
  1080. }
  1081. /*****************************************************************************
  1082.  * FUNCTION
  1083.  *  mmi_voip_entry_retrieve_single
  1084.  * DESCRIPTION
  1085.  *  Entry function of call optionRetrieve Single
  1086.  * PARAMETERS
  1087.  *  void
  1088.  * RETURNS
  1089.  *  void
  1090.  *****************************************************************************/
  1091. void mmi_voip_entry_retrieve_single(void)
  1092. {
  1093.     /*----------------------------------------------------------------*/
  1094.     /* Local Variables                                                */
  1095.     /*----------------------------------------------------------------*/
  1096.     S32 currhiliteTab = 0, callId = 0;
  1097.     /*----------------------------------------------------------------*/
  1098.     /* Code Body                                                      */
  1099.     /*----------------------------------------------------------------*/
  1100.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1101.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1102.     mmi_voip_set_processing_parameter(
  1103.         STR_ID_VOIP_RETRIEVE_SINGLE,
  1104.         STR_ID_VOIP_PROCESSING,
  1105.         IMG_GLOBAL_PROGRESS,
  1106.         0,
  1107.         0,
  1108.         0,
  1109.         0,
  1110.         0,
  1111.         mmi_voip_entry_release_call);
  1112.     mmi_voip_entry_processing_screen();
  1113.     /* set all rtp directions as inactive before action */
  1114.     mmi_voip_switch_rtp(TRUE, -1, -1);
  1115.     mmi_voip_retrieve_req(callId);
  1116. }
  1117. /*****************************************************************************
  1118.  * FUNCTION
  1119.  *  mmi_voip_entry_retrieve_conference
  1120.  * DESCRIPTION
  1121.  *  Entry function of call optionRetrieve Conference
  1122.  * PARAMETERS
  1123.  *  void
  1124.  * RETURNS
  1125.  *  void
  1126.  *****************************************************************************/
  1127. void mmi_voip_entry_retrieve_conference(void)
  1128. {
  1129.     /*----------------------------------------------------------------*/
  1130.     /* Local Variables                                                */
  1131.     /*----------------------------------------------------------------*/
  1132.     S32 currhiliteTab = 0, callId = 0;
  1133.     /*----------------------------------------------------------------*/
  1134.     /* Code Body                                                      */
  1135.     /*----------------------------------------------------------------*/
  1136.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1137.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1138.     mmi_voip_set_processing_parameter(
  1139.         STR_ID_VOIP_RETRIEVE_CONFERENCE,
  1140.         STR_ID_VOIP_PROCESSING,
  1141.         IMG_GLOBAL_PROGRESS,
  1142.         0,
  1143.         0,
  1144.         0,
  1145.         0,
  1146.         0,
  1147.         mmi_voip_entry_release_call);
  1148.     mmi_voip_entry_processing_screen();
  1149.     /* set all rtp directions as inactive before action */
  1150.     mmi_voip_switch_rtp(TRUE, -1, -1);
  1151.     mmi_voip_retrieve_req(callId);
  1152. }
  1153. /*****************************************************************************
  1154.  * FUNCTION
  1155.  *  mmi_voip_entry_swap
  1156.  * DESCRIPTION
  1157.  *  Entry function of call optionSwap
  1158.  * PARAMETERS
  1159.  *  void
  1160.  * RETURNS
  1161.  *  void
  1162.  *****************************************************************************/
  1163. void mmi_voip_entry_swap(void)
  1164. {
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Local Variables                                                */
  1167.     /*----------------------------------------------------------------*/
  1168.     S32 currhiliteTab = 0, callId = 0, othercallId = 0, callState = MMI_VOIP_IDLE_STATE;
  1169.     /*----------------------------------------------------------------*/
  1170.     /* Code Body                                                      */
  1171.     /*----------------------------------------------------------------*/
  1172.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1173.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1174.     callState = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].currState;
  1175.     mmi_voip_get_held_call_list(FALSE);
  1176.     mmi_voip_set_processing_parameter(
  1177.         STR_ID_VOIP_SWAP,
  1178.         STR_ID_VOIP_PROCESSING,
  1179.         IMG_GLOBAL_PROGRESS,
  1180.         0,
  1181.         0,
  1182.         0,
  1183.         0,
  1184.         0,
  1185.         mmi_voip_entry_release_call);
  1186.     if ((callState == MMI_VOIP_ACTIVE_STATE) && (g_voip_cntx_p->call_list_info.numHeld > 1))
  1187.     {
  1188.         mmi_voip_entry_multi_held_call();
  1189.     }
  1190.     else
  1191.     {
  1192.         mmi_voip_entry_processing_screen();
  1193.         /* set all rtp directions as inactive before action */
  1194.         mmi_voip_switch_rtp(TRUE, -1, -1);
  1195.         if (callState == MMI_VOIP_ACTIVE_STATE) /* only one held call */
  1196.         {
  1197.             othercallId = g_voip_cntx_p->call_list_info.held_call_info[0].callId;
  1198.             mmi_voip_swap_req(callId, othercallId);
  1199.         }
  1200.         else if (callState == MMI_VOIP_HOLD_STATE)
  1201.         {
  1202.             othercallId = mmi_voip_get_active_call_id();
  1203.             mmi_voip_swap_req(othercallId, callId);
  1204.         }
  1205.     }
  1206. }
  1207. /*****************************************************************************
  1208.  * FUNCTION
  1209.  *  mmi_voip_entry_conference
  1210.  * DESCRIPTION
  1211.  *  Entry function of call optionConference
  1212.  * PARAMETERS
  1213.  *  void
  1214.  * RETURNS
  1215.  *  void
  1216.  *****************************************************************************/
  1217. void mmi_voip_entry_conference(void)
  1218. {
  1219.     /*----------------------------------------------------------------*/
  1220.     /* Local Variables                                                */
  1221.     /*----------------------------------------------------------------*/
  1222.     S32 currhiliteTab = 0, callId = 0, othercallId = 0, callState = MMI_VOIP_IDLE_STATE;
  1223.     /*----------------------------------------------------------------*/
  1224.     /* Code Body                                                      */
  1225.     /*----------------------------------------------------------------*/
  1226.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1227.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1228.     callState = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].currState;
  1229.     mmi_voip_get_held_call_list(TRUE);
  1230.     mmi_voip_set_processing_parameter(
  1231.         STR_ID_VOIP_CONFERENCE,
  1232.         STR_ID_VOIP_PROCESSING,
  1233.         IMG_GLOBAL_PROGRESS,
  1234.         0,
  1235.         0,
  1236.         0,
  1237.         0,
  1238.         0,
  1239.         mmi_voip_entry_release_call);
  1240.     if ((callState == MMI_VOIP_ACTIVE_STATE) && (g_voip_cntx_p->call_list_info.numHeld > 1))
  1241.     {
  1242.         mmi_voip_entry_multi_held_call();
  1243.     }
  1244.     else
  1245.     {
  1246.         if (callState == MMI_VOIP_ACTIVE_STATE) /* only one single held call */
  1247.         {
  1248.             if (mmi_voip_is_codec_compatible(g_voip_cntx_p->call_list_info.held_call_info[0].codecList, TRUE))
  1249.             {
  1250.                 mmi_voip_entry_processing_screen();
  1251.                 /* set all rtp directions as inactive before action */
  1252.                 mmi_voip_switch_rtp(TRUE, -1, -1);
  1253.                 othercallId = g_voip_cntx_p->call_list_info.held_call_info[0].callId;
  1254.                 mmi_voip_merge_req(callId, othercallId);
  1255.             }
  1256.             else
  1257.             {
  1258.                 mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_CONFERENCE_FAIL), IMG_GLOBAL_UNFINISHED);
  1259.             #if 0
  1260. /* under construction !*/
  1261. /* under construction !*/
  1262. /* under construction !*/
  1263. /* under construction !*/
  1264. /* under construction !*/
  1265. /* under construction !*/
  1266.             #endif
  1267.             }
  1268.         }
  1269.         else if (callState == MMI_VOIP_HOLD_STATE)
  1270.         {
  1271.             if (mmi_voip_is_codec_compatible(g_voip_cntx_p->call_list_info.call_info[currhiliteTab].dialog_info[0].sdp_info.codec, TRUE))
  1272.             {
  1273.                 mmi_voip_entry_processing_screen();
  1274.                 /* set all rtp directions as inactive before action */
  1275.                 mmi_voip_switch_rtp(TRUE, -1, -1);
  1276.                 othercallId = mmi_voip_get_active_call_id();
  1277.                 mmi_voip_merge_req(othercallId, callId);
  1278.             }
  1279.             else
  1280.             {
  1281.                 mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_CONFERENCE_FAIL), IMG_GLOBAL_UNFINISHED);
  1282.             #if 0
  1283. /* under construction !*/
  1284. /* under construction !*/
  1285. /* under construction !*/
  1286. /* under construction !*/
  1287. /* under construction !*/
  1288. /* under construction !*/
  1289.             #endif
  1290.             }
  1291.         }
  1292.     }
  1293. }
  1294. /*****************************************************************************
  1295.  * FUNCTION
  1296.  *  mmi_voip_entry_split
  1297.  * DESCRIPTION
  1298.  *  Entry function of call optionSplit
  1299.  * PARAMETERS
  1300.  *  void
  1301.  * RETURNS
  1302.  *  void
  1303.  *****************************************************************************/
  1304. void mmi_voip_entry_split(void)
  1305. {
  1306.     /*----------------------------------------------------------------*/
  1307.     /* Local Variables                                                */
  1308.     /*----------------------------------------------------------------*/
  1309.     S32 currhiliteTab = 0, unhiliteIndex = 0, callId = 0, dialogId = 0;
  1310.     /*----------------------------------------------------------------*/
  1311.     /* Code Body                                                      */
  1312.     /*----------------------------------------------------------------*/
  1313.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1314.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1315.     unhiliteIndex = (g_voip_cntx_p->call_misc_info.currhiliteIndex == 0) ? (1) : (0);
  1316.     dialogId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].dialog_info[unhiliteIndex].dialogId;
  1317.     mmi_voip_set_processing_parameter(
  1318.         STR_ID_VOIP_SPLIT,
  1319.         STR_ID_VOIP_PROCESSING,
  1320.         IMG_GLOBAL_PROGRESS,
  1321.         0,
  1322.         0,
  1323.         0,
  1324.         0,
  1325.         0,
  1326.         mmi_voip_entry_release_call);
  1327.     mmi_voip_entry_processing_screen();
  1328.     /* set all rtp directions as inactive before action */
  1329.     mmi_voip_switch_rtp(TRUE, -1, -1);
  1330.     mmi_voip_split_req(callId, dialogId);
  1331. }
  1332. /*****************************************************************************
  1333.  * FUNCTION
  1334.  *  mmi_voip_entry_end_single
  1335.  * DESCRIPTION
  1336.  *  Entry function of call optionEnd Single
  1337.  * PARAMETERS
  1338.  *  void
  1339.  * RETURNS
  1340.  *  void
  1341.  *****************************************************************************/
  1342. void mmi_voip_entry_end_single(void)
  1343. {
  1344.     /*----------------------------------------------------------------*/
  1345.     /* Local Variables                                                */
  1346.     /*----------------------------------------------------------------*/
  1347.     S32 currhiliteTab = 0, currhiliteIndex = 0, callId = 0, dialogId = 0;
  1348.     /*----------------------------------------------------------------*/
  1349.     /* Code Body                                                      */
  1350.     /*----------------------------------------------------------------*/
  1351.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1352.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1353.     currhiliteIndex = g_voip_cntx_p->call_misc_info.currhiliteIndex;
  1354.     dialogId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].dialog_info[currhiliteIndex].dialogId;
  1355.     /* END key is disable in processing screen because force release will execute automatically */
  1356.     mmi_voip_set_processing_parameter(
  1357.         STR_ID_VOIP_END_SINGLE,
  1358.         STR_ID_VOIP_PROCESSING,
  1359.         IMG_GLOBAL_PROGRESS,
  1360.         0,
  1361.         0,
  1362.         0,
  1363.         0,
  1364.         0,
  1365.         0);
  1366.     mmi_voip_entry_processing_screen();
  1367.     mmi_voip_switch_rtp(TRUE, -1, -1);
  1368.     mmi_voip_release_req(callId, dialogId);
  1369.     mmi_voip_force_release_req(callId, dialogId);
  1370. }
  1371. /*****************************************************************************
  1372.  * FUNCTION
  1373.  *  mmi_voip_entry_end_conference
  1374.  * DESCRIPTION
  1375.  *  Entry function of call optionEnd Conference
  1376.  * PARAMETERS
  1377.  *  void
  1378.  * RETURNS
  1379.  *  void
  1380.  *****************************************************************************/
  1381. void mmi_voip_entry_end_conference(void)
  1382. {
  1383.     /*----------------------------------------------------------------*/
  1384.     /* Local Variables                                                */
  1385.     /*----------------------------------------------------------------*/
  1386.     S32 currhiliteTab = 0, callId = 0;
  1387.     /*----------------------------------------------------------------*/
  1388.     /* Code Body                                                      */
  1389.     /*----------------------------------------------------------------*/
  1390.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1391.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1392.     /* END key is disable in processing screen because force release will execute automatically */
  1393.     mmi_voip_set_processing_parameter(
  1394.         STR_ID_VOIP_END_CONFERENCE,
  1395.         STR_ID_VOIP_PROCESSING,
  1396.         IMG_GLOBAL_PROGRESS,
  1397.         0,
  1398.         0,
  1399.         0,
  1400.         0,
  1401.         0,
  1402.         0);
  1403.     mmi_voip_entry_processing_screen();
  1404.     mmi_voip_switch_rtp(TRUE, -1, -1);
  1405.     mmi_voip_release_req(callId, -1);
  1406.     mmi_voip_force_release_req(callId, -1);
  1407. }
  1408. /*****************************************************************************
  1409.  * FUNCTION
  1410.  *  mmi_voip_entry_end_all
  1411.  * DESCRIPTION
  1412.  *  Entry function of call optionEnd All
  1413.  * PARAMETERS
  1414.  *  void
  1415.  * RETURNS
  1416.  *  void
  1417.  *****************************************************************************/
  1418. void mmi_voip_entry_end_all(void)
  1419. {
  1420.     /*----------------------------------------------------------------*/
  1421.     /* Local Variables                                                */
  1422.     /*----------------------------------------------------------------*/
  1423.     /*----------------------------------------------------------------*/
  1424.     /* Code Body                                                      */
  1425.     /*----------------------------------------------------------------*/
  1426.     /* END key is disable in processing screen because force release will execute automatically */
  1427.     mmi_voip_set_processing_parameter(
  1428.         STR_ID_VOIP_END_ALL,
  1429.         STR_ID_VOIP_PROCESSING,
  1430.         IMG_GLOBAL_PROGRESS,
  1431.         0,
  1432.         0,
  1433.         0,
  1434.         0,
  1435.         0,
  1436.         0);
  1437.     mmi_voip_entry_processing_screen();
  1438.     mmi_voip_switch_rtp(TRUE, -1, -1);
  1439.     mmi_voip_release_req(-1, -1);
  1440.     mmi_voip_force_release_req(-1, -1);
  1441. }
  1442. /*****************************************************************************
  1443.  * FUNCTION
  1444.  *  mmi_voip_entry_release_call
  1445.  * DESCRIPTION
  1446.  *  Entry function of release call during other action processing.
  1447.  * PARAMETERS
  1448.  *  void
  1449.  * RETURNS
  1450.  *  void
  1451.  *****************************************************************************/
  1452. void mmi_voip_entry_release_call(void)
  1453. {
  1454.     /*----------------------------------------------------------------*/
  1455.     /* Local Variables                                                */
  1456.     /*----------------------------------------------------------------*/
  1457.     /*----------------------------------------------------------------*/
  1458.     /* Code Body                                                      */
  1459.     /*----------------------------------------------------------------*/
  1460.     /* END key is disable in processing screen because force release will execute automatically */
  1461.     mmi_voip_set_processing_parameter(
  1462.         STR_ID_VOIP_CALL_END,
  1463.         STR_GLOBAL_ABORTING,
  1464.         IMG_GLOBAL_PROGRESS,
  1465.         0,
  1466.         0,
  1467.         0,
  1468.         0,
  1469.         0,
  1470.         0);
  1471.     mmi_voip_entry_processing_screen();
  1472.     DeleteScreenIfPresent(SCR_ID_VOIP_PROCESSING);
  1473.     mmi_voip_release_req(g_voip_cntx_p->call_list_info.processCId, g_voip_cntx_p->call_list_info.processDId);
  1474.     mmi_voip_force_release_req(g_voip_cntx_p->call_list_info.processCId, g_voip_cntx_p->call_list_info.processDId);
  1475. }
  1476. #if 0
  1477. /* under construction !*/
  1478. /* under construction !*/
  1479. /* under construction !*/
  1480. /* under construction !*/
  1481. /* under construction !*/
  1482. /* under construction !*/
  1483. /* under construction !*/
  1484. /* under construction !*/
  1485. /* under construction !*/
  1486. /* under construction !*/
  1487. /* under construction !*/
  1488. /* under construction !*/
  1489. /* under construction !*/
  1490. /* under construction !*/
  1491. /* under construction !*/
  1492. /* under construction !*/
  1493. /* under construction !*/
  1494. /* under construction !*/
  1495. /* under construction !*/
  1496. /* under construction !*/
  1497. /* under construction !*/
  1498. /* under construction !*/
  1499. /* under construction !*/
  1500. /* under construction !*/
  1501. #endif
  1502. /*****************************************************************************
  1503.  * FUNCTION
  1504.  *  mmi_voip_entry_held_call_selected
  1505.  * DESCRIPTION
  1506.  *  Select the specific held call and get ready to process swap or conference action.
  1507.  * PARAMETERS
  1508.  *  void
  1509.  * RETURNS
  1510.  *  void
  1511.  *****************************************************************************/
  1512. void mmi_voip_entry_held_call_selected(void)
  1513. {
  1514.     /*----------------------------------------------------------------*/
  1515.     /* Local Variables                                                */
  1516.     /*----------------------------------------------------------------*/
  1517.     S32 currhiliteTab = 0, callIndex = 0, callId = 0, othercallId = 0;
  1518.     /*----------------------------------------------------------------*/
  1519.     /* Code Body                                                      */
  1520.     /*----------------------------------------------------------------*/
  1521.     currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1522.     callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1523.     callIndex = g_voip_cntx_p->call_misc_info.currhiliteIndex;
  1524.     othercallId = g_voip_cntx_p->call_list_info.held_call_info[callIndex].callId;
  1525.     if (g_voip_cntx_p->proc_scr_info.title_string == STR_ID_VOIP_SWAP)
  1526.     {
  1527.         mmi_voip_entry_processing_screen();
  1528.         /* set all rtp directions as inactive before action */
  1529.         mmi_voip_switch_rtp(TRUE, -1, -1);
  1530.         mmi_voip_swap_req(callId, othercallId);
  1531.     }
  1532.     else if (g_voip_cntx_p->proc_scr_info.title_string == STR_ID_VOIP_CONFERENCE)
  1533.     {
  1534.         if (mmi_voip_is_codec_compatible(g_voip_cntx_p->call_list_info.held_call_info[callIndex].codecList, TRUE))
  1535.         {
  1536.             mmi_voip_entry_processing_screen();
  1537.             /* set all rtp directions as inactive before action */
  1538.             mmi_voip_switch_rtp(TRUE, -1, -1);
  1539.             mmi_voip_merge_req(callId, othercallId);
  1540.         }
  1541.         else
  1542.         {
  1543.             mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_CONFERENCE_FAIL), IMG_GLOBAL_UNFINISHED);
  1544.         #if 0
  1545. /* under construction !*/
  1546. /* under construction !*/
  1547. /* under construction !*/
  1548. /* under construction !*/
  1549. /* under construction !*/
  1550. /* under construction !*/
  1551.         #endif
  1552.             DeleteScreenIfPresent(SCR_ID_VOIP_MULTI_HELD_CALL);
  1553.         }
  1554.     }
  1555. }
  1556. /*****************************************************************************
  1557.  * FUNCTION
  1558.  *  mmi_voip_entry_transfer_call_determined
  1559.  * DESCRIPTION
  1560.  *  Determine transfer target's URI and get ready to process transfer action.
  1561.  * PARAMETERS
  1562.  *  void
  1563.  * RETURNS
  1564.  *  void
  1565.  *****************************************************************************/
  1566. void mmi_voip_entry_transfer_call_determined(void)
  1567. {
  1568.     /*----------------------------------------------------------------*/
  1569.     /* Local Variables                                                */
  1570.     /*----------------------------------------------------------------*/
  1571.     U8 *unicodeOwner = OslMalloc(VOIP_URI_LEN * ENCODING_LENGTH);
  1572.     S32 currhiliteTab = 0, callId = 0, dialogId = 0;
  1573.     S32 profIndex = g_voip_cntx_p->prof_setting_info.actprofIndex;
  1574.     /*----------------------------------------------------------------*/
  1575.     /* Code Body                                                      */
  1576.     /*----------------------------------------------------------------*/
  1577.     if (pfnUnicodeStrlen((S8*) g_voip_cntx_p->call_misc_info.dispUri))
  1578.     {
  1579.         mmi_voip_parse_uri(g_voip_cntx_p->call_misc_info.dispUri);
  1580.         memset(unicodeOwner, 0, (VOIP_URI_LEN * ENCODING_LENGTH));
  1581.         AnsiiNToUnicodeString(
  1582.             (S8*)unicodeOwner, 
  1583.             (S8*)g_voip_cntx_p->prof_setting_info.saved_prof[profIndex].acct_info.username, 
  1584.             VOIP_URI_LEN);
  1585.         if (mmi_voip_is_owner_number(g_voip_cntx_p->call_misc_info.dispUri, unicodeOwner) == TRUE)
  1586.         {
  1587.             mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_CANNOT_DIAL_OWNER), IMG_GLOBAL_UNFINISHED);
  1588.         #if 0
  1589. /* under construction !*/
  1590. /* under construction !*/
  1591. /* under construction !*/
  1592. /* under construction !*/
  1593. /* under construction !*/
  1594. /* under construction !*/
  1595.         #endif
  1596.         }
  1597.         else
  1598.         {
  1599.             if (mmi_voip_validate_uri(g_voip_cntx_p->call_misc_info.dispUri) == TRUE)
  1600.             {
  1601.                 memset(g_voip_cntx_p->call_misc_info.inputUri, 0, VOIP_URI_LEN);
  1602.                 UnicodeNToAnsii(
  1603.                     (S8*) g_voip_cntx_p->call_misc_info.inputUri,
  1604.                     (S8*) g_voip_cntx_p->call_misc_info.dispUri,
  1605.                     (VOIP_URI_LEN * ENCODING_LENGTH));
  1606.                 currhiliteTab = g_voip_cntx_p->call_misc_info.currhiliteTab;
  1607.                 callId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].callId;
  1608.                 dialogId = g_voip_cntx_p->call_list_info.call_info[currhiliteTab].dialog_info[0].dialogId;
  1609.                 mmi_voip_set_processing_parameter(
  1610.                     STR_ID_VOIP_TRANSFER,
  1611.                     STR_ID_VOIP_PROCESSING,
  1612.                     IMG_GLOBAL_PROGRESS,
  1613.                     0,
  1614.                     0,
  1615.                     0,
  1616.                     0,
  1617.                     0,
  1618.                     mmi_voip_entry_release_call);
  1619.                 mmi_voip_entry_processing_screen();
  1620.                 /* set all rtp directions as inactive before action */
  1621.                 mmi_voip_switch_rtp(TRUE, -1, -1);
  1622.                 mmi_voip_transfer_req(callId, dialogId);
  1623.             }
  1624.             else
  1625.             {
  1626.                 mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_INVALID_USERNAME), IMG_GLOBAL_UNFINISHED);
  1627.             #if 0
  1628. /* under construction !*/
  1629. /* under construction !*/
  1630. /* under construction !*/
  1631. /* under construction !*/
  1632. /* under construction !*/
  1633. /* under construction !*/
  1634.             #endif
  1635.             }
  1636.         }
  1637.         OslMfree(unicodeOwner);
  1638.     }
  1639.     else /* not allow to dial an empty number */
  1640.     {
  1641.         mmi_voip_entry_popup((U8*)GetString(STR_ID_VOIP_EMPTY_USERNAME), IMG_GLOBAL_UNFINISHED);
  1642.     #if 0
  1643. /* under construction !*/
  1644. /* under construction !*/
  1645. /* under construction !*/
  1646. /* under construction !*/
  1647. /* under construction !*/
  1648. /* under construction !*/
  1649.     #endif
  1650.     }
  1651. }
  1652. /*****************************************************************************
  1653.  * FUNCTION
  1654.  *  mmi_voip_get_outgoing_call_id
  1655.  * DESCRIPTION
  1656.  *  Check if outgoing call exists and get its call id.
  1657.  * PARAMETERS
  1658.  *  void
  1659.  * RETURNS
  1660.  *  call id if outgoing call exists; -1 if outgoing call does not exist.
  1661.  *****************************************************************************/
  1662. S32 mmi_voip_get_outgoing_call_id(void)
  1663. {
  1664.     /*----------------------------------------------------------------*/
  1665.     /* Local Variables                                                */
  1666.     /*----------------------------------------------------------------*/
  1667.     S32 i = 0;
  1668.     /*----------------------------------------------------------------*/
  1669.     /* Code Body                                                      */
  1670.     /*----------------------------------------------------------------*/
  1671.     for (i = (MMI_VOIP_MAX_NUM_CALL - 1); i >= 0; i--)
  1672.     {
  1673.         if (g_voip_cntx_p->call_list_info.call_info[i].currState == MMI_VOIP_OUTGOING_STATE)
  1674.         {
  1675.             return g_voip_cntx_p->call_list_info.call_info[i].callId;
  1676.         }
  1677.     }
  1678.     if (i == -1)
  1679.     {
  1680.         return -1;
  1681.     }
  1682.     return -1;
  1683. }
  1684. /*****************************************************************************
  1685.  * FUNCTION
  1686.  *  mmi_voip_get_incoming_call_id
  1687.  * DESCRIPTION
  1688.  *  Check if incoming call exists and get its call id.
  1689.  * PARAMETERS
  1690.  *  void
  1691.  * RETURNS
  1692.  *  call id if incoming call exists; -1 if incoming call does not exist.
  1693.  *****************************************************************************/
  1694. S32 mmi_voip_get_incoming_call_id(void)
  1695. {
  1696.     /*----------------------------------------------------------------*/
  1697.     /* Local Variables                                                */
  1698.     /*----------------------------------------------------------------*/
  1699.     S32 i = 0;
  1700.     /*----------------------------------------------------------------*/
  1701.     /* Code Body                                                      */
  1702.     /*----------------------------------------------------------------*/
  1703.     for (i = (MMI_VOIP_MAX_NUM_CALL - 1); i >= 0; i--)
  1704.     {
  1705.         if (g_voip_cntx_p->call_list_info.call_info[i].currState == MMI_VOIP_INCOMING_STATE)
  1706.         {
  1707.             return g_voip_cntx_p->call_list_info.call_info[i].callId;
  1708.         }
  1709.     }
  1710.     if (i == -1)
  1711.     {
  1712.         return -1;
  1713.     }
  1714.     return -1;
  1715. }
  1716. /*****************************************************************************
  1717.  * FUNCTION
  1718.  *  mmi_voip_get_active_call_id
  1719.  * DESCRIPTION
  1720.  *  Check if active call exists and get its call id.
  1721.  * PARAMETERS
  1722.  *  void
  1723.  * RETURNS
  1724.  *  call id if active call exists; -1 if active call does not exist.
  1725.  *****************************************************************************/
  1726. S32 mmi_voip_get_active_call_id(void)
  1727. {
  1728.     /*----------------------------------------------------------------*/
  1729.     /* Local Variables                                                */
  1730.     /*----------------------------------------------------------------*/
  1731.     S32 i = 0, numActive = 0;
  1732.     /*----------------------------------------------------------------*/
  1733.     /* Code Body                                                      */
  1734.     /*----------------------------------------------------------------*/
  1735.     numActive = g_voip_cntx_p->call_list_info.numTotal - g_voip_cntx_p->call_list_info.numHeld;
  1736.     if (numActive == 0)
  1737.     {
  1738.         return -1;
  1739.     }
  1740.     else    /* numActive > 1 */
  1741.     {
  1742.         for (i = 0; i < MMI_VOIP_MAX_NUM_CALL; i++)
  1743.         {
  1744.             if (g_voip_cntx_p->call_list_info.call_info[i].currState == MMI_VOIP_ACTIVE_STATE)
  1745.             {
  1746.                 return g_voip_cntx_p->call_list_info.call_info[i].callId;
  1747.             }
  1748.         }
  1749.         if (i == MMI_VOIP_MAX_NUM_CALL)
  1750.         {
  1751.             return -1;  /* incoming call or outgoing call */
  1752.         }
  1753.     }
  1754.     return -1;
  1755. }
  1756. /*****************************************************************************
  1757.  * FUNCTION
  1758.  *  mmi_voip_get_held_call_list
  1759.  * DESCRIPTION
  1760.  *  Check if held call exists and get its call id.
  1761.  *  If more than one held calls exist, put them all in the held call list.
  1762.  * PARAMETERS
  1763.  *  singlecallOnly      [IN]        Single held call or don't care
  1764.  * RETURNS
  1765.  *  void
  1766.  *****************************************************************************/
  1767. void mmi_voip_get_held_call_list(BOOL singlecallOnly)
  1768. {
  1769.     /*----------------------------------------------------------------*/
  1770.     /* Local Variables                                                */
  1771.     /*----------------------------------------------------------------*/
  1772.     S32 i = 0, j = 0, callId = 0;
  1773.     /*----------------------------------------------------------------*/
  1774.     /* Code Body                                                      */
  1775.     /*----------------------------------------------------------------*/
  1776.     /* reset held call list */
  1777.     memset(&g_voip_cntx_p->call_list_info.held_call_info, 0, sizeof(mmi_voip_held_call_struct));
  1778.     for (i = 0; i < MMI_VOIP_MAX_HELD_CALL; i++)
  1779.     {
  1780.         g_voip_cntx_p->call_list_info.held_call_info[i].callId = -1;
  1781.     }
  1782.     /* assign held call to held call list */
  1783.     if (g_voip_cntx_p->call_list_info.numHeld > 0)
  1784.     {
  1785.         for (i = 0; i < MMI_VOIP_MAX_NUM_CALL; i++)
  1786.         {
  1787.             if (g_voip_cntx_p->call_list_info.call_info[i].currState == MMI_VOIP_HOLD_STATE)
  1788.             {
  1789.                 callId = g_voip_cntx_p->call_list_info.call_info[i].callId;
  1790.                 if (singlecallOnly)
  1791.                 {
  1792.                     if (g_voip_cntx_p->call_list_info.call_info[i].numDialog == 1)
  1793.                     {
  1794.                         g_voip_cntx_p->call_list_info.held_call_info[j].callId = callId;
  1795.                         memcpy(
  1796.                             g_voip_cntx_p->call_list_info.held_call_info[j].dispName,
  1797.                             g_voip_cntx_p->call_list_info.call_info[i].dialog_info[0].dispName,
  1798.                             (VOIP_DISP_NAME_LEN * sizeof(U16)));
  1799.                         memcpy(
  1800.                             g_voip_cntx_p->call_list_info.held_call_info[j].remoteUri,
  1801.                             g_voip_cntx_p->call_list_info.call_info[i].dialog_info[0].remoteUri,
  1802.                             VOIP_URI_LEN);
  1803.                         memcpy(
  1804.                             g_voip_cntx_p->call_list_info.held_call_info[j].codecList,
  1805.                             g_voip_cntx_p->call_list_info.call_info[i].dialog_info[0].sdp_info.codec,
  1806.                             VOIP_MAX_NUM_CODEC);
  1807.                         j++;
  1808.                     }
  1809.                 }
  1810.                 else
  1811.                 {
  1812.                     g_voip_cntx_p->call_list_info.held_call_info[j].callId = callId;
  1813.                     memcpy(
  1814.                         g_voip_cntx_p->call_list_info.held_call_info[j].dispName,
  1815.                         g_voip_cntx_p->call_list_info.call_info[i].dialog_info[0].dispName,
  1816.                         (VOIP_DISP_NAME_LEN * sizeof(U16)));
  1817.                     memcpy(
  1818.                         g_voip_cntx_p->call_list_info.held_call_info[j].remoteUri,
  1819.                         g_voip_cntx_p->call_list_info.call_info[i].dialog_info[0].remoteUri,
  1820.                         VOIP_URI_LEN);
  1821.                     memcpy(
  1822.                         g_voip_cntx_p->call_list_info.held_call_info[j].codecList,
  1823.                         g_voip_cntx_p->call_list_info.call_info[i].dialog_info[0].sdp_info.codec,
  1824.                         VOIP_MAX_NUM_CODEC);
  1825.                     j++;
  1826.                 }
  1827.             }
  1828.         }
  1829.     }
  1830. }
  1831. /*****************************************************************************
  1832.  * FUNCTION
  1833.  *  mmi_voip_get_call_index
  1834.  * DESCRIPTION
  1835.  *  Get call index based on the call id.
  1836.  * PARAMETERS
  1837.  *  callId      [IN]        Call id
  1838.  * RETURNS
  1839.  *  call index.
  1840.  *****************************************************************************/
  1841. S32 mmi_voip_get_call_index(S32 callId)
  1842. {
  1843.     /*----------------------------------------------------------------*/
  1844.     /* Local Variables                                                */
  1845.     /*----------------------------------------------------------------*/
  1846.     S32 i = 0;
  1847.     /*----------------------------------------------------------------*/
  1848.     /* Code Body                                                      */
  1849.     /*----------------------------------------------------------------*/
  1850.     for (i = 0; i < MMI_VOIP_MAX_NUM_CALL; i++)
  1851.     {
  1852.         if (g_voip_cntx_p->call_list_info.call_info[i].callId == callId)
  1853.         {
  1854.             return i;
  1855.         }
  1856.     }
  1857.     if (i == MMI_VOIP_MAX_NUM_CALL)
  1858.     {
  1859.         return -1;
  1860.     }
  1861.     return -1;
  1862. }
  1863. /*****************************************************************************
  1864.  * FUNCTION
  1865.  *  mmi_voip_get_dialog_index
  1866.  * DESCRIPTION
  1867.  *  Get dialog index based on the dialog id.
  1868.  * PARAMETERS
  1869.  *  callIndex       [IN]        Call index
  1870.  *  dialogId        [IN]        Dialog id
  1871.  * RETURNS
  1872.  *  dialog index.
  1873.  *****************************************************************************/
  1874. S32 mmi_voip_get_dialog_index(S32 callIndex, S32 dialogId)
  1875. {
  1876.     /*----------------------------------------------------------------*/
  1877.     /* Local Variables                                                */
  1878.     /*----------------------------------------------------------------*/
  1879.     S32 i = 0;
  1880.     /*----------------------------------------------------------------*/
  1881.     /* Code Body                                                      */
  1882.     /*----------------------------------------------------------------*/
  1883.     for (i = 0; i < VOIP_MAX_NUM_DIALOG; i++)
  1884.     {
  1885.         if (g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[i].dialogId == dialogId)
  1886.         {
  1887.             return i;
  1888.         }
  1889.     }
  1890.     if (i == VOIP_MAX_NUM_DIALOG)
  1891.     {
  1892.         return -1;
  1893.     }
  1894.     return -1;
  1895. }
  1896. /*****************************************************************************
  1897.  * FUNCTION
  1898.  *  mmi_voip_log_call_end_time
  1899.  * DESCRIPTION
  1900.  *  Put current time as end time and calculate call duration.
  1901.  * PARAMETERS
  1902.  *  callId          [IN]        Call id
  1903.  *  dialogId        [IN]        Dialog id
  1904.  *  duration        [IN]        Duration of the call
  1905.  * RETURNS
  1906.  *  void
  1907.  *****************************************************************************/
  1908. void mmi_voip_log_call_end_time(S32 callId, S32 dialogId, MYTIME *duration)
  1909. {
  1910.     /*----------------------------------------------------------------*/
  1911.     /* Local Variables                                                */
  1912.     /*----------------------------------------------------------------*/
  1913.     S32 callIndex = 0, dialogIndex = 0;
  1914.     MYTIME currTime;
  1915.     /*----------------------------------------------------------------*/
  1916.     /* Code Body                                                      */
  1917.     /*----------------------------------------------------------------*/
  1918.     callIndex = mmi_voip_get_call_index(callId);
  1919.     if (callIndex != -1)
  1920.     {
  1921.         dialogIndex = mmi_voip_get_dialog_index(callIndex, dialogId);
  1922.         if (dialogIndex != -1)
  1923.         {
  1924.             DTGetRTCTime(&currTime);
  1925.             g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].endTime = currTime;
  1926.             /* overflow 2030/12/31/23:59:59 */
  1927.             if (g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime.nYear == 2030 && 
  1928.                 currTime.nYear < g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime.nYear)
  1929.             {
  1930.                 currTime.nYear = g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime.nYear;
  1931.                 currTime.nMonth = g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime.nMonth;
  1932.                 currTime.nDay = g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime.nDay + 1;
  1933.             }
  1934.             GetTimeDifference(
  1935.                 &currTime,
  1936.                 &g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime,
  1937.                 duration);
  1938.         }
  1939.     }
  1940. }
  1941. /*****************************************************************************
  1942.  * FUNCTION
  1943.  *  mmi_voip_log_call_history
  1944.  * DESCRIPTION
  1945.  *  Log dialed call history entry when outgoing call is connected, local-aborted or remote-rejected.
  1946.  *  Log received call history entry when incoming call is accepted.
  1947.  *  Log missed call history entry when incoming call is local-rejected or remote-aborted.
  1948.  * PARAMETERS
  1949.  *  callId          [IN]        Call id
  1950.  *  dialogId        [IN]        Dialog id
  1951.  *  callOrigin      [IN]        Call origin, either MMI_VOIP_MO_ORIGIN or MMI_VOIP_MT_ORIGIN
  1952.  *  isConnect       [IN]        Call connect or not
  1953.  * RETURNS
  1954.  *  void
  1955.  *****************************************************************************/
  1956. void mmi_voip_log_call_history(S32 callId, S32 dialogId, mmi_voip_call_origin_enum callOrigin, BOOL isConnect)
  1957. {
  1958.     /*----------------------------------------------------------------*/
  1959.     /* Local Variables                                                */
  1960.     /*----------------------------------------------------------------*/
  1961.     S32 callIndex = 0, dialogIndex = 0;
  1962.     MYTIME currTime;
  1963.     /*----------------------------------------------------------------*/
  1964.     /* Code Body                                                      */
  1965.     /*----------------------------------------------------------------*/
  1966.     /* reset call log info */
  1967.     memset(&g_voip_cntx_p->call_log_info, 0, sizeof(mmi_voip_call_log_struct));
  1968.     /* it is possible that progressing_ind is not received yet, therefore, the outgoing call is not in the call list */
  1969.     PRINT_INFORMATION(("n[mmi_voip_log_call_history] Outgoing Call Id: %d, Connect or Not: %dn", mmi_voip_get_outgoing_call_id(), isConnect));
  1970.     if ((callOrigin == MMI_VOIP_MO_ORIGIN) && (isConnect == FALSE) && (mmi_voip_get_outgoing_call_id() == -1))
  1971.     {
  1972.         memset(g_voip_cntx_p->call_misc_info.dispUri, 0, (VOIP_URI_LEN * ENCODING_LENGTH));
  1973.         AnsiiNToUnicodeString(
  1974.             (S8*)g_voip_cntx_p->call_misc_info.dispUri,
  1975.             (S8*)g_voip_cntx_p->call_misc_info.inputUri,
  1976.             VOIP_URI_LEN);
  1977.         if (mmi_voip_get_outgoing_disp_name(
  1978.                 MMI_VOIP_PHB|MMI_VOIP_HISTORY|MMI_VOIP_SOS, 
  1979.                 g_voip_cntx_p->call_misc_info.dispUri, 
  1980.                 (U8*)g_voip_cntx_p->call_log_info.dispName, 
  1981.                 VOIP_DISP_NAME_LEN) == TRUE)
  1982.         {
  1983.             g_voip_cntx_p->call_log_info.dispDcs =
  1984.                 (GetUCS2Flag((S8*)g_voip_cntx_p->call_log_info.dispName) == TRUE) ? (MMI_PHB_UCS2) : (MMI_PHB_ASCII);
  1985.             memset(&g_voip_cntx_p->call_originapp_info, 0, sizeof(mmi_voip_call_originapp_struct));
  1986.         }
  1987.         memcpy(g_voip_cntx_p->call_log_info.remoteUri, g_voip_cntx_p->call_misc_info.inputUri, VOIP_URI_LEN);
  1988.         DTGetRTCTime(&currTime);
  1989.         g_voip_cntx_p->call_log_info.startTime = currTime;
  1990.         mmi_chist_log_voip_dialed_call(&g_voip_cntx_p->call_log_info);
  1991.     }
  1992.     else
  1993.     {
  1994.         if (callId != -1)
  1995.         {
  1996.             callIndex = mmi_voip_get_call_index(callId);
  1997.             if (dialogId != -1)
  1998.             {
  1999.                 dialogIndex = mmi_voip_get_dialog_index(callIndex, dialogId);
  2000.                 if (callOrigin == MMI_VOIP_MO_ORIGIN)
  2001.                 {
  2002.                     PRINT_INFORMATION(("n[mmi_voip_log_call_history] Reset origin app Structuren"));
  2003.                     /* reset origin app structure */
  2004.                     memset(&g_voip_cntx_p->call_originapp_info, 0, sizeof(mmi_voip_call_originapp_struct));
  2005.                     memcpy(
  2006.                         g_voip_cntx_p->call_log_info.dispName,
  2007.                         g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].appName,
  2008.                         (VOIP_DISP_NAME_LEN * sizeof(U16)));
  2009.                     memcpy(
  2010.                         g_voip_cntx_p->call_log_info.remoteUri,
  2011.                         g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].remoteUri,
  2012.                         VOIP_URI_LEN);
  2013.                     g_voip_cntx_p->call_log_info.dispDcs =
  2014.                         (GetUCS2Flag((S8*)g_voip_cntx_p->call_log_info.dispName) == TRUE) ? (MMI_PHB_UCS2) : (MMI_PHB_ASCII);
  2015.                     if (isConnect == TRUE)
  2016.                     {
  2017.                         g_voip_cntx_p->call_log_info.startTime =
  2018.                             g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime;                        
  2019.                         mmi_chist_log_voip_dialed_call(&g_voip_cntx_p->call_log_info);
  2020.                     }
  2021.                     else /* isConnect == FALSE */
  2022.                     {
  2023.                         DTGetRTCTime(&currTime);
  2024.                         g_voip_cntx_p->call_log_info.startTime = currTime;                        
  2025.                         mmi_chist_log_voip_dialed_call(&g_voip_cntx_p->call_log_info);
  2026.                     }
  2027.                 }
  2028.                 else if (callOrigin == MMI_VOIP_MT_ORIGIN)
  2029.                 {
  2030.                     memcpy(
  2031.                         g_voip_cntx_p->call_log_info.dispName,
  2032.                         g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].dispName,
  2033.                         (VOIP_DISP_NAME_LEN * sizeof(U16)));
  2034.                     memcpy(
  2035.                         g_voip_cntx_p->call_log_info.remoteUri,
  2036.                         g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].remoteUri,
  2037.                         VOIP_URI_LEN);
  2038.                     g_voip_cntx_p->call_log_info.dispDcs =
  2039.                         (GetUCS2Flag((S8*)g_voip_cntx_p->call_log_info.dispName) == TRUE) ? (MMI_PHB_UCS2) : (MMI_PHB_ASCII);
  2040.                     if (isConnect == TRUE)
  2041.                     {
  2042.                         g_voip_cntx_p->call_log_info.startTime =
  2043.                             g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime;                        
  2044.                         mmi_chist_log_voip_received_call(&g_voip_cntx_p->call_log_info);
  2045.                     }
  2046.                     else /* isConnect == FALSE */
  2047.                     {
  2048.                         DTGetRTCTime(&currTime);
  2049.                         g_voip_cntx_p->call_log_info.startTime = currTime;
  2050.                         mmi_chist_log_voip_missed_call(&g_voip_cntx_p->call_log_info);
  2051.                         SetMissedCallFlag(TRUE); /* display missed call screen in idle screen */
  2052.                     }
  2053.                 }
  2054.                 else
  2055.                 {
  2056.                     MMI_ASSERT(0);  /* call origin should be either MMI_VOIP_MO_ORIGIN or MMI_VOIP_MT_ORIGIN */
  2057.                 }
  2058.             }
  2059.             else
  2060.             {
  2061.                 MMI_ASSERT(dialogId != -1);
  2062.             }
  2063.         }
  2064.         else
  2065.         {
  2066.             MMI_ASSERT(callId != -1);
  2067.         }
  2068.     }
  2069. }
  2070. /*****************************************************************************
  2071.  * FUNCTION
  2072.  *  mmi_voip_log_call_duration
  2073.  * DESCRIPTION
  2074.  *  Log call history duration when call is released.
  2075.  * PARAMETERS
  2076.  *  callId          [IN]        Call id
  2077.  *  dialogId        [IN]        Dialog id
  2078.  *  callOrigin      [IN]        Call origin, either MMI_VOIP_MO_ORIGIN or MMI_VOIP_MT_ORIGIN
  2079.  * RETURNS
  2080.  *  void
  2081.  *****************************************************************************/
  2082. void mmi_voip_log_call_duration(S32 callId, S32 dialogId, mmi_voip_call_origin_enum callOrigin)
  2083. {
  2084.     /*----------------------------------------------------------------*/
  2085.     /* Local Variables                                                */
  2086.     /*----------------------------------------------------------------*/
  2087.     S32 callIndex = 0, dialogIndex = 0;
  2088.     /*----------------------------------------------------------------*/
  2089.     /* Code Body                                                      */
  2090.     /*----------------------------------------------------------------*/
  2091.     /* reset call log info */
  2092.     memset(&g_voip_cntx_p->call_log_info, 0, sizeof(mmi_voip_call_log_struct));
  2093.     if (callId != -1)
  2094.     {
  2095.         callIndex = mmi_voip_get_call_index(callId);
  2096.         if (dialogId != -1)
  2097.         {
  2098.             dialogIndex = mmi_voip_get_dialog_index(callIndex, dialogId);
  2099.             if (callOrigin == MMI_VOIP_MO_ORIGIN)
  2100.             {
  2101.                 memcpy(
  2102.                     g_voip_cntx_p->call_log_info.dispName,
  2103.                     g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].appName,
  2104.                     (VOIP_DISP_NAME_LEN * sizeof(U16)));
  2105.                 memcpy(
  2106.                     g_voip_cntx_p->call_log_info.remoteUri,
  2107.                     g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].remoteUri,
  2108.                     VOIP_URI_LEN);
  2109.                 g_voip_cntx_p->call_log_info.dispDcs =
  2110.                     (GetUCS2Flag((S8*)g_voip_cntx_p->call_log_info.dispName) == TRUE) ? (MMI_PHB_UCS2) : (MMI_PHB_ASCII);
  2111.                 g_voip_cntx_p->call_log_info.startTime =
  2112.                     g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime;
  2113.                 g_voip_cntx_p->call_log_info.endTime =
  2114.                     g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].endTime;
  2115.                 mmi_chist_log_voip_call_duration(&g_voip_cntx_p->call_log_info, PHB_LND);
  2116.             }
  2117.             else if (callOrigin == MMI_VOIP_MT_ORIGIN)
  2118.             {
  2119.                 memcpy(
  2120.                     g_voip_cntx_p->call_log_info.dispName,
  2121.                     g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].dispName,
  2122.                     (VOIP_DISP_NAME_LEN * sizeof(U16)));
  2123.                 memcpy(
  2124.                     g_voip_cntx_p->call_log_info.remoteUri,
  2125.                     g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].remoteUri,
  2126.                     VOIP_URI_LEN);
  2127.                 g_voip_cntx_p->call_log_info.dispDcs =
  2128.                     (GetUCS2Flag((S8*)g_voip_cntx_p->call_log_info.dispName) == TRUE) ? (MMI_PHB_UCS2) : (MMI_PHB_ASCII);
  2129.                 g_voip_cntx_p->call_log_info.startTime =
  2130.                     g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].startTime;
  2131.                 g_voip_cntx_p->call_log_info.endTime =
  2132.                     g_voip_cntx_p->call_list_info.call_info[callIndex].dialog_info[dialogIndex].endTime;
  2133.                 mmi_chist_log_voip_call_duration(&g_voip_cntx_p->call_log_info, PHB_LNR);
  2134.             }
  2135.             else
  2136.             {
  2137.                 MMI_ASSERT(0);  /* call origin should be either MMI_VOIP_MO_ORIGIN or MMI_VOIP_MT_ORIGIN */
  2138.             }
  2139.         }
  2140.         else
  2141.         {
  2142.             MMI_ASSERT(dialogId != -1);
  2143.         }
  2144.     }
  2145.     else
  2146.     {
  2147.         MMI_ASSERT(callId != -1);
  2148.     }
  2149. }
  2150. #endif /* __MMI_VOIP__ */