DEFINITION C_Tdpv_660004692 "Tdpvgsm"
DEFINITION ERR_DUPL_660004692 0x0D0
DEFINITION MODULE_660004692 0xA000
DEFINITION Multidistribution_Non_660004692 0
DEFINITION DISTRIBUTION_SPECIALE_660004692 0
DEFINITION ERR_CONV_660004692 0x0E0
DEFINITION NUMTAB_660004692 4
DEFINITION TRAI_KO_660004692 -1
REGISTRE POINTEUR pt_1_660004692
REGISTRE POINTEUR pt_AX_IDEMET_660004692
REGISTRE POINTEUR pt_networkInfo_660004692
REGISTRE POINTEUR pt_conteneur_660004692
REGISTRE POINTEUR pt_resultat_660004692
REGISTRE POINTEUR pt_MCCMNCC_660004692
REGISTRE POINTEUR pt_CellId_660004692
REGISTRE POINTEUR pt_localisation_660004692
REGISTRE POINTEUR pt_localisation_DCB_660004692
REGISTRE POINTEUR pt_call_660004692
REGISTRE POINTEUR pt_calling_DCB_660004692
REGISTRE POINTEUR pt_calling_660004692
REGISTRE POINTEUR pt_Dial_660004692
REGISTRE POINTEUR pt_Dialled_660004692
REGISTRE POINTEUR pt_Dialled_DCB_660004692
REGISTRE POINTEUR pt_IMSI_660004692
REGISTRE POINTEUR pt_IMSI_DCB_660004692
REGISTRE POINTEUR pt_CORLStatus_660004692
REGISTRE ENTIER erreur_660004692
REGISTRE ENTIER ERREUR_660004692
REGISTRE ENTIER b_URGENT_SANS_SIM_660004692
REGISTRE ENTIER code_rejet_660004692
REGISTRE ENTIER EFFICACE_660004692
REGISTRE ENTIER longueur_660004692
REGISTRE ENTIER Start_Date_660004692
REGISTRE ENTIER Date_Debut_660004692
REGISTRE ENTIER Request_Time_660004692
REGISTRE ENTIER Request_660004692
REGISTRE ENTIER date_audit_660004692
REGISTRE ENTIER Date_Fin_660004692
REGISTRE ENTIER End_Time_660004692
REGISTRE ENTIER v_CORLStatus_660004692
REGISTRE ENTIER res_660004692
REGISTRE ENTIER flag_rdt_660004692
REGISTRE ENTIER date_fin_660004692
REGISTRE ENTIER causeforrecclos_660004692
REGISTRE ENTIER scereturncode_660004692
REGISTRE ENTIER Trans_ReturnCode_660004692
################################################################################
#
# Pcode de distribution PRIMS : TprimsVoLTE
#
# history :
#     Creation le02/12/2014 en G5R3 lot3
# 13/01/2015 -JLG- G5R3C3 QC1488 champ MSISDN doit etre absent dans le cas d'un appel sans SIM
# 13/01/2015 -JLG- G5R3C3 QC1489 calcul de b_URGENT_SANS_SIM
# 13/01/2015 -JLG- G5R3C3 QC1493 tterm erronee  pour T3_causeForRecClosing = 1 et T3_SessionTerminationcause = 300, 400 et 500
# 16/01/2015 -JLG- G5R3C3 modifications longueurs des pointeurs a l'aide de VerifPcode4
# 27/01/2015 -PKH- G5R3C4 QC1506 Envoi en errone si les champs CallPrtAdr2Dat et DialledDigits sont au format ascii
# 02/03/2015 -PKH- G5R3C11 QC 1524 modification du calcul de la variable fonctionnelle Localisation et Volte_OrangeCo
# 03/03/2015 -PKH- G5R3C11 QC 1525 Creation d une fonction NORM_PRISM1 pour traiter les urn des services d urgences
# 06/03/2015 -JLG- G5R3C13 Report QC1527
# 06/03/2015 -JLG- G5R3C13 Report QC1528
# 09/04/2015 -JLG- QC1546 DUREE = 0 si CallDuration absent
################################################################################


#G5R3C11 Debut
#G5R3C11 Fin




erreur_660004692 = -1
b_URGENT_SANS_SIM_660004692 = -1
code_rejet_660004692 = 0
EFFICACE_660004692 = 1
longueur_660004692 = -1
Start_Date_660004692 = 0
Date_Debut_660004692 = -1
Request_Time_660004692 = 0
Request_660004692 = -1
End_Time_660004692 = 0
Date_Fin_660004692 = 0
v_CORLStatus_660004692 = -1
res_660004692 = 0
flag_rdt_660004692 = 0
date_fin_660004692 = 0
causeforrecclos_660004692 = -1
scereturncode_660004692 = -1
Trans_ReturnCode_660004692 = -1
#Volte_OrangeCo = 0

pt_1_660004692 = "pt_1_7655676556676656676656676565677655676565677656567798765678"
pt_networkInfo_660004692 = "pt_networkInfo222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222333333333="

#G5R3C11 Debut
pt_conteneur_660004692 = "pt_conteneur87609876789876767788998987800099890098766776677665677887676567788776678987676"
pt_resultat_660004692 = "pt_resultat75757657857675857566586655675565585766555865665785765"
pt_MCCMNCC_660004692 = "pt_MCCMNCC91"
pt_CellId_660004692 = "pt_CellId1515"
#pt_Orange =  "pt_Orange768787"
#pt_clee = "pt_clee19191919"
#pt_RetourTab = "pt_RetourTab0909"
#G5R3C11 Fin

pt_AX_IDEMET_660004692 = "pt_AX_IDEMET1111111111111111"
pt_localisation_660004692 = "pt_localisation212121212121212121212121212121212121212121212121212121"
pt_localisation_DCB_660004692 = "pt_localisation_DCB8282828282828282828282828282828282828282828282828282828828228282888282828282828282828"
pt_call_660004692 = "pt_call3333333333333333333333333333333333333333333333333333333333333333333333333331111111111111111111111111111111111111111111111"
pt_calling_DCB_660004692 ="pt_calling_DCB123413214312341312314312314132134413124131241321214131213414132321413212141312213144131221344131221"
pt_calling_660004692 = "pt_calling777777777777777777777777777777777777777777777777777777777777777777777"
pt_Dial_660004692 = "pt_Dial6666666666666666666666666666666666666666666666666666666666666666666666666661111111111111111111111111111111111111111111111"
pt_Dialled_660004692 = "pt_Dialled8888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777"
pt_Dialled_DCB_660004692 = "pt_Dialled_DCB8181818188181818181818181818188118188181818181818811818181"
pt_IMSI_660004692 = "pt_IMSI3213213213213213213213213213213213118888888888888888888888888888888888888888888888888888888888888888888888888888888888888"
pt_IMSI_DCB_660004692 = "pt_IMSI_DCB9191919199191991919"
pt_CORLStatus_660004692 = "pt_CORLStatus1"


i_strcpy(pt_1_660004692,"")
i_strcpy(pt_AX_IDEMET_660004692,"")
i_strcpy(pt_networkInfo_660004692,"")
#G5R3C11 Debut
i_strcpy(pt_conteneur_660004692,"")
i_strcpy(pt_resultat_660004692,"")
i_strcpy(pt_MCCMNCC_660004692,"")
i_strcpy(pt_CellId_660004692,"")
#i_strcpy(pt_Orange,"")
#i_strcpy(pt_RetourTab,"")
#G5R3C11 Fin

i_strcpy(pt_localisation_660004692,"")
i_strcpy(pt_localisation_DCB_660004692,"")
i_strcpy(pt_call_660004692,"")
i_strcpy(pt_Dial_660004692,"")
i_strcpy(pt_Dialled_660004692,"")
i_strcpy(pt_Dialled_DCB_660004692,"")
i_strcpy(pt_IMSI_660004692,"")
i_strcpy(pt_IMSI_DCB_660004692,"")
i_strcpy(pt_CORLStatus_660004692,"")
i_strcpy(pt_calling_DCB_660004692,"")


trace ("---------------------------------")
trace ("  TprimsVoLTE Distribution    ")
trace ("---------------------------------")


##################################################################################
# Identification de la provenance de l'article
# flag_rdt : nb de passage en redistribution (lecture de l'enveloppe obligatoire)
##################################################################################
flag_rdt_660004692 = -1
flag_rdt_660004692 = i_LireRedistCpt()

SI (flag_rdt_660004692 == 0)
ALORS
  erreur_660004692= i_add_opt("E_Redistri2")
FINSI
erreur_660004692 = i_set_attr_val_n($E_Redistri2::EnvoiRedis, 0)


########################################################
# Cpt applicatif CPT_RDT=1509 (REDISTRIBUTION)
########################################################
date_fin_660004692 = i_get_art_field(g_iartin, $TprimsVoLTE::dfin)
erreur_660004692 = i_incr_redist_dist_660004265(date_fin_660004692)

#erreur = i_cree_art("Conv_URS", g_iartout10)


#-------------#
#AX_IDEMET
#-------------#
#  Sdate Platine
erreur_660004692 = i_format_str2( pt_1_660004692, "%s%s", "AX_IDEMET_", i_LireEECSGTQS(g_ieec))
i_strcpy(pt_AX_IDEMET_660004692, i_get_tab_field("VariableContexte", i_get_art_field(g_iartin, $TprimsVoLTE::StartTime_SDATE), pt_1_660004692))


#-------------#
#Trans_ReturnCode
#-------------#
# QC1493
causeforrecclos_660004692 = i_get_art_field(g_iartin, $TprimsVoLTE::CausForRecClos)
scereturncode_660004692 = i_get_art_field(g_iartin, $TprimsVoLTE::sessionTerm)

SI (causeforrecclos_660004692 == 0)
ALORS
  Trans_ReturnCode_660004692 = 0x00
  SAUT FIN_TransReturnCode
FINSI
SI (causeforrecclos_660004692 == 3)
ALORS
  Trans_ReturnCode_660004692 = 0x07
  SAUT FIN_TransReturnCode
FINSI

SI causeforrecclos_660004692 == 1
ALORS
  SI (scereturncode_660004692 >= 300 && scereturncode_660004692 < 400)
  ALORS
    Trans_ReturnCode_660004692 =0xC1
    SAUT FIN_TransReturnCode
  FINSI
  SI (scereturncode_660004692 >= 400 && scereturncode_660004692 < 500)
  ALORS
    Trans_ReturnCode_660004692 =0xC2
    SAUT FIN_TransReturnCode
  FINSI
  SI (scereturncode_660004692 >= 500 && scereturncode_660004692 < 600)
  ALORS
    Trans_ReturnCode_660004692 = 0xC3
    SAUT FIN_TransReturnCode
  FINSI
  SI (scereturncode_660004692 >= 600)
  ALORS
    Trans_ReturnCode_660004692 = 0xC4
    SAUT FIN_TransReturnCode
  FINSI
  Trans_ReturnCode_660004692 = 0xC5
FINSI

POINT FIN_TransReturnCode

#G5C3C11  PKH QC1524
#--------------------------#
#Localisation
#--------------------------#

i_strcpy(pt_resultat_660004692, "")
i_strcpy(pt_localisation_660004692, "FFFFFFFFFFFFFFFFFF")

SI (i_valid_field_n(g_iartin, $TprimsVoLTE::networkInfo))
ALORS
  erreur_660004692 = i_get_art_str(g_iartin, $TprimsVoLTE::networkInfo, pt_networkInfo_660004692)
  longueur_660004692 = i_strlen(pt_networkInfo_660004692)
  SI !(i_adequation_chaine_expreg(pt_networkInfo_660004692,"3gpp\s*="))
  ALORS
    POINT BOUCLE_3GPP
    SI !(i_recupererValeur(pt_networkInfo_660004692, pt_conteneur_660004692, longueur_660004692, '='))
    ALORS
      # si 3gpp se trouve dans ce conteneur, alors sa valeur sera dans le conteneur suivant
      SI !(i_adequation_chaine_expreg(pt_conteneur_660004692,"3gpp\s*$"))
      ALORS
        SI !(i_recupererValeur(pt_networkInfo_660004692, pt_conteneur_660004692, longueur_660004692, '='))
        ALORS
          i_strcpy(pt_networkInfo_660004692, pt_conteneur_660004692)
          SI !(i_recupererValeur(pt_networkInfo_660004692, pt_conteneur_660004692, longueur_660004692, ';'))
          ALORS
            # j'enleve les blancs en debut
            POINT ENLEVE_BLANC
            SI !(i_adequation_chaine_expreg(pt_conteneur_660004692,"^ "))
            ALORS
              i_get_sub_str (pt_conteneur_660004692, 1, -1, pt_conteneur_660004692)
              SAUT ENLEVE_BLANC
            FINSI
            # copie valeur de 3gpp = pt_conteneur dans pt_resultat
            i_strcpy(pt_resultat_660004692, pt_conteneur_660004692)
          FINSI
        FINSI
      SINON
      	SAUT BOUCLE_3GPP
      FINSI
    FINSI
  FINSI
FINSI
      

SI (i_strlen(pt_resultat_660004692) == 16)
ALORS
  i_get_sub_str (pt_resultat_660004692, 0, 4, pt_MCCMNCC_660004692)
  i_get_sub_str (pt_resultat_660004692, -7,-1,pt_CellId_660004692)
  erreur_660004692 = i_format_str2(pt_localisation_660004692, "%s%s", pt_MCCMNCC_660004692, pt_CellId_660004692)
SINON
  SI (i_strlen(pt_resultat_660004692) == 17)
  ALORS
    i_get_sub_str (pt_resultat_660004692, 0, 5, pt_MCCMNCC_660004692)
    i_get_sub_str (pt_resultat_660004692, -7,-1,pt_CellId_660004692)
    erreur_660004692 = i_format_str2(pt_localisation_660004692, "%s%s", pt_MCCMNCC_660004692, pt_CellId_660004692)
  FINSI
FINSI

#QC1528 Suppression de la variable fonctionnelle IMSI_OrangeCo


#--------------------------#
#b_URGENT_SANS_SIM
#--------------------------#
# QC1489 sur le cacul de b_URGENT_SANS_SIM
SI (!i_valid_field_n(g_iartin, $TprimsVoLTE::IMSI) && !i_valid_field_n(g_iartin, $TprimsVoLTE::CallPrtAdr2Dat))
ALORS
  b_URGENT_SANS_SIM_660004692 = 1
SINON
  b_URGENT_SANS_SIM_660004692 = 0
FINSI


#-----------------------------------#
# Normalisation et troncature
#-----------------------------------#

#QC1525 nouvelle fonction de normalisation NORM_PRIMS1
#Traitement des nom urn des services d urgences dans la table IDPART
# ------------1er phase de normalisation-------------------------#
# suppression des prefixe: tel: et sip:
#   suppression si le 1er digit est +
#   suppresion des caracteres DTMF
#   suppression si les 2 premiers digits valent 00
#   suppression des suffixes ? partir du caracteres @
#   Suppression des suffixes a partir de ;
#   interrogation table idpart pour recuperer le numero d urgence
#   T3_callingNb,T3_DialledDigits
#   Ces traitements sont realis?s par la fonction NORMA_PRIMS1
#----------------------------------------------------------------#

#----------------------------------------------------------------#
#   T3_callingNb/CallPrtAdr2Dat (Demandeur)
#----------------------------------------------------------------#
SI (i_valid_field_n(g_iartin, $TprimsVoLTE::CallPrtAdr2Dat))
ALORS
  i_strcpy(pt_call_660004692,"")
  erreur_660004692 = i_get_art_str(g_iartin, $TprimsVoLTE::CallPrtAdr2Dat, pt_call_660004692)
  i_strcpy (pt_calling_660004692, NORMA_PRIMS1_660004265(pt_call_660004692,date_fin_660004692))

  trace2("=====Normalisation CallPrtAdr2Dat %s", pt_calling_660004692, "")

# 26/01/2015 QC 1506 - PKH - G5R3 lot3 envoi en erronne si le resultat de normalisation est une chaine ASCII
  SI (i_strplcmp(pt_calling_660004692, " ", 0, 1) == 0)
  ALORS
    trace("TprimsVolte, CallPrtAdr2Dat normalise = chaine ASCII")
    erreur_660004692 = 1
    code_rejet_660004692 = MODULE_660004692 + ERREUR_660004692   + EFFICACE_660004692
    erreur_660004692 = i_PlvMessEmettre(6674, 2, g_iartin, "", 1, code_rejet_660004692, "", "")
    SAUT DISTR_ERR
  FINSI

FINSI

#----------------------------------------------------------------------------#
#   T3_DialledDigits/DialledDigits (Demande), pt_Dialled
#----------------------------------------------------------------------------#
SI (i_valid_field_n(g_iartin, $TprimsVoLTE::DialledDigits))
ALORS
  erreur_660004692 = i_get_art_str(g_iartin, $TprimsVoLTE::DialledDigits, pt_Dial_660004692)
  i_strcpy(pt_Dialled_660004692, NORMA_PRIMS1_660004265(pt_Dial_660004692,date_fin_660004692))
  trace2 ("=====Normalisation DialledDigits = %s", pt_Dialled_660004692, "")

  # 26/01/2015 QC 1506 - PKH - G5R3 lot3 envoi en erronne si le resultat de normalisation est une chaine ASCII
  SI (i_strplcmp(pt_Dialled_660004692, " ", 0, 1) == 0)
  ALORS
    trace("TprimsVolte, DialledDigits normalise = chaine ASCII")
    erreur_660004692 = 1
    code_rejet_660004692 = MODULE_660004692 + ERREUR_660004692   + EFFICACE_660004692
    erreur_660004692 = i_PlvMessEmettre(6675, 2, g_iartin, "", 1, code_rejet_660004692, "", "")
    SAUT DISTR_ERR
  FINSI

FINSI


#-----------------------------------#
# Duplication Tdpvgsm (g_iartout)
#-----------------------------------#

SI (i_dup_art_tab( g_iartin, g_iartout, C_Tdpv_660004692))
ALORS
  trace("ERREUR de duplication")
  ERREUR_660004692 = ERR_DUPL_660004692
  code_rejet_660004692 = MODULE_660004692 + ERREUR_660004692   + EFFICACE_660004692
  erreur_660004692 = i_PlvMessEmettre(6673, 2, g_iartin, "", 2, code_rejet_660004692, "Tdpvgsm", 0)
  SAUT DISTR_ERR
FINSI

############################################################################
# Mises au format DPV40,
############################################################################


#T3t1
#T3t1.1 type    :D  :-  :MSET :00

#T3t1.2 tentite   :-  :-  :MSET :17
#T3t1.3 idemet    :-  :-  :MSET :FF

SI (i_strcmp(pt_AX_IDEMET_660004692,"") != 0)
ALORS
  erreur_660004692 = affectation_tab_660004265(g_iartout, $Tdpvgsm::idemet, pt_AX_IDEMET_660004692)
SINON
  erreur_660004692 = affectation_tab_660004265(g_iartout, $Tdpvgsm::idemet, "33009000000FFFFFFF")
FINSI

#T3t1.4 IMSI    :-  :-  :MSET :99
SI (b_URGENT_SANS_SIM_660004692 == 1)
ALORS
  erreur_660004692 = affectation_tab_660004265(g_iartout, $Tdpvgsm::IMSI, "888888888888888F")
SINON
  SI(i_valid_field_n(g_iartin, $TprimsVoLTE::IMSI))
  ALORS
    erreur_660004692 = i_get_art_str(g_iartin, $TprimsVoLTE::IMSI, pt_IMSI_660004692)
    i_get_sub_str (pt_IMSI_660004692, 0, 14, pt_IMSI_660004692)
    longueur_660004692=i_conv_ascii_dcb(pt_IMSI_660004692, pt_IMSI_DCB_660004692)
    erreur_660004692 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::IMSI, pt_IMSI_DCB_660004692, longueur_660004692)
  SINON
    erreur_660004692 = affectation_tab_660004265(g_iartout, $Tdpvgsm::IMSI, "999999999999999F")
  FINSI
FINSI


#T3t1.5 DATE    :-  :-  :1VAL :callStartTime
# Sdate Platine
Start_Date_660004692=i_get_art_field(g_iartin, $TprimsVoLTE::StartTime_SDATE)
Date_Debut_660004692 = i_DHgetLocalTime(NUMTAB_660004692, 7, Start_Date_660004692)
SI ( Date_Debut_660004692 == 0)
ALORS
  trace ("erreur conversion date StartTime_SDATE")
  ERREUR_660004692 = ERR_CONV_660004692
  code_rejet_660004692 = MODULE_660004692 + ERREUR_660004692   + EFFICACE_660004692
  erreur_660004692 = i_PlvMessEmettre(6662, 2, g_iartin, "", 2, code_rejet_660004692, "callStartTime", 0)
  SAUT DISTR_ERR
SINON
  erreur_660004692=i_set_art_field(g_iartout, $Tdpvgsm::DATE, Date_Debut_660004692)
FINSI


#QC1546
#T3t1.6 DUREE           :-  :-  :1VAL :dduree

#T3t1.7 svcsup    :D  :-  :MSET :FF:1
#T3t1.8 tlserv    :-  :-  :MSET :12:1
#T3t1.9 support1  :-  :-  :MSET :FF:1

#T3t1.10 systype    :-  :-  :MSET :06:1
#T3t1.11 reserve2 :-  :-  :MSET :FF:1
#T3t1.12 origine    :-  :-  :MSET :FF:1
#T3t1.13 indeff   :-  :-  :MSET :00:1
SI (i_valid_field_n(g_iartin, $TprimsVoLTE::callStatus))
ALORS
  erreur_660004692=i_set_art_field(g_iartout, $Tdpvgsm::indeff, i_get_art_field(g_iartin, $TprimsVoLTE::callStatus))
FINSI

#T3t1.14 tterm    :-  :-  :MSET :FF:1
SI (Trans_ReturnCode_660004692 != -1)
ALORS
  erreur_660004692=i_set_art_field(g_iartout, $Tdpvgsm::tterm, Trans_ReturnCode_660004692)
FINSI

#T3t1.15 indtax   :-  :-  :MSET :FF:1
#T3t1.16 nbUT   :-  :-  :MSET :FF:4
#T3t1.17 chgcar   :-  :-  :MSET :FF:2
#T3t1.18 couleur    :-  :-  :MSET :FF:1

#T3t2 idpart
SI (i_strplcmp (pt_Dialled_660004692," ", 0, 1) != 0)
ALORS
  longueur_660004692=i_conv_ascii_dcb(pt_Dialled_660004692, pt_Dialled_DCB_660004692)
  # test longueur pour memcpy
  SI (longueur_660004692 > 19)
  ALORS
    longueur_660004692 = 19
  FINSI
  erreur_660004692 = i_resize_tlv(g_iartout, "T3t2", "idpart", longueur_660004692*8)
  erreur_660004692 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idpart, pt_Dialled_DCB_660004692, longueur_660004692)
SINON
  longueur_660004692=i_strlen(pt_Dialled_660004692)
  SI (longueur_660004692 > 19)
  ALORS
    longueur_660004692 = 19
  FINSI
  erreur_660004692 = i_resize_tlv(g_iartout, "T3t2", "idpart", longueur_660004692*8)
  erreur_660004692 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::idpart, pt_Dialled_660004692, longueur_660004692)
  erreur_660004692 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::idpart, 0, 0x00)
FINSI

#T3t3 local
#QC1527 Suppression de T3t3 si localisation est FFFFFFFFFFFFFFFFFF
SI (i_strcmp(pt_localisation_660004692,"FFFFFFFFFFFFFFFFFF") != 0)
ALORS
  longueur_660004692 = i_conv_ascii_dcb(pt_localisation_660004692, pt_localisation_DCB_660004692)
  erreur_660004692 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::local, pt_localisation_DCB_660004692, longueur_660004692)
  erreur_660004692 = i_resize_tlv( g_iartout, "T3t3", "local", longueur_660004692 * 8 )
SINON
	erreur_660004692 = i_supprChamp(g_iartout, "T3t3")
FINSI


#T3t4 MSISDN
# QC1488
#MSISDN   :-  :-  :MSET :FF:1
SI (b_URGENT_SANS_SIM_660004692 == 0)
ALORS
  SI (i_strplcmp (pt_calling_660004692," ",0,1) != 0)
  ALORS
    longueur_660004692=i_conv_ascii_dcb(pt_calling_660004692, pt_calling_DCB_660004692)
    # test longueur pour memcpy
    SI (longueur_660004692 > 19)
    ALORS
      longueur_660004692 = 19
    FINSI
    erreur_660004692 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", longueur_660004692*8)
    erreur_660004692 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MSISDN, pt_calling_DCB_660004692, longueur_660004692)
  SINON
    longueur_660004692=i_strlen(pt_calling_660004692)
    SI (longueur_660004692 > 19)
    ALORS
      longueur_660004692 = 19
    FINSI
    erreur_660004692 = i_resize_tlv(g_iartout, "T3t4", "MSISDN", longueur_660004692*8)
    erreur_660004692 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::MSISDN, pt_calling_660004692, longueur_660004692)
    erreur_660004692 = i_set_art_fieldtab(g_iartout, $Tdpvgsm::MSISDN, 0, 0x00)
  FINSI
SINON
  erreur_660004692 = i_supprChamp(g_iartout, "T3t4")
FINSI

#T3t7 estalloc
#  Sdate Platine
SI (i_valid_field_n(g_iartin, $TprimsVoLTE::srvRequesTime))
ALORS

  erreur_660004692 = i_ajoutChamp(g_iartout, "T3t7", "estalloc", 0x01)
  Request_Time_660004692=i_get_art_field(g_iartin, $TprimsVoLTE::srvRequesTime) + 86400
  Request_660004692 = i_DHgetLocalTime(NUMTAB_660004692, 7, Request_Time_660004692)
  erreur_660004692=i_set_art_field(g_iartout, $Tdpvgsm::estalloc, Request_660004692)
FINSI

#T3t30
#T4t30.1
date_audit_660004692 = i_DHgetLocalTime(NUMTAB_660004692, 7, i_date_audit())
erreur_660004692 = i_set_art_field(g_iartout, $Tdpvgsm::timeInCE, date_audit_660004692)

#T4t30.2
# QC1405
SI (g_ieec > 500)
ALORS
  erreur_660004692 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec - 500)
SINON
  erreur_660004692 = i_set_art_field(g_iartout, $Tdpvgsm::eec, g_ieec)
FINSI
#/QC1405

#T3t43
#T4t43.3 transactionDesc :- :-  :1VAL :ICID

#T3t66
#T4t66.1
#V4T66.1.1 RecSeqNumber :D  :-  :1VAL :RecordSeqNb
#V4T66.1.2 SigVolum :D  :-  :1VAL :SigVolum
#V4T66.1.3 ExtBearVolum :D  :-  :1VAL :ExtBearVolum
#V4T66.1.4 TotalVolum :D  :-  :1VAL :TotalVolum

#V4T66.1.5 CallEndTStamp   :D   :-    :1VAL :callEndTime
# Sdate Platine
SI (i_valid_field_n(g_iartin, $TprimsVoLTE::callEndTime))
ALORS
  End_Time_660004692 =i_get_art_field(g_iartin, $TprimsVoLTE::callEndTime) + 86400
  Date_Fin_660004692 = i_DHgetLocalTime(NUMTAB_660004692, 7, End_Time_660004692)
  erreur_660004692=i_set_art_field(g_iartout, $Tdpvgsm::CallEndTStamp, Date_Fin_660004692)
FINSI

#V4t66.1.6 CauseRecClose  :D  :-  :1VAL :CausForRecClos
#V4t66.1.7SessionTerm :D  :-  :1VAL :sessionTerm

# cas de suppression du champ T4t66.1 .
SI (
  (i_valid_field_n(g_iartin, $TprimsVoLTE::RecordSeqNb))
  + (i_valid_field_n(g_iartin, $TprimsVoLTE::SigVolumT))
  + (i_valid_field_n(g_iartin, $TprimsVoLTE::ExtBearVolum))
  + (i_valid_field_n(g_iartin, $TprimsVoLTE::TotalVolum))
  + (i_valid_field_n(g_iartin, $TprimsVoLTE::callEndTime))
  + (i_valid_field_n(g_iartin, $TprimsVoLTE::CausForRecClos))
  + (i_valid_field_n(g_iartin, $TprimsVoLTE::sessionTerm))
  + (i_valid_field_n(g_iartin, $TprimsVoLTE::CORLStatus))
  ) == 0
ALORS
  erreur_660004692 = i_supprChamp(g_iartout, "T4t66.1")
FINSI


#V4T66.1.8 CORLStatus      :D   :-    :MSET :FF
SI (i_valid_field_n(g_iartin, $TprimsVoLTE::CORLStatus))
ALORS
  erreur_660004692 = i_get_art_str(g_iartin, $TprimsVoLTE::CORLStatus, pt_CORLStatus_660004692)
  v_CORLStatus_660004692 = CONV_ASCIINUMDEC_INT_660004265(pt_CORLStatus_660004692)
  SI  (v_CORLStatus_660004692 == -1)
  ALORS
    trace ( "[TprimsVoLTE DISTR]  -- ERREUR conversion champ CORLStatus---")
  SINON
    erreur_660004692=i_set_art_field(g_iartout, $Tdpvgsm::CORLStatus, v_CORLStatus_660004692)
  FINSI
FINSI

#T4t66.2
#SgsnAddr :-  :-  :MSET :00

longueur_660004692 = 0
SI (i_valid_field_n(g_iartin, $TprimsVoLTE::SgsnAddr))
ALORS
  longueur_660004692 = i_get_art_field(g_iartin, $TprimsVoLTE::SgsnAddr -1)
FINSI
SI (longueur_660004692 > 2)
ALORS
  # test longueur pour memcpy
  SI (longueur_660004692 > 16)
  ALORS
    longueur_660004692 = 16
  FINSI
  erreur_660004692 = i_resize_tlv(g_iartout, "T4t66.2", "SgsnAddr", longueur_660004692)
  erreur_660004692 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::SgsnAddr, i_get_art_fieldptr(g_iartin, $TprimsVoLTE::SgsnAddr), longueur_660004692)
SINON
  erreur_660004692 = i_supprChamp(g_iartout, "T4t66.2")
FINSI

#T4t66.3
#GGSNAddr :-  :-  :MSET :00
longueur_660004692 = 0
SI (i_valid_field_n(g_iartin, $TprimsVoLTE::ggsnAddr))
ALORS
  longueur_660004692 = i_get_art_field(g_iartin, $TprimsVoLTE::ggsnAddr -1)
FINSI
SI (longueur_660004692 > 2)
ALORS
  # test longueur pour memcpy
  SI (longueur_660004692 > 16)
  ALORS
    longueur_660004692 = 16
  FINSI
  erreur_660004692 = i_resize_tlv(g_iartout, "T4t66.3", "GGSNAddr", longueur_660004692)
  erreur_660004692 = i_memcpy_art_field_n(g_iartout, $Tdpvgsm::GGSNAddr, i_get_art_fieldptr(g_iartin, $TprimsVoLTE::ggsnAddr), longueur_660004692)
SINON
  erreur_660004692 = i_supprChamp(g_iartout, "T4t66.3")
FINSI

#T4t66.4
#SubRecordType  :-  :-  :1VAL :SubRecordType
#T4t66.5
#TransCalledNum :-  :-  :1VAL :CallPartyAdd
#T4t66.6
#OriginatingIOI :-  :-  :1VAL :OriginatingIOI
#T4t66.7
#TerminatingIOI :-  :-  :1VAL :TerminatingIOI
#T4t66.8
#AccessNetInfo  :-  :-  :1VAL :networkInfo
#T4t66.9
#SessionId  :-  :-  :1VAL :SessionID
#T4t66.10
#NodeIdentifier :-  :-  :1VAL :CSCFId
#T4t66.11
#AppliServerId  :-  :-  :1VAL :ASId
#T4t66.12
#SIPMethod  :-  :-  :1VAL :SIPmethod
#T4t66.13
#PrivateUserId  :-  :-  :1VAL :PrivateUSID

# cas de suppression champ T3t66
SI (i_get_art_field(g_iartout, $Tdpvgsm::L3t66) == 0)
ALORS
  erreur_660004692 = i_supprChamp(g_iartout, "T3t66")
FINSI


#-------------------------------
# Appel fonction aiguillage
#-------------------------------
erreur_660004692 = aiguillage2_660004590 (g_iartin, g_iartout, DISTRIBUTION_SPECIALE_660004692, Multidistribution_Non_660004692)
SI (erreur_660004692 == TRAI_KO_660004692)
ALORS
  trace("<<<__LINE__<<<__FILE__<<< Erreur retour fonction aiguillage2")
  SAUT DISTR_ERR
FINSI
RETOUR TRAIT_OK


#--------------------------------
# Stockage en Errone
#---------------------------------

POINT DISTR_ERR

trace( "Stockage en errone de distribution")
res_660004692 = i_make_art_rej(g_iartin, g_iartout8, code_rejet_660004692)
res_660004692 = i_stocke_art( g_iartout8, 0, PT_ERRONE, 0)

RETOUR TRAIT_OK
#--------------------------------- fin TprimsVoLTE_dist.src ---------------------------

