DEFINITION C_Conversion_860026742 "Conversion"
DEFINITION ZONEMETRO_860026742 7
DEFINITION NUMTABSEL_860026742 0
DEFINITION NUMTABSEL1_860026742 1
DEFINITION NUMTAB_860026742 1
DEFINITION C_Article_860026742 "Tv2oipSBC"
DEFINITION C_InstSYMP_860026742 "SYMP"
DEFINITION C_TsymTv2oipSBC_860026742 "TsymTv2oipSBC"
DEFINITION C_Inst42L_860026742 "42L"
REGISTRE ENTIER b_EFFICACE_860026742
REGISTRE ENTIER duree_860026742
REGISTRE ENTIER date_GMT_860026742
REGISTRE ENTIER erreur_860026742
REGISTRE ENTIER b_Idus_Internat_860026742
REGISTRE ENTIER IDUS_INF_860026742
REGISTRE ENTIER b_IP_REU_MAY_860026742
REGISTRE ENTIER numzone_860026742
REGISTRE ENTIER HLAHM1_860026742
REGISTRE ENTIER taille_860026742
REGISTRE ENTIER indice_860026742
REGISTRE ENTIER code_errone_860026742
REGISTRE ENTIER res_860026742
REGISTRE ENTIER inst42L_860026742
REGISTRE ENTIER b_DTMF_860026742
REGISTRE ENTIER b_DTMF_transmis_860026742
REGISTRE ENTIER b_DEDE_INTERNAT_860026742
REGISTRE ENTIER flag_SYMP_860026742
REGISTRE ENTIER longueur_860026742
REGISTRE ENTIER date_MET_860026742
REGISTRE ENTIER instECCv_860026742
REGISTRE ENTIER instSYMP_860026742
REGISTRE ENTIER DEDE_INF_860026742
REGISTRE POINTEUR pt_CALLING_860026742
REGISTRE POINTEUR pt_CALLED_860026742
REGISTRE POINTEUR pt_IDUS_NUM_860026742
REGISTRE POINTEUR pt_TEMP_860026742
REGISTRE POINTEUR pt_IDUS_860026742
REGISTRE POINTEUR pt_debChamp1_860026742
REGISTRE POINTEUR pt_debChamp2_860026742
REGISTRE POINTEUR pt_debChamp3_860026742
REGISTRE POINTEUR pt_DTMF_860026742
REGISTRE POINTEUR pt_DEDE_NUM_860026742
REGISTRE POINTEUR pt_sgtqs_860026742
REGISTRE POINTEUR pt_BANIP_RTC_860026742
REGISTRE POINTEUR pt_TEMP1_860026742
##############################################################################
# DISTRIBUTION
#  Tv2oipSBC: DC plateforme SIP
#  Creation JLG 02/06/2006
#
# ENTREE :
# Tv2oipSBC	g_iartin
# Tv2oipSBC	g_iartout
#
# REFERENTIELS :
# TD_42L (-6-FC)
#
# SORTIE :
# ECC distribuees + conversion + erronees
# 	SYMPHONIE	(TsymTv2oipSBC		, g_iartout6)
#
##############################################################################
#  HISTORIQUE
# 07/10/2014 - THE/DRE - # G4R8 Lot1 ####
# 07/04/2015 - THE/DRE - # G4R8C8 prise en compte <> format CallingNB et calledNB
#
##############################################################################



#############################################



#############################################
# G4R8 Lot1 ####


#############################################

b_EFFICACE_860026742		 = 0
date_GMT_860026742		 = 0
erreur_860026742			 = 0
b_Idus_Internat_860026742	 = 0
IDUS_INF_860026742		 = 0
b_IP_REU_MAY_860026742	 = 0
numzone_860026742			 = 0
taille_860026742			 = 0
code_errone_860026742		 = 0
inst42L_860026742			 = 0
b_DTMF_860026742			 = 0
b_DTMF_transmis_860026742	 = 1
b_DEDE_INTERNAT_860026742	 = 0
flag_SYMP_860026742		 = 0
longueur_860026742		 = 0
res_860026742				 = 0
duree_860026742			 = 0
HLAHM1_860026742			 = -1
date_MET_860026742		 = 0
DEDE_INF_860026742		 = 0


#############################################

# Initialisations pt
## G4R8 Lot1 
#pt_Message	 = "pt_Message987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210"

# G4R8 Lot1 
pt_CALLING_860026742	= "pt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLINGpt_CALLING"
pt_CALLED_860026742	= "pt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLEDpt_CALLE"
pt_IDUS_NUM_860026742	= "pt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS_NUMpt_IDUS"
pt_TEMP_860026742		= "pt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPpt_TEMPp"
pt_IDUS_860026742		= "pt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSpt_IDUSp"
pt_debChamp1_860026742 	= "pt_debChamp1"
pt_debChamp2_860026742 	= "pt_debChamp2"
pt_debChamp3_860026742 	= "pt_debChamp3"
pt_DTMF_860026742		= "pt_DTMFpt_DTMFpt_DTMFpt_DTMFpt_DTMFpt_DTMFpt_DTMF"
pt_DEDE_NUM_860026742	= "pt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE_NUMpt_DEDE"
pt_sgtqs_860026742	= "pt_sgtqspt_sgtqspt_sgtqs"
pt_BANIP_RTC_860026742 	= "pt_BANIP_RTC"
pt_TEMP1_860026742	 = "pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_TEMP1pt_T"
#
#
##############################################
#
## G4R8 Lot1 
i_strcpy(pt_CALLING_860026742,"")
i_strcpy(pt_CALLED_860026742,"")
i_strcpy(pt_IDUS_NUM_860026742,"")
i_strcpy(pt_TEMP_860026742,"")
i_strcpy(pt_IDUS_860026742,"")
i_strcpy (pt_debChamp1_860026742,"")
i_strcpy (pt_debChamp2_860026742,"")
i_strcpy (pt_debChamp3_860026742,"")
i_strcpy(pt_DTMF_860026742,"")
i_strcpy(pt_DEDE_NUM_860026742,"")
i_strcpy (pt_sgtqs_860026742,"")
i_strcpy(pt_BANIP_RTC_860026742, "")
i_strcpy (pt_TEMP1_860026742,"")


############################################################################################################################################
trace (" __LINE__ #### DEBUT du Pcode de distribution :__FILE__ #### ")
############################################################################################################################################

##############################################################################
# Creation article Conversion (utilise a plusieurs endroits)
##############################################################################

erreur_860026742 = i_cree_art(C_Conversion_860026742,g_iartout10)

erreur_860026742 = i_dup_art_id(g_iartin, g_iartout)

##############################################################################
# Variables fonctionnelles
##############################################################################

##### EFFICACITE ##########

duree_860026742=i_get_art_field(g_iartout, $Tv2oipSBC::DUREE)

SI ( duree_860026742 != 0 )
ALORS
	b_EFFICACE_860026742 = 1
FINSI

##### DATE_GMT ############

date_MET_860026742 = i_get_art_field(g_iartout,$Tv2oipSBC::DATE)
date_GMT_860026742 = i_DHgetCe2gTime(NUMTAB_860026742,ZONEMETRO_860026742,date_MET_860026742)

##############################################################################
# IDUS_NUM, IDUS_INF
##############################################################################

#################### IDUS_NUM ####################
# CallingNb pour IDUS_NUM
# Suppression de < sip: ou tel: > puis de < + >
#sip:+33296616791@orange-multimedia.fr
#sip:0973581215@FSFR.SBC.SFR.NET;user=phone
#sip:0243796318@orange-multimedia.fr;user=phone
#sip:+33490641483@orange-multimedia.fr:5060
#sip:anonymous@anonymous.invalid
#sip:3103@voicemail.orange-multimedia.net;user=phone
#sip:+262262658733@FSFR.SBC.SFR.NET;user=phone

# voir si n?cessaire
#erreur = i_ajoutChampNum(g_iartout, $Tv2oip::T4idus,$Tv2oip::IDUS_NUM,6)

erreur_860026742 = i_get_art_str(g_iartout, $Tv2oipSBC::CallingNb, pt_CALLING_860026742)

#################### pt_CALLING, suppression partie apres @ ############
taille_860026742 = i_strlen(pt_CALLING_860026742)
erreur_860026742 = i_recupererValeur(pt_CALLING_860026742, pt_TEMP_860026742, taille_860026742, '@')
i_strcpy(pt_CALLING_860026742, pt_TEMP_860026742 )


#################### pt_CALLING detection et suppression de tel: ou sip: #####
SI (i_adequation_chaine_expreg (pt_CALLING_860026742, "^sip:") == 0 ) || (i_adequation_chaine_expreg (pt_CALLING_860026742, "^tel:") == 0)
ALORS
	i_get_sub_str(pt_CALLING_860026742, 4, -1, pt_CALLING_860026742)
	SI (i_strplcmp ( pt_CALLING_860026742, "847", 0, 3) == 0 )
	ALORS
		i_get_sub_str(pt_CALLING_860026742, 3, -1, pt_CALLING_860026742)
	FINSI
# G4R8C8
SINON
	indice_860026742 = RECHERCHE_CHAINE_860026233(pt_CALLING_860026742, "sip:")
	SI indice_860026742 >= 0 
	ALORS
		i_get_sub_str(pt_CALLING_860026742, indice_860026742 + 4, -1, pt_CALLING_860026742)
		SI (i_strplcmp ( pt_CALLING_860026742, "847", 0, 3) == 0 )
		ALORS
			i_get_sub_str(pt_CALLING_860026742, 3, -1, pt_CALLING_860026742)
		FINSI
	SINON
		indice_860026742 = RECHERCHE_CHAINE_860026233(pt_CALLING_860026742, "tel:")
		SI indice_860026742 >= 0
		ALORS
			i_get_sub_str(pt_CALLING_860026742, indice_860026742 + 4, -1, pt_CALLING_860026742)
			SI (i_strplcmp ( pt_CALLING_860026742, "847", 0, 3) == 0 )
			ALORS
				i_get_sub_str(pt_CALLING_860026742, 3, -1, pt_CALLING_860026742)
			FINSI
		FINSI
	FINSI
FINSI

i_strcpy(pt_IDUS_NUM_860026742, pt_CALLING_860026742 )

##### pt_CALLING Suppression de "+" si present au debut du champ #####

SI (i_strplcmp( pt_CALLING_860026742, "+", 0, 1 ) == 0 )
ALORS
	b_Idus_Internat_860026742 = 1
	i_get_sub_str(pt_CALLING_860026742,1,-1,pt_CALLING_860026742)
FINSI

SI (i_strplcmp(pt_CALLING_860026742,"00",0,2) == 0 )
ALORS
	b_Idus_Internat_860026742 = 1
	i_get_sub_str(pt_CALLING_860026742,2,-1,pt_CALLING_860026742)
FINSI

SI b_Idus_Internat_860026742
ALORS
	SI (i_strplcmp(pt_CALLING_860026742, "33", 0, 2) == 0 )
	ALORS
		i_get_sub_str(pt_CALLING_860026742,2,-1,pt_CALLING_860026742 )
		b_Idus_Internat_860026742 = 0
	SINON
		SI ( i_strplcmp(pt_CALLING_860026742,"262",0,3) == 0 
		  || i_strplcmp(pt_CALLING_860026742,"590",0,3) == 0
		  || i_strplcmp(pt_CALLING_860026742,"594",0,3) == 0 
		  || i_strplcmp(pt_CALLING_860026742,"596",0,3) == 0 )
		ALORS
			i_get_sub_str(pt_CALLING_860026742,3,-1,pt_CALLING_860026742)
			b_Idus_Internat_860026742 = 0
		FINSI
	FINSI
FINSI

SI ( (b_Idus_Internat_860026742 == 0 ) && (i_strplcmp(pt_CALLING_860026742, "0", 0, 1 ) == 0 )  &&  (i_strplcmp(pt_CALLING_860026742, "0", 1, 1 ) != 0 ) )
ALORS
	i_get_sub_str(pt_CALLING_860026742,1,-1,pt_CALLING_860026742)
FINSI

i_strcpy( pt_IDUS_860026742, pt_CALLING_860026742 )
longueur_860026742 = i_strlen(pt_CALLING_860026742 )

SI b_Idus_Internat_860026742
ALORS
	IDUS_INF_860026742 = 0xC0
SINON
	#SI longueur <= 6 || (i_strcmp(pt_CALLING, "anonymous" ) == 0 )
	SI longueur_860026742 <= 6 || RECHERCHE_CHAINE_860026233(LCASE_860026233(pt_CALLING_860026742), "anonymous" ) >= 0 || RECHERCHE_CHAINE_860026233(LCASE_860026233(pt_CALLING_860026742), "unavailable") >= 0
	ALORS
		IDUS_INF_860026742 = 0x40
	SINON
		IDUS_INF_860026742 = 0x80
	FINSI
FINSI

SI IDUS_INF_860026742 == 0x80
ALORS
	longueur_860026742 = i_conv_ascii_dcb(pt_CALLING_860026742, pt_TEMP_860026742 )
	erreur_860026742 = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_TEMP_860026742, longueur_860026742)
	numzone_860026742 = i_DHgetZoneID(NUMTABSEL1_860026742, g_iartout10)
	HLAHM1_860026742 = i_DHgetLocalTime(NUMTAB_860026742,numzone_860026742,date_GMT_860026742)
FINSI

SI IDUS_INF_860026742 == 0x80 && ( i_strplcmp(pt_CALLING_860026742,"976",0,3) == 0 )
ALORS
	b_IP_REU_MAY_860026742 = 1
FINSI

SI b_IP_REU_MAY_860026742
ALORS
	#NDRTC
	#############################################################################
	# Recherche instances 42L BANIP
	#############################################################################

	inst42L_860026742 = i_LireInstanceECC(C_Inst42L_860026742)

	SI (!inst42L_860026742)
	ALORS
		erreur_860026742 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"42L",C_Article_860026742,g_ieec)
		SAUT DISTRI_ERR
	FINSI

	longueur_860026742 = i_conv_ascii_dcb (pt_CALLING_860026742, pt_TEMP_860026742)

	SI (i_EnvoiReqConsTabDist( TD_42L, date_GMT_860026742,pt_TEMP_860026742, longueur_860026742, 0, 1)!=0)
	ALORS
		code_errone_860026742 = 0xA0C0
		code_errone_860026742 = code_errone_860026742 + b_EFFICACE_860026742
		erreur_860026742 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026742,C_Inst42L_860026742,C_Article_860026742)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026742 = i_LireReqConsTabDist()

	SI ( erreur_860026742 != 0 )
	ALORS
		code_errone_860026742 = 0xA0C0
		code_errone_860026742 = code_errone_860026742 + b_EFFICACE_860026742
		erreur_860026742 = i_PlvMessEmettre(8508,2,g_iartin,"",3,C_Article_860026742,"LireReqConsTabDist",C_Inst42L_860026742)
		SAUT DISTRI_ERR
	FINSI

	# NDRTC
	# utilisation de conv_ascii_dcb
	instECCv_860026742 = i_LireEntierECCv( inst42L_860026742 )
	res_860026742 = i_LireInfoECC( inst42L_860026742, instECCv_860026742 )

	i_strcpy(pt_BANIP_RTC_860026742," ")
	SI ( res_860026742 != 0)
	ALORS
		erreur_860026742 = i_LireImsiInfo( res_860026742, 0, 5, pt_BANIP_RTC_860026742 )
	FINSI

	SI i_strcmp(pt_BANIP_RTC_860026742,g_inull) != 0 && i_strcmp(pt_BANIP_RTC_860026742," ") != 0
	ALORS
		taille_860026742 = i_conv_ascii_dcb (pt_BANIP_RTC_860026742, pt_TEMP1_860026742)
		erreur_860026742 = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_TEMP1_860026742, taille_860026742)
		numzone_860026742 = i_DHgetZoneID(NUMTABSEL1_860026742, g_iartout10)
	FINSI

	SI numzone_860026742 == 5
	ALORS
		HLAHM1_860026742 = i_DHgetLocalTime(NUMTAB_860026742,numzone_860026742,date_GMT_860026742)
	FINSI
FINSI

#################### SGTQS ###################################################

i_strcpy(pt_sgtqs_860026742, i_LireEECSGTQS(g_ieec))

##############################################################################
# DEDE_NUM_PORTA
##############################################################################
#################### IDUS_NUM ####################
# CalledNb pour DEDE_NUM
# Suppression de < sip: ou tel: > puis de < + >
#sip:0251694440@orange-multimedia.fr
#tel:+33241485974
#sip:+33243932368@orange-multimedia.fr
#sip:3103@orange-multimedia.fr
#sip:*31%23@ims-ft-group.com
#sip:%2331%23@ims-ft-group.com
#sip:%2331*0969990805@ims-ft-group.com
#sip:%2331*@ims-ft-group.com>"
#sip:*21*0550500000%23@ims-ft-group.com

erreur_860026742 = i_get_art_str(g_iartout,$Tv2oipSBC::CalledNb,pt_CALLED_860026742 )

SI (i_adequation_chaine_expreg (pt_CALLED_860026742, "^sip:") == 0) || (i_adequation_chaine_expreg (pt_CALLED_860026742, "^tel:") == 0)
ALORS
	i_get_sub_str(pt_CALLED_860026742, 4, -1, pt_CALLED_860026742)
# G4R8C8
SINON
	indice_860026742 = RECHERCHE_CHAINE_860026233(pt_CALLED_860026742, "sip:")
	SI indice_860026742 >= 0 
	ALORS
		i_get_sub_str(pt_CALLED_860026742, indice_860026742 + 4, -1, pt_CALLED_860026742)
	SINON
		indice_860026742 = RECHERCHE_CHAINE_860026233(pt_CALLED_860026742, "tel:")
		SI indice_860026742 >= 0
		ALORS
			i_get_sub_str(pt_CALLED_860026742, indice_860026742 + 4, -1, pt_CALLED_860026742)
		FINSI
	FINSI
FINSI


#################### pt TranslatedNb_DCB, suppression partie apres @ #############

longueur_860026742 = i_strlen(pt_CALLED_860026742)

i_strcpy (pt_DEDE_NUM_860026742,pt_CALLED_860026742)
erreur_860026742 = i_recupererValeur(pt_DEDE_NUM_860026742,pt_CALLED_860026742,longueur_860026742,'@')

erreur_860026742 = i_recupererValeur(pt_CALLED_860026742, pt_TEMP_860026742, i_strlen(pt_CALLED_860026742),';')
i_strcpy (pt_CALLED_860026742,pt_TEMP_860026742)

i_strcpy (pt_DEDE_NUM_860026742,pt_CALLED_860026742)
erreur_860026742 = i_adequation_chaine_expreg (pt_CALLED_860026742, "%23")

SI erreur_860026742 == 0
ALORS
	i_strcpy(pt_DEDE_NUM_860026742,REMPLACE_CHAINE_860026233(pt_CALLED_860026742,"%23","#"))
	i_strcpy(pt_CALLED_860026742,pt_DEDE_NUM_860026742)
FINSI

indice_860026742 = 0

taille_860026742 = i_strlen(pt_CALLED_860026742)
i_get_sub_str(pt_CALLED_860026742, 0, 0, pt_debChamp1_860026742)
i_get_sub_str(pt_CALLED_860026742, 0, 1, pt_debChamp2_860026742)
i_get_sub_str(pt_CALLED_860026742, 0, 3, pt_debChamp3_860026742)

######################################################################################
SI ( i_strcmp("*", pt_debChamp1_860026742) == 0) || ( i_strcmp("#", pt_debChamp1_860026742) == 0)
ALORS
	b_DTMF_860026742 = 1
	i_get_sub_str(pt_CALLED_860026742, 1, -1, pt_CALLED_860026742)
	indice_860026742 = RECHERCHE_CHAINE_860026233(pt_CALLED_860026742, "*")
	SI indice_860026742 < 0 
	ALORS
		indice_860026742 = RECHERCHE_CHAINE_860026233(pt_CALLED_860026742, "#")
	FINSI
	i_get_sub_str(pt_CALLED_860026742, 0, indice_860026742 + 1, pt_DTMF_860026742)
SINON
	erreur_860026742 = i_format_str2( pt_TEMP1_860026742, "%s%s", "INp", pt_debChamp3_860026742)
	i_strcpy(pt_TEMP_860026742, i_get_tab_field("Inter", date_GMT_860026742, pt_TEMP1_860026742))

	SI (i_strcmp( pt_TEMP_860026742,g_inull) != 0 )
	ALORS
		b_DTMF_860026742 = 1
		i_strcpy(pt_DTMF_860026742,pt_debChamp3_860026742)
#		longueur = 4
		SI (i_strcmp( pt_TEMP_860026742,"2") == 0 )
		ALORS
			b_DTMF_transmis_860026742 = 0
		FINSI
	FINSI
FINSI

longueur_860026742 = i_strlen(pt_DTMF_860026742)
SI longueur_860026742 > 0
ALORS
	SI longueur_860026742 < taille_860026742
	ALORS
		i_get_sub_str(pt_CALLED_860026742, longueur_860026742, -1, pt_TEMP_860026742)
		i_strcpy(pt_CALLED_860026742,pt_TEMP_860026742)
	SINON
		i_strcpy (pt_CALLED_860026742,"")
	FINSI
FINSI

# suppression du "#" de fin
i_get_sub_str(pt_CALLED_860026742, -1, -1, pt_TEMP_860026742)
SI i_strcmp(pt_TEMP_860026742, "#") == 0
ALORS
	i_get_sub_str(pt_CALLED_860026742, 0, -2, pt_CALLED_860026742)
FINSI

############################################################################################################################################

taille_860026742 = i_strlen(pt_CALLED_860026742)
i_get_sub_str(pt_CALLED_860026742, 0, 0, pt_debChamp1_860026742)
i_get_sub_str(pt_CALLED_860026742, 0, 1, pt_debChamp2_860026742)

SI ( i_strcmp("+", pt_debChamp1_860026742) == 0)
ALORS
	SI taille_860026742 > 1
	ALORS
		i_get_sub_str(pt_CALLED_860026742, 1, taille_860026742-1, pt_TEMP_860026742)
		i_strcpy(pt_CALLED_860026742,pt_TEMP_860026742)
		b_DEDE_INTERNAT_860026742 = 1
	FINSI
SINON
	SI ( i_strcmp("00", pt_debChamp2_860026742) == 0)
	ALORS
		SI taille_860026742 > 2
		ALORS
			i_get_sub_str(pt_CALLED_860026742, 2, taille_860026742-1, pt_TEMP_860026742)
			i_strcpy(pt_CALLED_860026742,pt_TEMP_860026742)
			b_DEDE_INTERNAT_860026742 = 1
		FINSI
	FINSI
FINSI

#################### suppression de 33 eventuel ###########
taille_860026742 = i_strlen(pt_CALLED_860026742)
i_get_sub_str(pt_CALLED_860026742, 0, 1, pt_debChamp1_860026742)
i_get_sub_str(pt_CALLED_860026742, 0, 2, pt_debChamp2_860026742)

SI ( i_strcmp("33", pt_debChamp1_860026742) == 0)
ALORS
	SI taille_860026742 > 2
	ALORS
		i_get_sub_str(pt_CALLED_860026742, 2, taille_860026742-1, pt_TEMP_860026742)
		i_strcpy(pt_CALLED_860026742,pt_TEMP_860026742)
		b_DEDE_INTERNAT_860026742 = 0
	FINSI
SINON
	SI ( i_strcmp("262", pt_debChamp2_860026742) == 0 || i_strcmp("594", pt_debChamp2_860026742) == 0 ||  i_strcmp("596", pt_debChamp2_860026742) == 0 ||  i_strcmp("590", pt_debChamp2_860026742) == 0)
	ALORS
		i_get_sub_str(pt_CALLED_860026742, 2, taille_860026742-1, pt_TEMP_860026742)
		i_strcpy(pt_CALLED_860026742,pt_TEMP_860026742)
		b_DEDE_INTERNAT_860026742 = 0
	FINSI
FINSI

taille_860026742 = i_strlen(pt_CALLED_860026742)

##############################################################################
# DEDE_INF (0x80 national, 0x40 special, 0xC0 international)
##############################################################################

SI b_DEDE_INTERNAT_860026742
ALORS
	DEDE_INF_860026742 = 0xC0
SINON
	SI taille_860026742 <= 6
	ALORS
		DEDE_INF_860026742 = 0x40
	SINON
		DEDE_INF_860026742 = 0x80
	FINSI
FINSI

##############################################################################
##### RECH_INSTANCE
##############################################################################

######  SYMPHONIE
instSYMP_860026742 = i_LireInstanceECC(C_InstSYMP_860026742)

SI (!instSYMP_860026742)
ALORS
	#trace(">>>__LINE__>>> Pas d'instance pour SYMPHONIE!")
	code_errone_860026742 = 0xA0B0
	code_errone_860026742 = code_errone_860026742 + b_EFFICACE_860026742
	erreur_860026742 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026742,C_InstSYMP_860026742,C_Article_860026742)
	SAUT DISTRI_ERR
FINSI

##############################################################################
# Criteres de distribution
##############################################################################

#----------------------------------------------------------------------------
# SYMPHONIE  : tous les DC vont a Symphonie
#----------------------------------------------------------------------------

#trace("********* Criteres distribution pour SYMPHONIE *********")
flag_SYMP_860026742 = 1

#################### MISE AU FORMAT POUR ECC #################################

#----------------------------------------------------------------------------
# Symphonie (TsymTv2oipSBC, g_iartout6)
#----------------------------------------------------------------------------

SI (flag_SYMP_860026742 == 1)
ALORS
	#trace("__LINE__: Duplication vers SYMPHONIE")
	erreur_860026742 = i_dup_art_tab(g_iartout,g_iartout6,C_TsymTv2oipSBC_860026742)

	SI i_valid_field_n(g_iartout, $Tv2oipSBC::TermIPAddr )
	ALORS
		erreur_860026742 = i_get_art_str(g_iartout, $Tv2oipSBC::TermIPAddr, pt_TEMP_860026742)
		taille_860026742 = i_strlen(pt_TEMP_860026742)
		erreur_860026742 = i_recupererValeur(pt_TEMP_860026742,pt_TEMP1_860026742,taille_860026742,':')
	FINSI

	taille_860026742 = i_strlen(pt_TEMP1_860026742)
	erreur_860026742 = i_resize_tlv( g_iartout6, "T3TermIPAddr", "TermIPAddr", taille_860026742 )
	erreur_860026742 = i_set_art_str( g_iartout6, $TsymTv2oipSBC::TermIPAddr , pt_TEMP1_860026742)

	#T3CallingFlow
	SI (i_get_art_field(g_iartout, $Tv2oipSBC::Octetsb ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::Octets, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::Packetb ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::Packets, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPavgJitteb ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPavgJitter, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPavglatenci ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPavglatency, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPmaxjitteb ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPmaxjitter, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPmaxLatenci ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPmaxLatency, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPpacketslosb ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPpacketslost, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTPavgjitteb ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTPavgjitter, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTPmaxJitteb ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTPmaxJitter, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTPpacketslosb ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTPpacketslost, 0xFFFFFFFF)
	FINSI

	# T3CalledFlow
	SI (i_get_art_field(g_iartout, $Tv2oipSBC::Octets0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::Octets1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::Packets0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::Packets1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPavgJitter0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPavgJitter1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPavglatency0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPavglatency1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPmaxjitter0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPmaxjitter1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPmaxLatency0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPmaxLatency1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTCPpacketslos0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTCPpacketslos1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTPavgjitter0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTPavgjitter1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTPmaxJitter0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTPmaxJitter1, 0xFFFFFFFF)
	FINSI

	SI (i_get_art_field(g_iartout, $Tv2oipSBC::RTPpacketslost0 ) & 0xffffffff) != 0
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::RTPpacketslost1, 0xFFFFFFFF)
	FINSI

	# ajout de tous les champs de T3ce
	erreur_860026742 = i_ajoutChampNum(g_iartout6, $TsymTv2oipSBC::T4_CCD,$TsymTv2oipSBC::CCD,6)
	erreur_860026742 = i_set_art_field(g_iartout6, $TsymTv2oipSBC::DATE, i_get_art_field(g_iartout,$Tv2oipSBC::DATE))

	# ******* HLAHM1 (DATE_LOCALE)**********
	SI HLAHM1_860026742 != -1
	ALORS
		erreur_860026742 = i_set_art_field(g_iartout6,$TsymTv2oipSBC::DATE_LOCALE,HLAHM1_860026742)
	SINON
		erreur_860026742 = i_supprChamp(g_iartout6, "T4_DATE_LOCALE")
	FINSI

	# ************** SGTQS *****************
	erreur_860026742=i_set_art_str(g_iartout6,$TsymTv2oipSBC::SGTQS,i_LireEECSGTQS( g_ieec ))

	# ************** ECC_FACT *****************
	erreur_860026742=i_set_art_str(g_iartout6, $TsymTv2oipSBC::ECC_FACT," ")

	# ************** CCD *****************
	erreur_860026742 = i_set_art_field(g_iartout6,$TsymTv2oipSBC::CCD,255)

	# Ajout Champ TYPCOM pour Symphonie 
	# **************** TYPCOM ****************
	erreur_860026742 = i_set_art_field(g_iartout6,$TsymTv2oipSBC::TYPCOM,255)

	# ************** IDUS_INF *****************
	erreur_860026742 = i_set_art_field(g_iartout6,$TsymTv2oipSBC::IDUS_INF, IDUS_INF_860026742 )

	# ************** DETR_INF *****************
	erreur_860026742 = i_set_art_field(g_iartout6,$TsymTv2oipSBC::DETR_INF,DEDE_INF_860026742)

	# ************** EFFICACITE *****************
	erreur_860026742 = i_set_art_field(g_iartout6,$TsymTv2oipSBC::EFFICACITE,b_EFFICACE_860026742)

FINSI

##############################################################################
# Envoi vers IECC
##############################################################################

#----------------------------------------------------------------------------
# SYMPHONIE (TsymTv2oipSBC, g_iartout6)
#----------------------------------------------------------------------------

SI (flag_SYMP_860026742 == 1)
ALORS
	#trace(">>>__LINE__>>> emission vers Symphonie")
	erreur_860026742  = i_stocke_art_iecc(g_iartout6,instSYMP_860026742)
FINSI

RETOUR TRAIT_OK

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

POINT DISTRI_ERR

#trace( ">>>__LINE__>>> Stockage en errone de distribution")
res_860026742 = i_make_art_rej(g_iartin, g_iartout8, code_errone_860026742)
res_860026742 = i_stocke_art( g_iartout8, 0, PT_ERRONE, 0)

RETOUR TRAIT_OK

##############################################################################
# Envoi en recyclage
##############################################################################

POINT RECYCLE

#trace( ">>>__LINE__>>> Stockage de l'article Tv2oipSBC en RECYCLAGE" )
res_860026742 = i_stocke_art( g_iartin, 0, PT_RECYCLE, 0 )

RETOUR TRAIT_OK

##############################################################################
# Stockage en ELIMINE EXPLICITE  (REJET3 = 1 ex: cas DC 119)
##############################################################################

POINT ELIMINE_EXP

#trace( ">>>__LINE__>>> Stockage en elimine explicite")
res_860026742 = i_stocke_art( g_iartin, 0, PT_DIVERS, 0 )

RETOUR TRAIT_OK

##############################################################################
# Stockage pour redistribution
##############################################################################

#res = i_stocke_art( g_iartin, 0, PT_REDIST|RD_TABLE6, 0 )

RETOUR TRAIT_OK

#--------------Fin Pcode Distribution Tv2oipSBC_dis.src------------------------

