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

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.  *  Modification Notice:
  37.  *  --------------------------
  38.  *  This software is modified by MediaTek Inc. and the information contained
  39.  *  herein is confidential. The software may not be copied and the information
  40.  *  contained herein may not be used or disclosed except with the written
  41.  *  permission of MediaTek Inc. (C) 2001
  42.  *
  43.  *******************************************************************************/
  44.  /*******************************************************************************
  45.  * Filename:
  46.  * ---------
  47.  *   OutgoingCallHelper.c
  48.  *
  49.  * Project:
  50.  * --------
  51.  *   Maui_Software
  52.  *
  53.  * Description:
  54.  * ------------
  55.  *  .......
  56.  *
  57.  * Author:
  58.  * -------
  59.  * -------
  60.  *
  61.  *------------------------------------------------------------------------------
  62.  * $Log$
  63.  *
  64.  * removed!
  65.  * removed!
  66.  * 
  67.  *
  68.  * removed!
  69.  * removed!
  70.  * 
  71.  *
  72.  * removed!
  73.  * removed!
  74.  * 
  75.  *
  76.  * removed!
  77.  * removed!
  78.  * 
  79.  *
  80.  * removed!
  81.  * removed!
  82.  * 
  83.  *
  84.  * removed!
  85.  * removed!
  86.  * 
  87.  *
  88.  * removed!
  89.  * removed!
  90.  * 
  91.  *
  92.  * removed!
  93.  * removed!
  94.  * 
  95.  *
  96.  * removed!
  97.  * removed!
  98.  * 
  99.  *
  100.  * removed!
  101.  * removed!
  102.  * 
  103.  *
  104.  * removed!
  105.  * removed!
  106.  * 
  107.  *
  108.  * removed!
  109.  * removed!
  110.  * 
  111.  *
  112.  * removed!
  113.  * removed!
  114.  * 
  115.  *
  116.  * removed!
  117.  * removed!
  118.  * 
  119.  *
  120.  * removed!
  121.  * removed!
  122.  * 
  123.  *
  124.  * removed!
  125.  * removed!
  126.  * 
  127.  *
  128.  * removed!
  129.  * removed!
  130.  * 
  131.  *
  132.  * removed!
  133.  * removed!
  134.  * 
  135.  *
  136.  * removed!
  137.  * removed!
  138.  * 
  139.  *
  140.  * removed!
  141.  * removed!
  142.  * 
  143.  *
  144.  * removed!
  145.  * removed!
  146.  * 
  147.  *
  148.  * removed!
  149.  * removed!
  150.  * 
  151.  *
  152.  * removed!
  153.  * removed!
  154.  * 
  155.  *
  156.  * removed!
  157.  * removed!
  158.  * 
  159.  *
  160.  * removed!
  161.  * removed!
  162.  * 
  163.  *
  164.  * removed!
  165.  * removed!
  166.  * 
  167.  *
  168.  * removed!
  169.  * removed!
  170.  * 
  171.  *
  172.  * removed!
  173.  * removed!
  174.  * 
  175.  *
  176.  * removed!
  177.  * removed!
  178.  * 
  179.  *
  180.  * removed!
  181.  * removed!
  182.  * 
  183.  *
  184.  * removed!
  185.  * removed!
  186.  * 
  187.  *
  188.  * removed!
  189.  * removed!
  190.  * 
  191.  *
  192.  * removed!
  193.  * removed!
  194.  * 
  195.  *
  196.  * removed!
  197.  * removed!
  198.  * 
  199.  *
  200.  * removed!
  201.  * removed!
  202.  * 
  203.  *
  204.  * removed!
  205.  * removed!
  206.  * 
  207.  *
  208.  * removed!
  209.  * removed!
  210.  * 
  211.  *
  212.  * removed!
  213.  * removed!
  214.  * 
  215.  *
  216.  * removed!
  217.  * removed!
  218.  * 
  219.  *
  220.  * removed!
  221.  * removed!
  222.  * 
  223.  *
  224.  * removed!
  225.  * removed!
  226.  * 
  227.  *
  228.  * removed!
  229.  * removed!
  230.  * 
  231.  *
  232.  * removed!
  233.  * removed!
  234.  * 
  235.  *
  236.  * removed!
  237.  * removed!
  238.  * 
  239.  *
  240.  * removed!
  241.  * removed!
  242.  * 
  243.  *
  244.  * removed!
  245.  * removed!
  246.  * 
  247.  *
  248.  * removed!
  249.  * removed!
  250.  * 
  251.  *
  252.  * removed!
  253.  * removed!
  254.  * 
  255.  *
  256.  * removed!
  257.  * removed!
  258.  * 
  259.  *
  260.  * removed!
  261.  * removed!
  262.  * 
  263.  *
  264.  * removed!
  265.  * removed!
  266.  * 
  267.  *
  268.  * removed!
  269.  * removed!
  270.  * 
  271.  *
  272.  * removed!
  273.  * removed!
  274.  * 
  275.  *
  276.  * removed!
  277.  * removed!
  278.  * 
  279.  *
  280.  * removed!
  281.  * removed!
  282.  * 
  283.  *
  284.  * removed!
  285.  * removed!
  286.  * 
  287.  *
  288.  * removed!
  289.  * removed!
  290.  * 
  291.  *
  292.  * removed!
  293.  * removed!
  294.  * 
  295.  *
  296.  * removed!
  297.  * removed!
  298.  * 
  299.  *
  300.  * removed!
  301.  * removed!
  302.  * 
  303.  *
  304.  * removed!
  305.  * removed!
  306.  * 
  307.  *
  308.  * removed!
  309.  * removed!
  310.  * 
  311.  *
  312.  * removed!
  313.  * removed!
  314.  * 
  315.  *
  316.  * removed!
  317.  * removed!
  318.  * 
  319.  *
  320.  * removed!
  321.  * removed!
  322.  * 
  323.  *
  324.  * removed!
  325.  * removed!
  326.  * 
  327.  *
  328.  * removed!
  329.  * removed!
  330.  * 
  331.  *
  332.  * removed!
  333.  * removed!
  334.  * 
  335.  *
  336.  * removed!
  337.  * removed!
  338.  * 
  339.  *
  340.  * removed!
  341.  * removed!
  342.  * Register callback function fop dialing icon
  343.  *
  344.  *******************************************************************************/
  345. /**
  346.  * Copyright Notice
  347.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  348.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  349.  *  (It is illegal to remove this copyright notice from this software or any
  350.  *  portion of it)
  351.  */
  352. /**************************************************************
  353.    FILENAME : OutgoingCallHelper.c
  354.    PURPOSE     : Call Management application
  355.    REMARKS     : nil
  356.    AUTHOR      : Subramanya BG
  357.    DATE     : Nov 12,02
  358. **************************************************************/
  359. #include "stdC.h"
  360. #include "MMI_Features.h"
  361. #include "L4Dr.h"
  362. #include "L4Dr1.h"
  363. #include "PixtelDataTypes.h"
  364. #include "GlobalConstants.h"
  365. #include "GlobalScrEnum.h"
  366. #include "DebugInitDef.h"
  367. #include "ProtocolEvents.h"
  368. #include "EventsGprot.h"
  369. #include "HistoryGprot.h"
  370. #include "CommonScreens.h"
  371. #include "wgui.h"
  372. #include "Wgui_status_icons.h"
  373. #include "wgui_categories_inputs.h"
  374. #include "wgui_categories_CM.h"
  375. #include "GlobalDefs.h"
  376. #include "TimerEvents.h"
  377. #include "BootUp.h"
  378. #include "PowerOnChargerProt.h"
  379. #include "PhonebookDef.h"
  380. #include "PhoneBookTypes.h"
  381. #include "PhoneBookGprot.h"
  382. #include "CallSetUpEnum.h"
  383. #include "SimDetectionGexdcl.h"
  384. #include "SimDetectionGprot.h"
  385. #include "AlarmFrameworkProt.h"
  386. #include "DateTimeGprot.h"
  387. #include "CallmanagementIdDef.h"
  388. #include "CallManagementStruct.h"
  389. #include "CallStructureManagementProt.h"
  390. #include "CmErrorTypes.h"
  391. #include "CmErrorHandlersProt.h"
  392. #include "CommonStubsProt.h"
  393. #include "HistoryHelperProt.h"
  394. #include "PsCallHelperDef.h"
  395. #include "mmiapi_struct.h"
  396. #include "PsCallHelperGprot.h"
  397. #include "RedialHelperGProt.h"
  398. #include "CallManagementGprot.h"
  399. #include "IncomingCallManagementProt.h"
  400. #include "OutgoingCallManagementProt.h"
  401. #include "CallsGProts.h"
  402. #include "OutgoingCallHelperGProt.h"
  403. #include "OutgoingCallHelperProt.h"
  404. #include "gpioInc.h"
  405. #ifdef __MMI_VOIP__
  406. #include "VoIPGProt.h"
  407. #endif
  408. #if defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__)
  409. #include "NetworkSetupDefs.h"
  410. #endif
  411. #if defined(__MMI_BG_SOUND_EFFECT__)
  412. #include "BGSoundGProt.h"
  413. #endif 
  414. #ifdef __MMI_BT_PROFILE__
  415. #include "mdi_datatype.h"
  416. #include "mdi_audio.h"
  417. void mmi_profiles_bt_call_start_callback(void);
  418. #endif /* __MMI_BT_PROFILE__ */ 
  419. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  420. #include "ddl.h"
  421. #include "jcutils.h"
  422. #include "jcerror.h"
  423. #include "jdd_tapi.h"
  424. #endif
  425. static CM_CALL_HANDLE gMyhandle;
  426. /* static U16 curKeyCode, curKeyType; */
  427. static pBOOL gCheckDialIndEndOutgoing = FALSE;
  428. S8 DTMFPadCallBuffer[MAX_DIGITS_USSD];
  429. S8 UnicodeDTMFPadCallBuffer[MAX_DIGITS_USSD * ENCODING_LENGTH];
  430. PU8 gCallDeflectNumber;
  431. extern U16 gtmpOutgoingIndex;
  432. extern void SSCHandleIMEI(void);
  433. const U16 CMIdleScreenDigits[MAX_CM_SCREEN_DIGITS] = 
  434. {
  435.     KEY_0, KEY_1, KEY_2, KEY_3,
  436.     KEY_4, KEY_5, KEY_6, KEY_7,
  437.     KEY_8, KEY_9, KEY_STAR,
  438.     KEY_POUND
  439. };
  440. /*****************************************************************************
  441.  * FUNCTION
  442.  *  MakeCallEx
  443.  * DESCRIPTION
  444.  *  Wrapper which checks to see if the call to be made is
  445.  *  O/G or USSD
  446.  *  
  447.  *  This function is exported to others applications
  448.  * PARAMETERS
  449.  *  strNumber       [IN]        
  450.  *  pre_check       [IN]        
  451.  *  Number(?)       [IN]        Which needs to be sent to network
  452.  * RETURNS
  453.  *  void
  454.  *****************************************************************************/
  455. void MakeCallEx(PS8 strNumber, BOOL pre_check)
  456. {
  457.     /*----------------------------------------------------------------*/
  458.     /* Local Variables                                                */
  459.     /*----------------------------------------------------------------*/
  460.     /*----------------------------------------------------------------*/
  461.     /* Code Body                                                      */
  462.     /*----------------------------------------------------------------*/
  463.     /* check low battery */
  464.     if (!CHECK_MO_ALLOW())
  465.     {
  466.         ChgrPlayLowBatTone();
  467.         BatteryIndicationPopup(STR_LOW_BATTERY_MT_PROHIBIT);
  468.         return;
  469.     }
  470. #ifdef __MMI_VOIP__
  471.     /* cannot dial gsm call when voip call exists */
  472.     if (mmi_voip_app_total_call() != 0)
  473.     {
  474.         ShowCallManagementErrorMessage(ERR_REQ_FACILITY_UNAVAIL);
  475.         return;
  476.     }
  477. #endif /* __MMI_VOIP__ */
  478.     if (IS_LOW_BATTERY())
  479.     {
  480.         ChgrPlayLowBatTone();
  481.         if (g_charbat_context.LowBatteryTxProhibitFlag)
  482.         {
  483.             SET_LOW_BATTERY_ALARM_THRESHOLD(LBAT_TALK_DURCNT_PROHIBIT);
  484.         }
  485.         else
  486.         {
  487.             SET_LOW_BATTERY_ALARM_THRESHOLD(LBAT_TALK_DURCNT_NORMAL);
  488.         }
  489.     }
  490.     SetNoSave();
  491.     if (!GetDialedDigitCalledFlag())
  492.     {
  493.         ClearDtmfBuf();
  494.         FillDtmfBuff((PU8) strNumber);
  495.     }
  496.     else
  497.     {
  498.         SetDialedDigitCalledFlag(FALSE);
  499.     }
  500.     if (!pre_check)
  501.     {
  502.         if (NULL == strNumber)
  503.         {
  504.             SetCallDeflectFlag(FALSE);
  505.             ShowCallManagementErrorMessage(ERR_INVALID_NUMBER_FORMAT);
  506.             return;
  507.         }
  508.         else if (0 == *strNumber)
  509.         {
  510.             SetCallDeflectFlag(FALSE);
  511.             ShowCallManagementErrorMessage(ERR_INVALID_NUMBER_FORMAT);
  512.             return;
  513.         }
  514. if (!CheckValidEmergencyNo1(strNumber))
  515. {
  516.         if (UCS2StrFirstPositionSearch(strNumber) == FALSE)
  517.         {
  518.             SetCallDeflectFlag(FALSE);
  519.             ShowCallManagementErrorMessage(ERR_INVALID_NUMBER_FORMAT);
  520.             return;
  521.         }
  522.         if (UCS2StrNoFirstPositionSearch(strNumber, 'p') == FALSE)
  523.         {
  524.             SetCallDeflectFlag(FALSE);
  525.             ShowCallManagementErrorMessage(ERR_INVALID_NUMBER_FORMAT);
  526.             return;
  527.         }
  528.         if (UCS2StrNoFirstPositionSearch(strNumber, 'w') == FALSE)
  529.         {
  530.             SetCallDeflectFlag(FALSE);
  531.             ShowCallManagementErrorMessage(ERR_INVALID_NUMBER_FORMAT);
  532.             return;
  533.         }
  534.         }
  535.     }
  536.     CheckShortCutOrCall();
  537. }
  538. /*****************************************************************************
  539.  * FUNCTION
  540.  *  MakeCall
  541.  * DESCRIPTION
  542.  *  Check if the background sound is turn on
  543.  *  
  544.  *  This function is exported to others applications
  545.  * PARAMETERS
  546.  *  strNumber       [IN]        
  547.  *  Number(?)       [IN]        Which needs to be sent to network
  548.  * RETURNS
  549.  *  void
  550.  *****************************************************************************/
  551. void MakeCall(PS8 strNumber)
  552. {
  553. #if defined(__MMI_BG_SOUND_EFFECT__)
  554.     /*----------------------------------------------------------------*/
  555.     /* Local Variables                                                */
  556.     /*----------------------------------------------------------------*/
  557.     U16 scr_id;
  558.     /*----------------------------------------------------------------*/
  559.     /* Code Body                                                      */
  560.     /*----------------------------------------------------------------*/
  561. #if defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__)
  562.     if (mmi_netset_get_active_preferred_mode() == 1 /*&& ref_prefer_mode == MMI_TRUE*/)
  563.     {
  564.         /* preferred mode = WLAN only */
  565.         DisplayPopup(
  566.             (PU8)GetString(STR_GLOBAL_UNFINISHED),
  567.             IMG_GLOBAL_UNFINISHED,
  568.             1,
  569.             CS_NOTIFYDURATION,
  570.             (U8)ERROR_TONE);
  571.         mmi_phb_call_set_dial_from_list(MMI_PHB_NONE);  /* reset dial from phonebook flag */
  572.         CHISTSetDialFromCallLogFlag(0);                 /* reset dial from call history flag */
  573.         return;
  574.     }
  575. #endif /* defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__) */
  576.     /* Don't enter background sound in the call setup screen */
  577.     scr_id = GetActiveScreenId();
  578.     SetNoSave();
  579.     /* Do check in advance to avoid some screen problem. */
  580.     if (!(scr_id >= SCR_ID_CALLSET_BARRING_MAIN && scr_id <= SCR_SETTING_BLACK_LIST_NUM) &&
  581.         (strNumber != NULL) &&
  582.         (*strNumber != 0) &&
  583. ( ( CheckValidEmergencyNo1(strNumber) ) ||
  584.         (UCS2StrFirstPositionSearch(strNumber) == TRUE) &&
  585.         (UCS2StrNoFirstPositionSearch(strNumber, 'p') == TRUE) &&
  586.         (UCS2StrNoFirstPositionSearch(strNumber, 'w') == TRUE) ) &&
  587.         (CHECK_MO_ALLOW()) &&
  588.         (mmi_bgsnd_mo_call_check_last_char(strNumber, '#') == MMI_FALSE))  /* Not SS string */
  589.     {
  590.         /* Already check the number correctness, no need to check in MakeCallEx() again */
  591.         if (mmi_bgsnd_mo_call_use_effect(strNumber) == FALSE)
  592.         {
  593.             MakeCallEx(strNumber, TRUE);
  594.         }
  595.     }
  596.     else
  597.     {
  598.         /* Check number correctness fail, let it check again and popup error message in the MakeCallEx() */
  599. #if defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__)
  600.     if (mmi_netset_get_active_preferred_mode() == 1 /*&& ref_prefer_mode == MMI_TRUE*/)
  601.     {
  602.         /* preferred mode = WLAN only */
  603.         DisplayPopup(
  604.             (PU8) GetString(STR_GLOBAL_UNFINISHED),
  605.             IMG_GLOBAL_UNFINISHED,
  606.             1,
  607.             CS_NOTIFYDURATION,
  608.             (U8) ERROR_TONE);
  609.         mmi_phb_call_set_dial_from_list(MMI_PHB_NONE);  /* reset dial from phonebook flag */
  610.         CHISTSetDialFromCallLogFlag(0);                 /* reset dial from call history flag */
  611.         return;
  612.     }
  613. #endif /* defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__) */
  614.         MakeCallEx(strNumber, FALSE);
  615.     }
  616. #else /* defined(__MMI_BG_SOUND_EFFECT__) */ 
  617.     MakeCallEx(strNumber, FALSE);
  618. #endif /* defined(__MMI_BG_SOUND_EFFECT__) */ 
  619. }
  620. /*****************************************************************************
  621.  * FUNCTION
  622.  *  CheckShortCutOrCall
  623.  * DESCRIPTION
  624.  *  Helper function to check if the key is shortcut or not
  625.  *  if not it makes a call
  626.  * PARAMETERS
  627.  *  void
  628.  * RETURNS
  629.  *  void
  630.  *****************************************************************************/
  631. void CheckShortCutOrCall(void)
  632. {
  633.     /*----------------------------------------------------------------*/
  634.     /* Local Variables                                                */
  635.     /*----------------------------------------------------------------*/
  636.     PU8 dtmfBuf;
  637.     /*----------------------------------------------------------------*/
  638.     /* Code Body                                                      */
  639.     /*----------------------------------------------------------------*/
  640.     SetNoSave();
  641.     dtmfBuf = GetDtmfBuffer();
  642.     if (GetCallDeflectFlag() == FALSE)
  643.     {
  644.         if (IsStandardGsmSS(dtmfBuf))
  645.         {
  646.             return;
  647.         }
  648.     }
  649.     if (GetCallDeflectFlag() == TRUE)
  650.     {
  651.         PRINT_INFORMATION(("XXX Call Deflectionn"));
  652.         SetCallDeflectFlag(FALSE);
  653.         OutgoingProcessCMEvent(CM_KB_CALL_DEFLECT_REQ, dtmfBuf);
  654.         /* return; */
  655.     }
  656.     else if (IsSimControlProcedure(dtmfBuf) == TRUE)
  657.     {
  658.         PRINT_INFORMATION(("XXX Sim Specifc Controln"));
  659.         return;
  660.     }
  661.     else if (IsManufactuerSpecific(dtmfBuf) == TRUE)
  662.     {
  663.         PRINT_INFORMATION(("XXX Manufacture Specific Control n"));
  664.         return;
  665.     }
  666.     else if (isHashString(dtmfBuf))
  667.     {
  668.         MakeMyCall((PS8) dtmfBuf);
  669.     }
  670.     else if (isShortString(dtmfBuf))
  671.     {
  672.         MakeMyCall((PS8) dtmfBuf);
  673.     }
  674.     else    /* if (AllowMoreCalls()) */
  675.     {
  676.         MakeMyCall((PS8) dtmfBuf);
  677.     }
  678.     /* else
  679.        {
  680.        ShowCallManagementErrorMessage(ERR_CSMCC_CMD_NOT_ALLOW);
  681.        } */
  682.     ClearDtmfBuf();
  683. }
  684. /*****************************************************************************
  685.  * FUNCTION
  686.  *  MakeMyCall
  687.  * DESCRIPTION
  688.  *  Helper function to make a outgoingcall of a given number.
  689.  *  
  690.  *  This converts the number to OUTGOING_CALL structure which is necessary for State m/c.
  691.  * PARAMETERS
  692.  *  strNumber       [IN]        
  693.  *  Number(?)       [IN]        Which needs to make the outgoing call.
  694.  * RETURNS
  695.  *  void
  696.  *****************************************************************************/
  697. void MakeMyCall(PS8 strNumber)
  698. {
  699.     /*----------------------------------------------------------------*/
  700.     /* Local Variables                                                */
  701.     /*----------------------------------------------------------------*/
  702.     OUTGOING_CALL outCall;
  703.     /*----------------------------------------------------------------*/
  704.     /* Code Body                                                      */
  705.     /*----------------------------------------------------------------*/
  706.     memset(&outCall, 0, sizeof(OUTGOING_CALL));
  707.     if ((strlen((void*)strNumber) * ENCODING_LENGTH) > MAX_CM_NUMBER)
  708.     {
  709.         PRINT_INFORMATION(("XXX Number too long XXX n"));
  710.         ShowCallManagementErrorMessage(ERR_INVALID_NUMBER_FORMAT);
  711.         return;
  712.     }
  713.     pfnUnicodeStrcpy((void*)outCall.Number, (void*)UnicodeDTMFPadCallBuffer);
  714.     MakeOutgoingcall(outCall);
  715. }
  716. /*****************************************************************************
  717.  * FUNCTION
  718.  *  MakeOutgoingcall
  719.  * DESCRIPTION
  720.  *  Helper function to generate Keybrd Event CM_KB_OUTGOINGCALL with the OUTGOING_CALL structure.
  721.  *  
  722.  *  This invokes the function to process the CM_KB_OUTGOINGCALL event in the state m/c.
  723.  * PARAMETERS
  724.  *  MsgStruct           [IN]        
  725.  *  structure(?)        [IN]        Contains the calling number and name if present corresponding to that number.
  726.  * RETURNS
  727.  *  void
  728.  *****************************************************************************/
  729. void MakeOutgoingcall(OUTGOING_CALL MsgStruct)
  730. {
  731.     /*----------------------------------------------------------------*/
  732.     /* Local Variables                                                */
  733.     /*----------------------------------------------------------------*/
  734.     /*----------------------------------------------------------------*/
  735.     /* Code Body                                                      */
  736.     /*----------------------------------------------------------------*/
  737.     OutgoingProcessCMEvent(CM_KB_OUTGOINGCALL, &MsgStruct);
  738. }
  739. /*****************************************************************************
  740.  * FUNCTION
  741.  *  IsStandardGsmSS
  742.  * DESCRIPTION
  743.  *  Helper function for interpreting user code
  744.  * PARAMETERS
  745.  *  dtmfBuf         [IN]        
  746.  *  true(?)         [OUT]       Or false on the basis of interepretaion of SS
  747.  *  buffer(?)       [IN]        For interpretation
  748.  * RETURNS
  749.  *  pBOOL
  750.  *****************************************************************************/
  751. pBOOL IsStandardGsmSS(PU8 dtmfBuf)
  752. {
  753.     /*----------------------------------------------------------------*/
  754.     /* Local Variables                                                */
  755.     /*----------------------------------------------------------------*/
  756.     PU8 tmpBuf = dtmfBuf;
  757.     CM_CALL_HANDLE callVal;
  758.     S32 bufLen;
  759.     pBOOL valid = FALSE;
  760.     /*----------------------------------------------------------------*/
  761.     /* Code Body                                                      */
  762.     /*----------------------------------------------------------------*/
  763.     if (GetTotalCallCount() == 0)
  764.     {
  765.         return FALSE;
  766.     }
  767.     /* second digit must be NULL, *, or 0~9 */
  768.     if ((*(tmpBuf + 1) == 0) || (*(tmpBuf + 1) == '*') || ((*(tmpBuf + 1) >= '0') && (*(tmpBuf + 1) <= '9')))
  769.     {
  770.         valid = TRUE;
  771.     }
  772.     if (valid == TRUE)
  773.     {
  774.         switch (*tmpBuf)
  775.         {
  776.             case '0':
  777.                 if ('' == *(tmpBuf + 1))
  778.                 {
  779.                     /* 0 send */
  780.                     if (-1 != GetIncomingCallHandle())
  781.                     {
  782.                         /* incoming call present => reject waiting call */
  783.                         if (GetTotalCallCount() > 1)
  784.                         {
  785.                             PRINT_INFORMATION(("n *** Reject Waiting Calln"));
  786.                             KbCBackCallIncomingRejected();
  787.                             return TRUE;
  788.                         }
  789.                         else
  790.                         {
  791.                             valid = TRUE;
  792.                             break;
  793.                         }
  794.                     }
  795.                     else
  796.                     {
  797.                         /* no incoming call, drop held call */
  798.                         if ((GetTotalHoldCallCount() > 0) ||
  799.                             ((GetTotalActiveCallCount() > 0) && (GetCurrentState() == CM_OUTGOING_STATE)))
  800.                         {
  801.                             PRINT_INFORMATION(("n *** Hanging Up All Holdn"));
  802.                             HangupallHeld();
  803.                             return TRUE;
  804.                         }
  805.                         else
  806.                         {
  807.                             valid = TRUE;
  808.                             break;
  809.                         }
  810.                     }
  811.                 }
  812.                 valid = FALSE;
  813.                 break;
  814.             case '1':
  815.                 if ('' == *(tmpBuf + 1))
  816.                 {
  817.                     /* 1 send */
  818.                     if (GetCurrentState() == CM_INCOMING_STATE)
  819.                     {
  820.                         if (GetTotalCallCount() == 1)
  821.                         {
  822.                             valid = TRUE;
  823.                             break;
  824.                         }
  825.                         else
  826.                         {
  827.                             KbCBackEndActiveAcceptIncomingCall();
  828.                             return TRUE;
  829.                         }
  830.                     }
  831.                     else if (GetCurrentState() == CM_OUTGOING_STATE)
  832.                     {
  833.                         valid = TRUE;
  834.                         break;
  835.                     }
  836.                     else
  837.                     {
  838.                         if (GetTotalCallCount() > 0)
  839.                         {
  840.                             ProcessIncomingEvents(CM_KB_END_ALL_ACTIVE_RETRIEVE_HELD, NULL);
  841.                             return TRUE;
  842.                         }
  843.                         else
  844.                         {
  845.                             valid = TRUE;
  846.                             break;
  847.                         }
  848.                     }
  849.                 }
  850.                 else if ('' == *(tmpBuf + 2))
  851.                 {
  852.                     /* 1X send */
  853.                     PRINT_INFORMATION(("n *** Hanging Up Active call n"));
  854.                     callVal = (CM_CALL_HANDLE) atoi((void*)(tmpBuf + 1));
  855.                     if (callVal != 0 && GetCallState(callVal) == CM_ACTIVE_STATE &&
  856.                         GetCurrentState() != CM_OUTGOING_STATE)
  857.                     {
  858.                         HangupCall(callVal);
  859.                         return TRUE;
  860.                     }
  861.                     else
  862.                     {
  863.                         valid = TRUE;
  864.                         break;
  865.                     }
  866.                 }
  867.                 valid = FALSE;
  868.                 break;
  869.             case '2':
  870.                 if ('' == *(tmpBuf + 1))
  871.                 {
  872.                     /* 2 send */
  873.                     if (GetWapCallPresent())
  874.                     {
  875.                         valid = TRUE;
  876.                         break;
  877.                     }
  878.                     if (CM_INCOMING_STATE == GetCurrentState())
  879.                     {
  880.                         KbCBackCallIncomingAccepted();
  881.                         return TRUE;
  882.                     }
  883.                     else if (GetCurrentState() == CM_OUTGOING_STATE)
  884.                     {
  885.                         valid = TRUE;
  886.                         break;
  887.                     }
  888.                     OutgoingProcessCMEvent(CM_KB_SWAPREQ, NULL);
  889.                     return TRUE;
  890.                 }
  891.                 else if ('' == *(tmpBuf + 2))
  892.                 {
  893.                     /* 2X send */
  894.                     callVal = (CM_CALL_HANDLE) atoi((void*)(tmpBuf + 1));
  895.                     if (callVal == 0 || (GetCallState(callVal) != CM_ACTIVE_STATE))
  896.                     {
  897.                         valid = TRUE;
  898.                         break;
  899.                     }
  900.                     if ((GetTotalActiveCallCount() > 1) &&
  901.                         (GetTotalHoldCallCount() == 0) && (GetCurrentState() != CM_OUTGOING_STATE))
  902.                     {
  903.                         PRINT_INFORMATION(("n *** Splitting Call n"));
  904.                         SplitCall(callVal);
  905.                         return TRUE;
  906.                     }
  907.                     else
  908.                     {
  909.                         valid = TRUE;
  910.                         break;
  911.                     }
  912.                 }
  913.                 valid = FALSE;
  914.                 break;
  915.             case '3':
  916.                 if ('' == *(tmpBuf + 1))
  917.                 {
  918.                     /* 3 send */
  919.                     if ((GetTotalActiveCallCount() < MAX_HOLD) &&
  920.                         (GetTotalHoldCallCount() < MAX_HOLD) &&
  921.                         ((GetTotalActiveCallCount() > 0 && GetTotalHoldCallCount() > 0)))
  922.                     {
  923.                         PRINT_INFORMATION(("n *** Conferencing Call n"));
  924.                         ConferenceCall();
  925.                         return TRUE;
  926.                     }
  927.                     else
  928.                     {
  929.                         valid = TRUE;
  930.                         break;
  931.                     }
  932.                 }
  933.                 valid = FALSE;
  934.                 break;
  935.             case '4':
  936.                 if ('*' == *(tmpBuf + 1))
  937.                 {
  938.                     /* 4* send */
  939.                     if ((-1 != GetIncomingCallHandle()))
  940.                     {
  941.                         bufLen = strlen((PS8) tmpBuf);
  942.                         if (tmpBuf[bufLen - 1] >= '0' && tmpBuf[bufLen - 1] <= '9')
  943.                         {
  944.                             PRINT_INFORMATION(("n *** Call Deflectionn"));
  945.                             gCallDeflectNumber = tmpBuf + 2;
  946.                             OutgoingProcessCMEvent(CM_KB_CALL_DEFLECT_REQ, gCallDeflectNumber);
  947.                             return TRUE;
  948.                         }
  949.                     }
  950.                     else
  951.                     {
  952.                         //PRINT_INFORMATION (("n *** Not a valid action n"));
  953.                         //ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
  954.                         //return TRUE;
  955.                         valid = FALSE;
  956.                         break;
  957.                     }
  958.                 }
  959.                 else if ('' == *(tmpBuf + 1))
  960.                 {
  961.                     /* 4 send */
  962.                     if ((GetTotalActiveCallCount() == 1 && (-1 != GetOutgoingCallHandle())) ||
  963.                         (GetTotalHoldCallCount() == 1 && (-1 != GetOutgoingCallHandle())) ||
  964.                         (GetTotalActiveCallCount() == 1 && GetTotalHoldCallCount() == 1))
  965.                     {
  966.                         PRINT_INFORMATION(("n *** Explicit Call Transfern"));
  967.                         TransferCall();
  968.                         return TRUE;
  969.                     }
  970.                     else
  971.                     {
  972.                         valid = TRUE;
  973.                         break;
  974.                     }
  975.                 }
  976.                 valid = FALSE;
  977.                 break;
  978.             case '5':
  979.                 if ('' == *(tmpBuf + 1))
  980.                 {
  981.                     /* 5 send */
  982.                     if (GetCCBSFlag() == TRUE)
  983.                     {
  984.                         PRINT_INFORMATION(("n *** CCBS Activationn"));
  985.                         ActivateCCBS();
  986.                         return TRUE;
  987.                     }
  988.                     else
  989.                     {
  990.                         valid = TRUE;
  991.                         break;
  992.                     }
  993.                 }
  994.                 valid = FALSE;
  995.                 break;
  996.             default:
  997.                 valid = FALSE;
  998.                 break;
  999.         }
  1000.     }
  1001.     if (GetTotalCallCount() == 1 && GetCurrentState() == CM_INCOMING_STATE)
  1002.     {
  1003.         /* answer */
  1004.         KbCBackCallIncomingAccepted();
  1005.         /* ProcessIncomingEvents (CM_KB_INCOMING_CALL_ACCEPT,NULL); */
  1006.         return TRUE;
  1007.     }
  1008.     else if (valid == TRUE)
  1009.     {
  1010.         PRINT_INFORMATION(("n Not a valid actionn"));
  1011.         ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
  1012.         return TRUE;
  1013.     }
  1014.     return FALSE;
  1015. }
  1016. /*****************************************************************************
  1017.  * FUNCTION
  1018.  *  isHashString
  1019.  * DESCRIPTION
  1020.  *  Helper function to check is this is a # string
  1021.  * PARAMETERS
  1022.  *  buf             [IN]        
  1023.  *  Buffer(?)       [IN]        Containing USSD string
  1024.  * RETURNS
  1025.  *  void
  1026.  *****************************************************************************/
  1027. pBOOL isHashString(PU8 buf)
  1028. {
  1029.     /*----------------------------------------------------------------*/
  1030.     /* Local Variables                                                */
  1031.     /*----------------------------------------------------------------*/
  1032.     U16 count = 0;
  1033.     /*----------------------------------------------------------------*/
  1034.     /* Code Body                                                      */
  1035.     /*----------------------------------------------------------------*/
  1036.     while ('' != buf[count])
  1037.     {
  1038.         if ('#' == buf[count])
  1039.         {
  1040.             return TRUE;
  1041.         }
  1042.         if (count >= MAX_DIGIT)
  1043.         {
  1044.             return FALSE;
  1045.         }
  1046.         count++;
  1047.     }
  1048.     return FALSE;
  1049. }
  1050. /*****************************************************************************
  1051.  * FUNCTION
  1052.  *  isShortString
  1053.  * DESCRIPTION
  1054.  *  Helper function to check is this is a short string
  1055.  * PARAMETERS
  1056.  *  buf             [IN]        
  1057.  *  Buffer(?)       [IN]        Containing USSD string
  1058.  * RETURNS
  1059.  *  void
  1060.  *****************************************************************************/
  1061. pBOOL isShortString(PU8 buf)
  1062. {
  1063.     /*----------------------------------------------------------------*/
  1064.     /* Local Variables                                                */
  1065.     /*----------------------------------------------------------------*/
  1066.     U16 count = 0;
  1067.     /*----------------------------------------------------------------*/
  1068.     /* Code Body                                                      */
  1069.     /*----------------------------------------------------------------*/
  1070.     while ('' != buf[count++])
  1071.         if (count > 2)
  1072.         {
  1073.             return FALSE;
  1074.         }
  1075.     return TRUE;
  1076. }
  1077. /*****************************************************************************
  1078.  * FUNCTION
  1079.  *  UCS2StrNoFirstPositionSearch
  1080.  * DESCRIPTION
  1081.  *  Search for a character in string for only first position
  1082.  * PARAMETERS
  1083.  *  strNumber           [IN]        
  1084.  *  charToSearch        [IN]        
  1085.  * RETURNS
  1086.  *  pBOOL
  1087.  *****************************************************************************/
  1088. pBOOL UCS2StrNoFirstPositionSearch(PS8 strNumber, S8 charToSearch)
  1089. {
  1090.     /*----------------------------------------------------------------*/
  1091.     /* Local Variables                                                */
  1092.     /*----------------------------------------------------------------*/
  1093.     U16 pos;
  1094.     /*----------------------------------------------------------------*/
  1095.     /* Code Body                                                      */
  1096.     /*----------------------------------------------------------------*/
  1097.     PRINT_INFORMATION(("nIn UCS2StrNoFirstPositionSearchn"));
  1098.     if (strNumber[0] == charToSearch)
  1099.     {
  1100.         return FALSE;
  1101.     }
  1102.     else
  1103.     {
  1104.         pos = 2;
  1105.         while (strNumber[pos] != '')
  1106.         {
  1107.             if (strNumber[pos] == charToSearch)
  1108.             {
  1109. if (strNumber[pos+2] != '*' && strNumber[pos+2] != '#')
  1110.                     return TRUE;
  1111. else
  1112.     return FALSE;
  1113.             }
  1114.             pos = pos + 2;
  1115.         }
  1116.         return TRUE;
  1117.     }
  1118. }
  1119. /*****************************************************************************
  1120.  * FUNCTION
  1121.  *  UCS2StrFirstPositionSearch
  1122.  * DESCRIPTION
  1123.  *  Search for a '+' character in string for only first position
  1124.  * PARAMETERS
  1125.  *  strNumber       [IN]        
  1126.  * RETURNS
  1127.  *  pBOOL
  1128.  *****************************************************************************/
  1129. pBOOL UCS2StrFirstPositionSearch(PS8 strNumber)
  1130. {
  1131.     /*----------------------------------------------------------------*/
  1132.     /* Local Variables                                                */
  1133.     /*----------------------------------------------------------------*/
  1134.     U16 pos;
  1135.     /* pBOOL firstFlag=FALSE; */
  1136.     pBOOL secondFlag = FALSE;
  1137.     S8 charToSearch = '+';
  1138.     U8 length;
  1139.     /*----------------------------------------------------------------*/
  1140.     /* Code Body                                                      */
  1141.     /*----------------------------------------------------------------*/
  1142.     PRINT_INFORMATION(("nIn UCS2StrFirstPositionSearchn"));
  1143.     //if(strNumber[0]==charToSearch)
  1144.     //   firstFlag=TRUE;
  1145. length = pfnUnicodeStrlen(strNumber);
  1146.     pos = 2;
  1147.     while (strNumber[pos] != '')
  1148.     {
  1149.         if ((strNumber[pos] == charToSearch) && 
  1150.             ((strNumber[pos - 2] != '#' && strNumber[pos - 2] != '*' &&
  1151.              strNumber[(length-1)<<1] != '#') ||
  1152.              (strNumber[0] == charToSearch)))
  1153.         {
  1154.             secondFlag = TRUE;
  1155.             break;
  1156.         }
  1157.         pos = pos + 2;
  1158.     }
  1159.     if (secondFlag == FALSE)
  1160.     {
  1161.         return TRUE;
  1162.     }
  1163.     else
  1164.     {
  1165.         return FALSE;
  1166.     }
  1167. }
  1168. /*****************************************************************************
  1169.  * FUNCTION
  1170.  *  ShowOutgoingIndicationScreen
  1171.  * DESCRIPTION
  1172.  *  Shows only outgoing call screen and takes control
  1173.  * PARAMETERS
  1174.  *  number          [IN]        
  1175.  *  Number(?)       [IN]        To show on screen
  1176.  * RETURNS
  1177.  *  void
  1178.  *****************************************************************************/
  1179. void ShowOutgoingIndicationScreen(PU8 number)
  1180. {
  1181.     /*----------------------------------------------------------------*/
  1182.     /* Local Variables                                                */
  1183.     /*----------------------------------------------------------------*/
  1184.     /*----------------------------------------------------------------*/
  1185.     /* Code Body                                                      */
  1186.     /*----------------------------------------------------------------*/
  1187.     /* for SAT MO only  */
  1188.     SetSATScrnSavedFlag(FALSE);
  1189.     SetPreviousState((CALL_STATE) GetCurrentState());
  1190.     SetCurrentState(CM_OUTGOING_STATE);
  1191.     gtmpOutgoingIndex = GetFirstFreeIndex();
  1192.     AddNewCallInfo(
  1193.         number,
  1194.         (CALL_STATE) GetCurrentState(),
  1195.         CM_IDLE_STATE,
  1196.         CM_CALL_MO_STK,
  1197.         (CM_CALL_HANDLE) (gtmpOutgoingIndex + 1),
  1198.         CSMCC_VOICE_CALL);
  1199.     OutgoingProcessCMEvent(CM_PS_SHOW_OUTGOING_CALL_SCREEN, NULL);
  1200.     SetSATScrnSavedFlag(TRUE);
  1201. }
  1202. /*****************************************************************************
  1203.  * FUNCTION
  1204.  *  RemoveOutgoingIndicationScreen
  1205.  * DESCRIPTION
  1206.  *  Removes outgoing call screen
  1207.  * PARAMETERS
  1208.  *  void
  1209.  *  Number(?)       [IN]        To show on screen
  1210.  * RETURNS
  1211.  *  void
  1212.  *****************************************************************************/
  1213. void RemoveOutgoingIndicationScreen(void)
  1214. {
  1215.     /*----------------------------------------------------------------*/
  1216.     /* Local Variables                                                */
  1217.     /*----------------------------------------------------------------*/
  1218.     CM_CALL_HANDLE handle;
  1219.     /*----------------------------------------------------------------*/
  1220.     /* Code Body                                                      */
  1221.     /*----------------------------------------------------------------*/
  1222.     /* SAT MO fail case */
  1223.     handle = GetOutgoingCallHandle();
  1224.     if (handle == -1)
  1225.     {
  1226.         return;
  1227.     }
  1228.     SetCallState(handle, CM_IDLE_STATE, TRUE);
  1229.     SetCurrentState(GetPreviousState());
  1230.     SetPreviousState(CM_OUTGOING_STATE);
  1231.     if (FALSE == GetSATScrnSavedFlag())
  1232.     {
  1233.         EntryNewScreen(GLOBAL_SCR_DUMMY, NULL, NULL, NULL);
  1234.         SetSATScrnSavedFlag(TRUE);
  1235.     }
  1236.     SetCallEndedBeforeConnFlag(FALSE);
  1237.     /* GoBackfromNotifyScr(); */
  1238.     ShowCallManagementErrorMessage(ERR_L4C_GEN_CAUSE);
  1239. }
  1240. /*****************************************************************************
  1241.  * FUNCTION
  1242.  *  PsCBackSetCallFeatures
  1243.  * DESCRIPTION
  1244.  *  This Sets the features of the call as per
  1245.  * PARSING STR RSP
  1246.  *  
  1247.  *  
  1248.  *  PARSING_STRING_RSP from PS
  1249.  * PARAMETERS
  1250.  *  info        [?]     
  1251.  * RETURNS
  1252.  *  void
  1253.  *****************************************************************************/
  1254. void PsCBackSetCallFeatures(void *info)
  1255. {
  1256.     /*----------------------------------------------------------------*/
  1257.     /* Local Variables                                                */
  1258.     /*----------------------------------------------------------------*/
  1259.     MMI_PARSE_STR_RSP *rsp;
  1260.     CM_CALL_HANDLE handle = -1;
  1261.     /*----------------------------------------------------------------*/
  1262.     /* Code Body                                                      */
  1263.     /*----------------------------------------------------------------*/
  1264.     PRINT_INFORMATION(("XXX In PsCBackSetCallFeatures n"));
  1265.     rsp = (MMI_PARSE_STR_RSP*) info;
  1266.     if (TRUE == DeriveAndSetCallFeatures(info))
  1267.     {
  1268.         if (GetCCFlag() == TRUE)
  1269.         {
  1270.             PHB_CM_INTERFACE PhoneNumberStruct;
  1271.             /* MO call */
  1272.         #ifdef __MMI_BT_PROFILE__
  1273.             /* stop audio background play before sco link */
  1274.             mdi_audio_suspend_background_play();
  1275.             /* establish sco link here */
  1276.             mmi_profiles_bt_call_start_callback();
  1277.         #endif /* __MMI_BT_PROFILE__ */ 
  1278.             /* look up dialed number from phonebook first anyway */
  1279.             /* auto redial and dial from list */
  1280.             if (cm_p->redial_info.DialFromPhb != MMI_PHB_NONE)
  1281.             {
  1282.                 mmi_phb_call_set_dial_from_list(cm_p->redial_info.DialFromPhb);
  1283.             }
  1284.             PhoneNumberStruct = mmi_phb_call_get_data_for_call_mgnt(GetOutgoingNumber(), TRUE);
  1285.             SetCMPhoneBookStruct(&PhoneNumberStruct);
  1286.             /* PhoneNumberStruct = GetCMPhoneBookStruct(); */
  1287.             if (CHISTGetDialFromCallLogFlag() == 0)
  1288.             {
  1289.                 /* not dial from call log => use phonebook data and name */
  1290.                 PRINT_INFORMATION(("*** In PsCBackSetCallFeatures, set MO name from PHB1 ***n"));
  1291.                 SetOutgoingNamefromPhonebook();
  1292.             }
  1293.             else if (pfnUnicodeStrcmp((PS8) PhoneNumberStruct.name, (PS8) GetOutgoingName()) != 0)
  1294.             {
  1295.                 /* dial from call log but phonebook name not match => don't use phonebook data */
  1296.                 PRINT_INFORMATION(("*** In PsCBackSetCallFeatures, set MO name from Call Log ***n"));
  1297.                 memset(&PhoneNumberStruct, 0, sizeof(PHB_CM_INTERFACE));
  1298.                 PhoneNumberStruct.pictureId = IMG_PHB_DEFAULT;
  1299.                 SetCMPhoneBookStruct(&PhoneNumberStruct);
  1300.             }
  1301.             else
  1302.             {
  1303.                 /* dial from call log but still use phonebook data */
  1304.                 PRINT_INFORMATION(("*** In PsCBackSetCallFeatures, set MO name from PHB2 ***n"));
  1305.             }
  1306.             AlmDisableExpiryHandler();
  1307.             OutgoingProcessCMEvent(CM_PS_SHOW_OUTGOING_CALL_SCREEN, NULL);
  1308.             CHISTSetDialFromCallLogFlag(0);
  1309.             return;
  1310.         }
  1311.         else if (rsp->info.opcode == SS_OPERATION)
  1312.         {
  1313.             /* SS string */
  1314.             if (GetCurrentState() == CM_INCOMING_STATE)
  1315.             {
  1316.                 history ss_scr;
  1317.                 S16 nHistory = 0;
  1318. //micha1106
  1319.                 if (!IsScreenPresent(SCR_CM_REQUESTINGUSSD))
  1320.                 {
  1321.                     ss_scr.scrnID = SCR_CM_REQUESTINGUSSD;
  1322.                     ss_scr.entryFuncPtr = EntryScrUSSDReq;
  1323.                     pfnUnicodeStrcpy((S8*) ss_scr.inputBuffer, (S8*) & nHistory);
  1324.                     InsertHistoryBeforeThisScrnReference(CM_SCR_MARKER, &ss_scr);
  1325.                 }
  1326.             }
  1327.             else
  1328.             {
  1329.                 OutgoingProcessCMEvent(CM_PS_SHOW_REQUESTING_CALL_SCREEN, NULL);
  1330.             }
  1331.         }
  1332.         else
  1333.         {
  1334.             /* must be SIM operation */
  1335.             /* OutgoingProcessCMFailureEvent(CM_PS_CALLCONNECTED, ERR_INVALID_NUMBER_FORMAT); */
  1336.         }
  1337.     }
  1338.     else if ((rsp->result.flag == 0) && (rsp->info.opcode == SIM_OPERATION))
  1339.     {
  1340.         DisplayPopup((PU8) GetString(STR_GLOBAL_NOT_DONE), IMG_GLOBAL_UNFINISHED, 0, CS_NOTIFYDURATION, ERROR_TONE);
  1341.     }
  1342.     else if ((rsp->result.flag == 0) && (rsp->info.opcode == INVALID_OPERATION))
  1343.     {
  1344.         if (rsp->result.cause == PHB_L4C_ERROR)
  1345.         {
  1346.             OutgoingProcessCMFailureEvent(CM_PS_CALLCONNECTED, ERR_L4C_FDN_FAIL);
  1347.         }
  1348.         else if (rsp->result.cause == L4C_CMD_CONFLICT)
  1349.         {
  1350.             OutgoingProcessCMFailureEvent(CM_PS_CALLCONNECTED, ERR_L4C_GEN_CAUSE);
  1351.         }
  1352.         else
  1353.         {
  1354.             OutgoingProcessCMFailureEvent(CM_PS_CALLCONNECTED, ERR_INVALID_NUMBER_FORMAT);
  1355.         }
  1356.     }
  1357.     else
  1358.     {
  1359.         OutgoingProcessCMFailureEvent(CM_PS_CALLCONNECTED, ERROR_FAIL);
  1360.         RemoveSSReqScr();
  1361.     }
  1362.     g_phb_cntx.dial_from_list = MMI_PHB_NONE;
  1363.     PurgeOutgoingCallsStructure();
  1364.     SetCallEndedBeforeConnFlag(FALSE);
  1365.     CHISTSetDialFromCallLogFlag(0);
  1366.     SetCurrentState(GetPreviousState());
  1367.     if (GetPreviousState() == CM_INCOMING_STATE)
  1368.     {
  1369.         if (GetTotalCallCount() == 1)
  1370.         {
  1371.             SetPreviousState(CM_IDLE_STATE);
  1372.         }
  1373.         else if (GetTotalActiveCallCount() == GetTotalCallCount() - 1)
  1374.         {
  1375.             SetPreviousState(CM_ACTIVE_STATE);
  1376.         }
  1377.         else if (GetTotalHoldCallCount() == GetTotalCallCount() - 1)
  1378.         {
  1379.             SetPreviousState(CM_HOLD_STATE);
  1380.         }
  1381.     }
  1382.     /* reset phb data */
  1383.     if (GetCurrentState() == CM_INCOMING_STATE)
  1384.     {
  1385.         handle = GetIncomingCallHandle();
  1386.     }
  1387.     else if (GetCurrentState() == CM_OUTGOING_STATE)
  1388.     {
  1389.         handle = GetOutgoingCallHandle();
  1390.     }
  1391.     if (handle != -1)
  1392.     {
  1393.         PHB_CM_INTERFACE phb_data;
  1394.         phb_data = mmi_phb_call_get_data_for_call_mgnt(GetCallNumber(handle), FALSE);
  1395.     #ifdef __MMI_INCOMING_CALL_VIDEO__
  1396.         /* waiting call and ccbs invoke can't use video for display */
  1397.         if (GetTotalCallCount() > 0 || GetCCBSFlag() == TRUE)
  1398.         {
  1399.             phb_data.videoId = 0;
  1400.         }
  1401.     #endif /* __MMI_INCOMING_CALL_VIDEO__ */ 
  1402.         SetCMPhoneBookStruct(&phb_data);
  1403.     }
  1404.     SetDefaultVolumeKeyHandlers();
  1405.     return;
  1406. }
  1407. /*****************************************************************************
  1408.  * FUNCTION
  1409.  *  PsCbackOutgoingCallIdSync
  1410.  * DESCRIPTION
  1411.  *  Helper function to get call list from PS to sync with MMI
  1412.  *  
  1413.  *  DIAL_IND from PS.
  1414.  * PARAMETERS
  1415.  *  MsgStruct       [?]     
  1416.  * RETURNS
  1417.  *  void
  1418.  *****************************************************************************/
  1419. void PsCbackOutgoingCallIdSync(void *MsgStruct)
  1420. {
  1421.     /*----------------------------------------------------------------*/
  1422.     /* Local Variables                                                */
  1423.     /*----------------------------------------------------------------*/
  1424.     CM_CALL_HANDLE handle;
  1425.     U16 response;
  1426.     /*----------------------------------------------------------------*/
  1427.     /* Code Body                                                      */
  1428.     /*----------------------------------------------------------------*/
  1429.     PRINT_INFORMATION(("XXX - In PsCbackOutgoingCallIdSync XXXn"));
  1430.     handle = DeriveOutgoingCallIdRsp(MsgStruct, &response);
  1431.     if (handle == -1 || handle > MAX_CALLS)
  1432.     {
  1433.         if (GetDialIndication() == TRUE)
  1434.         {
  1435.             ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
  1436.             return;
  1437.         }
  1438.         PRINT_INFORMATION(("Error in making outgoing call %d", response));
  1439.         /* keep MO fail cause for later display if notify ss is ongoing */
  1440.         SetCallEndCause(response);
  1441.         /* MO fail */
  1442.         /* SyncCallList(); */
  1443.         SetDialIndication(FALSE);
  1444.         LogCallInfoForCallHistory(GetOutgoingCallHandle());
  1445.         GetEndTimeAndLogUnconnectedMOCall();
  1446.         if (IsRedialSet())
  1447.         {
  1448.             SetRedialNumber();
  1449.         }
  1450.         OutgoingProcessCMFailureEvent(CM_PS_CALLCONNECTED, response);
  1451.         /* reset call end before conn flag for next call */
  1452.         SetCallEndedBeforeConnFlag(FALSE);
  1453.     }
  1454.     else
  1455.     {
  1456.         SetOutgoingCallHandle(handle);
  1457.         SetDialIndication(TRUE);
  1458.         if (GetTotalCallCount() > 1)
  1459.         {
  1460.             SyncCallList();
  1461.         }
  1462.     }
  1463. }
  1464. /*****************************************************************************
  1465.  * FUNCTION
  1466.  *  OutgoingCallConnected
  1467.  * DESCRIPTION
  1468.  *  Helper function to Generate CM known Stack Event CM_PS_CALLCONNECTED
  1469.  *  with the Structure containing CM_CALL_HANDLE.
  1470.  *  
  1471.  *  We could have mapped void* to CM_CALL_HANDLE and passed it to the
  1472.  *  state m/c. CONNECT_IND from PS
  1473.  * PARAMETERS
  1474.  *  MsgStruct       [?]         
  1475.  *  This(?)         [IN]        Contains CM_CALL_HANDLE passed by the stack when call is connected)
  1476.  * RETURNS
  1477.  *  void
  1478.  *****************************************************************************/
  1479. void OutgoingCallConnected(void *MsgStruct)
  1480. {
  1481.     /*----------------------------------------------------------------*/
  1482.     /* Local Variables                                                */
  1483.     /*----------------------------------------------------------------*/
  1484.     MMI_CONNECT_IND *msg;
  1485.     CM_CALL_HANDLE handle;
  1486.     MYTIME t;
  1487.     /*----------------------------------------------------------------*/
  1488.     /* Code Body                                                      */
  1489.     /*----------------------------------------------------------------*/
  1490. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  1491. mmi_jdd_tapi_make_call_result(JC_OK);
  1492. #endif
  1493.     msg = (MMI_CONNECT_IND*) MsgStruct;
  1494.     PRINT_INFORMATION(("XXX - In OutgoingCallConnected XXXn"));
  1495.     if (GetInternalAlert() == TRUE)
  1496.     {
  1497.         StopInternalOutgoingTone();
  1498.     }
  1499.     SetSpeechFlag(FALSE);
  1500.     if (CM_CSD_CALL == (msg->call_type))
  1501.     {
  1502.         SetWapCallPresent(TRUE);
  1503.     }
  1504.     if (GetTotalCallCount() <= 1)
  1505.     {
  1506.     #ifdef __MMI_CONNECT_NOTICE__
  1507.         /* play connect notice according to user defined style */
  1508.         PlayConnectNotice();
  1509.     #else /* __MMI_CONNECT_NOTICE__ */ 
  1510.         playRequestedTone(CONNECT_TONE);
  1511.     #endif /* __MMI_CONNECT_NOTICE__ */ 
  1512.     }
  1513.     if (GetOutgoingCallOrigin() == CM_CALL_MO_STK)
  1514.     {
  1515.         /* STK call doesn't have DIAL_IND, so need to set call id in CONNECT_IND */
  1516.         SetOutgoingCallHandle(msg->call_id);
  1517.     }
  1518.     handle = GetOutgoingCallHandle();
  1519.     /* log MO call with original number and name */
  1520.     SetCalledNumWithTypeAux(GetMMIStructIndexof(handle), MsgStruct);
  1521.     DTGetRTCTime(&t);
  1522.     UpdateCallStartTimeAndLogCall(handle, &t);
  1523.     
  1524.     /* set MO name for display in case number is changed by PS */
  1525.     SetCalledNumWithType(GetMMIStructIndexof(handle), MsgStruct);
  1526. #ifdef __IP_NUMBER__
  1527.     SetTempUseIPNumber(FALSE);
  1528. #endif 
  1529.     OutgoingProcessCMEvent(CM_PS_CALLCONNECTED, &handle);
  1530. }
  1531. /*****************************************************************************
  1532.  * FUNCTION
  1533.  *  PsCBackOutgoingCallEnded
  1534.  * DESCRIPTION
  1535.  *  Call Back function for ATH_SUCCESS to hangup outgoing call
  1536.  *  
  1537.  *  ATH_RSP from PS
  1538.  * PARAMETERS
  1539.  *  MsgStruct       [?]         
  1540.  *  expected(?)     [IN]        NULL
  1541.  * RETURNS
  1542.  *  void
  1543.  *****************************************************************************/
  1544. void PsCBackOutgoingCallEnded(void *MsgStruct)
  1545. {
  1546.     /*----------------------------------------------------------------*/
  1547.     /* Local Variables                                                */
  1548.     /*----------------------------------------------------------------*/
  1549.     CM_CALL_HANDLE handle;
  1550.     /*----------------------------------------------------------------*/
  1551.     /* Code Body                                                      */
  1552.     /*----------------------------------------------------------------*/
  1553. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  1554. mmi_jdd_tapi_make_call_result(JC_ERR_UNKNOWN);
  1555. #endif
  1556.     SetCallAbortReqSentFlag(FALSE);
  1557.     if (GetCurrentState() == CM_IDLE_STATE)
  1558.     {
  1559.         PRINT_INFORMATION(("XXX - In PsCBackOutgoingCallEnded no call to drop XXXn"));
  1560.         /* SetDropRequestFlag(FALSE); */
  1561.         return;
  1562.     }
  1563.     if ((handle = GetOutgoingCallHandle()) == -1)
  1564.     {
  1565.         /* MO call already got connected before it's aborted */
  1566.         handle = GetHungUpHandle();
  1567.         if (handle == -1)
  1568.         {
  1569.             PRINT_INFORMATION(("XXX - In PsCBackOutgoingCallEnded call already dropped XXXn"));
  1570.             return;
  1571.         }
  1572.     }
  1573.     OutgoingProcessCMEvent(CM_PS_HANGUPSUC, (void*)&handle);
  1574.     SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  1575. }
  1576. /*****************************************************************************
  1577.  * FUNCTION
  1578.  *  PsCBackUSSDResponse
  1579.  * DESCRIPTION
  1580.  *  This function is called back by the protocol stack when USSD data is recieved by n/w
  1581.  *  
  1582.  *  info is
  1583.  * PARAMETERS
  1584.  *  info        [?]     
  1585.  * RETURNS
  1586.  *  void
  1587.  *****************************************************************************/
  1588. void PsCBackUSSDResponse(void *info)
  1589. {
  1590.     /*----------------------------------------------------------------*/
  1591.     /* Local Variables                                                */
  1592.     /*----------------------------------------------------------------*/
  1593.     /*----------------------------------------------------------------*/
  1594.     /* Code Body                                                      */
  1595.     /*----------------------------------------------------------------*/
  1596.     PRINT_INFORMATION(("XXX - In PsCBackUSSDResponse XXXn"));
  1597.     OutgoingProcessCMEvent(CM_PS_USSD_RECVD, info);
  1598.     /* ProcessIncomingEvents (CM_PS_USSD_RECVD, info); */
  1599. }
  1600. /* Start by Julia: Drop call refinement */
  1601. /*****************************************************************************
  1602.  * FUNCTION
  1603.  *  ReleaseCall
  1604.  * DESCRIPTION
  1605.  *  Invokes the helper function to make the disconnecting call released complete
  1606.  *  
  1607.  *  This is invoked whenever the user press END key in the disconnecting call screen
  1608.  * PARAMETERS
  1609.  *  void
  1610.  * RETURNS
  1611.  *  void
  1612.  *****************************************************************************/
  1613. void ReleaseCall(void)
  1614. {
  1615.     /*----------------------------------------------------------------*/
  1616.     /* Local Variables                                                */
  1617.     /*----------------------------------------------------------------*/
  1618.     U8 count;
  1619.     CM_CALL_HANDLE handle;
  1620.     /*----------------------------------------------------------------*/
  1621.     /* Code Body                                                      */
  1622.     /*----------------------------------------------------------------*/
  1623.     for (count = 0; count < MAX_CALLS; count++)
  1624.     {
  1625.         if (cm_p->state_info.AllCalls[count].curr_state == CM_DISCONNECTING_STATE)
  1626.         {
  1627.             handle = cm_p->state_info.AllCalls[count].call_handle;
  1628.             MakePsReleaseCompleteRequest(handle);
  1629.             OutgoingProcessCMEvent(CM_PS_HANGUPSUC, (void*)&handle);
  1630.             if (GetAutoReleaseFlag() == FALSE)
  1631.             {
  1632.                 return;
  1633.             }
  1634.         }
  1635.     }
  1636.     SetAutoReleaseFlag(FALSE);
  1637. }
  1638. /* End by Julia */
  1639. /*****************************************************************************
  1640.  * FUNCTION
  1641.  *  DropRequest
  1642.  * DESCRIPTION
  1643.  *  Invokes the helper function to hangup or disconnect the call
  1644.  *  which is yet to connect.
  1645.  *  
  1646.  *  This is invoked whenever the User press LSK in the outgoingcallscreen.
  1647.  * PARAMETERS
  1648.  *  void
  1649.  * RETURNS
  1650.  *  void
  1651.  *****************************************************************************/
  1652. void DropRequest(void)
  1653. {
  1654.     /*----------------------------------------------------------------*/
  1655.     /* Local Variables                                                */
  1656.     /*----------------------------------------------------------------*/
  1657.     CM_CALL_HANDLE handle;
  1658.     /*----------------------------------------------------------------*/
  1659.     /* Code Body                                                      */
  1660.     /*----------------------------------------------------------------*/
  1661.     PRINT_INFORMATION(("*** In Drop Requestn"));
  1662.     if (GetNotifySSFlag())
  1663.     {
  1664.         StopTimer(CM_NOTIFYDURATION_TIMER);
  1665.     }
  1666.     if (FALSE == GetAbortCallRequestedFlag())
  1667.     {
  1668.         handle = GetOutgoingCallHandle();
  1669.         if ((GetCallflag(handle, TRUE) & CM_HANGUP_REQUESTED) == 0)
  1670.         {
  1671.             SetDropRequestFlag(TRUE);
  1672.             SetAbortCallRequestedFlag(TRUE);
  1673.             HangupCall(handle);
  1674.             if (GetExitScrnID() == SCR1001_CM_OUTGOINGCALLSCREEN)
  1675.             {
  1676.                 MOMTHideAnimation();
  1677.             }
  1678.         }
  1679.     }
  1680.     else
  1681.     {
  1682.         PRINT_INFORMATION(("*** In   DropRequest .. Not calling dropn"));
  1683.     }
  1684. }
  1685. /*****************************************************************************
  1686.  * FUNCTION
  1687.  *  HangupCall
  1688.  * DESCRIPTION
  1689.  *  Helper function to generate Keybrd Event CM_KB_HANGUPREQ with the OUTGOING_CALL structure.
  1690.  *  
  1691.  *  This invokes the function to process the CM_KB_HANGUPREQ event in the state m/c.
  1692.  * PARAMETERS
  1693.  *  CallHandle      [IN]        
  1694.  *  contains(?)     [IN]        The call handle of the call that needs to be dropped.
  1695.  * RETURNS
  1696.  *  void
  1697.  *****************************************************************************/
  1698. void HangupCall(CM_CALL_HANDLE CallHandle)
  1699. {
  1700.     /*----------------------------------------------------------------*/
  1701.     /* Local Variables                                                */
  1702.     /*----------------------------------------------------------------*/
  1703.     /*----------------------------------------------------------------*/
  1704.     /* Code Body                                                      */
  1705.     /*----------------------------------------------------------------*/
  1706.     PRINT_INFORMATION(("*** In HangupCalln"));
  1707.     OutgoingProcessCMEvent(CM_KB_HANGUPREQ, &CallHandle);
  1708. }
  1709. /*****************************************************************************
  1710.  * FUNCTION
  1711.  *  HangupReqSucess
  1712.  * DESCRIPTION
  1713.  *  Helper function to Generate CM known Stack Event CM_PS_HANGUPSUC
  1714.  *  with the Structure containing CM_CALL_HANDLE.
  1715.  *  
  1716.  *  We are assuming that the protocol stack sends the sucess response for the hangup request
  1717.  *  with the CM_CALL_HANDLE. CHLD RELEASE_SPECIFIC => RELEASE_IND from PS
  1718.  * PARAMETERS
  1719.  *  MsgStruct       [?]         
  1720.  *  This(?)         [IN]        Contains CM_CALL_HANDLE passed by the stack when call drop is success)
  1721.  * RETURNS
  1722.  *  void
  1723.  *****************************************************************************/
  1724. void HangupReqSucess(void *MsgStruct)
  1725. {
  1726.     /*----------------------------------------------------------------*/
  1727.     /* Local Variables                                                */
  1728.     /*----------------------------------------------------------------*/
  1729.     CM_CALL_HANDLE handle;
  1730.     /*----------------------------------------------------------------*/
  1731.     /* Code Body                                                      */
  1732.     /*----------------------------------------------------------------*/
  1733.     PRINT_INFORMATION(("XXX - In HangupReqSucess XXXn"));
  1734.     handle = DeriveCallHandle(MsgStruct);
  1735.     OutgoingProcessCMEvent(CM_PS_HANGUPSUC, (void*)&handle);
  1736.     SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  1737. }
  1738. /*****************************************************************************
  1739.  * FUNCTION
  1740.  *  HangupAll
  1741.  * DESCRIPTION
  1742.  *  Helper function to generate Keybrd Event CM_KB_HANGUPALLREQ with the NULL structure.
  1743.  *  
  1744.  *  This invokes the function to process the CM_KB_HANGUPALLREQ event in the state m/c.
  1745.  * PARAMETERS
  1746.  *  void
  1747.  * RETURNS
  1748.  *  void
  1749.  *****************************************************************************/
  1750. void HangupAll(void)
  1751. {
  1752.     /*----------------------------------------------------------------*/
  1753.     /* Local Variables                                                */
  1754.     /*----------------------------------------------------------------*/
  1755.     U16 scrId;
  1756.     U8 flag;
  1757.     /*----------------------------------------------------------------*/
  1758.     /* Code Body                                                      */
  1759.     /*----------------------------------------------------------------*/
  1760.     flag = GetAllCallFlags();
  1761. #ifdef __MMI_CLAMSHELL__
  1762.     if (GetCurrentState() == CM_INCOMING_STATE && GetTotalCallCount() > 1)
  1763.     {
  1764.         KbCBackCallIncomingRejected();
  1765.         return;
  1766.     }
  1767. #endif /* __MMI_CLAMSHELL__ */ 
  1768.     if (GetTotalActiveCallCount() > 0 && GetTotalHoldCallCount() > 0 &&
  1769.         ((flag & CM_SWAP_REQUESTED) == 0) && ((flag & CM_CONF_REQUESTED) == 0) && ((flag & CM_ECT_REQUESTED) == 0))
  1770.     {
  1771.         /* swapping can't decide which call is active and held, 
  1772.            issue rel all req instead */
  1773.         /* rel active and accept */
  1774.         ProcessIncomingEvents(CM_KB_END_ALL_ACTIVE_RETRIEVE_HELD, NULL);
  1775.     }
  1776.     else
  1777.     {
  1778.         OutgoingProcessCMEvent(CM_KB_HANGUPALLREQ, (void*)NULL);
  1779.     }
  1780.     scrId = GetExitScrnID();
  1781.     if (scrId == SCR1001_CM_OUTGOINGCALLSCREEN || (scrId == SCR_CM_ACTIVECALLSCREEN && GetTotalCallCount() == 1))
  1782.     {
  1783.         MOMTHideAnimation();
  1784.     }
  1785.     /* else
  1786.        EntryScr1002ActiveCall(); */
  1787. }
  1788. /*****************************************************************************
  1789.  * FUNCTION
  1790.  *  HangupallReqSucess
  1791.  * DESCRIPTION
  1792.  *  Helper function to Generate CM known Stack Event CM_PS_HANGUPALLSUC
  1793.  *  with the Structure containing NULL.
  1794.  *  
  1795.  *  We are assuming that the protocol stack sends the Sucess response for the Hangup all calls request
  1796.  *  without any structure.
  1797.  * PARAMETERS
  1798.  *  MsgStruct       [?]         
  1799.  *  This(?)         [IN]        Contains Null)
  1800.  * RETURNS
  1801.  *  void
  1802.  *****************************************************************************/
  1803. void HangupallReqSucess(void *MsgStruct)
  1804. {
  1805.     /*----------------------------------------------------------------*/
  1806.     /* Local Variables                                                */
  1807.     /*----------------------------------------------------------------*/
  1808.     /*----------------------------------------------------------------*/
  1809.     /* Code Body                                                      */
  1810.     /*----------------------------------------------------------------*/
  1811.     gMyhandle = DeriveCallHandle(MsgStruct);
  1812.     PRINT_INFORMATION(("XXX - In HangupallReqSucess XXXn"));
  1813.     OutgoingProcessCMEvent(CM_PS_HANGUPALLSUC, (void*)&gMyhandle);
  1814.     SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  1815. }
  1816. /*****************************************************************************
  1817.  * FUNCTION
  1818.  *  HangupallActive
  1819.  * DESCRIPTION
  1820.  *  Helper function to generate Keybrd Event CM_KB_HANGUPALLACTREQ with the NULL structure.
  1821.  *  
  1822.  *  This invokes the function to process the CM_KB_HANGUPALLACTREQ event in the state m/c.
  1823.  * PARAMETERS
  1824.  *  void
  1825.  * RETURNS
  1826.  *  void
  1827.  *****************************************************************************/
  1828. void HangupallActive(void)
  1829. {
  1830.     /*----------------------------------------------------------------*/
  1831.     /* Local Variables                                                */
  1832.     /*----------------------------------------------------------------*/
  1833.     /*----------------------------------------------------------------*/
  1834.     /* Code Body                                                      */
  1835.     /*----------------------------------------------------------------*/
  1836.     OutgoingProcessCMEvent(CM_KB_HANGUPALLACTREQ, (void*)NULL);
  1837. }
  1838. /*****************************************************************************
  1839.  * FUNCTION
  1840.  *  HangupallActReqSucess
  1841.  * DESCRIPTION
  1842.  *  Helper function to Generate CM known Stack Event CM_PS_HANGUPALLACTSUC
  1843.  *  with the Structure containing NULL.
  1844.  *  
  1845.  *  We are assuming that the protocol stack sends the Sucess response for the Hangup all Active calls
  1846.  *  request without any structure.
  1847.  * PARAMETERS
  1848.  *  MsgStruct       [?]         
  1849.  *  This(?)         [IN]        Contains Null)
  1850.  * RETURNS
  1851.  *  void
  1852.  *****************************************************************************/
  1853. void HangupallActReqSucess(void *MsgStruct)
  1854. {
  1855.     /*----------------------------------------------------------------*/
  1856.     /* Local Variables                                                */
  1857.     /*----------------------------------------------------------------*/
  1858.     /*----------------------------------------------------------------*/
  1859.     /* Code Body                                                      */
  1860.     /*----------------------------------------------------------------*/
  1861.     gMyhandle = DeriveCallHandle(MsgStruct);
  1862.     PRINT_INFORMATION(("XXX - In HangupallActReqSucess XXXn"));
  1863.     OutgoingProcessCMEvent(CM_PS_HANGUPALLACTSUC, (void*)&gMyhandle);
  1864.     SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  1865. }
  1866. /*****************************************************************************
  1867.  * FUNCTION
  1868.  *  HangupallHeld
  1869.  * DESCRIPTION
  1870.  *  Helper function to generate Keybrd Event CM_KB_HANGUPALLHLDREQ with the NULL structure.
  1871.  *  
  1872.  *  This invokes the function to process the CM_KB_HANGUPALLHLDREQ event in the state m/c.
  1873.  * PARAMETERS
  1874.  *  void
  1875.  * RETURNS
  1876.  *  void
  1877.  *****************************************************************************/
  1878. void HangupallHeld(void)
  1879. {
  1880.     /*----------------------------------------------------------------*/
  1881.     /* Local Variables                                                */
  1882.     /*----------------------------------------------------------------*/
  1883.     /*----------------------------------------------------------------*/
  1884.     /* Code Body                                                      */
  1885.     /*----------------------------------------------------------------*/
  1886.     OutgoingProcessCMEvent(CM_KB_HANGUPALLHLDREQ, (void*)NULL);
  1887. }
  1888. /*****************************************************************************
  1889.  * FUNCTION
  1890.  *  HangupallHldReqSucess
  1891.  * DESCRIPTION
  1892.  *  Helper function to Generate CM known Stack Event CM_PS_HANGUPALLHLDSUC
  1893.  *  with the Structure containing NULL.
  1894.  *  
  1895.  *  We are assuming that the protocol stack sends the Sucess response for the Hangup all Held calls
  1896.  *  request without any structure.
  1897.  * PARAMETERS
  1898.  *  MsgStruct       [?]         
  1899.  *  This(?)         [IN]        Contains Null)
  1900.  * RETURNS
  1901.  *  void
  1902.  *****************************************************************************/
  1903. void HangupallHldReqSucess(void *MsgStruct)
  1904. {
  1905.     /*----------------------------------------------------------------*/
  1906.     /* Local Variables                                                */
  1907.     /*----------------------------------------------------------------*/
  1908.     /*----------------------------------------------------------------*/
  1909.     /* Code Body                                                      */
  1910.     /*----------------------------------------------------------------*/
  1911.     gMyhandle = DeriveCallHandle(MsgStruct);
  1912.     PRINT_INFORMATION(("XXX - In HangupallHldReqSucess XXXn"));
  1913.     OutgoingProcessCMEvent(CM_PS_HANGUPALLHLDSUC, (void*)&gMyhandle);
  1914.     SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  1915. }
  1916. /*****************************************************************************
  1917.  * FUNCTION
  1918.  *  MakeActiveCallHold
  1919.  * DESCRIPTION
  1920.  *  Helper function to generate Keybrd Event CM_KB_HOLDREQ with the NULL structure.
  1921.  *  
  1922.  *  This invokes the function to process the CM_KB_HOLDREQ event in the state m/c.
  1923.  * PARAMETERS
  1924.  *  void
  1925.  * RETURNS
  1926.  *  void
  1927.  *****************************************************************************/
  1928. void MakeActiveCallHold(void)
  1929. {
  1930.     /*----------------------------------------------------------------*/
  1931.     /* Local Variables                                                */
  1932.     /*----------------------------------------------------------------*/
  1933.     /*----------------------------------------------------------------*/
  1934.     /* Code Body                                                      */
  1935.     /*----------------------------------------------------------------*/
  1936.     OutgoingProcessCMEvent(CM_KB_HOLDREQ, (void*)NULL);
  1937. }
  1938. /*****************************************************************************
  1939.  * FUNCTION
  1940.  *  HoldReqSucess
  1941.  * DESCRIPTION
  1942.  *  Helper function to Generate CM known Stack Event CM_PS_HOLDSUC
  1943.  *  with the Structure containing NULL.
  1944.  *  
  1945.  *  We are assuming that the protocol stack sends the Sucess response for the Hold request
  1946.  *  without any structure.
  1947.  * PARAMETERS
  1948.  *  MsgStruct       [?]         
  1949.  *  This(?)         [IN]        Contains Null)
  1950.  * RETURNS
  1951.  *  void
  1952.  *****************************************************************************/
  1953. void HoldReqSucess(void *MsgStruct)
  1954. {
  1955.     /*----------------------------------------------------------------*/
  1956.     /* Local Variables                                                */
  1957.     /*----------------------------------------------------------------*/
  1958.     U16 result;
  1959.     /*----------------------------------------------------------------*/
  1960.     /* Code Body                                                      */
  1961.     /*----------------------------------------------------------------*/
  1962.     if (CheckChldRequestSuccess(MsgStruct, &result))
  1963.     {
  1964.         PRINT_INFORMATION(("XXX - In HoldReqSucess XXXn"));
  1965.         OutgoingProcessCMEvent(CM_PS_HOLDSUC, (void*)MsgStruct);
  1966.     }
  1967.     else
  1968.     {
  1969.         PRINT_INFORMATION(("Error in Making Hold call in protocol stack cause %d", result));
  1970.         SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  1971.         ResetHoldFlag();
  1972.         OutgoingProcessCMFailureEvent(CM_PS_HOLDSUC, result);
  1973.     }
  1974. }
  1975. /*****************************************************************************
  1976.  * FUNCTION
  1977.  *  RetrieveHeldCall
  1978.  * DESCRIPTION
  1979.  *  Helper function to generate Keybrd Event CM_KB_RETRIEVEREQ with the NULL structure.
  1980.  *  
  1981.  *  This invokes the function to process the CM_KB_RETRIEVEREQ event in the state m/c.
  1982.  * PARAMETERS
  1983.  *  void
  1984.  * RETURNS
  1985.  *  void
  1986.  *****************************************************************************/
  1987. void RetrieveHeldCall(void)
  1988. {
  1989.     /*----------------------------------------------------------------*/
  1990.     /* Local Variables                                                */
  1991.     /*----------------------------------------------------------------*/
  1992.     /*----------------------------------------------------------------*/
  1993.     /* Code Body                                                      */
  1994.     /*----------------------------------------------------------------*/
  1995.     OutgoingProcessCMEvent(CM_KB_RETRIEVEREQ, (void*)NULL);
  1996. }
  1997. /*****************************************************************************
  1998.  * FUNCTION
  1999.  *  RetrieveReqSucess
  2000.  * DESCRIPTION
  2001.  *  Helper function to Generate CM known Stack Event CM_PS_RETRIEVESUC
  2002.  *  with the Structure containing NULL.
  2003.  *  
  2004.  *  We are assuming that the protocol stack sends the Sucess response for the retrieve request
  2005.  *  without any structure.
  2006.  * PARAMETERS
  2007.  *  MsgStruct       [?]         
  2008.  *  This(?)         [IN]        Contains Null)
  2009.  * RETURNS
  2010.  *  void
  2011.  *****************************************************************************/
  2012. void RetrieveReqSucess(void *MsgStruct)
  2013. {
  2014.     /*----------------------------------------------------------------*/
  2015.     /* Local Variables                                                */
  2016.     /*----------------------------------------------------------------*/
  2017.     U16 result;
  2018.     /*----------------------------------------------------------------*/
  2019.     /* Code Body                                                      */
  2020.     /*----------------------------------------------------------------*/
  2021.     if (CheckChldRequestSuccess(MsgStruct, &result))
  2022.     {
  2023.         PRINT_INFORMATION(("XXX - In RetrieveReqSucess XXXn"));
  2024.         OutgoingProcessCMEvent(CM_PS_RETRIEVESUC, (void*)MsgStruct);
  2025.     }
  2026.     else
  2027.     {
  2028.         PRINT_INFORMATION(("Error in Retriving Hold Call in protocol stack cause %d", result));
  2029.         SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  2030.         ResetRetrieveFlag();
  2031.         OutgoingProcessCMFailureEvent(CM_PS_RETRIEVESUC, result);
  2032.     }
  2033. }
  2034. /*****************************************************************************
  2035.  * FUNCTION
  2036.  *  SwapCall
  2037.  * DESCRIPTION
  2038.  *  Helper function to generate Keybrd Event CM_KB_SWAPREQ with the NULL structure.
  2039.  *  
  2040.  *  This invokes the function to process the CM_KB_SWAPREQ event in the state m/c.
  2041.  * PARAMETERS
  2042.  *  void
  2043.  * RETURNS
  2044.  *  void
  2045.  *****************************************************************************/
  2046. void SwapCall(void)
  2047. {
  2048.     /*----------------------------------------------------------------*/
  2049.     /* Local Variables                                                */
  2050.     /*----------------------------------------------------------------*/
  2051.     /*----------------------------------------------------------------*/
  2052.     /* Code Body                                                      */
  2053.     /*----------------------------------------------------------------*/
  2054.     OutgoingProcessCMEvent(CM_KB_SWAPREQ, (void*)NULL);
  2055. }
  2056. /*****************************************************************************
  2057.  * FUNCTION
  2058.  *  SwapReqSucess
  2059.  * DESCRIPTION
  2060.  *  Helper function to Generate CM known Stack Event CM_PS_SWAPSUC
  2061.  *  with the Structure containing NULL.
  2062.  *  
  2063.  *  We are assuming that the protocol stack sends the Sucess response for the Swap request
  2064.  *  without any structure.
  2065.  * PARAMETERS
  2066.  *  MsgStruct       [?]         
  2067.  *  This(?)         [IN]        Contains Null)
  2068.  * RETURNS
  2069.  *  void
  2070.  *****************************************************************************/
  2071. void SwapReqSucess(void *MsgStruct)
  2072. {
  2073.     /*----------------------------------------------------------------*/
  2074.     /* Local Variables                                                */
  2075.     /*----------------------------------------------------------------*/
  2076.     U16 result;
  2077.     /*----------------------------------------------------------------*/
  2078.     /* Code Body                                                      */
  2079.     /*----------------------------------------------------------------*/
  2080.     if (CheckChldRequestSuccess(MsgStruct, &result))
  2081.     {
  2082.         PRINT_INFORMATION(("XXX - In SwapReqSucess XXXn"));
  2083.         OutgoingProcessCMEvent(CM_PS_SWAPSUC, (void*)MsgStruct);
  2084.     }
  2085.     else
  2086.     {
  2087.         PRINT_INFORMATION(("Error in swapping resuest in PS cause: %dn", result));
  2088.         SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  2089.         ResetSwapFlag();
  2090.         OutgoingProcessCMFailureEvent(CM_PS_SWAPSUC, result);
  2091.     }
  2092. }
  2093. /*****************************************************************************
  2094.  * FUNCTION
  2095.  *  ConferenceCall
  2096.  * DESCRIPTION
  2097.  *  Helper function to generate Keybrd Event CM_KB_CONFREQ with the NULL structure.
  2098.  *  
  2099.  *  This invokes the function to process the CM_KB_CONFREQ event in the state m/c.
  2100.  * PARAMETERS
  2101.  *  void
  2102.  * RETURNS
  2103.  *  void
  2104.  *****************************************************************************/
  2105. void ConferenceCall(void)
  2106. {
  2107.     /*----------------------------------------------------------------*/
  2108.     /* Local Variables                                                */
  2109.     /*----------------------------------------------------------------*/
  2110.     /*----------------------------------------------------------------*/
  2111.     /* Code Body                                                      */
  2112.     /*----------------------------------------------------------------*/
  2113.     if ((GetTotalActiveCallCount() < MAX_HOLD) &&
  2114.         (GetTotalHoldCallCount() < MAX_HOLD) && ((GetTotalActiveCallCount() > 0 && GetTotalHoldCallCount() > 0)))
  2115.     {
  2116.         OutgoingProcessCMEvent(CM_KB_CONFREQ, (void*)NULL);
  2117.     }
  2118.     else
  2119.     {
  2120.         ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
  2121.     }
  2122. }
  2123. /*****************************************************************************
  2124.  * FUNCTION
  2125.  *  ConfReqSucess
  2126.  * DESCRIPTION
  2127.  *  Helper function to Generate CM known Stack Event CM_PS_CONFSUC
  2128.  *  with the Structure containing NULL.
  2129.  *  
  2130.  *  We are assuming that the protocol stack sends the Sucess response for the Conference request
  2131.  *  without any structure.
  2132.  * PARAMETERS
  2133.  *  MsgStruct       [?]         
  2134.  *  This(?)         [IN]        Contains Null)
  2135.  * RETURNS
  2136.  *  void
  2137.  *****************************************************************************/
  2138. void ConfReqSucess(void *MsgStruct)
  2139. {
  2140.     /*----------------------------------------------------------------*/
  2141.     /* Local Variables                                                */
  2142.     /*----------------------------------------------------------------*/
  2143.     U16 result;
  2144.     /*----------------------------------------------------------------*/
  2145.     /* Code Body                                                      */
  2146.     /*----------------------------------------------------------------*/
  2147.     if (CheckChldRequestSuccess(MsgStruct, &result))
  2148.     {
  2149.         PRINT_INFORMATION(("XXX - In ConfReqSucess XXXn"));
  2150.         OutgoingProcessCMEvent(CM_PS_CONFSUC, (void*)MsgStruct);
  2151.     }
  2152.     else
  2153.     {
  2154.         PRINT_INFORMATION(("Error in Conferencing resquest in PS cause: %dn", result));
  2155.         ResetConfFlag();
  2156.         SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  2157.         OutgoingProcessCMFailureEvent(CM_PS_CONFSUC, result);
  2158.     }
  2159. }
  2160. /*****************************************************************************
  2161.  * FUNCTION
  2162.  *  SplitCall
  2163.  * DESCRIPTION
  2164.  *  Helper function to generate Keybrd Event CM_KB_SPLITREQ with the NULL structure.
  2165.  *  
  2166.  *  This invokes the function to process the CM_KB_SPLITREQ event in the state m/c.
  2167.  * PARAMETERS
  2168.  *  CallHandle      [IN]        
  2169.  * RETURNS
  2170.  *  void
  2171.  *****************************************************************************/
  2172. void SplitCall(CM_CALL_HANDLE CallHandle)
  2173. {
  2174.     /*----------------------------------------------------------------*/
  2175.     /* Local Variables                                                */
  2176.     /*----------------------------------------------------------------*/
  2177.     /*----------------------------------------------------------------*/
  2178.     /* Code Body                                                      */
  2179.     /*----------------------------------------------------------------*/
  2180.     OutgoingProcessCMEvent(CM_KB_SPLITREQ, &CallHandle);
  2181. }
  2182. /*****************************************************************************
  2183.  * FUNCTION
  2184.  *  SplitReqSucess
  2185.  * DESCRIPTION
  2186.  *  Helper function to Generate CM known Stack Event CM_PS_SPLITSUC
  2187.  *  with the Structure containing NULL.
  2188.  *  
  2189.  *  We are assuming that the protocol stack sends the Sucess response for the Split
  2190.  *  request without any structure.
  2191.  * PARAMETERS
  2192.  *  MsgStruct       [?]         
  2193.  *  This(?)         [IN]        Contains Null)
  2194.  * RETURNS
  2195.  *  void
  2196.  *****************************************************************************/
  2197. void SplitReqSucess(void *MsgStruct)
  2198. {
  2199.     /*----------------------------------------------------------------*/
  2200.     /* Local Variables                                                */
  2201.     /*----------------------------------------------------------------*/
  2202.     U16 result;
  2203.     /*----------------------------------------------------------------*/
  2204.     /* Code Body                                                      */
  2205.     /*----------------------------------------------------------------*/
  2206.     if (CheckChldRequestSuccess(MsgStruct, &result))
  2207.     {
  2208.         PRINT_INFORMATION(("XXX - In SplitReqSucess XXXn"));
  2209.         OutgoingProcessCMEvent(CM_PS_SPLITSUC, (void*)MsgStruct);
  2210.     }
  2211.     else
  2212.     {
  2213.         PRINT_INFORMATION(("Error in Split in protocol stack cause %d", result));
  2214.         SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  2215.         ResetSplitFlag();
  2216.         OutgoingProcessCMFailureEvent(CM_PS_SPLITSUC, result);
  2217.     }
  2218. }
  2219. /*****************************************************************************
  2220.  * FUNCTION
  2221.  *  TransferCall
  2222.  * DESCRIPTION
  2223.  *  This function performs Explicit Call Transfer.
  2224.  * PARAMETERS
  2225.  *  void
  2226.  * RETURNS
  2227.  *  void
  2228.  *****************************************************************************/
  2229. void TransferCall(void)
  2230. {
  2231.     /*----------------------------------------------------------------*/
  2232.     /* Local Variables                                                */
  2233.     /*----------------------------------------------------------------*/
  2234.     /*----------------------------------------------------------------*/
  2235.     /* Code Body                                                      */
  2236.     /*----------------------------------------------------------------*/
  2237.     OutgoingProcessCMEvent(CM_KB_ECT_REQ, (void*)NULL);
  2238. }
  2239. /*****************************************************************************
  2240.  * FUNCTION
  2241.  *  EctReqSucess
  2242.  * DESCRIPTION
  2243.  *  Helper function to Generate CM known Stack Event CM_PS_SPLITSUC
  2244.  *  with the Structure containing NULL.
  2245.  *  
  2246.  *  We are assuming that the protocol stack sends the Sucess response for the Split
  2247.  *  request without any structure.
  2248.  * PARAMETERS
  2249.  *  MsgStruct       [?]         
  2250.  *  This(?)         [IN]        Contains Null)
  2251.  * RETURNS
  2252.  *  void
  2253.  *****************************************************************************/
  2254. void EctReqSucess(void *MsgStruct)
  2255. {
  2256.     /*----------------------------------------------------------------*/
  2257.     /* Local Variables                                                */
  2258.     /*----------------------------------------------------------------*/
  2259.     U16 result;
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Code Body                                                      */
  2262.     /*----------------------------------------------------------------*/
  2263.     if (CheckChldRequestSuccess(MsgStruct, &result))
  2264.     {
  2265.         PRINT_INFORMATION(("XXX - In EctReqSucess XXXn"));
  2266.         OutgoingProcessCMEvent(CM_PS_ECT_SUC, (void*)MsgStruct);
  2267.     }
  2268.     else
  2269.     {
  2270.         PRINT_INFORMATION(("Error in ECT in protocol stack cause %d", result));
  2271.         SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  2272.         ResetEctFlag();
  2273.         OutgoingProcessCMFailureEvent(CM_PS_ECT_SUC, result);
  2274.     }
  2275. }
  2276. /*****************************************************************************
  2277.  * FUNCTION
  2278.  *  EnterScreenAndHandleDigit
  2279.  * DESCRIPTION
  2280.  *  Helper function to initiate sending DTMF tone and
  2281.  *  display screen
  2282.  * PARAMETERS
  2283.  *  void
  2284.  * RETURNS
  2285.  *  void
  2286.  *****************************************************************************/
  2287. void EnterScreenAndHandleDigit(void)
  2288. {
  2289.     /*----------------------------------------------------------------*/
  2290.     /* Local Variables                                                */
  2291.     /*----------------------------------------------------------------*/
  2292.     /*----------------------------------------------------------------*/
  2293.     /* Code Body                                                      */
  2294.     /*----------------------------------------------------------------*/
  2295.     ClearDtmfBuf();
  2296.     SetCMScrnFlag(FALSE);
  2297.     if ((GetTotalActiveCallCount() > 0 || GetCurrentState() == CM_OUTGOING_STATE) && (GetDTMFFlag()))
  2298.     {
  2299.         EntryScrDisplayDialedDigits();
  2300.         HandleDTMFScreenDigits();
  2301.     }
  2302.     else
  2303.     {
  2304.         EntryScrDisplayDialedDigits();
  2305.         UpdateDialedDigitDisplay();
  2306.     }
  2307. }
  2308. /*****************************************************************************
  2309.  * FUNCTION
  2310.  *  EntryScrDisplayDialedDigits
  2311.  * DESCRIPTION
  2312.  *  Shows the dialled digits in dtmf
  2313.  * PARAMETERS
  2314.  *  void
  2315.  * RETURNS
  2316.  *  void
  2317.  *****************************************************************************/
  2318. void EntryScrDisplayDialedDigits(void)
  2319. {
  2320.     /*----------------------------------------------------------------*/
  2321.     /* Local Variables                                                */
  2322.     /*----------------------------------------------------------------*/
  2323.     U8 *historyBuffer;
  2324.     U16 lskStrShow = STR_GLOBAL_SAVE;
  2325.     U8 *tmp = GetCurrInputBuffer(DTMF_SCR_DISPLAY_ID);
  2326.     /*----------------------------------------------------------------*/
  2327.     /* Code Body                                                      */
  2328.     /*----------------------------------------------------------------*/
  2329.     EntryNewScreen(DTMF_SCR_DISPLAY_ID, ExitScrDisplayDialedDigits, NULL, NULL);
  2330.     cm_p->history_info.IsSave = TRUE;
  2331.     if (tmp)
  2332.     {
  2333.         pfnUnicodeStrcpy((S8*) UnicodeDTMFPadCallBuffer, (S8*) tmp);
  2334.     }
  2335.     else
  2336.     {
  2337.   memset (UnicodeDTMFPadCallBuffer, 0, sizeof (UnicodeDTMFPadCallBuffer));
  2338.     }
  2339.     historyBuffer = GetCurrGuiBuffer(DTMF_SCR_DISPLAY_ID);
  2340.     /* delete any previous intance of screen if present */
  2341.     if (GetCurrScrnId() != DTMF_SCR_DISPLAY_ID)
  2342.     {
  2343.         DeleteScreenIfPresent(DTMF_SCR_DISPLAY_ID);
  2344.     }
  2345.     if ((GetCurrScrnId() == SCR1001_CM_OUTGOINGCALLSCREEN && GetTotalCallCount() == 1) || EmergencyCallPresent())
  2346.     {
  2347.         lskStrShow = 0;
  2348.         SetNoSave();
  2349.     }
  2350.     if (lskStrShow != 0)
  2351.     {
  2352.         RegisterInputBoxEmptyFunction(DialDigitScreenEmpty);
  2353.         RegisterInputBoxNotEmptyFunction(DialDigitScreenNotEmpty);
  2354.     }
  2355.     else
  2356.     {
  2357.         /* no icon, no center key */
  2358.     #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  2359.     #if defined  (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
  2360.         SetDialingKeypadCallHandler(UI_dummy_function);
  2361. SetDialingKeypadIPCallHandler(UI_dummy_function);         //KP Jerry add on 2006-11-13
  2362.         SetDialingKeypadPhonebookHandler(UI_dummy_function);
  2363.     #else /* defined  (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */ 
  2364.      ResetCenterSoftkey();
  2365.     #endif /* defined  (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */ 
  2366.     #endif /* ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) ) */ 
  2367.     }
  2368.     ShowCategory16Screen(
  2369.         lskStrShow,
  2370.         0,
  2371.         STR_GLOBAL_BACK,
  2372.         IMG_GLOBAL_BACK,
  2373.         (PU8) UnicodeDTMFPadCallBuffer,
  2374.         MAX_DIGIT,
  2375.         historyBuffer);
  2376.     wgui_save_key_handlers();
  2377.     /* LSK, RSK */
  2378.     SetCategory16RightSoftkeyFunction(CheckBeforeGoBackHistory, KEY_EVENT_UP);
  2379.     if (lskStrShow != 0)
  2380.     {
  2381.         SetLeftSoftkeyFunction(CallMgmtSavePhoneBook, KEY_EVENT_UP);
  2382.     }
  2383.     /* SEND, END key */
  2384.     if (GetCurrentState() == CM_INCOMING_STATE)
  2385.     {
  2386.         if (GetTotalCallCount() == 1)
  2387.         {
  2388.             SetKeyHandler(KbCBackCallIncomingRejected, KEY_END, KEY_EVENT_DOWN);
  2389.         }
  2390.         else
  2391.         {
  2392.         #ifdef __MMI_CLAMSHELL__
  2393.             SetKeyHandler(KbCBackCallIncomingRejected, KEY_END, KEY_EVENT_DOWN);
  2394.         #else 
  2395.             SetKeyHandler(KbCBackEndAllCallsExceptIncoming, KEY_END, KEY_EVENT_DOWN);
  2396.         #endif 
  2397.         }
  2398.     }
  2399.     else if (CM_IDLE_STATE != GetCurrentState())
  2400.     {
  2401.         SetKeyHandler(HangupAll, KEY_END, KEY_EVENT_DOWN);
  2402.     }
  2403.     /* group key */
  2404.     if ((GetTotalActiveCallCount() > 0 || GetCurrentState() == CM_OUTGOING_STATE) && (GetDTMFFlag()))
  2405.     {
  2406.         SetGroupKeyHandler(HandleDTMFScreenDigits, (PU16) CMIdleScreenDigits, MAX_CM_SCREEN_DIGITS - 1, KEY_EVENT_DOWN);
  2407.         SetGroupKeyHandler(HandleDTMFScreenStopTone, (PU16) CMIdleScreenDigits, MAX_CM_SCREEN_DIGITS - 1, KEY_EVENT_UP);
  2408.         SetGroupKeyHandler(NULL, (PU16) CMIdleScreenDigits, MAX_CM_SCREEN_DIGITS - 1, KEY_REPEAT);
  2409.     }
  2410.     else
  2411.     {
  2412.         SetGroupKeyHandler(
  2413.             UpdateDialedDigitDisplay,
  2414.             (PU16) CMIdleScreenDigits,
  2415.             MAX_CM_SCREEN_DIGITS - 1,
  2416.             KEY_EVENT_DOWN);
  2417.         SetGroupKeyHandler(NULL, (PU16) CMIdleScreenDigits, MAX_CM_SCREEN_DIGITS - 1, KEY_REPEAT);
  2418.     }
  2419.     /* side key */
  2420.     SetSideVolumeKeysForCM();
  2421. }
  2422. /*****************************************************************************
  2423.  * FUNCTION
  2424.  *  ExitScrDisplayDialedDigits
  2425.  * DESCRIPTION
  2426.  *  Shows the dialed digits in dtmf
  2427.  * PARAMETERS
  2428.  *  void
  2429.  * RETURNS
  2430.  *  void
  2431.  *****************************************************************************/
  2432. void ExitScrDisplayDialedDigits(void)
  2433. {
  2434.     /*----------------------------------------------------------------*/
  2435.     /* Local Variables                                                */
  2436.     /*----------------------------------------------------------------*/
  2437.     /*----------------------------------------------------------------*/
  2438.     /* Code Body                                                      */
  2439.     /*----------------------------------------------------------------*/
  2440.     if (cm_p->history_info.IsSave)
  2441.     {
  2442.         history Scr1001;
  2443.         Scr1001.scrnID = DTMF_SCR_DISPLAY_ID;
  2444.         Scr1001.entryFuncPtr = EntryScrDisplayDialedDigits;
  2445.         pfnUnicodeStrcpy((S8*) Scr1001.inputBuffer, (S8*) UnicodeDTMFPadCallBuffer);
  2446.         GetCategoryHistory(Scr1001.guiBuffer);
  2447.         AddHistory(Scr1001);
  2448.     }
  2449.     else
  2450.     {
  2451.         cm_p->history_info.IsSave = TRUE;
  2452.     }
  2453.     if (GetDTMFKeyUpFlag() == TRUE)
  2454.     {
  2455.         HandleDTMFScreenStopTone();
  2456.     }
  2457. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  2458. #if defined  (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
  2459.     SetDialingKeypadCallHandler(UI_dummy_function);
  2460. SetDialingKeypadIPCallHandler(UI_dummy_function);       //KP Jerry add on 2006-11-13
  2461. #else 
  2462.     ResetCenterSoftkey();
  2463. #endif 
  2464. #endif /* ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) ) */ 
  2465. }
  2466. /*****************************************************************************
  2467.  * FUNCTION
  2468.  *  DialDigitScreenEmpty
  2469.  * DESCRIPTION
  2470.  *  register function when screen is empty for call deflection
  2471.  * PARAMETERS
  2472.  *  void
  2473.  * RETURNS
  2474.  *  void
  2475.  *****************************************************************************/
  2476. void DialDigitScreenEmpty(void)
  2477. {
  2478.     /*----------------------------------------------------------------*/
  2479.     /* Local Variables                                                */
  2480.     /*----------------------------------------------------------------*/
  2481.     /*----------------------------------------------------------------*/
  2482.     /* Code Body                                                      */
  2483.     /*----------------------------------------------------------------*/
  2484.     ClearKeyHandler(KEY_SEND, KEY_EVENT_UP);
  2485. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  2486. #if defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
  2487.     /* grey call, phb icon */
  2488.     SetDialingKeypadCallHandler(UI_dummy_function);
  2489.     SetDialingKeypadIPCallHandler(UI_dummy_function);//KP Jerry add on 2007-4-24
  2490.     SetDialingKeypadPhonebookHandler(mmi_phb_list_enter_first_from_active_call);
  2491. #else /* defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */ 
  2492.     SetCenterSoftkeyFunction(UI_dummy_function, KEY_EVENT_UP);
  2493. #endif /* defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */ 
  2494. #endif /* ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) ) */ 
  2495. }
  2496. /*****************************************************************************
  2497.  * FUNCTION
  2498.  *  DialDigitScreenNotEmpty
  2499.  * DESCRIPTION
  2500.  *  register function when screen is not empty for call deflection
  2501.  * PARAMETERS
  2502.  *  void
  2503.  * RETURNS
  2504.  *  void
  2505.  *****************************************************************************/
  2506. void DialDigitScreenNotEmpty(void)
  2507. {
  2508.     /*----------------------------------------------------------------*/
  2509.     /* Local Variables                                                */
  2510.     /*----------------------------------------------------------------*/
  2511.     /*----------------------------------------------------------------*/
  2512.     /* Code Body                                                      */
  2513.     /*----------------------------------------------------------------*/
  2514.     SetKeyHandler(MakeCallFromDTMFScr, KEY_SEND, KEY_EVENT_DOWN);
  2515. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  2516. #if defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
  2517.     SetDialingKeypadCallHandler(MakeCallFromDTMFScr);
  2518.     SetDialingKeypadIPCallHandler(MakeIPCallFromDTMFScr);     //KP Jerry add on 2007-4-25
  2519.     SetDialingKeypadPhonebookHandler(mmi_phb_list_enter_first_from_active_call);
  2520. #else /* defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */ 
  2521.     SetCenterSoftkeyFunction(MakeCallFromDTMFScr, KEY_EVENT_UP);
  2522. #endif /* defined (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__) */ 
  2523. #endif /* ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) ) */ 
  2524. }
  2525. /**************************************************************
  2526.    FUNCTION NAME     : StoreAndKeepKeyCode
  2527.    PURPOSE           : Helper to store current key press
  2528.    INPUT PARAMETERS  : void
  2529.    OUTPUT PARAMETERS : nil
  2530.    RETURNS           : void
  2531.    REMARKS           : This is needed since the key repeat event rewrites it in the framework
  2532. **************************************************************/
  2533. /*
  2534.  * void StoreAndKeepKeyCode (U16 keycode, U16 keytype)
  2535.  * {
  2536.  * curKeyCode = keycode;
  2537.  * curKeyType = keytype;
  2538.  * }
  2539.  */
  2540. /*****************************************************************************
  2541.  * FUNCTION
  2542.  *  InCallSSCParsing
  2543.  * DESCRIPTION
  2544.  *  Helper function to check if the string is IMEI
  2545.  * PARAMETERS
  2546.  *  void
  2547.  * RETURNS
  2548.  *  void
  2549.  *****************************************************************************/
  2550. void InCallSSCParsing(void)
  2551. {
  2552.     /*----------------------------------------------------------------*/
  2553.     /* Local Variables                                                */
  2554.     /*----------------------------------------------------------------*/
  2555.     S8 stringIMEI[20];
  2556.     S8 newstringIMEI[MAX_DIGITS_USSD * ENCODING_LENGTH];
  2557.     /*----------------------------------------------------------------*/
  2558.     /* Code Body                                                      */
  2559.     /*----------------------------------------------------------------*/
  2560.     strcpy((S8*) stringIMEI, "*#06#");
  2561.     AnsiiToUnicodeString((PS8) newstringIMEI, (PS8) stringIMEI);
  2562.     if (pfnUnicodeStrcmp((S8*) newstringIMEI, (S8*) UnicodeDTMFPadCallBuffer) == 0)
  2563.     {
  2564.         SSCHandleIMEI();
  2565.         return;
  2566.     }
  2567. }
  2568. /*****************************************************************************
  2569.  * FUNCTION
  2570.  *  is_valid_dtmf_key
  2571.  * DESCRIPTION
  2572.  *  Helper function to make an send dtmf tones over the network or
  2573.  *  dial a call in case of user clicking send
  2574.  * PARAMETERS
  2575.  *  keycode     [IN]        
  2576.  * RETURNS
  2577.  *  void
  2578.  *****************************************************************************/
  2579. pBOOL is_valid_dtmf_key(U16 keycode)
  2580. {
  2581.     /*----------------------------------------------------------------*/
  2582.     /* Local Variables                                                */
  2583.     /*----------------------------------------------------------------*/
  2584.     U8 i;
  2585.     /*----------------------------------------------------------------*/
  2586.     /* Code Body                                                      */
  2587.     /*----------------------------------------------------------------*/
  2588.     for (i = 0; i < MAX_CM_SCREEN_DIGITS; i++)
  2589.     {
  2590.         if (keycode == CMIdleScreenDigits[i])
  2591.         {
  2592.             return MMI_TRUE;
  2593.         }
  2594.     }
  2595.     return MMI_FALSE;
  2596. }
  2597. /*****************************************************************************
  2598.  * FUNCTION
  2599.  *  HandleDTMFScreenDigits
  2600.  * DESCRIPTION
  2601.  *  Helper function to make an send dtmf tones over the network or
  2602.  *  dial a call in case of user clicking send
  2603.  * PARAMETERS
  2604.  *  void
  2605.  * RETURNS
  2606.  *  void
  2607.  *****************************************************************************/
  2608. void HandleDTMFScreenDigits(void)
  2609. {
  2610.     /*----------------------------------------------------------------*/
  2611.     /* Local Variables                                                */
  2612.     /*----------------------------------------------------------------*/
  2613.     U16 keycode, keytype;
  2614.     /*----------------------------------------------------------------*/
  2615.     /* Code Body                                                      */
  2616.     /*----------------------------------------------------------------*/
  2617.     PRINT_INFORMATION(("n **** HandleDTMFScreenDigitsn"));
  2618.     PRINT_INFORMATION(("n **** Sending DTMF Tonen"));
  2619.     /* SetProtocolEventHandler(DtmfSendSuccess, PRT_DTMF_START_RES); */
  2620.     SetDTMFKeyUpFlag(TRUE);
  2621.     GetkeyInfo(&keycode, &keytype);
  2622.     /* StoreAndKeepKeyCode(keycode, keytype); */
  2623.     /* enter dial pad from New Call menu item */
  2624.     if (!IsScreenPresent(SCR1003_CM_ACTIVECALLOPTIONS) && is_valid_dtmf_key(keycode))
  2625.     {
  2626.         MuteOnMicrophone();
  2627.     #ifdef __MMI_WGUI_CSK_ENABLE__
  2628.         if (keycode != KEY_CSK)
  2629.     #endif 
  2630.             MakePsSendDTMFTone(&keycode);
  2631.     }
  2632.     wgui_execute_key_handler(keycode, keytype);
  2633. }
  2634. /*****************************************************************************
  2635.  * FUNCTION
  2636.  *  UpdateDialedDigitDisplay
  2637.  * DESCRIPTION
  2638.  *  Helper function to update dial screen with only digits
  2639.  * PARAMETERS
  2640.  *  void
  2641.  * RETURNS
  2642.  *  void
  2643.  *****************************************************************************/
  2644. void UpdateDialedDigitDisplay(void)
  2645. {
  2646.     /*----------------------------------------------------------------*/
  2647.     /* Local Variables                                                */
  2648.     /*----------------------------------------------------------------*/
  2649.     U16 keycode, keytype;
  2650.     /*----------------------------------------------------------------*/
  2651.     /* Code Body                                                      */
  2652.     /*----------------------------------------------------------------*/
  2653.     GetkeyInfo(&keycode, &keytype);
  2654.     /* StoreAndKeepKeyCode(keycode, keytype); */
  2655.     wgui_execute_key_handler(keycode, keytype);
  2656.     HandleDisplayDialedDigits();
  2657.     InCallSSCParsing();
  2658. }
  2659. /*****************************************************************************
  2660.  * FUNCTION
  2661.  *  HandleDTMFScreenStopTone
  2662.  * DESCRIPTION
  2663.  *  Helper function to make an send dtmf tones over the network or
  2664.  *  dial a call in case of user clicking send
  2665.  * PARAMETERS
  2666.  *  void
  2667.  * RETURNS
  2668.  *  void
  2669.  *****************************************************************************/
  2670. void HandleDTMFScreenStopTone(void)
  2671. {
  2672.     /*----------------------------------------------------------------*/
  2673.     /* Local Variables                                                */
  2674.     /*----------------------------------------------------------------*/
  2675.     U16 keycode, keytype;
  2676.     /*----------------------------------------------------------------*/
  2677.     /* Code Body                                                      */
  2678.     /*----------------------------------------------------------------*/
  2679.     PRINT_INFORMATION(("n **** HandleDTMFScreenStopTonen"));
  2680.     MakePsStopDTMFTone();
  2681.     if (IsPhoneInMute() == MMI_FALSE)
  2682.     {
  2683.         MuteOffMicrophone();
  2684.     }
  2685.     HandleDisplayDialedDigits();
  2686.     SetDTMFKeyUpFlag(FALSE);
  2687.     GetkeyInfo(&keycode, &keytype);
  2688.     /* StoreAndKeepKeyCode(keycode, keytype); */
  2689.     wgui_execute_key_handler(keycode, keytype);
  2690.     InCallSSCParsing();
  2691. }
  2692. /*****************************************************************************
  2693.  * FUNCTION
  2694.  *  HandleDisplayDialedDigits
  2695.  * DESCRIPTION
  2696.  *  Handles drawing of category screen and display digits
  2697.  * PARAMETERS
  2698.  *  void
  2699.  * RETURNS
  2700.  *  void
  2701.  *****************************************************************************/
  2702. void HandleDisplayDialedDigits(void)
  2703. {
  2704.     /*----------------------------------------------------------------*/
  2705.     /* Local Variables                                                */
  2706.     /*----------------------------------------------------------------*/
  2707.     /*----------------------------------------------------------------*/
  2708.     /* Code Body                                                      */
  2709.     /*----------------------------------------------------------------*/
  2710.     if ((GetTotalActiveCallCount() > 0 || GetCurrentState() == CM_OUTGOING_STATE) && (GetDTMFFlag()))
  2711.     {
  2712.         SetGroupKeyHandler(HandleDTMFScreenDigits, (PU16) CMIdleScreenDigits, MAX_CM_SCREEN_DIGITS - 1, KEY_EVENT_DOWN);
  2713.         SetGroupKeyHandler(HandleDTMFScreenStopTone, (PU16) CMIdleScreenDigits, MAX_CM_SCREEN_DIGITS - 1, KEY_EVENT_UP);
  2714.         SetGroupKeyHandler(MMI_dummy_function, (PU16) CMIdleScreenDigits, MAX_CM_SCREEN_DIGITS - 1, KEY_REPEAT);
  2715.     }
  2716.     else
  2717.     {
  2718.         /* wgui_execute_key_handler(curKeyCode, curKeyType); */
  2719.         SetGroupKeyHandler(
  2720.             UpdateDialedDigitDisplay,
  2721.             (PU16) CMIdleScreenDigits,
  2722.             MAX_CM_SCREEN_DIGITS - 1,
  2723.             KEY_EVENT_DOWN);
  2724.     }
  2725. if (GetCurrentState() != CM_OUTGOING_STATE && !EmergencyCallPresent())
  2726. {
  2727.     SetKeyHandler(MakeCallFromDTMFScr, KEY_SEND, KEY_EVENT_DOWN);
  2728. }
  2729.     if (GetCurrentState() == CM_INCOMING_STATE)
  2730.     {
  2731.         if (GetTotalCallCount() == 1)
  2732.         {
  2733.             SetKeyHandler(KbCBackCallIncomingRejected, KEY_END, KEY_EVENT_DOWN);
  2734.         }
  2735.         else
  2736.         {
  2737.         #ifdef __MMI_CLAMSHELL__
  2738.             SetKeyHandler(KbCBackCallIncomingRejected, KEY_END, KEY_EVENT_DOWN);
  2739.         #else 
  2740.             SetKeyHandler(KbCBackEndAllCallsExceptIncoming, KEY_END, KEY_EVENT_DOWN);
  2741.         #endif 
  2742.         }
  2743.     }
  2744.     else if (CM_IDLE_STATE == GetCurrentState())
  2745.     {
  2746.         SetKeyHandler(CheckBeforeGoBackHistory, KEY_END, KEY_EVENT_DOWN);
  2747.     }
  2748.     else
  2749.     {
  2750.         SetKeyHandler(HangupAll, KEY_END, KEY_EVENT_DOWN);
  2751.     }
  2752.     RegisterCategory16NavigationKeys();
  2753.     SetLeftSoftkeyFunction(CallMgmtSavePhoneBook, KEY_EVENT_UP);
  2754.     SetCategory16RightSoftkeyFunction(CheckBeforeGoBackHistory, KEY_EVENT_UP);
  2755.     SetSideVolumeKeysForCM();
  2756. }
  2757. /*****************************************************************************
  2758.  * FUNCTION
  2759.  *  MakeCallFromDTMFScr
  2760.  * DESCRIPTION
  2761.  *  Clear the DTMF buffer
  2762.  * PARAMETERS
  2763.  *  void
  2764.  * RETURNS
  2765.  *  void
  2766.  *****************************************************************************/
  2767. void MakeCallFromDTMFScr(void)
  2768. {
  2769. #ifdef __MMI_TOUCH_DIAL_SCREEN__
  2770.     /*----------------------------------------------------------------*/
  2771.     /* Local Variables                                                */
  2772.     /*----------------------------------------------------------------*/
  2773.     /*----------------------------------------------------------------*/
  2774.     /* Code Body                                                      */
  2775.     /*----------------------------------------------------------------*/
  2776.     /* no input */
  2777.     if (UnicodeDTMFPadCallBuffer[0] == 0 && UnicodeDTMFPadCallBuffer[1] == 0)
  2778.     {
  2779.         return;
  2780.     }
  2781. #endif /* __MMI_TOUCH_DIAL_SCREEN__ */ 
  2782.     SetDialedDigitCalledFlag(TRUE);
  2783.     MakeCall(UnicodeDTMFPadCallBuffer);
  2784. }
  2785. //KP Jerry add on 2007-4-25 start
  2786. void MakeIPCallFromDTMFScr(void)
  2787. {
  2788. #ifdef __MMI_TOUCH_DIAL_SCREEN__
  2789.     /*----------------------------------------------------------------*/
  2790.     /* Local Variables                                                */
  2791.     /*----------------------------------------------------------------*/
  2792.     /*----------------------------------------------------------------*/
  2793.     /* Code Body                                                      */
  2794.     /*----------------------------------------------------------------*/
  2795.     /* no input */
  2796.     if (UnicodeDTMFPadCallBuffer[0] == 0 && UnicodeDTMFPadCallBuffer[1] == 0)
  2797.     {
  2798.         return;
  2799.     }
  2800. #endif /* __MMI_TOUCH_DIAL_SCREEN__ */ 
  2801.     SetDialedDigitCalledFlag(TRUE);
  2802.     SetTempUseIPNumber(TRUE);
  2803.     MakeCall(UnicodeDTMFPadCallBuffer);
  2804. }
  2805. //KP Jerry add on 2007-4-25 end
  2806. /*****************************************************************************
  2807.  * FUNCTION
  2808.  *  CallMgmtSavePhoneBook
  2809.  * DESCRIPTION
  2810.  *  
  2811.  * PARAMETERS
  2812.  *  void
  2813.  * RETURNS
  2814.  *  void
  2815.  *****************************************************************************/
  2816. void CallMgmtSavePhoneBook(void)
  2817. {
  2818.     /*----------------------------------------------------------------*/
  2819.     /* Local Variables                                                */
  2820.     /*----------------------------------------------------------------*/
  2821.     /*----------------------------------------------------------------*/
  2822.     /* Code Body                                                      */
  2823.     /*----------------------------------------------------------------*/
  2824.     SetCMScrnFlag(FALSE);
  2825.     SaveNumberFromIdleScrn(UnicodeDTMFPadCallBuffer, 0);
  2826. }
  2827. /*****************************************************************************
  2828.  * FUNCTION
  2829.  *  ClearDtmfBuf
  2830.  * DESCRIPTION
  2831.  *  Clear the DTMF buffer
  2832.  * PARAMETERS
  2833.  *  void
  2834.  * RETURNS
  2835.  *  void
  2836.  *****************************************************************************/
  2837. void ClearDtmfBuf(void)
  2838. {
  2839.     /*----------------------------------------------------------------*/
  2840.     /* Local Variables                                                */
  2841.     /*----------------------------------------------------------------*/
  2842.     /*----------------------------------------------------------------*/
  2843.     /* Code Body                                                      */
  2844.     /*----------------------------------------------------------------*/
  2845.     memset(UnicodeDTMFPadCallBuffer, 0, sizeof(UnicodeDTMFPadCallBuffer));
  2846.     memset(DTMFPadCallBuffer, 0, sizeof(DTMFPadCallBuffer));
  2847. }
  2848. /*****************************************************************************
  2849.  * FUNCTION
  2850.  *  FillDtmfBuff
  2851.  * DESCRIPTION
  2852.  *  Fills up DTMF Buffer for access later
  2853.  * PARAMETERS
  2854.  *  buf     [IN]        
  2855.  * RETURNS
  2856.  *  void
  2857.  *****************************************************************************/
  2858. void FillDtmfBuff(PU8 buf)
  2859. {
  2860.     /*----------------------------------------------------------------*/
  2861.     /* Local Variables                                                */
  2862.     /*----------------------------------------------------------------*/
  2863.     /*----------------------------------------------------------------*/
  2864.     /* Code Body                                                      */
  2865.     /*----------------------------------------------------------------*/
  2866.     pfnUnicodeStrcpy(UnicodeDTMFPadCallBuffer, (void*)buf);
  2867. }
  2868. /*****************************************************************************
  2869.  * FUNCTION
  2870.  *  GetDtmfBuffer
  2871.  * DESCRIPTION
  2872.  *  Return the DTMF buffer
  2873.  * PARAMETERS
  2874.  *  void
  2875.  * RETURNS
  2876.  *  void
  2877.  *****************************************************************************/
  2878. PU8 GetDtmfBuffer(void)
  2879. {
  2880.     /*----------------------------------------------------------------*/
  2881.     /* Local Variables                                                */
  2882.     /*----------------------------------------------------------------*/
  2883.     /*----------------------------------------------------------------*/
  2884.     /* Code Body                                                      */
  2885.     /*----------------------------------------------------------------*/
  2886.     UnicodeToAnsii(DTMFPadCallBuffer, UnicodeDTMFPadCallBuffer);
  2887.     return (PU8) DTMFPadCallBuffer;
  2888. }
  2889. /*****************************************************************************
  2890.  * FUNCTION
  2891.  *  SetDialIndication
  2892.  * DESCRIPTION
  2893.  *  to set the dial indication flag as per argument
  2894.  * PARAMETERS
  2895.  *  truth       [IN]        
  2896.  *  TRUE(?)     [IN]        /FALSE
  2897.  * RETURNS
  2898.  *  void
  2899.  *****************************************************************************/
  2900. void SetDialIndication(pBOOL truth)
  2901. {
  2902.     /*----------------------------------------------------------------*/
  2903.     /* Local Variables                                                */
  2904.     /*----------------------------------------------------------------*/
  2905.     /*----------------------------------------------------------------*/
  2906.     /* Code Body                                                      */
  2907.     /*----------------------------------------------------------------*/
  2908.     gCheckDialIndEndOutgoing = truth;
  2909. }
  2910. /*****************************************************************************
  2911.  * FUNCTION
  2912.  *  GetDialIndication
  2913.  * DESCRIPTION
  2914.  *  To Get the dial indication flag
  2915.  * PARAMETERS
  2916.  *  void
  2917.  *  TRUE(?)     [IN]        /FALSE
  2918.  * RETURNS
  2919.  *  void
  2920.  *****************************************************************************/
  2921. pBOOL GetDialIndication(void)
  2922. {
  2923.     /*----------------------------------------------------------------*/
  2924.     /* Local Variables                                                */
  2925.     /*----------------------------------------------------------------*/
  2926.     /*----------------------------------------------------------------*/
  2927.     /* Code Body                                                      */
  2928.     /*----------------------------------------------------------------*/
  2929.     return gCheckDialIndEndOutgoing;
  2930. }
  2931. #ifdef MMI_ON_HARDWARE_P
  2932. /*****************************************************************************
  2933.  * FUNCTION
  2934.  *  MakeCallReqInd
  2935.  * DESCRIPTION
  2936.  *  Helper function to make call when PRT_MMI_MAKE_CALL_REQ_IND comes.
  2937.  * PARAMETERS
  2938.  * MsgStruct(?)       [IN]        Which needs to make the outgoing call.              
  2939.  * RETURNS
  2940.  *  void
  2941.  *****************************************************************************/
  2942. void MakeCallReqInd(void *MsgStruct)
  2943. {
  2944.     /*----------------------------------------------------------------*/
  2945.     /* Local Variables                                                */
  2946.     /*----------------------------------------------------------------*/
  2947.     
  2948.     /*----------------------------------------------------------------*/
  2949.     /* Code Body                                                      */
  2950.     /*----------------------------------------------------------------*/
  2951.     PRINT_INFORMATION(("XXX - In MakeCallReqInd XXXn"));
  2952.     MakeCall((PS8)((MMI_MAKE_CALL_REQ_IND*) MsgStruct)->strNumber);
  2953. }
  2954. #endif /* MMI_ON_HARDWARE_P */