feat: create cook branch
This commit is contained in:
1 parent
9a139c52c6
commit
025a455e17
70 files changed
+3603
-11829
No files matched your search
Binary file not shown.
Binary file not shown.
+1
-184
@@ -290,7 +290,7 @@ extern int gx_fsm(long sec, int msec);
|
|||||||
|
|
||||||
/*----------------------------------------------------*/
|
/*----------------------------------------------------*/
|
||||||
|
|
||||||
static u8 wxc2_version[4] = {1, 0, 1, 46};
|
static u8 wxc2_version[4] = {1, 0, 1, 50};
|
||||||
//static char wxc2_mini_version[4]={""};
|
//static char wxc2_mini_version[4]={""};
|
||||||
|
|
||||||
static int wxc2_update_version(char *state_str)
|
static int wxc2_update_version(char *state_str)
|
||||||
@@ -730,188 +730,6 @@ static int CheckHDLicense(unsigned char *HDSerailNumber)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1//def Kylin_and_2204_lic
|
|
||||||
static int GetHDInfo()
|
|
||||||
{
|
|
||||||
FILE *fpConf=NULL;
|
|
||||||
int i,j=0,k;
|
|
||||||
char ethmac[64]="",meminfo[64]="",hwinfo[128]="",*start,*offset,*offset_0,buf[8192]="",tmp[2048]="";//,cpuinfo[64]=""
|
|
||||||
char ascii_buf[128] = {0};
|
|
||||||
unsigned char TmpStr[64] = {0}, act_req_code[128] = {0}, act_req_code_des[128] = {0};
|
|
||||||
int ret, offset_len;
|
|
||||||
|
|
||||||
printf("Get HD info ...\n");
|
|
||||||
|
|
||||||
memset(ethmac, 0, 64);
|
|
||||||
sprintf(buf,"ip a > ../log/hwinfo");
|
|
||||||
ret = system(buf);
|
|
||||||
fpConf = fopen("../log/hwinfo","r");
|
|
||||||
if (fpConf == NULL) {
|
|
||||||
printf("Log directory may be missing!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ret = fread(buf,2048,1,fpConf);
|
|
||||||
start = buf;
|
|
||||||
for (;;) {
|
|
||||||
offset = strstr(start,"ether ");
|
|
||||||
if (offset == NULL) {
|
|
||||||
offset = strstr(start,"HWaddr ");
|
|
||||||
offset_len = 7;
|
|
||||||
} else {
|
|
||||||
offset_len = 6;
|
|
||||||
}
|
|
||||||
if (offset != NULL) {
|
|
||||||
strncpy(tmp, start, offset-start);
|
|
||||||
tmp[offset-start] = 0;
|
|
||||||
if (strstr(tmp, "docker") != NULL) {
|
|
||||||
start = offset + offset_len;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
offset += offset_len;
|
|
||||||
for(i=0,j=0;i<64;i++) {
|
|
||||||
if ((*(offset+i)=='\n') ||
|
|
||||||
(*(offset+i)==' ')) {
|
|
||||||
ethmac[j] = 0;
|
|
||||||
break;
|
|
||||||
} else if (*(offset+i)==':') {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
ethmac[j] = tolower(*(offset+i));
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ethmac[j] = 0;
|
|
||||||
}
|
|
||||||
fclose(fpConf);
|
|
||||||
remove("../log/hwinfo");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int uuid_or_cpuid=0; //0=CPUID, 1=UUID
|
|
||||||
memset(meminfo, 0, 64);
|
|
||||||
sprintf(buf,"dmidecode | grep UUID > ../log/hwinfo");
|
|
||||||
ret = system(buf);
|
|
||||||
fpConf = fopen("../log/hwinfo","r");
|
|
||||||
if(fpConf != NULL) {
|
|
||||||
ret = fread(buf,2048,1,fpConf);
|
|
||||||
offset_0=offset = strstr(buf,"UUID: ");
|
|
||||||
if (offset != NULL) {
|
|
||||||
uuid_or_cpuid = 1;
|
|
||||||
for(i=6,j=0;i<64;i++) {
|
|
||||||
if (*(offset+i)=='\n') {
|
|
||||||
meminfo[j] = 0;
|
|
||||||
break;
|
|
||||||
} else if (isdigit(*(offset+i))) {
|
|
||||||
meminfo[j] = *(offset+i);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fpConf);
|
|
||||||
remove("../log/hwinfo");
|
|
||||||
}
|
|
||||||
|
|
||||||
if( uuid_or_cpuid == 0) {//UUID not found
|
|
||||||
// CPUID
|
|
||||||
memset(meminfo, 0, 64);
|
|
||||||
sprintf(buf,"dmidecode -t 4 | grep ID >../log/hwinfo");
|
|
||||||
ret = system(buf);
|
|
||||||
fpConf = fopen("../log/hwinfo","r");
|
|
||||||
if(fpConf != NULL) {
|
|
||||||
ret = fread(buf,2048,1,fpConf);
|
|
||||||
offset_0=offset = strstr(buf,"ID: ");
|
|
||||||
if (offset != NULL) {
|
|
||||||
for(i=4,j=0;i<64;i++) {
|
|
||||||
if (*(offset+i)=='\n') {
|
|
||||||
meminfo[j] = 0;
|
|
||||||
break;
|
|
||||||
} else if (isdigit(*(offset+i))) {
|
|
||||||
meminfo[j] = *(offset+i);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
offset = strstr(offset_0+4,"ID: ");
|
|
||||||
if (offset != NULL) {
|
|
||||||
for(i=4;i<64;i++) {
|
|
||||||
if (*(offset+i)=='\n') {
|
|
||||||
meminfo[j] = 0;
|
|
||||||
break;
|
|
||||||
} else if (isdigit(*(offset+i))) {
|
|
||||||
meminfo[j] = *(offset+i);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fpConf);
|
|
||||||
remove("../log/hwinfo");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(hwinfo, "");
|
|
||||||
strcat(hwinfo, ethmac);
|
|
||||||
i = j = strlen(ethmac);
|
|
||||||
hwinfo[i++] = ethmac[0];
|
|
||||||
hwinfo[i++] = ethmac[1];
|
|
||||||
hwinfo[i++] = ethmac[2];
|
|
||||||
hwinfo[i++] = ethmac[3];
|
|
||||||
hwinfo[i] = 0;
|
|
||||||
strcat(hwinfo, meminfo);
|
|
||||||
j = strlen(meminfo);
|
|
||||||
i += j;
|
|
||||||
hwinfo[i++] = ethmac[4];
|
|
||||||
hwinfo[i++] = ethmac[5];
|
|
||||||
hwinfo[i++] = ethmac[6];
|
|
||||||
hwinfo[i++] = ethmac[7];
|
|
||||||
hwinfo[i] = 0;
|
|
||||||
//strcat(hwinfo, cpuinfo);
|
|
||||||
//j = strlen(cpuinfo);
|
|
||||||
//i += j;
|
|
||||||
hwinfo[i++] = ethmac[8];
|
|
||||||
hwinfo[i++] = ethmac[9];
|
|
||||||
hwinfo[i++] = ethmac[10];
|
|
||||||
hwinfo[i++] = ethmac[11];
|
|
||||||
hwinfo[i] = 0;
|
|
||||||
|
|
||||||
j = strlen(hwinfo);
|
|
||||||
if (j == 0) {
|
|
||||||
printf("Missing Activation Request Info!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
k = (j + 7) / 8;
|
|
||||||
memset(hwinfo + j, '0', 128 - j);
|
|
||||||
|
|
||||||
memset(act_req_code, 0, 128);
|
|
||||||
for (i = 0; i < k; i++) {
|
|
||||||
memset(TmpStr, 0, 64);
|
|
||||||
DesCrypt(TmpStr, (unsigned char *)hwinfo + 8 * i, NULL, 0);
|
|
||||||
memcpy(act_req_code + 8 * i, TmpStr, 8);
|
|
||||||
}
|
|
||||||
memset(ascii_buf, 0, 128);
|
|
||||||
BcdToAscii(ascii_buf, act_req_code, k * 16);
|
|
||||||
|
|
||||||
fpConf = fopen("../log/Activation_request_code.txt","w");
|
|
||||||
if (fpConf != NULL) {
|
|
||||||
fprintf(fpConf, "%s\n", ascii_buf);
|
|
||||||
fclose(fpConf);
|
|
||||||
} else {
|
|
||||||
printf("Missing Activation_request_code file!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(act_req_code_des, 0, 128);
|
|
||||||
for (i = 0; i < k; i++) {
|
|
||||||
memset(TmpStr, 0, 64);
|
|
||||||
DesCrypt(TmpStr, act_req_code + 8 * i, NULL, 0);
|
|
||||||
memcpy(act_req_code_des + 8 * i, TmpStr, 8);
|
|
||||||
}
|
|
||||||
wxc2HDInfo[0] = k*8;
|
|
||||||
memcpy(&wxc2HDInfo[1],act_req_code_des,k*8);
|
|
||||||
printf("Get HD info... OK!\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static int GetHDInfo()
|
static int GetHDInfo()
|
||||||
{
|
{
|
||||||
FILE *fpConf=NULL;
|
FILE *fpConf=NULL;
|
||||||
@@ -1258,7 +1076,6 @@ if(lic_mem_cpu)
|
|||||||
printf("Get HD info... OK!\n");
|
printf("Get HD info... OK!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void SaveWxc2SystemConf()
|
static void SaveWxc2SystemConf()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,16 +8,6 @@ cook_island:
|
|||||||
@cd ./src/main; make -f Cook_Makefile; cd ..; cd ..
|
@cd ./src/main; make -f Cook_Makefile; cd ..; cd ..
|
||||||
@cd ./src/object; make; cp libpps.a ../../lib; cd ..; cd ..
|
@cd ./src/object; make; cp libpps.a ../../lib; cd ..; cd ..
|
||||||
|
|
||||||
zed_mobile:
|
|
||||||
@cd ./src/lib; make; cd ..; cd ..
|
|
||||||
@cd ./src/main; make -f Zed_Makefile; cd ..; cd ..
|
|
||||||
@cd ./src/object; make; cp libpps.a ../../lib; cd ..; cd ..
|
|
||||||
|
|
||||||
rdb_tariff:
|
|
||||||
@cd ./src/lib; make; cd ..; cd ..
|
|
||||||
@cd ./src/main; make -f Rdb_Makefile; cd ..; cd ..
|
|
||||||
@cd ./src/object; make; cp libpps.a ../../lib; cd ..; cd ..
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@cd ./src/lib; make clean; cd ..; cd ..
|
@cd ./src/lib; make clean; cd ..; cd ..
|
||||||
@cd ./src/main; make clean; cd ..; cd ..
|
@cd ./src/main; make clean; cd ..; cd ..
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ typedef struct _tocdr_report {
|
|||||||
BYTE gprsDestIP[64];
|
BYTE gprsDestIP[64];
|
||||||
BYTE gprsVolume[4];
|
BYTE gprsVolume[4];
|
||||||
BYTE peerAddress[128];
|
BYTE peerAddress[128];
|
||||||
BYTE plan_id[4];
|
|
||||||
} _tocdr_report;
|
} _tocdr_report;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -102,9 +102,9 @@ void GetSubsCapInfo(_account_info *ptr,int cap_type, float *balance, int *counte
|
|||||||
BOOL isPromotionCanBeUsedAtThisPoint(_state_data *shmp);
|
BOOL isPromotionCanBeUsedAtThisPoint(_state_data *shmp);
|
||||||
BOOL isPromotionCanBeUsedForRoDebit(_account_info *shmp);
|
BOOL isPromotionCanBeUsedForRoDebit(_account_info *shmp);
|
||||||
double GetBalanceWithPromotionControl(_state_data *stateProc,_account_info *ptr);
|
double GetBalanceWithPromotionControl(_state_data *stateProc,_account_info *ptr);
|
||||||
int GetAccountBundlePlanInfo(_account_info *ptr, long ret_value[]);
|
int GetAccountBundlePlanInfo(_account_info *ptr, long ret_value[], _state_data *shmp);
|
||||||
int UpdateAccountBundlePlanInfo(_account_info *shmp, long set_value[]);
|
int UpdateAccountBundlePlanInfo(_account_info *shmp, long set_value[]);
|
||||||
int subscribe_bundle_plan_send_used_up_info(char *caller_number, SMS_SENTENCE id);
|
int subscribe_bundle_plan_send_used_up_info(char *caller_number, SMS_SENTENCE id, _state_data *shmp);
|
||||||
|
|
||||||
int GetAccountVoiceID(int head,int tail);
|
int GetAccountVoiceID(int head,int tail);
|
||||||
|
|
||||||
@@ -176,8 +176,6 @@ extern void SendSmsDirectDebitAndRefundCDR(_state_data *shmp, int sent_num, int
|
|||||||
extern int SendServiceNotApplied(u_short portid,u8 ussdSmsFlag,u8 serviceNumberPosition);
|
extern int SendServiceNotApplied(u_short portid,u8 ussdSmsFlag,u8 serviceNumberPosition);
|
||||||
extern u_long PPS_SET_INTEGER(u_char *pdata, u_char dataLen);
|
extern u_long PPS_SET_INTEGER(u_char *pdata, u_char dataLen);
|
||||||
extern float pps_billing_ro_voice(_state_data *shmp, u32 *need_assigned_duration, u32 *new_assigned_bundle);
|
extern float pps_billing_ro_voice(_state_data *shmp, u32 *need_assigned_duration, u32 *new_assigned_bundle);
|
||||||
extern float pps_billing_ro_voice_with_crm(_state_data *shmp, u32 *need_assigned_duration, u32 *new_assigned_bundle);
|
|
||||||
extern float pps_refund_ro_voice_with_crm(_state_data *shmp, u32 refund_duration, u32 *refund_bundle);
|
|
||||||
extern float pps_refund_ro_voice(_state_data *shmp, u32 refund_duration, u32 *refund_bundle);
|
extern float pps_refund_ro_voice(_state_data *shmp, u32 refund_duration, u32 *refund_bundle);
|
||||||
extern int pps_get_ro_voice_quota(_state_data *shmp);
|
extern int pps_get_ro_voice_quota(_state_data *shmp);
|
||||||
extern int pps_get_account_bundle_mo_voice(_state_data * shmp);
|
extern int pps_get_account_bundle_mo_voice(_state_data * shmp);
|
||||||
@@ -285,11 +283,6 @@ extern int BillingProc_ccc(_state_data *shmp, int sub_flag0);
|
|||||||
extern int IsEnableToCall_ccc(int proc_id);
|
extern int IsEnableToCall_ccc(int proc_id);
|
||||||
extern int pps_get_answer_timer_out();
|
extern int pps_get_answer_timer_out();
|
||||||
extern void ChargeAccountByRealCallDuration(u_short portid);
|
extern void ChargeAccountByRealCallDuration(u_short portid);
|
||||||
extern char *pps_get_service_number(unsigned int num_pos);
|
|
||||||
extern int OCS_with_external_CRM();
|
|
||||||
extern void pps_send_rent_charge_to_crm(int head, int tail);
|
|
||||||
extern void ocs_get_crm_prefix_definition();
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ typedef struct _PpsParam
|
|||||||
int scf_work_as_adaptor_with_vcs;
|
int scf_work_as_adaptor_with_vcs;
|
||||||
int data_quota_as_postpaid;
|
int data_quota_as_postpaid;
|
||||||
int new_flags[31];
|
int new_flags[31];
|
||||||
_ocsCRMConrol ocs_crm_control;
|
|
||||||
}PPSParamStruct;
|
}PPSParamStruct;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -179,10 +179,13 @@ typedef enum
|
|||||||
SMS_BUNDLE_PLAN_VOICE_USEDUP = 97,
|
SMS_BUNDLE_PLAN_VOICE_USEDUP = 97,
|
||||||
SMS_BUNDLE_PLAN_SMS_USEDUP = 98,
|
SMS_BUNDLE_PLAN_SMS_USEDUP = 98,
|
||||||
SMS_BUNDLE_PLAN_USSD_MENU1 = 99,
|
SMS_BUNDLE_PLAN_USSD_MENU1 = 99,
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
SMS_BUNDLE_PLAN_ROAM_AND_NOTROAM = 100,
|
||||||
|
|
||||||
SMS_MAX_ITEM = 100 ,
|
SMS_MAX_ITEM = 101//100
|
||||||
SMS_LAST_CALL_INFO = 101,
|
#else
|
||||||
SMS_LAST_SMS_INFO = 102,
|
SMS_MAX_ITEM = 100
|
||||||
|
#endif
|
||||||
}SMS_SENTENCE;
|
}SMS_SENTENCE;
|
||||||
|
|
||||||
typedef enum _PPS_USSD_OPERATON
|
typedef enum _PPS_USSD_OPERATON
|
||||||
@@ -258,14 +261,22 @@ typedef enum _ppsTableMaxItem
|
|||||||
MaxcapPlanTableItem = 4,
|
MaxcapPlanTableItem = 4,
|
||||||
MaxPoolAccountTableItem = 1,
|
MaxPoolAccountTableItem = 1,
|
||||||
MaxGprsTableItem = 1,
|
MaxGprsTableItem = 1,
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
MaxGprsCapPlan = 2,
|
||||||
|
#else
|
||||||
MaxGprsCapPlan = 1,
|
MaxGprsCapPlan = 1,
|
||||||
|
#endif
|
||||||
MaxFriendFamilyTableItem = 1,
|
MaxFriendFamilyTableItem = 1,
|
||||||
/****************** cos tables ********************/
|
/****************** cos tables ********************/
|
||||||
|
|
||||||
/*** if you add items in any table,notify these value ***/
|
/*** if you add items in any table,notify these value ***/
|
||||||
MaxPromptResolutionReservedItem = 1,
|
MaxPromptResolutionReservedItem = 1,
|
||||||
MaxMnpPrefixReservedItem = 1,
|
MaxMnpPrefixReservedItem = 1,
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
MaxSmsSentenceReservedItem = 0,//1,
|
||||||
|
#else
|
||||||
MaxSmsSentenceReservedItem = 1,
|
MaxSmsSentenceReservedItem = 1,
|
||||||
|
#endif
|
||||||
MaxThirdPartyInfoReservedItem = 1,
|
MaxThirdPartyInfoReservedItem = 1,
|
||||||
MaxBasicTariffZoneReservedItem = 1,
|
MaxBasicTariffZoneReservedItem = 1,
|
||||||
MaxIvrSourceReservedItem = 1,
|
MaxIvrSourceReservedItem = 1,
|
||||||
@@ -312,7 +323,6 @@ typedef enum _serviceNumberPosition
|
|||||||
GPRSPrepaidPostion,
|
GPRSPrepaidPostion,
|
||||||
TellMeNumber,
|
TellMeNumber,
|
||||||
FriendFamilyPosition,
|
FriendFamilyPosition,
|
||||||
MAXServicePostion,
|
|
||||||
|
|
||||||
}serviceNumberPosition;
|
}serviceNumberPosition;
|
||||||
|
|
||||||
@@ -559,7 +569,9 @@ typedef struct _CosSmsNotificationInquiry
|
|||||||
u8 smsNotificationWhenFriendFamilyServiceSuspend;
|
u8 smsNotificationWhenFriendFamilyServiceSuspend;
|
||||||
u8 smsNotificationWhenFriendFamilyPlanExhaust;
|
u8 smsNotificationWhenFriendFamilyPlanExhaust;
|
||||||
u8 smsNotificationWhenFriendFamilyServiceRemoved;
|
u8 smsNotificationWhenFriendFamilyServiceRemoved;
|
||||||
u8 reserve[26];
|
u8 smsNotificationWhenPromotionInsufficient;
|
||||||
|
u8 insufficientPromotionThreshold;
|
||||||
|
u8 reserve[24];
|
||||||
u8 existFlag;
|
u8 existFlag;
|
||||||
}CosSmsNotificationInquiry;
|
}CosSmsNotificationInquiry;
|
||||||
|
|
||||||
@@ -645,8 +657,13 @@ typedef struct _PPS_COS_RADIUS_ITEM
|
|||||||
ulong maxDurationQuotaEachTime;/* s */
|
ulong maxDurationQuotaEachTime;/* s */
|
||||||
ulong durationThresholdDiff;/* s */
|
ulong durationThresholdDiff;/* s */
|
||||||
u8 gprsChargedBy;/*0:define by cos;1:defined by incoming GSN IP */
|
u8 gprsChargedBy;/*0:define by cos;1:defined by incoming GSN IP */
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
GPRS_VOLUME_CAP_PLAN capPlan[MaxGprsCapPlan];
|
||||||
|
u8 reserved[44];
|
||||||
|
#else
|
||||||
GPRS_VOLUME_CAP_PLAN capPlan[MaxGprsCapPlan];
|
GPRS_VOLUME_CAP_PLAN capPlan[MaxGprsCapPlan];
|
||||||
u8 reserved[64];
|
u8 reserved[64];
|
||||||
|
#endif
|
||||||
u8 existFlag;
|
u8 existFlag;
|
||||||
}PPS_COS_RADIUS_ITEM;
|
}PPS_COS_RADIUS_ITEM;
|
||||||
|
|
||||||
@@ -737,9 +754,6 @@ typedef struct _PpsTable
|
|||||||
|
|
||||||
serviceBundlePlan bundlePlans[MAX_BUNDLE_PLANS];
|
serviceBundlePlan bundlePlans[MAX_BUNDLE_PLANS];
|
||||||
|
|
||||||
SmsSentence smsExtSentence[MaxSmsSentenceItem+MaxSmsSentenceReservedItem];
|
|
||||||
|
|
||||||
|
|
||||||
}PpsTable;
|
}PpsTable;
|
||||||
|
|
||||||
|
|
||||||
@@ -781,39 +795,10 @@ typedef struct _PpsServiceConrol{
|
|||||||
u8 log_func_flag;
|
u8 log_func_flag;
|
||||||
u8 calling_card_method;
|
u8 calling_card_method;
|
||||||
u8 calling_card_cos_id;
|
u8 calling_card_cos_id;
|
||||||
u8 work_with_crm;
|
|
||||||
u8 mt_not_charged_for_cdr;
|
|
||||||
u8 crm_free_seconds;
|
|
||||||
u8 crm_status_validity;
|
|
||||||
u8 crm_days_before_validity;
|
|
||||||
u8 crm_notification_for_event;
|
|
||||||
u8 cellid_present_in_ccr;
|
u8 cellid_present_in_ccr;
|
||||||
u8 reserved[8];
|
u8 reserved[14];
|
||||||
/******* below is table ********/
|
/******* below is table ********/
|
||||||
}PpsServiceConrol;
|
}PpsServiceConrol;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
CT_LOCAL_CALL_OUT=100,
|
|
||||||
CT_TRUNK_CALL_OUT, // Local city call out
|
|
||||||
CT_NDD_CALL_OUT, // Nation l.d.tel
|
|
||||||
CT_HMT_CALL_OUT, // Hong Kong, Macao, TaiWan
|
|
||||||
CT_IDD_CALL_OUT, // International L.D.Tel
|
|
||||||
CT_LOCAL_CALL_IN,
|
|
||||||
CT_TRUNK_CALL_IN,
|
|
||||||
|
|
||||||
*/
|
|
||||||
#define MAX_CALL_TYPE_DES 10
|
|
||||||
typedef struct ocsCRMCallTypeDes{
|
|
||||||
char equal_or_contain; //0=equal, 1=contain
|
|
||||||
char description[MAX_CALL_TYPE_DES][128]; //0=LOCAL CALL OUT...
|
|
||||||
}_ocsCRMCallTypeDes;
|
|
||||||
|
|
||||||
typedef struct ocsCRMConrol{
|
|
||||||
char base_prefix_file_name[128];
|
|
||||||
_ocsCRMCallTypeDes crm_call_type;
|
|
||||||
}_ocsCRMConrol;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _VmsRouteParam
|
typedef struct _VmsRouteParam
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,82 @@
|
|||||||
#define _PPS_REDIS__H_
|
#define _PPS_REDIS__H_
|
||||||
#include "ppsm.h"
|
#include "ppsm.h"
|
||||||
|
|
||||||
|
// all Redis field of one KEY
|
||||||
|
#define OCS_REDIS_FIELD_NULL 0
|
||||||
|
#define OCS_REDIS_FIELD_BALANCE 1
|
||||||
|
#define OCS_REDIS_FIELD_PROMO_BALANCE 2
|
||||||
|
#define OCS_REDIS_FIELD_BUNDLE_DATA 3
|
||||||
|
#define OCS_REDIS_FIELD_BUNDLE_MOV 4
|
||||||
|
#define OCS_REDIS_FIELD_BUNDLE_MTV 5
|
||||||
|
#define OCS_REDIS_FIELD_BUNDLE_SMS 6
|
||||||
|
#define OCS_REDIS_FIELD_BUNDLE_VALIDITY 7
|
||||||
|
#define OCS_REDIS_FIELD_BUNDLE_WARN_SMS_FLAG 8
|
||||||
|
#define OCS_REDIS_FIELD_MAX_NUM 9
|
||||||
|
|
||||||
|
typedef struct OCS_usr_redis{
|
||||||
|
char msisdn[24];
|
||||||
|
double usr_balance;
|
||||||
|
double pro_balance;
|
||||||
|
|
||||||
|
long long data; /* left in, in B */
|
||||||
|
int mo_voice; /* in seconds */
|
||||||
|
int mt_voice;
|
||||||
|
u_short sms;
|
||||||
|
u_long validity_date;
|
||||||
|
int warning_sms_flag;
|
||||||
|
}OCS_usr_redis;
|
||||||
|
|
||||||
|
extern int RedisInit(u32 localip, u32 peerip);
|
||||||
|
extern void RedisLinkMon();
|
||||||
|
extern int RedisFlushDb();
|
||||||
|
extern void RedisCreateDbFromOcs();
|
||||||
|
extern void RedisSaveDbToOcs();
|
||||||
|
//extern void RedisLoadFromRedis();
|
||||||
|
|
||||||
|
extern int RedisSetUserBalanceFromOcs(_prepaid_info *pUsr, double balance);
|
||||||
|
extern int RedisUpdateUserBalance(OCS_usr_redis *usr_redis);
|
||||||
|
extern int RedisUpdateUserInfo(OCS_usr_redis *usr_redis);
|
||||||
|
extern int RedisUpdateUserInfoFromOcs(_prepaid_info *pUsr);
|
||||||
|
extern int RedisUpdateBundleInfoFromOcs(_prepaid_info *pUsr);
|
||||||
|
extern int RedisUpdateUsrFieldFromOcs(_prepaid_info *pUsr, int field_id);
|
||||||
|
extern int RedisUpdateUserField(OCS_usr_redis *pUsr, int field_id);
|
||||||
|
extern int RedisGetUserInfo(_prepaid_info *pUsr, OCS_usr_redis *usr_redis);
|
||||||
|
extern int RedisGetBundleInfo(_prepaid_info *pUsr, OCS_usr_redis *usr_redis);
|
||||||
|
extern int RedisGetUserInfo2Ocs(_prepaid_info *pUsr);
|
||||||
|
extern int RedisGetUserField(_prepaid_info *pUsr, OCS_usr_redis *usr_redis, int field_id);
|
||||||
|
extern int RedisGetUserBalance(_prepaid_info *pUsr, OCS_usr_redis *usr_redis);
|
||||||
|
|
||||||
|
extern int RedisClearUserBundle(OCS_usr_redis *pUsr);
|
||||||
|
extern int RedisDelUserInfoByMsisdn(char *msisdn);
|
||||||
|
extern int RedisDelUserInfo(_prepaid_info *pUsr);
|
||||||
|
extern void RedisTest(int i);
|
||||||
|
extern int RedisCreateLogTask(pthread_t *idTask);
|
||||||
|
extern void RedisAddLogStr(char *time, char *level, char *, int line, char *text);
|
||||||
|
|
||||||
|
|
||||||
|
// Redis log writer
|
||||||
|
#define MAX_REDIS_LOG_LINES 81920
|
||||||
|
#define MAX_REDIS_LINE_LEN 512
|
||||||
|
typedef struct OCS_redis_log_t
|
||||||
|
{
|
||||||
|
int header;
|
||||||
|
int tailer;
|
||||||
|
|
||||||
|
char log_str[MAX_REDIS_LOG_LINES][MAX_REDIS_LINE_LEN];
|
||||||
|
}OCS_redis_log_t;
|
||||||
|
|
||||||
|
// simple log
|
||||||
|
enum RedisLogLevel
|
||||||
|
{
|
||||||
|
RS_ERROR = 1,
|
||||||
|
RS_WARN = 2,
|
||||||
|
RS_INFO = 3,
|
||||||
|
RS_DEBUG = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
void mylog1(const char* filename, int line, enum RedisLogLevel level, const char* fmt, ...) __attribute__((format(printf,4,5)));
|
||||||
|
|
||||||
|
#define redislog(level, format, ...) mylog1(__FILE__, __LINE__, level, format, ## __VA_ARGS__)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,11 @@
|
|||||||
#include "ramdata.h"
|
#include "ramdata.h"
|
||||||
#include "tariff.h"
|
#include "tariff.h"
|
||||||
#include "cdrme.h"
|
#include "cdrme.h"
|
||||||
#include "../../../../plat/diameter/include/gy_message.h"
|
|
||||||
|
|
||||||
//#define OCS_USE_REDIS_DB 1
|
//#define OCS_USE_REDIS_DB 1
|
||||||
//#ifdef OCS_USE_REDIS_DB
|
#ifdef OCS_USE_REDIS_DB
|
||||||
//#include "pps_redis.h"
|
#include "pps_redis.h"
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
#define SMMP_IT_INTERVAL_SEC 0
|
#define SMMP_IT_INTERVAL_SEC 0
|
||||||
#define SMMP_IT_INTERVAL_USEC 10000
|
#define SMMP_IT_INTERVAL_USEC 10000
|
||||||
@@ -34,7 +33,7 @@
|
|||||||
#define PERIODIC_ACTIONS (CYCLE_STATE_INTERVAL)
|
#define PERIODIC_ACTIONS (CYCLE_STATE_INTERVAL)
|
||||||
|
|
||||||
#define NORMAL_DELAY_TIMER (10*CYCLE_STATE_INTERVAL)
|
#define NORMAL_DELAY_TIMER (10*CYCLE_STATE_INTERVAL)
|
||||||
#define SSHORT_DELAY_TIMER (5*CYCLE_STATE_INTERVAL)
|
#define SSHORT_DELAY_TIMER (2*CYCLE_STATE_INTERVAL)
|
||||||
#define PROMPT_AND_COLLECT_TIMER (5*ONE_MINUTE_STATE_TIME)
|
#define PROMPT_AND_COLLECT_TIMER (5*ONE_MINUTE_STATE_TIME)
|
||||||
#define SPECIAL_RESOURCE_REPORT_TIMER (5*ONE_MINUTE_STATE_TIME)
|
#define SPECIAL_RESOURCE_REPORT_TIMER (5*ONE_MINUTE_STATE_TIME)
|
||||||
|
|
||||||
@@ -186,8 +185,6 @@ typedef enum _call_state {
|
|||||||
S_GY_PS_WAIT_TERM,
|
S_GY_PS_WAIT_TERM,
|
||||||
S_GY_PS_RELEASE,
|
S_GY_PS_RELEASE,
|
||||||
S_GY_PS_POSTPAID,
|
S_GY_PS_POSTPAID,
|
||||||
S_RO_VOC_GET_TARIFF_FROM_CRM,//S_GY_PS_GET_TARIFF_FROM_CRM,
|
|
||||||
S_GY_PS_GET_TARIFF_FROM_CRM_RES,
|
|
||||||
|
|
||||||
S_RO_ADAPTOR_CALL_INIT = 130,
|
S_RO_ADAPTOR_CALL_INIT = 130,
|
||||||
S_RO_CALL_WAIT_FIRST_CCA,
|
S_RO_CALL_WAIT_FIRST_CCA,
|
||||||
@@ -200,8 +197,6 @@ typedef enum _call_state {
|
|||||||
S_SMPP_MAIN,
|
S_SMPP_MAIN,
|
||||||
|
|
||||||
S_CC_CHECK_CALL_VALIDITY,
|
S_CC_CHECK_CALL_VALIDITY,
|
||||||
|
|
||||||
S_CRM_QUERY_TARIFF_TEST,
|
|
||||||
|
|
||||||
} _call_state;
|
} _call_state;
|
||||||
|
|
||||||
@@ -213,7 +208,6 @@ typedef enum _pps_map_state {
|
|||||||
S_MAP_SEND_PUSSR_ACK,
|
S_MAP_SEND_PUSSR_ACK,
|
||||||
S_MAP_CHECK_USSD_INPUT_CARD_VALIDITY,
|
S_MAP_CHECK_USSD_INPUT_CARD_VALIDITY,
|
||||||
S_MAP_USSD_CHECK_CARD_DATA_RCM,
|
S_MAP_USSD_CHECK_CARD_DATA_RCM,
|
||||||
S_MAP_USSD_CHECK_CARD_DATA_CRM,
|
|
||||||
S_MAP_USSD_INPUT_CARD_PWD_AGAIN,
|
S_MAP_USSD_INPUT_CARD_PWD_AGAIN,
|
||||||
S_MAP_SEND_PUSSR_ACK_SEND_USSN,
|
S_MAP_SEND_PUSSR_ACK_SEND_USSN,
|
||||||
S_MAP_SEND_USSN_LOWBALANCE_PROMPT,
|
S_MAP_SEND_USSN_LOWBALANCE_PROMPT,
|
||||||
@@ -226,8 +220,6 @@ typedef enum _pps_map_state {
|
|||||||
S_MAP_BUNDLE_PLAN,
|
S_MAP_BUNDLE_PLAN,
|
||||||
S_MAP_BUNDLE_QUERY,
|
S_MAP_BUNDLE_QUERY,
|
||||||
S_MAP_REST_TOPUP,
|
S_MAP_REST_TOPUP,
|
||||||
S_MAP_THIRD_PARTY_HOTLINE,
|
|
||||||
S_MAP_THIRD_PARTY_CHANNEL,
|
|
||||||
}_pps_map_state;
|
}_pps_map_state;
|
||||||
|
|
||||||
typedef enum _pps_smpp_state {
|
typedef enum _pps_smpp_state {
|
||||||
@@ -300,7 +292,6 @@ typedef enum recharge_state
|
|||||||
S_REC_CHECK_CARD_WITH_RCM,
|
S_REC_CHECK_CARD_WITH_RCM,
|
||||||
S_REC_CHECK_CARD_WITH_REST,
|
S_REC_CHECK_CARD_WITH_REST,
|
||||||
S_REC_CHECK_CARD_WITH_REST_GET,
|
S_REC_CHECK_CARD_WITH_REST_GET,
|
||||||
S_REC_CHECK_CARD_WITH_CRM,
|
|
||||||
}_recharge_state;
|
}_recharge_state;
|
||||||
|
|
||||||
typedef enum rec_mng_retval
|
typedef enum rec_mng_retval
|
||||||
@@ -411,7 +402,8 @@ enum _call_type {
|
|||||||
CT_MT_SM,
|
CT_MT_SM,
|
||||||
CT_CONFERENCE_CALL,
|
CT_CONFERENCE_CALL,
|
||||||
CT_THIRD_PARTY_CHARGE,
|
CT_THIRD_PARTY_CHARGE,
|
||||||
CT_IDD_CALL_IN,
|
CT_EMERGENCY_CALL,
|
||||||
|
|
||||||
CT_SERVICE,
|
CT_SERVICE,
|
||||||
CT_FREE_SERVICE_CALL,
|
CT_FREE_SERVICE_CALL,
|
||||||
CT_INVALID_CALL,
|
CT_INVALID_CALL,
|
||||||
@@ -419,8 +411,6 @@ enum _call_type {
|
|||||||
CT_MT_CALL,
|
CT_MT_CALL,
|
||||||
CT_MF_CALL,
|
CT_MF_CALL,
|
||||||
CT_INVALID_MO_SMS,// 123
|
CT_INVALID_MO_SMS,// 123
|
||||||
CT_EMERGENCY_CALL,
|
|
||||||
|
|
||||||
CT_DIRECT_DEBITING = 138,
|
CT_DIRECT_DEBITING = 138,
|
||||||
CT_REFUND_ACCOUNT = 139,
|
CT_REFUND_ACCOUNT = 139,
|
||||||
CT_TRANFER_OUT=140,
|
CT_TRANFER_OUT=140,
|
||||||
@@ -447,7 +437,6 @@ enum _call_type {
|
|||||||
CT_RO_DEBIT,
|
CT_RO_DEBIT,
|
||||||
|
|
||||||
CT_MO_CC_CALL,
|
CT_MO_CC_CALL,
|
||||||
CT_MAX_CALL_TYPE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_ASCII_NUMBER_LEN 24
|
#define MAX_ASCII_NUMBER_LEN 24
|
||||||
@@ -456,7 +445,6 @@ typedef struct {
|
|||||||
u_char number[MAX_ASCII_NUMBER_LEN];
|
u_char number[MAX_ASCII_NUMBER_LEN];
|
||||||
u_char IMSI[8];
|
u_char IMSI[8];
|
||||||
char location;
|
char location;
|
||||||
u_char free_flag;
|
|
||||||
unsigned int valid_time;
|
unsigned int valid_time;
|
||||||
float fee;
|
float fee;
|
||||||
float charge;
|
float charge;
|
||||||
@@ -567,18 +555,9 @@ typedef struct gprs_process{
|
|||||||
RADIUS_TLV_TS acct_session_id;
|
RADIUS_TLV_TS acct_session_id;
|
||||||
u_char calculateCount;
|
u_char calculateCount;
|
||||||
u_char calledType;
|
u_char calledType;
|
||||||
int update_quote_counter;
|
|
||||||
RADIUS_ATTRIBUTE_CALLED_STATION_ID *calledList;
|
RADIUS_ATTRIBUTE_CALLED_STATION_ID *calledList;
|
||||||
}_gprs_process;
|
}_gprs_process;
|
||||||
|
|
||||||
typedef struct _ussd_chnl_info{
|
|
||||||
char scUrl[256];
|
|
||||||
char prompt[256];
|
|
||||||
char input[24];
|
|
||||||
char sessId[64];
|
|
||||||
u_char sess_state;
|
|
||||||
}ussd_chnl_info;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u_short portid;// handle port
|
u_short portid;// handle port
|
||||||
u_char state; /* state of the process */
|
u_char state; /* state of the process */
|
||||||
@@ -654,8 +633,6 @@ typedef struct {
|
|||||||
CMB callMeBack;
|
CMB callMeBack;
|
||||||
MASTER_SLAVE_CARD masterSlaveCard;
|
MASTER_SLAVE_CARD masterSlaveCard;
|
||||||
_gprs_process gprs_process;
|
_gprs_process gprs_process;
|
||||||
ussd_chnl_info chnl_info;
|
|
||||||
char areaName[32];
|
|
||||||
}ppsService;
|
}ppsService;
|
||||||
u_char update_card_ack;
|
u_char update_card_ack;
|
||||||
u_char update_card_result;
|
u_char update_card_result;
|
||||||
@@ -680,12 +657,9 @@ typedef struct {
|
|||||||
u_char last_ro_quota_type;// 0: bundle; 1: cap; for Ro refund
|
u_char last_ro_quota_type;// 0: bundle; 1: cap; for Ro refund
|
||||||
unsigned int last_bundle_duration;// for Ro refund
|
unsigned int last_bundle_duration;// for Ro refund
|
||||||
unsigned int last_cap_duration;// for Ro refund
|
unsigned int last_cap_duration;// for Ro refund
|
||||||
_gy_msg gy_ccr_info;
|
|
||||||
}ro_if;
|
}ro_if;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
u_short src_ref;
|
|
||||||
u_short dst_ref;
|
|
||||||
u_short timer;
|
u_short timer;
|
||||||
u_char rest_src; /* 0/1/2=USSD, SMS, VOICE */
|
u_char rest_src; /* 0/1/2=USSD, SMS, VOICE */
|
||||||
u_char rest_oc; /* 0/1 = query, recharge */
|
u_char rest_oc; /* 0/1 = query, recharge */
|
||||||
@@ -695,17 +669,6 @@ typedef struct {
|
|||||||
long balance;
|
long balance;
|
||||||
long mo_expiry_date;
|
long mo_expiry_date;
|
||||||
long mt_expiry_date;
|
long mt_expiry_date;
|
||||||
u_char query_tariff_status;
|
|
||||||
int unit;
|
|
||||||
float unit_charge;
|
|
||||||
int tariff_discount;
|
|
||||||
int plan_id;
|
|
||||||
int bundle_plan_id;
|
|
||||||
unsigned long long total_plan_value;
|
|
||||||
unsigned long long used_plan_value;
|
|
||||||
int sess_update_times;
|
|
||||||
int busicode;
|
|
||||||
unsigned long long plan_value_add_this_time;
|
|
||||||
}rest_if;
|
}rest_if;
|
||||||
|
|
||||||
} _process_info;
|
} _process_info;
|
||||||
@@ -1078,16 +1041,5 @@ int load_tariff_main();
|
|||||||
int IdleProc(u_short);
|
int IdleProc(u_short);
|
||||||
int EstablishProc(int invokeid);
|
int EstablishProc(int invokeid);
|
||||||
int realSyncTcpSend(DWORD db_type, DWORD instance, DWORD ocode, BYTE *payload, WORD len);
|
int realSyncTcpSend(DWORD db_type, DWORD instance, DWORD ocode, BYTE *payload, WORD len);
|
||||||
int OCS_with_external_CRM();
|
|
||||||
void pps_send_rent_charge_to_crm(int head, int tail);
|
|
||||||
extern int pps_send_query_tariff_req(u_short portid);
|
|
||||||
extern int BillingProc_crm(_state_data *shmp, int sub_flag0);
|
|
||||||
extern int pps_send_update_plan_value_req(u_short portid);
|
|
||||||
int pps_send_selfcare_topup_req(u_short portid);
|
|
||||||
int RechargeSucceedwithCRM(u_short portid);
|
|
||||||
unsigned int ocs_get_ue_index(long long msisdn);
|
|
||||||
long long ocs_get_ue_by_index(int store_index);
|
|
||||||
void pps_send_update_subs_status_to_crm(_prepaid_info *user_ptr, int update_flag);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* SMMP__H */
|
#endif /* SMMP__H */
|
||||||
@@ -15,8 +15,7 @@
|
|||||||
#define T_EXPIRED 1
|
#define T_EXPIRED 1
|
||||||
|
|
||||||
#define POOL_MAX_CHILD 5
|
#define POOL_MAX_CHILD 5
|
||||||
|
#define HAS_BUNDLE_ROAMING 1
|
||||||
#define OCS_WITH_CRM 1
|
|
||||||
|
|
||||||
typedef enum account_status {
|
typedef enum account_status {
|
||||||
T_FRESH, /* fresh account, can't dial in or out,
|
T_FRESH, /* fresh account, can't dial in or out,
|
||||||
@@ -26,7 +25,6 @@ typedef enum account_status {
|
|||||||
T_BLACKLIST,
|
T_BLACKLIST,
|
||||||
T_RELEASED,
|
T_RELEASED,
|
||||||
T_OPRTRIAL,
|
T_OPRTRIAL,
|
||||||
T_DISABLE,
|
|
||||||
MAX_USER_TYPE,
|
MAX_USER_TYPE,
|
||||||
|
|
||||||
T_EXTERNAL=10,
|
T_EXTERNAL=10,
|
||||||
@@ -56,7 +54,11 @@ typedef enum last_call{
|
|||||||
#define MAX_MSISDN_ALEN 16
|
#define MAX_MSISDN_ALEN 16
|
||||||
#define MAX_PIN_LEN 6
|
#define MAX_PIN_LEN 6
|
||||||
#define MAX_HOME_LOCATION 4
|
#define MAX_HOME_LOCATION 4
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
#define MAX_PPS_USER_FIELD_NUMS 74//68
|
||||||
|
#else
|
||||||
#define MAX_PPS_USER_FIELD_NUMS 68
|
#define MAX_PPS_USER_FIELD_NUMS 68
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct prepaid_info_old {
|
typedef struct prepaid_info_old {
|
||||||
u_char msisdn[MAX_MSISDN_BLEN];
|
u_char msisdn[MAX_MSISDN_BLEN];
|
||||||
@@ -139,25 +141,8 @@ typedef struct bundle_info
|
|||||||
int iRes[2];
|
int iRes[2];
|
||||||
}_bundle_info;
|
}_bundle_info;
|
||||||
|
|
||||||
typedef struct crm_info
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
{
|
typedef struct prepaid_info_no_bundle_roam {
|
||||||
int customer_id;
|
|
||||||
int account_id;
|
|
||||||
int product_id;
|
|
||||||
u_long birthday;
|
|
||||||
int base_plan_id;
|
|
||||||
int rent_charge;
|
|
||||||
int new_plan_id;
|
|
||||||
int new_rent_charge;
|
|
||||||
u_char vas_cug_state; /*0=not used, 1=normal, 2=suspended */
|
|
||||||
u_long ulRes[4];
|
|
||||||
int iRes[4];
|
|
||||||
u_char user_class;
|
|
||||||
u_char ucRes[3];
|
|
||||||
}_crm_info;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct prepaid_info {
|
|
||||||
u_char msisdn[MAX_MSISDN_BLEN];
|
u_char msisdn[MAX_MSISDN_BLEN];
|
||||||
char pin[MAX_PIN_LEN];
|
char pin[MAX_PIN_LEN];
|
||||||
u_char status;
|
u_char status;
|
||||||
@@ -223,13 +208,85 @@ typedef struct prepaid_info {
|
|||||||
double dReserved[2];
|
double dReserved[2];
|
||||||
|
|
||||||
_bundle_info bundle_info;
|
_bundle_info bundle_info;
|
||||||
#ifdef OCS_WITH_CRM
|
} _prepaid_info_no_bundle_roam;
|
||||||
_crm_info crm_info;
|
#endif
|
||||||
|
|
||||||
|
typedef struct prepaid_info {
|
||||||
|
u_char msisdn[MAX_MSISDN_BLEN];
|
||||||
|
char pin[MAX_PIN_LEN];
|
||||||
|
u_char status;
|
||||||
|
double balance;
|
||||||
|
double promo_balance;
|
||||||
|
long overdraft;// amount that can overdraft
|
||||||
|
u_long first_used_date;
|
||||||
|
u_long mo_expiration_date; /* outgoing */
|
||||||
|
u_long mt_expiration_date; /* incoming */
|
||||||
|
u_long promo_date;
|
||||||
|
u_char cos_id;
|
||||||
|
u_char rent_type;
|
||||||
|
u_char home_location[MAX_HOME_LOCATION];
|
||||||
|
u_short cug_id;
|
||||||
|
u_char language_type;
|
||||||
|
u_char recharge_fail;
|
||||||
|
u_char free_sm_counter;
|
||||||
|
u_char latch_flag;
|
||||||
|
u_char favorite_numbers;
|
||||||
|
/* favorite number set flag
|
||||||
|
0=no favorite number set,
|
||||||
|
otherwise = favorite number sets */
|
||||||
|
u_char fav_change_counter; /* favorite number edit counter */
|
||||||
|
u_char favorite_number[MAX_FAVORITE_NUMBERS][MAX_MSISDN_BLEN];
|
||||||
|
u_char last_call_type;
|
||||||
|
u_long last_call_date;
|
||||||
|
u_char last_call_number[MAX_MSISDN_BLEN];
|
||||||
|
|
||||||
|
/*following fields are designed for cap CALL/SMS,Pierre, 2007-07-13 */
|
||||||
|
|
||||||
|
double in_net_cap_sms_balance;
|
||||||
|
u_short in_net_cap_sms_counter;
|
||||||
|
double out_net_cap_sms_balance;
|
||||||
|
u_short out_net_cap_sms_counter;
|
||||||
|
|
||||||
|
double in_net_cap_call_balance;
|
||||||
|
u_long in_net_cap_call_duration;
|
||||||
|
double out_net_cap_call_balance;
|
||||||
|
u_long out_net_cap_call_duration;
|
||||||
|
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
double out_net_cap_gprsBalance;
|
||||||
|
long long out_net_cap_gprsVolume;
|
||||||
|
#else
|
||||||
|
double call_in_cap_balance;
|
||||||
|
u_long call_in_cap_duration;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
double in_net_cap_balance;
|
||||||
|
double out_net_cap_balance;
|
||||||
|
|
||||||
|
long long gprsVolume;
|
||||||
|
long long gprsVolumeThisMonth;
|
||||||
|
double gprsBalance;
|
||||||
|
u_short gprsNotificationTimes;
|
||||||
|
|
||||||
|
u_char freeSMSActiveDays;
|
||||||
|
|
||||||
|
UserData_Pool_Account poolAccount;
|
||||||
|
|
||||||
|
u_char callMeBackRequestTimes;
|
||||||
|
u_char favorite_plan_id; /* 0=default, not plan user, 1-6=index0-5*/
|
||||||
|
u_char favorite_plan_state; /* 0=ok, 1=suspended */
|
||||||
|
u_char cap_sms_notify_counter;
|
||||||
|
u_char cReseverd[3];
|
||||||
|
u_long free_favorite_call; /* in seconds */
|
||||||
|
u_long free_favorite_sms;
|
||||||
|
double dReserved[2];
|
||||||
|
|
||||||
|
_bundle_info bundle_info;
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
_bundle_info bundle_roam;
|
||||||
#endif
|
#endif
|
||||||
} _prepaid_info;
|
} _prepaid_info;
|
||||||
|
|
||||||
#define INVALID_UE_INDEX 0xFFFFFFFF
|
|
||||||
|
|
||||||
|
|
||||||
#define UNIT_STORE_ACCOUNT 100
|
#define UNIT_STORE_ACCOUNT 100
|
||||||
#define MSISDN_HEAD_NUM 600 //1000
|
#define MSISDN_HEAD_NUM 600 //1000
|
||||||
@@ -240,6 +297,13 @@ typedef struct prepaid_data_old{
|
|||||||
_prepaid_info_old prepaid_info[MSISDN_HEAD_NUM][UNIT_STORE_ACCOUNT];
|
_prepaid_info_old prepaid_info[MSISDN_HEAD_NUM][UNIT_STORE_ACCOUNT];
|
||||||
} _prepaid_data_old;
|
} _prepaid_data_old;
|
||||||
|
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
typedef struct prepaid_data_no_bundle_roam{
|
||||||
|
long long msisdn_head[MSISDN_HEAD_NUM];
|
||||||
|
_prepaid_info_no_bundle_roam prepaid_info[MSISDN_HEAD_NUM][UNIT_STORE_ACCOUNT];
|
||||||
|
} _prepaid_data_no_bundle_roam;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct prepaid_data {
|
typedef struct prepaid_data {
|
||||||
long long msisdn_head[MSISDN_HEAD_NUM];
|
long long msisdn_head[MSISDN_HEAD_NUM];
|
||||||
_prepaid_info prepaid_info[MSISDN_HEAD_NUM][UNIT_STORE_ACCOUNT];
|
_prepaid_info prepaid_info[MSISDN_HEAD_NUM][UNIT_STORE_ACCOUNT];
|
||||||
@@ -313,6 +377,10 @@ typedef struct card_data{
|
|||||||
#define COS_GROUP_NUM 16
|
#define COS_GROUP_NUM 16
|
||||||
#define MAX_ZONE_NUM_NEW (MAX_ZONE_NUM/COS_GROUP_NUM)
|
#define MAX_ZONE_NUM_NEW (MAX_ZONE_NUM/COS_GROUP_NUM)
|
||||||
|
|
||||||
|
#define BUNDLE_DISABLE 0
|
||||||
|
#define BUNDLE_HOME_PLMN 1
|
||||||
|
#define BUNDLE_OTHER_NETWORK 2
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Charge on receiving call is not defined , 2003-10-10
|
Charge on receiving call is not defined , 2003-10-10
|
||||||
*/
|
*/
|
||||||
@@ -472,13 +540,6 @@ typedef struct _VAS_TARIFF{
|
|||||||
VAS_MMSEMAIL_DELIVER_TARIFF vasMmsEmailDeliverTariff[MAX_VAS_MMSEMAIL_DELIVER_TARIFF];
|
VAS_MMSEMAIL_DELIVER_TARIFF vasMmsEmailDeliverTariff[MAX_VAS_MMSEMAIL_DELIVER_TARIFF];
|
||||||
}VAS_TARIFF;
|
}VAS_TARIFF;
|
||||||
|
|
||||||
typedef struct base_tariff {
|
|
||||||
char bill_id[TARIFF_PREFIX_LEN+1];
|
|
||||||
char area[TARIFF_AREA_LEN];
|
|
||||||
u_char call_type;
|
|
||||||
} _base_tariff;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct tariff_data_old {
|
typedef struct tariff_data_old {
|
||||||
_comm_tariff comm_tariff[MAX_ZONE_NUM_OLD];
|
_comm_tariff comm_tariff[MAX_ZONE_NUM_OLD];
|
||||||
_rent_tariff rent_tariff[MAX_ZONE_NUM_OLD][MAX_RENT_TARIFF];
|
_rent_tariff rent_tariff[MAX_ZONE_NUM_OLD][MAX_RENT_TARIFF];
|
||||||
@@ -499,7 +560,6 @@ typedef struct tariff_data {
|
|||||||
_bill_sms bill_sms[MAX_ZONE_NUM][MAX_SMS_PREFIX];
|
_bill_sms bill_sms[MAX_ZONE_NUM][MAX_SMS_PREFIX];
|
||||||
_gprs_tariff gprs_tariff[MAX_ZONE_NUM][MAX_GPRS_PREFIX];
|
_gprs_tariff gprs_tariff[MAX_ZONE_NUM][MAX_GPRS_PREFIX];
|
||||||
VAS_TARIFF vas_tariff[MAX_ZONE_NUM];
|
VAS_TARIFF vas_tariff[MAX_ZONE_NUM];
|
||||||
_base_tariff base_tariff[BILLING_BASE_NUM];
|
|
||||||
} _tariff_data;
|
} _tariff_data;
|
||||||
/*---------*/
|
/*---------*/
|
||||||
|
|
||||||
|
|||||||
@@ -88,39 +88,6 @@ typedef struct balance_summary
|
|||||||
double today_balance;
|
double today_balance;
|
||||||
}_balance_summary;
|
}_balance_summary;
|
||||||
|
|
||||||
#ifdef _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_ // ussd_code daily report
|
|
||||||
#define USSDCODE_QUERY_CODE_STR "114"
|
|
||||||
#define USSDCODE_TOPUP_CODE_STR "113"
|
|
||||||
#define USSDCODE_HOTLINE_CODE_STR "117"
|
|
||||||
|
|
||||||
#define USSDCODE_TYPE_QUERY 0
|
|
||||||
#define USSDCODE_TYPE_TOPUP 1
|
|
||||||
#define USSDCODE_TYPE_HOTLINE 2
|
|
||||||
#define USSDCODE_TYPE_CHANNEL 3
|
|
||||||
#define USSDCODE_MAX_CODE_NUM 8
|
|
||||||
|
|
||||||
#define USSDCODE_STAT_REQ 0
|
|
||||||
#define USSDCODE_STAT_DUR 1
|
|
||||||
#define USSDCODE_STAT_ERR_TIMEOUT 2
|
|
||||||
#define USSDCODE_STAT_ERR_SYSTEM 3
|
|
||||||
#define USSDCODE_STAT_ERR_MSG 4
|
|
||||||
|
|
||||||
typedef struct ussdcode_report
|
|
||||||
{
|
|
||||||
char code[8];// 114,113,117,101/707
|
|
||||||
//char type[12];// query,topup,hotline,channel
|
|
||||||
unsigned int req_count;
|
|
||||||
unsigned int req_duration;// Sec
|
|
||||||
|
|
||||||
unsigned int err_timeout_count;
|
|
||||||
//unsigned int err_network_count;
|
|
||||||
unsigned int err_system_count;
|
|
||||||
unsigned int err_msg_count;
|
|
||||||
}_ussdcode_report;
|
|
||||||
|
|
||||||
int pps_update_ussd_code_state(char *code, int type, int result, int dur);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct daily_report
|
typedef struct daily_report
|
||||||
{
|
{
|
||||||
int year_month_day[3];
|
int year_month_day[3];
|
||||||
@@ -128,9 +95,6 @@ typedef struct daily_report
|
|||||||
_prepaid_card_report prepaid_card_report;
|
_prepaid_card_report prepaid_card_report;
|
||||||
_call_report call_report;
|
_call_report call_report;
|
||||||
_balance_summary balance_summary;
|
_balance_summary balance_summary;
|
||||||
#ifdef _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_ // ussd_code daily report
|
|
||||||
_ussdcode_report ussdcode_report[USSDCODE_MAX_CODE_NUM];
|
|
||||||
#endif
|
|
||||||
}_daily_report;
|
}_daily_report;
|
||||||
|
|
||||||
typedef struct _pps_report
|
typedef struct _pps_report
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "../../../../plat/public/src/include/public.h"
|
#include "../../../../plat/public/src/include/public.h"
|
||||||
|
|
||||||
#define MAX_BODY_LEN 1024
|
#define MAX_BODY_LEN 128
|
||||||
|
|
||||||
#define REST_PROXY_PORT 4951
|
#define REST_PROXY_PORT 4951
|
||||||
|
|
||||||
@@ -26,7 +26,6 @@ enum ERROR_CODE
|
|||||||
ERR_REST_INVALID_RECHARGE_PWD = 5006,
|
ERR_REST_INVALID_RECHARGE_PWD = 5006,
|
||||||
ERR_REST_UNABLE_TO_COMPLY=5012,
|
ERR_REST_UNABLE_TO_COMPLY=5012,
|
||||||
ERR_REST_USER_UNKNOWN = 5030,
|
ERR_REST_USER_UNKNOWN = 5030,
|
||||||
ERR_REST_NO_LICENSE = 5040,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum REST_PROXY_MSG_TYPE
|
enum REST_PROXY_MSG_TYPE
|
||||||
@@ -35,14 +34,6 @@ enum REST_PROXY_MSG_TYPE
|
|||||||
REST_TOPUP=2,
|
REST_TOPUP=2,
|
||||||
REST_TRANSFER=3,
|
REST_TRANSFER=3,
|
||||||
|
|
||||||
REST_ORDER=0x84,
|
|
||||||
REST_FREE_RESOURCE=0x85,
|
|
||||||
REST_DOWNLOAD_APP=0x86,
|
|
||||||
REST_CHANNEL=0x87,
|
|
||||||
REST_OFFER_CHANGE=0x88,
|
|
||||||
REST_POINT_QUERY=0x89,
|
|
||||||
REST_POINT_TRANSFER=0x8a,
|
|
||||||
|
|
||||||
// for selfcare
|
// for selfcare
|
||||||
REST_SEND_AUTHCODE_REQ=5,
|
REST_SEND_AUTHCODE_REQ=5,
|
||||||
REST_SEND_AUTHCODE_RSP=6,
|
REST_SEND_AUTHCODE_RSP=6,
|
||||||
@@ -62,40 +53,7 @@ enum REST_PROXY_MSG_TYPE
|
|||||||
REST_CHECK_BALANCE_RSP=20,
|
REST_CHECK_BALANCE_RSP=20,
|
||||||
REST_QUERY_BALANCE_REQ=21,
|
REST_QUERY_BALANCE_REQ=21,
|
||||||
REST_QUERY_BALANCE_RSP=22,
|
REST_QUERY_BALANCE_RSP=22,
|
||||||
|
//
|
||||||
REST_QUERY_RECHARGE_CARD_REQ=23, // query recharge card interface from CRM
|
|
||||||
REST_QUERY_RECHARGE_CARD_RSP=24,
|
|
||||||
REST_UPDATE_RECHARGE_CARD_REQ=25, // update recharge card interface with CRM
|
|
||||||
REST_UPDATE_RECHARGE_CARD_RSP=26,
|
|
||||||
|
|
||||||
REST_CRM_PAYMENT_REQ=27,
|
|
||||||
REST_CRM_PAYMENT_RES=28,
|
|
||||||
|
|
||||||
REST_CRM_SMS_DELIVER_REQ=29,
|
|
||||||
REST_CRM_SMS_DELIVER_RES=30,
|
|
||||||
|
|
||||||
REST_CRM_CREATE_ACCT_REQ=31,
|
|
||||||
REST_CRM_CREATE_ACCT_RES=32,
|
|
||||||
|
|
||||||
REST_CRM_QUERY_TARIFF_REQ=33,
|
|
||||||
REST_CRM_QUERY_TARIFF_RES=34,
|
|
||||||
|
|
||||||
REST_CRM_UPDATE_SUBS_REQ=35,
|
|
||||||
REST_CRM_UPDATE_SUBS_RES=36,
|
|
||||||
|
|
||||||
REST_CRM_DELETE_SUBS_REQ=37,
|
|
||||||
REST_CRM_DELETE_SUBS_RES=38,
|
|
||||||
|
|
||||||
REST_CRM_UPDATE_SESS_INFO_REQ=39,
|
|
||||||
REST_CRM_UPDATE_SESS_INFO_RES=40,
|
|
||||||
|
|
||||||
REST_CRM_UPDATE_PLAN_INFO_REQ=41,
|
|
||||||
REST_CRM_UPDATE_PLAN_INFO_RES=42,
|
|
||||||
|
|
||||||
REST_CRM_RENT_CHARGE=43,
|
|
||||||
REST_CRM_RENT_CHARGE_RES=44,
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -134,7 +92,7 @@ enum REST_IE_TAG
|
|||||||
IE_MT_EXPIRY,
|
IE_MT_EXPIRY,
|
||||||
IE_USERNAME,
|
IE_USERNAME,
|
||||||
IE_PASSWORD,
|
IE_PASSWORD,
|
||||||
IE_MSG_CONTENT, //value=11
|
IE_MSG_CONTENT,
|
||||||
IE_STATUS,
|
IE_STATUS,
|
||||||
IE_REMARK,
|
IE_REMARK,
|
||||||
IE_GROUP_NAME,
|
IE_GROUP_NAME,
|
||||||
@@ -144,7 +102,7 @@ enum REST_IE_TAG
|
|||||||
IE_MT_VOICE_MIN,// in minute
|
IE_MT_VOICE_MIN,// in minute
|
||||||
IE_REMAIN_MT_VOICE_SEC,// in second
|
IE_REMAIN_MT_VOICE_SEC,// in second
|
||||||
IE_REMAIN_MT_VOICE_MIN,// in minute
|
IE_REMAIN_MT_VOICE_MIN,// in minute
|
||||||
IE_SMS_NUM, //value=21
|
IE_SMS_NUM,
|
||||||
IE_REMAIN_SMS_NUM,
|
IE_REMAIN_SMS_NUM,
|
||||||
IE_DATA_VOL_MB,// in MB
|
IE_DATA_VOL_MB,// in MB
|
||||||
IE_REMAIN_DATA_VOL_KB,// in KB
|
IE_REMAIN_DATA_VOL_KB,// in KB
|
||||||
@@ -154,45 +112,9 @@ enum REST_IE_TAG
|
|||||||
IE_VALID_DAYS,
|
IE_VALID_DAYS,
|
||||||
IE_EXPIRY_TIME,
|
IE_EXPIRY_TIME,
|
||||||
IE_MSISDN_TRANS_OUT,
|
IE_MSISDN_TRANS_OUT,
|
||||||
IE_MSISDN_TRANS_IN, //value=31
|
IE_MSISDN_TRANS_IN,
|
||||||
IE_BALANCE_AVAILABLE,
|
IE_BALANCE_AVAILABLE,
|
||||||
IE_RECHARGE_AMOUNT,
|
IE_RECHARGE_AMOUNT,
|
||||||
IE_RECHARGE_TYPE,
|
|
||||||
IE_RECHARGE_CARD_STATUS,
|
|
||||||
IE_RECHARGE_CARD_FACE_VALUE,
|
|
||||||
IE_RECHARGE_CARD_EXPIRED_TS,
|
|
||||||
IE_RECHARGE_CARD_UPDATED_TS,
|
|
||||||
IE_CUSTOMER_ID,
|
|
||||||
IE_ACCOUNT_ID,
|
|
||||||
IE_PRODUCT_ID, //value=41
|
|
||||||
IE_PLAN_ID,
|
|
||||||
IE_RENT_CHARGE,
|
|
||||||
IE_BIRTHDAY,
|
|
||||||
IE_SMS_CONTENT,
|
|
||||||
IE_SERVICE_TYPE,
|
|
||||||
IE_TARIIFF_PREFIX,
|
|
||||||
IE_TARIFF_UNIT,
|
|
||||||
IE_TARIFF_CHARGE,
|
|
||||||
IE_TARIFF_DISCOUNT,
|
|
||||||
IE_PLAN_VALUE,//value=51
|
|
||||||
IE_PLAN_USED_VALUE,
|
|
||||||
IE_BUNDLE_ID,
|
|
||||||
IE_CAUSE,
|
|
||||||
IE_SESS_FLAG,
|
|
||||||
IE_TIMESTAMP,
|
|
||||||
IE_CONSUME_VALUE,
|
|
||||||
IE_CALLED_NUMBER,
|
|
||||||
IE_UE_IP,
|
|
||||||
IE_GW_IP,
|
|
||||||
IE_CUG_ID,
|
|
||||||
IE_VAS_CUG_STATUS,
|
|
||||||
IE_SESS_UPDATE_TIME,
|
|
||||||
IE_PLAN_VALUE_ADD_THIS_TIME,
|
|
||||||
IE_USER_CLASS,
|
|
||||||
IE_PINCODE,
|
|
||||||
IE_CALLER_NUMBER,
|
|
||||||
IE_MAX_NUM,
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct rest_header
|
typedef struct rest_header
|
||||||
@@ -218,16 +140,13 @@ typedef struct rest_query_res
|
|||||||
|
|
||||||
typedef struct rest_topup
|
typedef struct rest_topup
|
||||||
{
|
{
|
||||||
u8 optional_flag; /* optional=1 ,account_id is presented */
|
|
||||||
char msisdn[24];
|
char msisdn[24];
|
||||||
|
|
||||||
char username[24];
|
char username[24];
|
||||||
char password[24];
|
char password[24];
|
||||||
char pincode[24];
|
|
||||||
u32 balance;
|
|
||||||
long account_id;
|
|
||||||
}_rest_topup;
|
}_rest_topup;
|
||||||
|
|
||||||
|
|
||||||
typedef struct rest_topup_res
|
typedef struct rest_topup_res
|
||||||
{
|
{
|
||||||
u8 optional_flag;
|
u8 optional_flag;
|
||||||
@@ -238,128 +157,11 @@ typedef struct rest_topup_res
|
|||||||
u32 mt_expiry;
|
u32 mt_expiry;
|
||||||
}_rest_topup_res;
|
}_rest_topup_res;
|
||||||
|
|
||||||
typedef struct rest_channel
|
|
||||||
{
|
|
||||||
u8 optional_flag; /* optional=1 ,account_id is presented */
|
|
||||||
char msisdn[24];
|
|
||||||
|
|
||||||
char sess_id[64];
|
|
||||||
char sc_url[128];
|
|
||||||
char input[24];
|
|
||||||
}_rest_channel;
|
|
||||||
|
|
||||||
typedef struct rest_channel_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u8 error_code;
|
|
||||||
|
|
||||||
u8 sess_state;
|
|
||||||
char prompt[256];
|
|
||||||
}_rest_channel_res;
|
|
||||||
|
|
||||||
typedef struct rest_order
|
|
||||||
{
|
|
||||||
u8 optional_flag; /* optional=1 ,account_id is presented */
|
|
||||||
char msisdn[24];
|
|
||||||
char callerMsisdn[24];
|
|
||||||
char payMsisdn[24];
|
|
||||||
|
|
||||||
u32 busicode;// 1000: recharge; 1001: order; 1002: cancel;
|
|
||||||
u32 offer_id;
|
|
||||||
u32 balance;// when busicode=1000
|
|
||||||
u32 paymethod;// byte0: 4: balance; 10: mobile money; null: default balance // byte1: thirdPartyPayMethod
|
|
||||||
char pincode[64];// when paymethod 10
|
|
||||||
//char thirdPartyPayMethod[32];// Airtel, MTN
|
|
||||||
//char thirdPartyPayPhone[64];// use payMsisdn
|
|
||||||
}_rest_order;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct rest_order_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u8 error_code;
|
|
||||||
}_rest_order_res;
|
|
||||||
|
|
||||||
typedef struct rest_freeresource
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
}_rest_freeresource;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct rest_freeresource_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u8 error_code;
|
|
||||||
}_rest_freeresource_res;
|
|
||||||
|
|
||||||
typedef struct rest_downloadApp
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
}_rest_downloadApp;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct rest_downloadApp_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u8 error_code;
|
|
||||||
}_rest_downloadApp_res;
|
|
||||||
|
|
||||||
typedef struct rest_offerChange
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
u8 opt_out;
|
|
||||||
}_rest_offerChange;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct rest_offerChange_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u8 error_code;
|
|
||||||
}_rest_offerChange_res;
|
|
||||||
|
|
||||||
typedef struct rest_queryPoint
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
}_rest_queryPoint;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct rest_queryPoint_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u8 error_code;
|
|
||||||
|
|
||||||
u32 amount;
|
|
||||||
u32 airtime_amount;
|
|
||||||
}_rest_queryPoint_res;
|
|
||||||
|
|
||||||
typedef struct rest_transferPoint
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
char target_msisdn[24];
|
|
||||||
|
|
||||||
u32 amount;
|
|
||||||
u32 busicode;
|
|
||||||
}_rest_transferPoint;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct rest_transferPoint_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u8 error_code;
|
|
||||||
}_rest_transferPoint_res;
|
|
||||||
|
|
||||||
// for selfcare =============================
|
// for selfcare =============================
|
||||||
typedef struct rest_send_authcode_req
|
typedef struct rest_send_authcode_req
|
||||||
{
|
{
|
||||||
char msisdn[24];
|
char msisdn[24];
|
||||||
char sms_content[MAX_BODY_LEN];
|
char sms_content[128];
|
||||||
}_rest_send_authcode_req;
|
}_rest_send_authcode_req;
|
||||||
|
|
||||||
typedef struct rest_send_authcode_rsp
|
typedef struct rest_send_authcode_rsp
|
||||||
@@ -441,8 +243,6 @@ typedef struct rest_recharge_req
|
|||||||
char msisdn[24];
|
char msisdn[24];
|
||||||
|
|
||||||
u32 amount;// mandatory, add to balance
|
u32 amount;// mandatory, add to balance
|
||||||
u8 op_type;
|
|
||||||
u16 valid_days;
|
|
||||||
}_rest_recharge_req;
|
}_rest_recharge_req;
|
||||||
|
|
||||||
|
|
||||||
@@ -451,7 +251,6 @@ typedef struct rest_recharge_rsp
|
|||||||
u8 optional_flag;
|
u8 optional_flag;
|
||||||
u8 result;
|
u8 result;
|
||||||
u32 error_code;
|
u32 error_code;
|
||||||
u8 status;// current status
|
|
||||||
u32 balance;// current balance
|
u32 balance;// current balance
|
||||||
u64 expiredTime;// expired time
|
u64 expiredTime;// expired time
|
||||||
}_rest_recharge_rsp;
|
}_rest_recharge_rsp;
|
||||||
@@ -523,139 +322,8 @@ typedef struct rest_query_balance_rsp
|
|||||||
u8 optional_flag;
|
u8 optional_flag;
|
||||||
u8 result;
|
u8 result;
|
||||||
u32 error_code;
|
u32 error_code;
|
||||||
u8 status;// use ACCT_STATUS
|
|
||||||
u32 balance;// current balance
|
u32 balance;// current balance
|
||||||
u32 mo_expiry;
|
|
||||||
}_rest_query_balance_rsp;
|
}_rest_query_balance_rsp;
|
||||||
|
|
||||||
typedef struct rest_sms_deliver_req
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
u16 sms_len;
|
|
||||||
char sms_content[MAX_BODY_LEN];
|
|
||||||
}_rest_sms_deliver_req;
|
|
||||||
|
|
||||||
typedef struct rest_sms_deliver_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u32 error_code;
|
|
||||||
}_rest_sms_deliver_res;
|
|
||||||
|
|
||||||
typedef struct rest_create_acct_req
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
u32 customer_id;
|
|
||||||
u32 account_id;
|
|
||||||
u32 product_id;
|
|
||||||
u32 plan_id; /* basic plan */
|
|
||||||
u8 user_class;
|
|
||||||
u32 balance;
|
|
||||||
u32 expiry_date;
|
|
||||||
u32 rent_charge;
|
|
||||||
u32 birthday;
|
|
||||||
u32 cug_id;
|
|
||||||
}_rest_create_acct_req;
|
|
||||||
|
|
||||||
typedef struct rest_create_acct_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u32 error_code;
|
|
||||||
}_rest_create_acct_res;
|
|
||||||
|
|
||||||
typedef struct rest_query_tariff_req
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
u8 service_type; /*0=mo call, 1=mt call, 2=sms, 3=data */
|
|
||||||
char called_number[24];
|
|
||||||
}_rest_query_tariff_req;
|
|
||||||
|
|
||||||
typedef struct rest_query_tariff_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u32 error_code;
|
|
||||||
char prefix[24];
|
|
||||||
u32 unit_time;
|
|
||||||
u32 unit_charge;
|
|
||||||
u32 discount;
|
|
||||||
u32 plan_id;
|
|
||||||
u32 bundle_plan_id;
|
|
||||||
u64 total_plan_value;
|
|
||||||
u64 used_plan_value;
|
|
||||||
}_rest_query_tariff_res;
|
|
||||||
|
|
||||||
typedef struct rest_update_subs_req
|
|
||||||
{
|
|
||||||
u32 optional_flag;
|
|
||||||
char msisdn[24];
|
|
||||||
u32 account_id;
|
|
||||||
u8 status; /*falg=1*/
|
|
||||||
u32 balance;
|
|
||||||
u32 balance_expiry_date;
|
|
||||||
u32 basic_plan_id;
|
|
||||||
u32 basic_plan_rent;
|
|
||||||
u8 vas_cug_status;
|
|
||||||
}_rest_update_subs_req;
|
|
||||||
|
|
||||||
typedef struct rest_update_subs_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u32 error_code;
|
|
||||||
}_rest_update_subs_res;
|
|
||||||
|
|
||||||
typedef struct rest_delete_subs_req
|
|
||||||
{
|
|
||||||
char msisdn[24];
|
|
||||||
u8 cause;
|
|
||||||
}_rest_delete_subs_req;
|
|
||||||
|
|
||||||
typedef struct rest_delete_subs_res
|
|
||||||
{
|
|
||||||
u8 optional_flag;
|
|
||||||
u8 result;
|
|
||||||
u32 error_code;
|
|
||||||
}_rest_delete_subs_res;
|
|
||||||
|
|
||||||
typedef struct rest_update_sess_info_req
|
|
||||||
{
|
|
||||||
u32 optional_flag; /*bit 0=called, 1= ue_ip, 2=pgw ip */
|
|
||||||
char msisdn[24];
|
|
||||||
u8 first_sess; /*if 1 then clear all session in database */
|
|
||||||
u8 service_type; /*0=mo call, 1=mt call, 2=mo sms, 3= data*/
|
|
||||||
u32 start_time;
|
|
||||||
u32 consumed_value; /*duration of call, bytes of data */
|
|
||||||
char called[24]; /*for call/sms */
|
|
||||||
u32 ue_ip;
|
|
||||||
u32 gw_ip;
|
|
||||||
}_rest_update_sess_info_req;
|
|
||||||
|
|
||||||
typedef struct rest_update_plan_info_req
|
|
||||||
{
|
|
||||||
u32 optional_flag; /*bit 0=called, 1= ue_ip, 2=pgw ip */
|
|
||||||
char msisdn[24];
|
|
||||||
u8 service_type; /*0=mo call, 1=mt call, 2=mo sms, 3= data*/
|
|
||||||
u32 account_id;
|
|
||||||
u32 plan_id;
|
|
||||||
u32 bundle_id;
|
|
||||||
u64 plan_total_value;
|
|
||||||
u64 plan_used_value;
|
|
||||||
u32 sess_update_times;
|
|
||||||
u64 this_time_add_value;
|
|
||||||
}_rest_update_plan_info_req;
|
|
||||||
|
|
||||||
typedef struct rest_rent_charge_req
|
|
||||||
{
|
|
||||||
u32 optional_flag;
|
|
||||||
char msisdn[24];
|
|
||||||
u32 balance;
|
|
||||||
u32 rent_charge;
|
|
||||||
}_rest_rent_charge_req;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//======================================
|
//======================================
|
||||||
|
|
||||||
typedef struct rest_msg_s
|
typedef struct rest_msg_s
|
||||||
@@ -669,21 +337,6 @@ typedef struct rest_msg_s
|
|||||||
_rest_topup topup;
|
_rest_topup topup;
|
||||||
_rest_topup_res topup_res;
|
_rest_topup_res topup_res;
|
||||||
|
|
||||||
_rest_order order;
|
|
||||||
_rest_order_res order_res;
|
|
||||||
_rest_freeresource free_resource;
|
|
||||||
_rest_freeresource_res free_resource_res;
|
|
||||||
_rest_downloadApp downloadApp;
|
|
||||||
_rest_downloadApp_res downloadApp_res;
|
|
||||||
_rest_channel chnl;
|
|
||||||
_rest_channel_res chnl_res;
|
|
||||||
_rest_offerChange offerChange;
|
|
||||||
_rest_offerChange_res offerChange_res;
|
|
||||||
_rest_queryPoint queryPoint;
|
|
||||||
_rest_queryPoint_res queryPoint_res;
|
|
||||||
_rest_transferPoint transferPoint;
|
|
||||||
_rest_transferPoint_res transferPoint_res;
|
|
||||||
|
|
||||||
// for selfcare
|
// for selfcare
|
||||||
_rest_send_authcode_req send_authcode_req;
|
_rest_send_authcode_req send_authcode_req;
|
||||||
_rest_send_authcode_rsp send_authcode_rsp;
|
_rest_send_authcode_rsp send_authcode_rsp;
|
||||||
@@ -704,28 +357,6 @@ typedef struct rest_msg_s
|
|||||||
_rest_query_balance_req query_balance_req;
|
_rest_query_balance_req query_balance_req;
|
||||||
_rest_query_balance_rsp query_balance_rsp;
|
_rest_query_balance_rsp query_balance_rsp;
|
||||||
//
|
//
|
||||||
_rest_sms_deliver_req sms_deliver;
|
|
||||||
_rest_sms_deliver_res sms_deliver_res;
|
|
||||||
|
|
||||||
_rest_create_acct_req create_acct;
|
|
||||||
_rest_create_acct_res create_acct_res;
|
|
||||||
|
|
||||||
_rest_query_tariff_req query_tariff;
|
|
||||||
_rest_query_tariff_res query_tariff_res;
|
|
||||||
|
|
||||||
_rest_update_subs_req update_subs;
|
|
||||||
_rest_update_subs_res update_subs_res;
|
|
||||||
|
|
||||||
_rest_delete_subs_req delete_subs;
|
|
||||||
_rest_delete_subs_res delete_subs_res;
|
|
||||||
|
|
||||||
_rest_update_sess_info_req update_sess_info;
|
|
||||||
|
|
||||||
_rest_update_plan_info_req update_plan_info;
|
|
||||||
|
|
||||||
_rest_rent_charge_req rent_charge;
|
|
||||||
|
|
||||||
|
|
||||||
}msg;
|
}msg;
|
||||||
}_rest_msg_s;
|
}_rest_msg_s;
|
||||||
|
|
||||||
@@ -760,70 +391,4 @@ int encode_rest_query_balance_req(_rest_msg_s *ptr, u8 *buf);
|
|||||||
int encode_rest_query_balance_rsp(_rest_msg_s *ptr, u8 *buf);
|
int encode_rest_query_balance_rsp(_rest_msg_s *ptr, u8 *buf);
|
||||||
//
|
//
|
||||||
|
|
||||||
// for restproxy=====================================
|
|
||||||
#define YX_USSD_MENU_MAIN 0
|
|
||||||
#define YX_USSD_MENU_UNLIMITED_ONCE_RECUR 1
|
|
||||||
#define YX_USSD_MENU_PRESS_ZED_DATA 2
|
|
||||||
#define YX_USSD_MENU_PRESS_ZED_VOICE 3
|
|
||||||
#define YX_USSD_MENU_PRESS_MIFI_AND_ROUTER 4
|
|
||||||
#define YX_USSD_MENU_PRESS_INPUT_NO 5
|
|
||||||
#define YX_USSD_MENU_PRESS_BALANCE_CHECK 6
|
|
||||||
#define YX_USSD_MENU_PRESS_AMA 7
|
|
||||||
#define YX_USSD_MENU_PRESS_UNLIMITED_BUNDLES 8
|
|
||||||
#define YX_USSD_MENU_PRESS_PURCHASE_AIRTIME 9
|
|
||||||
#define YX_USSD_MENU_DATA_24HRS 10
|
|
||||||
#define YX_USSD_MENU_DATA_7DAYS 11
|
|
||||||
#define YX_USSD_MENU_DATA_30DAYS 12
|
|
||||||
#define YX_USSD_MENU_VOICE_DAILY 13
|
|
||||||
#define YX_USSD_MENU_VOICE_WEEKLY 14
|
|
||||||
#define YX_USSD_MENU_VOICE_MONTHLY 15
|
|
||||||
#define YX_USSD_MENU_MIFI_SUB 16
|
|
||||||
#define YX_USSD_MENU_BUY_FOR_OTHER 17
|
|
||||||
#define YX_USSD_MENU_SELECT_PROVIDER 18
|
|
||||||
#define YX_USSD_MENU_ENTER_PAY_NUMBER 19
|
|
||||||
#define YX_USSD_MENU_SELECT_MONEY 20
|
|
||||||
#define YX_USSD_MENU_PAID_MONEY 21
|
|
||||||
#define YX_USSD_MENU_SELECT_MOBIL_MONEY 22
|
|
||||||
#define YX_USSD_MENU_SUBSCRIB_COMPLETE 23
|
|
||||||
#define YX_USSD_MENU_CANCEL_RENEWAL 24
|
|
||||||
#define YX_USSD_MENU_AIRTIME_AMOUNT 25
|
|
||||||
#define YX_USSD_MENU_AIRTIME_NO 26
|
|
||||||
#define YX_USSD_MENU_DIBAAMA 27
|
|
||||||
#define YX_USSD_MENU_DIBA 28
|
|
||||||
#define YX_USSD_MENU_MOMO_PIN 29
|
|
||||||
#define YX_USSD_MENU_PROMO 30
|
|
||||||
#define YX_USSD_MENU_QUERY_POINT 31
|
|
||||||
#define YX_USSD_MENU_CUR_POINT 32
|
|
||||||
#define YX_USSD_MENU_POINT2NUM 33
|
|
||||||
#define YX_USSD_MENU_OFFER_CHANGED 34
|
|
||||||
#define YX_USSD_MENU_POINT_TRANSFERED 35
|
|
||||||
#define YX_USSD_MENU_POINT_LOW 36
|
|
||||||
#define YX_USSD_MENU_OFFER_OUT 37
|
|
||||||
#define YX_USSD_MENU_POINT_TRANS_FAIL 38
|
|
||||||
#define YX_USSD_MENU_SHARE_NBR 39
|
|
||||||
#define YX_USSD_MENU_NUM_MAX 64
|
|
||||||
extern char yx_ussd_menu[YX_USSD_MENU_NUM_MAX][512];
|
|
||||||
#define YX_USSD_CHNL_NUM_MAX 16
|
|
||||||
extern char yx_chnl_info[YX_USSD_CHNL_NUM_MAX][128];
|
|
||||||
|
|
||||||
#define YX_MOBILE_MONEY_MAX 8
|
|
||||||
#define YX_OFFER_TYPE_MAX 10
|
|
||||||
#define YX_OFFER_TYPE_BUNDLE 0
|
|
||||||
#define YX_OFFER_TYPE_DATA_1 1
|
|
||||||
#define YX_OFFER_TYPE_DATA_2 2
|
|
||||||
#define YX_OFFER_TYPE_DATA_3 3
|
|
||||||
#define YX_OFFER_TYPE_VOICE_1 4
|
|
||||||
#define YX_OFFER_TYPE_VOICE_2 5
|
|
||||||
#define YX_OFFER_TYPE_VOICE_3 6
|
|
||||||
#define YX_OFFER_TYPE_MIFI_1 7
|
|
||||||
#define YX_OFFER_TYPE_AMA_1 8
|
|
||||||
#define YX_OFFER_TYPE_DIBA_1 9
|
|
||||||
#define YX_OFFER_PER_TYPE 12
|
|
||||||
|
|
||||||
int pps_third_party_plan_process(u_short portid);
|
|
||||||
int pps_third_party_channel_process(u_short portid);
|
|
||||||
int match_channel_info(char *sc, char *url);
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#define MAX_MEGA_SIZE 34
|
#define MAX_MEGA_SIZE 34
|
||||||
#define PRIVATE_TARIFF_SIZE (MAX_MEGA_SIZE*1024*1024)
|
#define PRIVATE_TARIFF_SIZE (MAX_MEGA_SIZE*1024*1024)
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
_comm_tariff comm_tariff[MAX_ZONE_NUM];
|
_comm_tariff comm_tariff[MAX_ZONE_NUM];
|
||||||
_rent_tariff rent_tariff[MAX_ZONE_NUM][MAX_RENT_TARIFF];
|
_rent_tariff rent_tariff[MAX_ZONE_NUM][MAX_RENT_TARIFF];
|
||||||
@@ -37,7 +38,7 @@ typedef struct
|
|||||||
}_pps_prefix_node;
|
}_pps_prefix_node;
|
||||||
|
|
||||||
//_pps_prefix_node pps_prefix_table[MAX_ZONE_NUM_NEW][PPS_PREFIX_NODE_NUM];
|
//_pps_prefix_node pps_prefix_table[MAX_ZONE_NUM_NEW][PPS_PREFIX_NODE_NUM];
|
||||||
//_pps_prefix_node pps_prefix_table[PPS_PREFIX_NODE_NUM];
|
_pps_prefix_node pps_prefix_table[PPS_PREFIX_NODE_NUM];
|
||||||
/* the ZONE NUM is as a prefix or a separate table is for further study,
|
/* the ZONE NUM is as a prefix or a separate table is for further study,
|
||||||
if the ZONE NUM is as prefix , then should not be larger than 16 */
|
if the ZONE NUM is as prefix , then should not be larger than 16 */
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ DaemonInit(const char *pname, int facility)
|
|||||||
err_sys("%s: %s: fork (%d)",
|
err_sys("%s: %s: fork (%d)",
|
||||||
FILE_MACRO, FUNCTION_MACRO, LINE_MACRO);
|
FILE_MACRO, FUNCTION_MACRO, LINE_MACRO);
|
||||||
else if (pid != 0)
|
else if (pid != 0)
|
||||||
{
|
exit(0); /* parent goes bye-bye */
|
||||||
exit(0);
|
|
||||||
} /* parent goes bye-bye */
|
|
||||||
|
|
||||||
/* 41st child continues */
|
/* 41st child continues */
|
||||||
setsid(); /* become session leader */
|
setsid(); /* become session leader */
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ WriteDebugMsg(void *dest, const void *src)
|
|||||||
if (p->subWrite == p->subRead) {
|
if (p->subWrite == p->subRead) {
|
||||||
(p->subRead == DEBUG_BUFFER_LINE-1) ?
|
(p->subRead == DEBUG_BUFFER_LINE-1) ?
|
||||||
(p->subRead = 0) : (p->subRead ++);
|
(p->subRead = 0) : (p->subRead ++);
|
||||||
return FAILURE;
|
return OVERFLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@@ -165,9 +165,7 @@ ReadDebugMsg(void *dest, const void *src)
|
|||||||
*/
|
*/
|
||||||
p->subRead ++;
|
p->subRead ++;
|
||||||
if (p->subRead == DEBUG_BUFFER_LINE)
|
if (p->subRead == DEBUG_BUFFER_LINE)
|
||||||
{
|
|
||||||
p->subRead = 0;
|
p->subRead = 0;
|
||||||
}
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-13
@@ -179,6 +179,11 @@ const char * AsciiTime(char *ptr, time_t time)
|
|||||||
|
|
||||||
t=&tt;
|
t=&tt;
|
||||||
t=localtime(&time);
|
t=localtime(&time);
|
||||||
|
if (t==NULL)
|
||||||
|
{
|
||||||
|
sprintf(ptr,"%04d%02d%02d%02d%02d%02d",1970,1,1,0,0,0);
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
sprintf(ptr,"%04d%02d%02d%02d%02d%02d",
|
sprintf(ptr,"%04d%02d%02d%02d%02d%02d",
|
||||||
t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour,
|
t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour,
|
||||||
t->tm_min, t->tm_sec);
|
t->tm_min, t->tm_sec);
|
||||||
@@ -200,18 +205,6 @@ const char * AsciiTimeYMD(char *ptr, time_t time)
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * AsciiTimeYMDHMS(char *ptr, time_t time)
|
|
||||||
{
|
|
||||||
struct tm *t,tt;
|
|
||||||
|
|
||||||
t=&tt;
|
|
||||||
t=localtime(&time);
|
|
||||||
sprintf(ptr,"%02d-%02d-%04d %02d:%02d:%02d",
|
|
||||||
t->tm_mday, t->tm_mon+1,t->tm_year+1900, t->tm_hour,
|
|
||||||
t->tm_min, t->tm_sec);
|
|
||||||
ptr[19] = 0;
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
u_short
|
u_short
|
||||||
GetTmDay()
|
GetTmDay()
|
||||||
@@ -323,7 +316,6 @@ MakeTime(struct tm *timep, char *ptr)
|
|||||||
char tempbuf[5];
|
char tempbuf[5];
|
||||||
struct tm tm, *timeptr;
|
struct tm tm, *timeptr;
|
||||||
time_t retval;
|
time_t retval;
|
||||||
memset(&tm, 0, sizeof(struct tm));
|
|
||||||
timeptr = &tm;
|
timeptr = &tm;
|
||||||
strncpy(tempbuf, ptr, 4);
|
strncpy(tempbuf, ptr, 4);
|
||||||
tempbuf[4] = 0;
|
tempbuf[4] = 0;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ INC_TRUE=1
|
|||||||
INC_FALSE=0
|
INC_FALSE=0
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS=-D_REENTRANT -D_MAX_64COS_COOK_ -Wall -Wno-unused-function -g -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ -I/usr/local/lib/glib-2.0/include -L/usr/local/lib -lglib-2.0
|
CFLAGS=-D_REENTRANT -D_MAX_64COS_COOK_ -Wall -Wno-unused-function -g -lhiredis
|
||||||
#-O2
|
#-O2
|
||||||
prefix = /usr
|
prefix = /usr
|
||||||
includedir = $(prefix)/include
|
includedir = $(prefix)/include
|
||||||
@@ -66,7 +66,7 @@ PROGS=ppsm
|
|||||||
|
|
||||||
#pps_OBJ = ppsmain.o capmsg.o dailyreport.o loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o ppsfunc.o ppsm.o precard.o rammng.o smppapi.o crd.o ppsmap.o ppsussd.o ppsopr.o callingCardMsg.o callingCardState.o
|
#pps_OBJ = ppsmain.o capmsg.o dailyreport.o loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o ppsfunc.o ppsm.o precard.o rammng.o smppapi.o crd.o ppsmap.o ppsussd.o ppsopr.o callingCardMsg.o callingCardState.o
|
||||||
|
|
||||||
pps_OBJ = capmsg.o dailyreport.o loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o ppsfunc.o ppsm.o precard.o rammng.o smppapi.o crd.o ppsmap.o ppsussd.o callingCardMsg.o callingCardState.o tariffApplication.o callMeBack.o freeSMS.o feeTransfer.o masterSlaveCard.o radius.o gprs.o vas.o restapi.o ocs_user_table.o pps_redis.o
|
pps_OBJ = capmsg.o dailyreport.o loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o ppsfunc.o ppsm.o precard.o rammng.o smppapi.o crd.o ppsmap.o ppsussd.o callingCardMsg.o callingCardState.o tariffApplication.o callMeBack.o freeSMS.o feeTransfer.o masterSlaveCard.o radius.o gprs.o vas.o restapi.o pps_redis.o
|
||||||
all:$(PROGS)
|
all:$(PROGS)
|
||||||
#$(pps_OBJ)
|
#$(pps_OBJ)
|
||||||
# executive file
|
# executive file
|
||||||
@@ -152,8 +152,6 @@ vas.o:vas.c
|
|||||||
$(COMPILE.c) -c vas.c $(INCLUDES)
|
$(COMPILE.c) -c vas.c $(INCLUDES)
|
||||||
restapi.o:restapi.c
|
restapi.o:restapi.c
|
||||||
$(COMPILE.c) -c restapi.c $(INCLUDES)
|
$(COMPILE.c) -c restapi.c $(INCLUDES)
|
||||||
ocs_user_table.o:ocs_user_table.c
|
|
||||||
$(COMPILE.c) -c ocs_user_table.c $(INCLUDES)
|
|
||||||
pps_redis.o:pps_redis.c
|
pps_redis.o:pps_redis.c
|
||||||
$(COMPILE.c) -c pps_redis.c $(INCLUDES)
|
$(COMPILE.c) -c pps_redis.c $(INCLUDES)
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ INC_TRUE=1
|
|||||||
INC_FALSE=0
|
INC_FALSE=0
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS=-D_REENTRANT -Wall -Wno-unused-function -g
|
CFLAGS=-D_REENTRANT -Wall -Wno-unused-function -g -lhiredis
|
||||||
CFLAGS_IN=-D_REENTRANT -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
|
|
||||||
|
|
||||||
#-O2
|
#-O2
|
||||||
prefix = /usr
|
prefix = /usr
|
||||||
includedir = $(prefix)/include
|
includedir = $(prefix)/include
|
||||||
@@ -46,7 +44,7 @@ PPS_LIBRARY = -lopr
|
|||||||
|
|
||||||
STATIC=
|
STATIC=
|
||||||
|
|
||||||
COMPILE.c=$(CC) $(CFLAGS) $(CFLAGS_IN)
|
COMPILE.c=$(CC) $(CFLAGS)
|
||||||
LINK.c=$(CC) $(CFLAGS)
|
LINK.c=$(CC) $(CFLAGS)
|
||||||
|
|
||||||
COMPILE_SUFFIX=$(STATIC) $(INC_FLAGS)
|
COMPILE_SUFFIX=$(STATIC) $(INC_FLAGS)
|
||||||
@@ -68,7 +66,7 @@ PROGS=ppsm
|
|||||||
|
|
||||||
#pps_OBJ = ppsmain.o capmsg.o dailyreport.o loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o ppsfunc.o ppsm.o precard.o rammng.o smppapi.o crd.o ppsmap.o ppsussd.o ppsopr.o callingCardMsg.o callingCardState.o
|
#pps_OBJ = ppsmain.o capmsg.o dailyreport.o loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o ppsfunc.o ppsm.o precard.o rammng.o smppapi.o crd.o ppsmap.o ppsussd.o ppsopr.o callingCardMsg.o callingCardState.o
|
||||||
|
|
||||||
pps_OBJ = capmsg.o dailyreport.o loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o ppsfunc.o ppsm.o precard.o rammng.o smppapi.o crd.o ppsmap.o ppsussd.o callingCardMsg.o callingCardState.o tariffApplication.o callMeBack.o freeSMS.o feeTransfer.o masterSlaveCard.o radius.o gprs.o vas.o restapi.o ocs_user_table.o pps_redis.o
|
pps_OBJ = capmsg.o dailyreport.o loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o ppsfunc.o ppsm.o precard.o rammng.o smppapi.o crd.o ppsmap.o ppsussd.o callingCardMsg.o callingCardState.o tariffApplication.o callMeBack.o freeSMS.o feeTransfer.o masterSlaveCard.o radius.o gprs.o vas.o restapi.o pps_redis.o
|
||||||
all:$(PROGS)
|
all:$(PROGS)
|
||||||
#$(pps_OBJ)
|
#$(pps_OBJ)
|
||||||
# executive file
|
# executive file
|
||||||
@@ -154,10 +152,7 @@ vas.o:vas.c
|
|||||||
$(COMPILE.c) -c vas.c $(INCLUDES)
|
$(COMPILE.c) -c vas.c $(INCLUDES)
|
||||||
restapi.o:restapi.c
|
restapi.o:restapi.c
|
||||||
$(COMPILE.c) -c restapi.c $(INCLUDES)
|
$(COMPILE.c) -c restapi.c $(INCLUDES)
|
||||||
ocs_user_table.o:ocs_user_table.c
|
|
||||||
$(COMPILE.c) -c ocs_user_table.c $(INCLUDES)
|
|
||||||
pps_redis.o:pps_redis.c
|
pps_redis.o:pps_redis.c
|
||||||
$(COMPILE.c) -c pps_redis.c $(INCLUDES)
|
$(COMPILE.c) -c pps_redis.c $(INCLUDES)
|
||||||
clean:
|
clean:
|
||||||
rm -f *.c~ *.o core ppsm *.c.bak
|
rm -f *.c~ *.o core ppsm *.c.bak
|
||||||
|
|
||||||
@@ -56,13 +56,13 @@ void capMessageProc()
|
|||||||
PutLogFunID("capMessageProc");
|
PutLogFunID("capMessageProc");
|
||||||
for(loop=0;loop<64;loop++)
|
for(loop=0;loop<64;loop++)
|
||||||
{
|
{
|
||||||
if(!GetScfOpen(&capmsg)) // 从Open队列中读取消息,定期调用
|
if(!GetScfOpen(&capmsg)) // ��Open�����ж�ȡ��Ϣ�����ڵ���
|
||||||
break;
|
break;
|
||||||
if(capmsg.msgLength[0]==0 && capmsg.msgLength[1]==0) {// 检查长度域是否> 0
|
if(capmsg.msgLength[0]==0 && capmsg.msgLength[1]==0) {// ��鳤�����Ƿ�> 0
|
||||||
debugmib.display.proc_begin[6] ++;
|
debugmib.display.proc_begin[6] ++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
portid = AssignProcID(0);// 分配处理端口
|
portid = AssignProcID(0);// ���䴦���˿�
|
||||||
if( portid< MAX_FSM_PROCESS && portid>=0 )
|
if( portid< MAX_FSM_PROCESS && portid>=0 )
|
||||||
{
|
{
|
||||||
AddPPSStatistics(MIBPPS_CAPOPEN,0);
|
AddPPSStatistics(MIBPPS_CAPOPEN,0);
|
||||||
@@ -80,7 +80,6 @@ void capMessageProc()
|
|||||||
|
|
||||||
tcap_change_local_ssn(dlgid, SSN_SCF, 0x92);
|
tcap_change_local_ssn(dlgid, SSN_SCF, 0x92);
|
||||||
|
|
||||||
if(0)
|
|
||||||
if((logMsgFlag & 0x04) || (logMsgFlag & 0x02))
|
if((logMsgFlag & 0x04) || (logMsgFlag & 0x02))
|
||||||
{
|
{
|
||||||
DebugMsgDelimiter();
|
DebugMsgDelimiter();
|
||||||
|
|||||||
+88
-367
@@ -54,12 +54,12 @@ int SendDailyReportToPeerServerForStop();
|
|||||||
extern void SendOperatorRechargeCDR();
|
extern void SendOperatorRechargeCDR();
|
||||||
extern int IsPromotionTime(COSTable *cosTableItem, struct timeval tvn);
|
extern int IsPromotionTime(COSTable *cosTableItem, struct timeval tvn);
|
||||||
extern int smppSendAccountInfo();
|
extern int smppSendAccountInfo();
|
||||||
extern int smppSendMOSM(char *called, char *caller, u_char *msg,int msgLen,u_char dataCoding);
|
extern int smppSendMOSM(char *caller, char *called, u_char *msg,int msgLen,u_char dataCoding);
|
||||||
extern int CleanPPSUSSDStatisticsByDay();
|
extern int CleanPPSUSSDStatisticsByDay();
|
||||||
extern void resetPoolSlaveDaily(u_short head,u_short tail);
|
extern void resetPoolSlaveDaily(u_short head,u_short tail);
|
||||||
extern int UseExternalVC();
|
extern int UseExternalVC();
|
||||||
extern u_char *getSmsSentenceNative(u8 languageType,SMS_SENTENCE id);
|
extern u_char *getSmsSentenceNative(u8 languageType,SMS_SENTENCE id);
|
||||||
extern int subscribe_bundle_plan_send_used_up_info(char *caller_number, SMS_SENTENCE id);
|
extern int subscribe_bundle_plan_send_used_up_info(char *caller_number, SMS_SENTENCE id, _state_data *shmp);
|
||||||
extern char* ppsParseSentence(char *sentence, int varNum, char *varStr[]);
|
extern char* ppsParseSentence(char *sentence, int varNum, char *varStr[]);
|
||||||
/*----------------------------------------------*/
|
/*----------------------------------------------*/
|
||||||
void reportInit()
|
void reportInit()
|
||||||
@@ -293,18 +293,12 @@ int reportAccount(int segmentno)
|
|||||||
status = shmp->status;
|
status = shmp->status;
|
||||||
shmp->free_sm_counter = 0;
|
shmp->free_sm_counter = 0;
|
||||||
shmp->gprsNotificationTimes = 0;
|
shmp->gprsNotificationTimes = 0;
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
//rent chage for CUG service
|
|
||||||
if(shmp->cug_id != NOT_CUG_ACCOUNT && shmp->crm_info.vas_cug_state == 0)
|
|
||||||
{
|
|
||||||
pps_send_rent_charge_to_crm(i, j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pps_report.daily_report[index].account_report.total_num ++;
|
pps_report.daily_report[index].account_report.total_num ++;
|
||||||
pps_report.daily_report[index].account_report.total_balance =
|
pps_report.daily_report[index].account_report.total_balance =
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
// too many query in a tick if using balance of redis DB, TODO
|
||||||
|
#endif
|
||||||
totalBalance = totalBalance +
|
totalBalance = totalBalance +
|
||||||
shmp->balance +
|
shmp->balance +
|
||||||
shmp->promo_balance;
|
shmp->promo_balance;
|
||||||
@@ -371,9 +365,6 @@ int reportPrepaidCard(int segmentno)
|
|||||||
if(UseExternalVC())
|
if(UseExternalVC())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
now_day = (tvnow.tv_sec - timezone)/(24*3600);
|
now_day = (tvnow.tv_sec - timezone)/(24*3600);
|
||||||
|
|
||||||
for(i=0;i<MAX_CARD_SEGMENT;i++)
|
for(i=0;i<MAX_CARD_SEGMENT;i++)
|
||||||
@@ -424,86 +415,6 @@ int reportPrepaidCard(int segmentno)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_ // ussd_code daily report
|
|
||||||
extern int yx_ussd_daily_report;
|
|
||||||
int GetUssdCodeDailyReportByIndex(u_char oidLen,DWORD *oid,
|
|
||||||
u_char *pdata, BYTE *vartype)
|
|
||||||
{
|
|
||||||
int totalLen;
|
|
||||||
int index,saveIndex;//,yesterdayIndex;
|
|
||||||
int value=0,tag;
|
|
||||||
char buf[256]="",tagbuf[16]="";
|
|
||||||
_daily_report *shmp=NULL, *shmp_peer = NULL;
|
|
||||||
ASN_BUF *asnbuf, asnbuf1;
|
|
||||||
|
|
||||||
PutLogFunID("GetUssdCodeDailyReportByIndex");
|
|
||||||
asnbuf = &asnbuf1;
|
|
||||||
AsnEncode(pdata,512,asnbuf);
|
|
||||||
|
|
||||||
index = oid[14];
|
|
||||||
saveIndex = index %7;
|
|
||||||
//yesterdayIndex = (saveIndex+7-1)%7;
|
|
||||||
|
|
||||||
shmp = &pps_report.daily_report[saveIndex];
|
|
||||||
shmp_peer = &pps_report.peer_daily_report[saveIndex];
|
|
||||||
|
|
||||||
sprintf(buf,"%04d-%02d-%02d",
|
|
||||||
shmp->year_month_day[0],
|
|
||||||
shmp->year_month_day[1],
|
|
||||||
shmp->year_month_day[2]);
|
|
||||||
totalLen = add_tlv("1", 10, (u_char *)buf, 0x80, asnbuf);
|
|
||||||
|
|
||||||
PutLogFunID("GetDailyReportByIndex0");
|
|
||||||
|
|
||||||
strcpy(shmp->ussdcode_report[USSDCODE_TYPE_QUERY].code, USSDCODE_QUERY_CODE_STR);
|
|
||||||
strcpy(shmp->ussdcode_report[USSDCODE_TYPE_TOPUP].code, USSDCODE_TOPUP_CODE_STR);
|
|
||||||
strcpy(shmp->ussdcode_report[USSDCODE_TYPE_HOTLINE].code, USSDCODE_HOTLINE_CODE_STR);
|
|
||||||
|
|
||||||
int i=0, offset=2, tagPerCode=8, codeLen=0;
|
|
||||||
for (i=0; i<USSDCODE_MAX_CODE_NUM; i++)
|
|
||||||
{
|
|
||||||
codeLen = strlen(shmp->ussdcode_report[i].code);
|
|
||||||
if (codeLen <= 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i;
|
|
||||||
sprintf(tagbuf,"%d",tag);
|
|
||||||
totalLen = add_tlv(tagbuf, codeLen, (u_char *)shmp->ussdcode_report[i].code,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 1;
|
|
||||||
value = shmp->ussdcode_report[i].req_count;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 2;
|
|
||||||
value = shmp->ussdcode_report[i].req_duration;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 3;
|
|
||||||
value = shmp->ussdcode_report[i].err_timeout_count;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 4;
|
|
||||||
value = shmp->ussdcode_report[i].err_system_count;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 5;
|
|
||||||
value = shmp->ussdcode_report[i].err_msg_count;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
PutLogFunID("GetUssdCodeDailyReportByIndex1");
|
|
||||||
|
|
||||||
//printfDailyLog(saveIndex);
|
|
||||||
return totalLen;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int GetDailyReport(u_char oidLen, DWORD *oid, u_char *pdata, BYTE *vartype)
|
int GetDailyReport(u_char oidLen, DWORD *oid, u_char *pdata, BYTE *vartype)
|
||||||
{
|
{
|
||||||
@@ -541,18 +452,6 @@ int GetDailyReport(u_char oidLen, DWORD *oid, u_char *pdata, BYTE *vartype)
|
|||||||
if(oid[14]>=pps_report.saveTail) return -1;
|
if(oid[14]>=pps_report.saveTail) return -1;
|
||||||
return GetDailyReportByIndex(oidLen,oid,pdata,vartype);
|
return GetDailyReportByIndex(oidLen,oid,pdata,vartype);
|
||||||
break;
|
break;
|
||||||
#if 0//def _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_ // ussd_code daily report
|
|
||||||
case 0x04:
|
|
||||||
if(oidLen<15){
|
|
||||||
printf("error oid len: %d\n",oidLen);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(!masterFlag) return -1;
|
|
||||||
if(oid[14]>=pps_report.saveTail) return -1;
|
|
||||||
return GetUssdCodeDailyReportByIndex(oidLen,oid,pdata,vartype);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
@@ -897,60 +796,6 @@ int GetDailyReportByIndex(u_char oidLen,DWORD *oid,
|
|||||||
totalLen = add_tlv(tagbuf,strlen(balancebuf), (u_char *)balancebuf,0x80,asnbuf);
|
totalLen = add_tlv(tagbuf,strlen(balancebuf), (u_char *)balancebuf,0x80,asnbuf);
|
||||||
/*********************** VAS daily report **************************/
|
/*********************** VAS daily report **************************/
|
||||||
|
|
||||||
#ifdef _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_ // ussd_code daily report
|
|
||||||
if (yx_ussd_daily_report == 0)
|
|
||||||
{
|
|
||||||
return totalLen;
|
|
||||||
}
|
|
||||||
int offset=86, tagPerCode=8, codeLen=0;
|
|
||||||
for (i=0; i<USSDCODE_MAX_CODE_NUM; i++)
|
|
||||||
{
|
|
||||||
codeLen = strlen(shmp->ussdcode_report[i].code);
|
|
||||||
if (codeLen <= 0)
|
|
||||||
{
|
|
||||||
//continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i;
|
|
||||||
sprintf(tagbuf,"%d",tag);
|
|
||||||
totalLen = add_tlv(tagbuf, codeLen, (u_char *)shmp->ussdcode_report[i].code,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 1;
|
|
||||||
value = shmp->ussdcode_report[i].req_count;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 2;
|
|
||||||
value = shmp->ussdcode_report[i].req_duration;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 3;
|
|
||||||
value = shmp->ussdcode_report[i].err_timeout_count;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 4;
|
|
||||||
value = shmp->ussdcode_report[i].err_system_count;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 5;
|
|
||||||
value = shmp->ussdcode_report[i].err_msg_count;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 6;
|
|
||||||
value = 0;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
|
|
||||||
tag = offset + tagPerCode*i + 7;
|
|
||||||
value = 0;
|
|
||||||
sprintf(tagbuf,"%d",tag++);
|
|
||||||
totalLen = AddInteger(tagbuf,value,0x80,asnbuf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
PutLogFunID("GetDailyReportByIndex2");
|
PutLogFunID("GetDailyReportByIndex2");
|
||||||
|
|
||||||
//printfDailyLog(saveIndex);
|
//printfDailyLog(saveIndex);
|
||||||
@@ -1177,83 +1022,6 @@ int ReadDailyReportRequest(u_char oidLen,DWORD *oid,u_char *pdata,BYTE *vartype)
|
|||||||
return sizeof(_daily_report);
|
return sizeof(_daily_report);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_ // ussd_code daily report
|
|
||||||
int pps_update_ussd_code_state(char *code, int type, int result, int dur)
|
|
||||||
{
|
|
||||||
_ussdcode_report *shmp = NULL;
|
|
||||||
int index = pps_report.ptrTail % MAX_RECORDS_SAVED, i;
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case USSDCODE_TYPE_QUERY:
|
|
||||||
shmp = &pps_report.daily_report[index].ussdcode_report[USSDCODE_TYPE_QUERY];
|
|
||||||
break;
|
|
||||||
case USSDCODE_TYPE_TOPUP:
|
|
||||||
shmp = &pps_report.daily_report[index].ussdcode_report[USSDCODE_TYPE_TOPUP];
|
|
||||||
break;
|
|
||||||
case USSDCODE_TYPE_HOTLINE:
|
|
||||||
shmp = &pps_report.daily_report[index].ussdcode_report[USSDCODE_TYPE_HOTLINE];
|
|
||||||
break;
|
|
||||||
case USSDCODE_TYPE_CHANNEL:
|
|
||||||
for (i=USSDCODE_TYPE_CHANNEL; i<USSDCODE_MAX_CODE_NUM; i++)
|
|
||||||
{
|
|
||||||
if (pps_report.daily_report[index].ussdcode_report[i].code[0] == '\0')
|
|
||||||
{
|
|
||||||
strncpy(pps_report.daily_report[index].ussdcode_report[i].code, code, 3);
|
|
||||||
shmp = &pps_report.daily_report[index].ussdcode_report[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (strncmp(pps_report.daily_report[index].ussdcode_report[i].code, code, 3) == 0)
|
|
||||||
{
|
|
||||||
shmp = &pps_report.daily_report[index].ussdcode_report[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (shmp == NULL)
|
|
||||||
{
|
|
||||||
return -1;// full?
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (result)
|
|
||||||
{
|
|
||||||
case USSDCODE_STAT_REQ:
|
|
||||||
shmp->req_count++;
|
|
||||||
break;
|
|
||||||
case USSDCODE_STAT_DUR:
|
|
||||||
shmp->req_duration += (dur / CYCLE_STATE_INTERVAL);
|
|
||||||
break;
|
|
||||||
case USSDCODE_STAT_ERR_TIMEOUT:
|
|
||||||
if (dur > 0)
|
|
||||||
{
|
|
||||||
shmp->req_duration += (dur / CYCLE_STATE_INTERVAL);
|
|
||||||
}
|
|
||||||
shmp->err_timeout_count ++;
|
|
||||||
break;
|
|
||||||
case USSDCODE_STAT_ERR_SYSTEM:
|
|
||||||
if (dur > 0)
|
|
||||||
{
|
|
||||||
shmp->req_duration += (dur / CYCLE_STATE_INTERVAL);
|
|
||||||
}
|
|
||||||
shmp->err_system_count ++;
|
|
||||||
break;
|
|
||||||
case USSDCODE_STAT_ERR_MSG:
|
|
||||||
if (dur > 0)
|
|
||||||
{
|
|
||||||
shmp->req_duration += (dur / CYCLE_STATE_INTERVAL);
|
|
||||||
}
|
|
||||||
shmp->err_msg_count ++;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int GetDailyReportResponse(snmp_pdu *pdu, snmp_addr *addr)
|
int GetDailyReportResponse(snmp_pdu *pdu, snmp_addr *addr)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1364,123 +1132,15 @@ void PPSSendUserSMSNotification(int head, int tail,char *msgSend)
|
|||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int pps_crm_get_notify_days();
|
|
||||||
extern int pps_crm_get_status_vd();
|
|
||||||
extern void pps_send_update_subs_status_to_crm(_prepaid_info *user_ptr, int update_flag);
|
|
||||||
int AccountExpiredDateCheck_crm(_prepaid_info *user_ptr, int instance)
|
|
||||||
{
|
|
||||||
int send_notify_days = pps_crm_get_notify_days();
|
|
||||||
int status = user_ptr->status;
|
|
||||||
int crm_update_user_status=0, crm_send_expired_notification=0;
|
|
||||||
u_long expired_secs = user_ptr->mo_expiration_date;
|
|
||||||
long status_changed_seconds = (30*24*3600);
|
|
||||||
|
|
||||||
if(user_ptr->crm_info.user_class == 0x02)//tourist
|
|
||||||
{
|
|
||||||
status_changed_seconds = (1*24*3600 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int status_vd = pps_crm_get_status_vd();
|
|
||||||
|
|
||||||
if(status_vd>0)
|
|
||||||
{
|
|
||||||
status_changed_seconds = (status_vd * 24 * 3600);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(status)
|
|
||||||
{
|
|
||||||
case T_NORMAL:
|
|
||||||
status_changed_seconds = 0;//status_changed_seconds;
|
|
||||||
break;
|
|
||||||
case T_SUSPEND:
|
|
||||||
status_changed_seconds *= 1;
|
|
||||||
break;
|
|
||||||
case T_DISABLE:
|
|
||||||
status_changed_seconds *= 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((expired_secs + status_changed_seconds )< tvnow.tv_sec)
|
|
||||||
{
|
|
||||||
crm_update_user_status = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(status == T_NORMAL)
|
|
||||||
{
|
|
||||||
if( crm_update_user_status == 1)
|
|
||||||
{
|
|
||||||
user_ptr->status = T_SUSPEND;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(send_notify_days>=1)
|
|
||||||
{
|
|
||||||
if ((expired_secs > ( (send_notify_days-1)*24*3600 + tvnow.tv_sec)) && (expired_secs < ( send_notify_days*24*3600 + tvnow.tv_sec)))
|
|
||||||
{
|
|
||||||
crm_send_expired_notification = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(status == T_SUSPEND)
|
|
||||||
{
|
|
||||||
if( crm_update_user_status == 1)
|
|
||||||
{
|
|
||||||
user_ptr->status = T_DISABLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(status == T_DISABLE)
|
|
||||||
{
|
|
||||||
if( crm_update_user_status == 1)
|
|
||||||
{
|
|
||||||
user_ptr->status = T_RELEASED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(crm_update_user_status )
|
|
||||||
// user_ptr->mo_expiration_date = tvnow.tv_sec;
|
|
||||||
|
|
||||||
if(!masterFlag) return 0;
|
|
||||||
|
|
||||||
if(crm_update_user_status )
|
|
||||||
{
|
|
||||||
pps_send_update_subs_status_to_crm(user_ptr, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(crm_send_expired_notification)
|
|
||||||
{
|
|
||||||
pps_send_update_subs_status_to_crm(user_ptr, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(user_ptr->status == T_RELEASED)
|
|
||||||
//if(status == T_DISABLE)
|
|
||||||
{
|
|
||||||
char msisdn[32];
|
|
||||||
int len = user_ptr->msisdn[MAX_MSISDN_BLEN-1];
|
|
||||||
BcdToAscii(msisdn, user_ptr->msisdn,(MAX_MSISDN_BLEN-1)*2);
|
|
||||||
msisdn[len] = 0;
|
|
||||||
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"%s.%d try to delete RELEASED account: msisdn=%s, instance=%d",
|
|
||||||
__FUNCTION__, __LINE__, msisdn, instance);
|
|
||||||
|
|
||||||
SendAccountRealSync(instance,0.0,0.0,OMC_OCODE_DEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AccountExpiredDateCheck()
|
int AccountExpiredDateCheck()
|
||||||
{
|
{
|
||||||
static u_long LatchIndex=0;
|
static u_long LatchIndex=0;
|
||||||
int i, j, balance, cos_id, storeIndex;
|
int i,j ,balance,cos_id;//,storeIndex;
|
||||||
u_short status=0, expiredFlag = 0;
|
u_short status=0,expiredFlag = 0;
|
||||||
int len;
|
int len;
|
||||||
char caller_number[32];
|
char caller_number[32];
|
||||||
int crm_update_user_status=0;
|
|
||||||
COSTable *cosTableItem;
|
COSTable *cosTableItem;
|
||||||
PutLogFunID("AccountExpiredDateCheck");
|
PutLogFunID("AccountExpiredDateCheck");
|
||||||
|
|
||||||
@@ -1493,7 +1153,7 @@ int AccountExpiredDateCheck()
|
|||||||
|
|
||||||
i=LatchIndex/UNIT_STORE_ACCOUNT;
|
i=LatchIndex/UNIT_STORE_ACCOUNT;
|
||||||
j=LatchIndex%UNIT_STORE_ACCOUNT;
|
j=LatchIndex%UNIT_STORE_ACCOUNT;
|
||||||
storeIndex = LatchIndex;
|
//storeIndex = LatchIndex;
|
||||||
if(LatchIndex ++>=MSISDN_HEAD_NUM*UNIT_STORE_ACCOUNT)
|
if(LatchIndex ++>=MSISDN_HEAD_NUM*UNIT_STORE_ACCOUNT)
|
||||||
{
|
{
|
||||||
return 0;// LatchIndex = 0;
|
return 0;// LatchIndex = 0;
|
||||||
@@ -1504,9 +1164,6 @@ int AccountExpiredDateCheck()
|
|||||||
status = ramshm_ptr->prepaid_data.prepaid_info[i][j].status;
|
status = ramshm_ptr->prepaid_data.prepaid_info[i][j].status;
|
||||||
if(status == T_FRESH) return 1;
|
if(status == T_FRESH) return 1;
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
return AccountExpiredDateCheck_crm(&ramshm_ptr->prepaid_data.prepaid_info[i][j], storeIndex);
|
|
||||||
|
|
||||||
cos_id = ramshm_ptr->prepaid_data.prepaid_info[i][j].cos_id%MaxCosTableItem;
|
cos_id = ramshm_ptr->prepaid_data.prepaid_info[i][j].cos_id%MaxCosTableItem;
|
||||||
cosTableItem = &ppsParam.ppsTables.cosTable[cos_id];
|
cosTableItem = &ppsParam.ppsTables.cosTable[cos_id];
|
||||||
|
|
||||||
@@ -1526,13 +1183,23 @@ int AccountExpiredDateCheck()
|
|||||||
if(expiredFlag)
|
if(expiredFlag)
|
||||||
{
|
{
|
||||||
ramshm_ptr->prepaid_data.prepaid_info[i][j].status = T_RELEASED;
|
ramshm_ptr->prepaid_data.prepaid_info[i][j].status = T_RELEASED;
|
||||||
crm_update_user_status = 1;
|
|
||||||
|
|
||||||
if(cosTableItem->accountValidity[0].actionAfterDaysKeepingAnExpiredAccount)
|
if(cosTableItem->accountValidity[0].actionAfterDaysKeepingAnExpiredAccount)
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserField(&ramshm_ptr->prepaid_data.prepaid_info[i][j], &usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
if(usr_redis.usr_balance > 0)
|
||||||
|
#else
|
||||||
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].balance>0)
|
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].balance>0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
balance = usr_redis.usr_balance;
|
||||||
|
usr_redis.usr_balance = 0.0;
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
#else
|
||||||
balance = ramshm_ptr->prepaid_data.prepaid_info[i][j].balance;
|
balance = ramshm_ptr->prepaid_data.prepaid_info[i][j].balance;
|
||||||
|
#endif
|
||||||
ramshm_ptr->prepaid_data.prepaid_info[i][j].balance = 0;
|
ramshm_ptr->prepaid_data.prepaid_info[i][j].balance = 0;
|
||||||
if(masterFlag)
|
if(masterFlag)
|
||||||
{
|
{
|
||||||
@@ -1548,16 +1215,24 @@ int AccountExpiredDateCheck()
|
|||||||
else if(ramshm_ptr->prepaid_data.prepaid_info[i][j].mt_expiration_date<tvnow.tv_sec)
|
else if(ramshm_ptr->prepaid_data.prepaid_info[i][j].mt_expiration_date<tvnow.tv_sec)
|
||||||
{
|
{
|
||||||
if(status != T_BLACKLIST)
|
if(status != T_BLACKLIST)
|
||||||
{
|
|
||||||
ramshm_ptr->prepaid_data.prepaid_info[i][j].status = T_SUSPEND;
|
ramshm_ptr->prepaid_data.prepaid_info[i][j].status = T_SUSPEND;
|
||||||
crm_update_user_status = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
if(cosTableItem->accountValidity[0].actionWhenAccountExpires)
|
if(cosTableItem->accountValidity[0].actionWhenAccountExpires)
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserField(&ramshm_ptr->prepaid_data.prepaid_info[i][j], &usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
if(usr_redis.usr_balance > 0)
|
||||||
|
#else
|
||||||
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].balance>0)
|
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].balance>0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
balance = usr_redis.usr_balance;
|
||||||
|
usr_redis.usr_balance = 0.0;
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
#else
|
||||||
balance = ramshm_ptr->prepaid_data.prepaid_info[i][j].balance;
|
balance = ramshm_ptr->prepaid_data.prepaid_info[i][j].balance;
|
||||||
|
#endif
|
||||||
ramshm_ptr->prepaid_data.prepaid_info[i][j].balance = 0;
|
ramshm_ptr->prepaid_data.prepaid_info[i][j].balance = 0;
|
||||||
if(masterFlag)
|
if(masterFlag)
|
||||||
{
|
{
|
||||||
@@ -1574,10 +1249,21 @@ int AccountExpiredDateCheck()
|
|||||||
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_date<
|
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_date<
|
||||||
tvnow.tv_sec)
|
tvnow.tv_sec)
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserField(&ramshm_ptr->prepaid_data.prepaid_info[i][j], &usr_redis, OCS_REDIS_FIELD_PROMO_BALANCE);
|
||||||
|
if(usr_redis.pro_balance > 0)
|
||||||
|
#else
|
||||||
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance >0)
|
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance >0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
balance = ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance;
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
balance = usr_redis.pro_balance;
|
||||||
|
usr_redis.pro_balance = 0.0;
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_PROMO_BALANCE);
|
||||||
|
#else
|
||||||
|
balance = ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance;
|
||||||
|
#endif
|
||||||
ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance = 0;
|
ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance = 0;
|
||||||
if(masterFlag)
|
if(masterFlag)
|
||||||
SendOperatorRechargeCDR(i,j,-balance);
|
SendOperatorRechargeCDR(i,j,-balance);
|
||||||
@@ -1593,20 +1279,22 @@ int AccountExpiredDateCheck()
|
|||||||
BcdToAscii(caller_number, ramshm_ptr->prepaid_data.prepaid_info[i][j].msisdn, (MAX_MSISDN_BLEN-1)*2);
|
BcdToAscii(caller_number, ramshm_ptr->prepaid_data.prepaid_info[i][j].msisdn, (MAX_MSISDN_BLEN-1)*2);
|
||||||
caller_number[len ] = '\0';
|
caller_number[len ] = '\0';
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserInfo(&ramshm_ptr->prepaid_data.prepaid_info[i][j], &usr_redis);
|
||||||
|
RedisClearUserBundle(&usr_redis);
|
||||||
|
if (usr_redis.data > 0)
|
||||||
|
#else
|
||||||
if (ramshm_ptr->prepaid_data.prepaid_info[i][j].bundle_info.data > 0)
|
if (ramshm_ptr->prepaid_data.prepaid_info[i][j].bundle_info.data > 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
subscribe_bundle_plan_send_used_up_info(caller_number, SMS_BUNDLE_PLAN_DATA_USEDUP);
|
subscribe_bundle_plan_send_used_up_info(caller_number, SMS_BUNDLE_PLAN_DATA_USEDUP, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&ramshm_ptr->prepaid_data.prepaid_info[i][j].bundle_info, 0x00, sizeof(_bundle_info));
|
memset(&ramshm_ptr->prepaid_data.prepaid_info[i][j].bundle_info, 0x00, sizeof(_bundle_info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(crm_update_user_status )
|
|
||||||
{
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
pps_send_update_subs_status_to_crm(&ramshm_ptr->prepaid_data.prepaid_info[i][j], 1);
|
|
||||||
}
|
|
||||||
status = ramshm_ptr->prepaid_data.prepaid_info[i][j].status;
|
status = ramshm_ptr->prepaid_data.prepaid_info[i][j].status;
|
||||||
if(status != T_NORMAL) return 1;
|
if(status != T_NORMAL) return 1;
|
||||||
|
|
||||||
@@ -1636,12 +1324,18 @@ int AccountLatchFlagCheck(int head, int tail)
|
|||||||
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].msisdn[9]<MIN_MSISDN_ALEN)
|
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].msisdn[9]<MIN_MSISDN_ALEN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
cos_id = ramshm_ptr->prepaid_data.prepaid_info[i][j].cos_id%MaxCosTableItem;
|
cos_id = ramshm_ptr->prepaid_data.prepaid_info[i][j].cos_id%MaxCosTableItem;
|
||||||
cosTableItem = &ppsParam.ppsTables.cosTable[cos_id];
|
cosTableItem = &ppsParam.ppsTables.cosTable[cos_id];
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserBalance(&ramshm_ptr->prepaid_data.prepaid_info[i][j], &usr_redis);
|
||||||
|
if(usr_redis.usr_balance <
|
||||||
|
cosTableItem->smsNotificationInquiry[0].insufficientBalanceThreshold)
|
||||||
|
#else
|
||||||
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].balance<
|
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].balance<
|
||||||
cosTableItem->smsNotificationInquiry[0].insufficientBalanceThreshold)
|
cosTableItem->smsNotificationInquiry[0].insufficientBalanceThreshold)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if(cosTableItem->smsNotificationInquiry[0].smsNotificationWhenBalanceInsufficient)
|
if(cosTableItem->smsNotificationInquiry[0].smsNotificationWhenBalanceInsufficient)
|
||||||
if(!(ramshm_ptr->prepaid_data.prepaid_info[i][j].latch_flag & 0x01))
|
if(!(ramshm_ptr->prepaid_data.prepaid_info[i][j].latch_flag & 0x01))
|
||||||
@@ -1673,6 +1367,24 @@ int AccountLatchFlagCheck(int head, int tail)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
#else
|
||||||
|
if(ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance<
|
||||||
|
cosTableItem->smsNotificationInquiry[0].insufficientPromotionThreshold*100.0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if(cosTableItem->smsNotificationInquiry[0].smsNotificationWhenPromotionInsufficient)
|
||||||
|
if(!(ramshm_ptr->prepaid_data.prepaid_info[i][j].latch_flag & 0x04))
|
||||||
|
{
|
||||||
|
ramshm_ptr->prepaid_data.prepaid_info[i][j].latch_flag |=0x04;
|
||||||
|
smPromptFlag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ramshm_ptr->prepaid_data.prepaid_info[i][j].latch_flag &=0xFB;
|
||||||
|
}
|
||||||
|
|
||||||
if(smPromptFlag )
|
if(smPromptFlag )
|
||||||
{
|
{
|
||||||
len = ramshm_ptr->prepaid_data.prepaid_info[i][j].msisdn[9];
|
len = ramshm_ptr->prepaid_data.prepaid_info[i][j].msisdn[9];
|
||||||
@@ -1698,12 +1410,21 @@ int AccountLatchFlagCheck(int head, int tail)
|
|||||||
AsciiTime(promotion_expire_date,
|
AsciiTime(promotion_expire_date,
|
||||||
ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_date);
|
ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_date);
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
smppSendAccountInfo(msisdn,
|
||||||
|
ppsParam.ppsTables.serviceNumber[ScratchCardRechargeNumberPosition].number,
|
||||||
|
(long)usr_redis.usr_balance,expire_date,
|
||||||
|
(long)usr_redis.pro_balance,promotion_expire_date,
|
||||||
|
0,"","",
|
||||||
|
(0x80 | ramshm_ptr->prepaid_data.prepaid_info[i][j].language_type ));
|
||||||
|
#else
|
||||||
smppSendAccountInfo(msisdn,
|
smppSendAccountInfo(msisdn,
|
||||||
ppsParam.ppsTables.serviceNumber[ScratchCardRechargeNumberPosition].number,
|
ppsParam.ppsTables.serviceNumber[ScratchCardRechargeNumberPosition].number,
|
||||||
(long)ramshm_ptr->prepaid_data.prepaid_info[i][j].balance,expire_date,
|
(long)ramshm_ptr->prepaid_data.prepaid_info[i][j].balance,expire_date,
|
||||||
(long)ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance,promotion_expire_date,
|
(long)ramshm_ptr->prepaid_data.prepaid_info[i][j].promo_balance,promotion_expire_date,
|
||||||
0,"","",
|
0,"","",
|
||||||
(0x80 | ramshm_ptr->prepaid_data.prepaid_info[i][j].language_type ));
|
(0x80 | ramshm_ptr->prepaid_data.prepaid_info[i][j].language_type ));
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ enum transfer_mode{
|
|||||||
pps_print_event(shmp->process_info.logMsisdn,"[%05d]\33[32m%s\33[0m transfer to state \33[36m%s\33[0m", portid, __FUNCTION__, #val); \
|
pps_print_event(shmp->process_info.logMsisdn,"[%05d]\33[32m%s\33[0m transfer to state \33[36m%s\33[0m", portid, __FUNCTION__, #val); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
u8 getTransferState(u_short portid)
|
/*inline */u8 getTransferState(u_short portid)
|
||||||
{
|
{
|
||||||
_state_data *shmp;
|
_state_data *shmp;
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ u8 getTransferState(u_short portid)
|
|||||||
return shmp->process_info.ppsService.feeTransfer.state;
|
return shmp->process_info.ppsService.feeTransfer.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void playPromptAndCollectVoice(u_short portid,u_short voiceID,u8 inputLen)
|
/*inline */void playPromptAndCollectVoice(u_short portid,u_short voiceID,u8 inputLen)
|
||||||
{
|
{
|
||||||
_state_data *shmp;
|
_state_data *shmp;
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ void playPromptAndCollectVoice(u_short portid,u_short voiceID,u8 inputLen)
|
|||||||
SendPromptAndCollectUserInfo(portid);
|
SendPromptAndCollectUserInfo(portid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void playPromptVoice(u_short portid,u_short voiceID)
|
/*inline */void playPromptVoice(u_short portid,u_short voiceID)
|
||||||
{
|
{
|
||||||
_state_data *shmp;
|
_state_data *shmp;
|
||||||
|
|
||||||
@@ -486,7 +486,15 @@ int GetBalanceWithOutPromotion(int head, int tail)
|
|||||||
PutLogFunID("getBalanceWithOutPromotion");
|
PutLogFunID("getBalanceWithOutPromotion");
|
||||||
|
|
||||||
if (head < MSISDN_HEAD_NUM && tail < UNIT_STORE_ACCOUNT)
|
if (head < MSISDN_HEAD_NUM && tail < UNIT_STORE_ACCOUNT)
|
||||||
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserBalance(&shmp->prepaid_info[head][tail], &usr_redis);
|
||||||
|
return usr_redis.usr_balance;
|
||||||
|
#else
|
||||||
return shmp->prepaid_info[head][tail].balance;
|
return shmp->prepaid_info[head][tail].balance;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -568,7 +576,7 @@ static int expieredDaysTransfer(_account_info *callerInfo,_account_info *destInf
|
|||||||
_prepaid_info *pcalled,*pcaller;
|
_prepaid_info *pcalled,*pcaller;
|
||||||
|
|
||||||
if(get_not_change_transfer_expiry_date())
|
if(get_not_change_transfer_expiry_date())
|
||||||
{return 1;}
|
return 1;
|
||||||
|
|
||||||
pcalled = &prepaidPoint->prepaid_info[destInfo->head][destInfo->tail];
|
pcalled = &prepaidPoint->prepaid_info[destInfo->head][destInfo->tail];
|
||||||
pcaller = &prepaidPoint->prepaid_info[callerInfo->head][callerInfo->tail];
|
pcaller = &prepaidPoint->prepaid_info[callerInfo->head][callerInfo->tail];
|
||||||
@@ -609,17 +617,40 @@ int poolTransferAccount(_account_info *callerInfo,_account_info *destInfo,float
|
|||||||
}
|
}
|
||||||
|
|
||||||
pcalled = &prepaidPoint->prepaid_info[destInfo->head][destInfo->tail];
|
pcalled = &prepaidPoint->prepaid_info[destInfo->head][destInfo->tail];
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis called_redis;
|
||||||
|
RedisGetUserBalance(pcalled, &called_redis);
|
||||||
|
oldCalledBalance = called_redis.usr_balance;
|
||||||
|
oldCalledPromo = called_redis.pro_balance;
|
||||||
|
pcalled->balance = called_redis.usr_balance;
|
||||||
|
pcalled->promo_balance = called_redis.pro_balance;
|
||||||
|
#else
|
||||||
oldCalledBalance = pcalled->balance;
|
oldCalledBalance = pcalled->balance;
|
||||||
oldCalledPromo = pcalled->promo_balance;
|
oldCalledPromo = pcalled->promo_balance;
|
||||||
|
#endif
|
||||||
pcaller = &prepaidPoint->prepaid_info[callerInfo->head][callerInfo->tail];
|
pcaller = &prepaidPoint->prepaid_info[callerInfo->head][callerInfo->tail];
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis caller_redis;
|
||||||
|
RedisGetUserBalance(pcaller, &caller_redis);
|
||||||
|
oldCallerBalance = caller_redis.usr_balance;
|
||||||
|
oldCallerPromo = caller_redis.pro_balance;
|
||||||
|
pcaller->balance = caller_redis.usr_balance;
|
||||||
|
pcaller->promo_balance = caller_redis.pro_balance;
|
||||||
|
#else
|
||||||
oldCallerBalance = pcaller->balance;
|
oldCallerBalance = pcaller->balance;
|
||||||
oldCallerPromo = pcaller->promo_balance;
|
oldCallerPromo = pcaller->promo_balance;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(isPromotionCanBeTransfered(callerInfo) == FALSE)
|
if(isPromotionCanBeTransfered(callerInfo) == FALSE)
|
||||||
{
|
{
|
||||||
expieredDaysTransfer(callerInfo,destInfo,transferedFee,0);
|
expieredDaysTransfer(callerInfo,destInfo,transferedFee,0);
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
called_redis.usr_balance += transferedFee;
|
||||||
|
caller_redis.usr_balance -= transferedFee;
|
||||||
|
#else
|
||||||
pcalled->balance += transferedFee;
|
pcalled->balance += transferedFee;
|
||||||
pcaller->balance -= transferedFee;
|
pcaller->balance -= transferedFee;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -631,19 +662,48 @@ int poolTransferAccount(_account_info *callerInfo,_account_info *destInfo,float
|
|||||||
if(balanceExpired == TRUE)
|
if(balanceExpired == TRUE)
|
||||||
{
|
{
|
||||||
expieredDaysTransfer(callerInfo,destInfo,0,transferedFee);
|
expieredDaysTransfer(callerInfo,destInfo,0,transferedFee);
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
called_redis.pro_balance += transferedFee;
|
||||||
|
caller_redis.pro_balance -= transferedFee;
|
||||||
|
#else
|
||||||
pcalled->promo_balance += transferedFee;
|
pcalled->promo_balance += transferedFee;
|
||||||
pcaller->promo_balance -= transferedFee;
|
pcaller->promo_balance -= transferedFee;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(promotionExpired == TRUE)
|
else if(promotionExpired == TRUE)
|
||||||
{
|
{
|
||||||
expieredDaysTransfer(callerInfo,destInfo,transferedFee,0);
|
expieredDaysTransfer(callerInfo,destInfo,transferedFee,0);
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
called_redis.usr_balance += transferedFee;
|
||||||
|
caller_redis.usr_balance -= transferedFee;
|
||||||
|
#else
|
||||||
pcalled->balance += transferedFee;
|
pcalled->balance += transferedFee;
|
||||||
pcaller->balance -= transferedFee;
|
pcaller->balance -= transferedFee;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isPromotionFirstTransfered(callerInfo) == FALSE)
|
if(isPromotionFirstTransfered(callerInfo) == FALSE)
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
if(transferedFee > caller_redis.usr_balance)
|
||||||
|
{
|
||||||
|
diff = transferedFee - caller_redis.usr_balance;
|
||||||
|
expieredDaysTransfer(callerInfo,destInfo,transferedFee - diff,diff);
|
||||||
|
called_redis.usr_balance += transferedFee - diff;
|
||||||
|
caller_redis.usr_balance = 0;
|
||||||
|
called_redis.pro_balance += diff;
|
||||||
|
caller_redis.pro_balance -= diff;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
expieredDaysTransfer(callerInfo,destInfo,transferedFee,0);
|
||||||
|
called_redis.usr_balance += transferedFee;
|
||||||
|
caller_redis.usr_balance -= transferedFee;
|
||||||
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
if(transferedFee > pcaller->balance)
|
if(transferedFee > pcaller->balance)
|
||||||
{
|
{
|
||||||
diff = transferedFee - pcaller->balance;
|
diff = transferedFee - pcaller->balance;
|
||||||
@@ -661,9 +721,28 @@ int poolTransferAccount(_account_info *callerInfo,_account_info *destInfo,float
|
|||||||
pcaller->balance -= transferedFee;
|
pcaller->balance -= transferedFee;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(isPromotionFirstTransfered(callerInfo) == TRUE)
|
else if(isPromotionFirstTransfered(callerInfo) == TRUE)
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
if(transferedFee > caller_redis.pro_balance)
|
||||||
|
{
|
||||||
|
diff = transferedFee - caller_redis.pro_balance;
|
||||||
|
expieredDaysTransfer(callerInfo,destInfo,diff,transferedFee - diff);
|
||||||
|
called_redis.pro_balance += transferedFee - diff;
|
||||||
|
caller_redis.pro_balance = 0;
|
||||||
|
called_redis.usr_balance += diff;
|
||||||
|
caller_redis.usr_balance -= diff;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
expieredDaysTransfer(callerInfo,destInfo,0,transferedFee);
|
||||||
|
called_redis.pro_balance += transferedFee;
|
||||||
|
caller_redis.pro_balance -= transferedFee;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if(transferedFee > pcaller->promo_balance)
|
if(transferedFee > pcaller->promo_balance)
|
||||||
{
|
{
|
||||||
diff = transferedFee - pcaller->promo_balance;
|
diff = transferedFee - pcaller->promo_balance;
|
||||||
@@ -680,12 +759,19 @@ int poolTransferAccount(_account_info *callerInfo,_account_info *destInfo,float
|
|||||||
pcalled->promo_balance += transferedFee;
|
pcalled->promo_balance += transferedFee;
|
||||||
pcaller->promo_balance -= transferedFee;
|
pcaller->promo_balance -= transferedFee;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateAccountStatus(destInfo->head, destInfo->tail, T_NORMAL);
|
UpdateAccountStatus(destInfo->head, destInfo->tail, T_NORMAL);
|
||||||
instance = destInfo->head * UNIT_STORE_ACCOUNT + destInfo->tail;
|
instance = destInfo->head * UNIT_STORE_ACCOUNT + destInfo->tail;
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
RedisUpdateUserBalance(&called_redis);
|
||||||
|
RedisUpdateUserBalance(&caller_redis);
|
||||||
|
if(called_redis.usr_balance >= 0)
|
||||||
|
#else
|
||||||
if(pcalled->balance >= 0)
|
if(pcalled->balance >= 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
UpdateAccountOverdraft(destInfo->head, destInfo->tail, 0);
|
UpdateAccountOverdraft(destInfo->head, destInfo->tail, 0);
|
||||||
}
|
}
|
||||||
@@ -1473,14 +1559,14 @@ static int SendTransferExpiredAccountRequest(u_short portid,u8 ussdSmsFlag)
|
|||||||
static int SendTransferInfoConfirmRequest(u_short portid,u8 ussdSmsFlag)
|
static int SendTransferInfoConfirmRequest(u_short portid,u8 ussdSmsFlag)
|
||||||
{
|
{
|
||||||
_state_data *shmp;
|
_state_data *shmp;
|
||||||
//TRANSFER_FEE *transferInfo;
|
TRANSFER_FEE *transferInfo;
|
||||||
float balance;
|
float balance;
|
||||||
u_char tmp[MAX_SMS_LEN*4] = {0}, /*tmpbuf[64]={0}, */buf[MAX_SMS_LEN*2]={0};
|
u_char tmp[MAX_SMS_LEN*4] = {0}, /*tmpbuf[64]={0}, */buf[MAX_SMS_LEN*2]={0};
|
||||||
char tmpCaller[32],tmpCalled[32];
|
char tmpCaller[32],tmpCalled[32];
|
||||||
|
|
||||||
shmp = (_state_data *)&smshm_ptr->state_data;
|
shmp = (_state_data *)&smshm_ptr->state_data;
|
||||||
shmp += portid;
|
shmp += portid;
|
||||||
//transferInfo = &shmp->process_info.ppsService.feeTransfer;
|
transferInfo = &shmp->process_info.ppsService.feeTransfer;
|
||||||
|
|
||||||
strcpy((char *)tmp, (char *)getSmsSentenceNative(0,SMS_WILL_TRANSFER_OUT));
|
strcpy((char *)tmp, (char *)getSmsSentenceNative(0,SMS_WILL_TRANSFER_OUT));
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ extern _ram_data *ramshm_ptr;
|
|||||||
extern _state_machine *smshm_ptr;;
|
extern _state_machine *smshm_ptr;;
|
||||||
extern _tariff_private *blf_shmp;
|
extern _tariff_private *blf_shmp;
|
||||||
|
|
||||||
extern _prepaid_info *getPrepaidInfo(_account_info *account);
|
extern inline _prepaid_info *getPrepaidInfo(_account_info *account);
|
||||||
|
|
||||||
#define FREE_SMS_ACTIVE 0x01
|
#define FREE_SMS_ACTIVE 0x01
|
||||||
#define FREE_SMS_DEACTIVE 0xFE
|
#define FREE_SMS_DEACTIVE 0xFE
|
||||||
@@ -184,17 +184,17 @@ static int isFreeServiceDaysDeductable(_prepaid_info *prepaidInfo)
|
|||||||
|
|
||||||
void freeServiceDaysDeduct(u_short head,u_short tail)
|
void freeServiceDaysDeduct(u_short head,u_short tail)
|
||||||
{
|
{
|
||||||
u8 len;//cosID=0,
|
u8 cosID=0,len;
|
||||||
//COSTable *cosTableItem;
|
COSTable *cosTableItem;
|
||||||
_prepaid_data *shmp=&ramshm_ptr->prepaid_data;
|
_prepaid_data *shmp=&ramshm_ptr->prepaid_data;
|
||||||
_prepaid_info *userData;
|
_prepaid_info *userData;
|
||||||
u_char destNumber[32]={0};
|
u_char destNumber[32]={0};
|
||||||
|
|
||||||
userData = &shmp->prepaid_info[head][tail];
|
userData = &shmp->prepaid_info[head][tail];
|
||||||
//cosID = userData->cos_id;
|
cosID = userData->cos_id;
|
||||||
if(isFreeServiceActived(userData)== TRUE && isFreeServiceDaysDeductable(userData) == TRUE)
|
if(isFreeServiceActived(userData)== TRUE && isFreeServiceDaysDeductable(userData) == TRUE)
|
||||||
{
|
{
|
||||||
//cosTableItem = &ppsParam.ppsTables.cosTable[cosID];
|
cosTableItem = &ppsParam.ppsTables.cosTable[cosID];
|
||||||
userData->freeSMSActiveDays--;
|
userData->freeSMSActiveDays--;
|
||||||
if(userData->freeSMSActiveDays <= 0)
|
if(userData->freeSMSActiveDays <= 0)
|
||||||
{
|
{
|
||||||
@@ -368,10 +368,21 @@ static int activteCharge(_state_data *shmp)
|
|||||||
if(tariff_id>=MAX_ZONE_NUM || tariff_id<0)
|
if(tariff_id>=MAX_ZONE_NUM || tariff_id<0)
|
||||||
tariff_id = 0;
|
tariff_id = 0;
|
||||||
amount = blf_shmp->comm_tariff[tariff_id].activeFreeSMSCharegeAmount;
|
amount = blf_shmp->comm_tariff[tariff_id].activeFreeSMSCharegeAmount;
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserField(&ramshm_ptr->prepaid_data.prepaid_info[head][tail], &usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
if((usr_redis.usr_balance + ptr->overdraft) - amount < 0)
|
||||||
|
#else
|
||||||
if((ptr->balance + ptr->overdraft) - amount < 0)
|
if((ptr->balance + ptr->overdraft) - amount < 0)
|
||||||
|
#endif
|
||||||
return -2;
|
return -2;
|
||||||
enableUserRentFlag(ptr);
|
enableUserRentFlag(ptr);
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
ptr->balance = usr_redis.usr_balance;
|
||||||
|
usr_redis.usr_balance -= amount;
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
#endif
|
||||||
ptr->balance -= amount;
|
ptr->balance -= amount;
|
||||||
SendManualOperationCDR(&shmp->caller_info,&shmp->called_info,-amount);
|
SendManualOperationCDR(&shmp->caller_info,&shmp->called_info,-amount);
|
||||||
return amount;
|
return amount;
|
||||||
@@ -399,11 +410,22 @@ static int deactivteCharge(_state_data *shmp)
|
|||||||
if(tariff_id>=MAX_ZONE_NUM || tariff_id<0)
|
if(tariff_id>=MAX_ZONE_NUM || tariff_id<0)
|
||||||
tariff_id = 0;
|
tariff_id = 0;
|
||||||
amount = blf_shmp->comm_tariff[tariff_id].deactiveFreeSMSCharegeAmount;
|
amount = blf_shmp->comm_tariff[tariff_id].deactiveFreeSMSCharegeAmount;
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserField(&ramshm_ptr->prepaid_data.prepaid_info[head][tail], &usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
if((usr_redis.usr_balance + ptr->overdraft) - amount < 0)
|
||||||
|
#else
|
||||||
if((ptr->balance + ptr->overdraft) - amount < 0)
|
if((ptr->balance + ptr->overdraft) - amount < 0)
|
||||||
|
#endif
|
||||||
return -2;
|
return -2;
|
||||||
disableUserRentFlag(ptr);
|
disableUserRentFlag(ptr);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
ptr->balance = usr_redis.usr_balance;
|
||||||
|
usr_redis.usr_balance -= amount;
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
#endif
|
||||||
ptr->balance -= amount;
|
ptr->balance -= amount;
|
||||||
SendManualOperationCDR(&shmp->caller_info,&shmp->called_info,-amount);
|
SendManualOperationCDR(&shmp->caller_info,&shmp->called_info,-amount);
|
||||||
return amount;
|
return amount;
|
||||||
|
|||||||
+282
-243
@@ -29,7 +29,7 @@
|
|||||||
#define MAX_VQ_BYTES_EACH_TIME_POST (1024*1024*5)/* 5MB */
|
#define MAX_VQ_BYTES_EACH_TIME_POST (1024*1024*5)/* 5MB */
|
||||||
#define MAX_VTH_BYTES_DIFF_POST (1024*1024*1)/*1MB */
|
#define MAX_VTH_BYTES_DIFF_POST (1024*1024*1)/*1MB */
|
||||||
|
|
||||||
#define MAX_BYTES_PER_SESSION (((long long)100)*1024*1024*1024)/* 10G */
|
#define MAX_BYTES_PER_SESSION (((long long)10)*1024*1024*1024)/* 10G */
|
||||||
|
|
||||||
#define pps_set_gprs_state(val) do { \
|
#define pps_set_gprs_state(val) do { \
|
||||||
gprsProc->state = val; \
|
gprsProc->state = val; \
|
||||||
@@ -189,11 +189,40 @@ int pps_get_gprs_inactive_timer(_state_data *shmp)
|
|||||||
|
|
||||||
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
||||||
if(radiusItem->inactiveSessionLimit <= 0)
|
if(radiusItem->inactiveSessionLimit <= 0)
|
||||||
return 900;
|
return 0;
|
||||||
return radiusItem->inactiveSessionLimit;
|
return radiusItem->inactiveSessionLimit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pps_get_quota_holding_timer(_state_data *shmp)
|
||||||
|
{
|
||||||
|
PPS_COS_RADIUS_ITEM *radiusItem;
|
||||||
|
|
||||||
|
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
||||||
|
if(radiusItem->maxDurationQuotaEachTime <= 0)
|
||||||
|
return 0;
|
||||||
|
return (radiusItem->maxDurationQuotaEachTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong pps_get_cos_quota(_state_data *shmp)
|
||||||
|
{
|
||||||
|
PPS_COS_RADIUS_ITEM *radiusItem;
|
||||||
|
|
||||||
|
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
||||||
|
if(radiusItem->maxVolumeQuotaEachTime <= 0)
|
||||||
|
return (5*1024*1024);
|
||||||
|
return (radiusItem->maxVolumeQuotaEachTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong pps_get_volume_threshold(_state_data *shmp)
|
||||||
|
{
|
||||||
|
PPS_COS_RADIUS_ITEM *radiusItem;
|
||||||
|
|
||||||
|
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
||||||
|
if(radiusItem->volumeThresholdDiff <= 0)
|
||||||
|
return 0;
|
||||||
|
return (radiusItem->volumeThresholdDiff);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL isAccessTimeout(_state_data *shmp)
|
BOOL isAccessTimeout(_state_data *shmp)
|
||||||
{
|
{
|
||||||
@@ -587,7 +616,7 @@ static BOOL isGprsRoaming(_state_data *shmp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getGprsCapInfo(_account_info *ptr,long long *gprsVolume,double *gprsCharged)
|
void getGprsCapInfo(u_char cap_flag, _account_info *ptr,long long *gprsVolume,double *gprsCharged)
|
||||||
{
|
{
|
||||||
_prepaid_data *shmp=&ramshm_ptr->prepaid_data;
|
_prepaid_data *shmp=&ramshm_ptr->prepaid_data;
|
||||||
|
|
||||||
@@ -595,8 +624,21 @@ void getGprsCapInfo(_account_info *ptr,long long *gprsVolume,double *gprsCharged
|
|||||||
|
|
||||||
if (ptr->head < MSISDN_HEAD_NUM && ptr->tail < UNIT_STORE_ACCOUNT)
|
if (ptr->head < MSISDN_HEAD_NUM && ptr->tail < UNIT_STORE_ACCOUNT)
|
||||||
{
|
{
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
if(cap_flag==1) /* int net */
|
||||||
|
{
|
||||||
|
*gprsVolume = shmp->prepaid_info[ptr->head][ptr->tail].gprsVolume;
|
||||||
|
*gprsCharged = shmp->prepaid_info[ptr->head][ptr->tail].gprsBalance;
|
||||||
|
}
|
||||||
|
else /* out net */
|
||||||
|
{
|
||||||
|
*gprsVolume = shmp->prepaid_info[ptr->head][ptr->tail].out_net_cap_gprsVolume;
|
||||||
|
*gprsCharged = shmp->prepaid_info[ptr->head][ptr->tail].out_net_cap_gprsBalance;
|
||||||
|
}
|
||||||
|
#else
|
||||||
*gprsVolume = shmp->prepaid_info[ptr->head][ptr->tail].gprsVolume;
|
*gprsVolume = shmp->prepaid_info[ptr->head][ptr->tail].gprsVolume;
|
||||||
*gprsCharged = shmp->prepaid_info[ptr->head][ptr->tail].gprsBalance;
|
*gprsCharged = shmp->prepaid_info[ptr->head][ptr->tail].gprsBalance;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -622,9 +664,22 @@ int GetGprsCapTariffID(_state_data *shmp)
|
|||||||
|
|
||||||
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
||||||
|
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
int loop, cap_plan = 0;
|
||||||
|
for(loop=0;loop<MaxGprsCapPlan;loop++)
|
||||||
|
{
|
||||||
|
if(shmp->process_info.cap_flag == (loop%2+1))
|
||||||
|
{
|
||||||
|
cap_plan = loop;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shmp->process_info.cap_plan = cap_plan;
|
||||||
|
capPlanPtr = &radiusItem->capPlan[cap_plan];
|
||||||
|
#else
|
||||||
capPlanPtr = &radiusItem->capPlan[0];
|
capPlanPtr = &radiusItem->capPlan[0];
|
||||||
|
#endif
|
||||||
getGprsCapInfo(&shmp->caller_info,&gprsVolume,&gprsCharged);// Get CAP GPRS volume & balance from user profile
|
getGprsCapInfo(shmp->process_info.cap_flag, &shmp->caller_info,&gprsVolume,&gprsCharged);// Get CAP GPRS volume & balance from user profile
|
||||||
if(gprsVolume<0 || gprsVolume>4000000000000LL) gprsVolume = 0;
|
if(gprsVolume<0 || gprsVolume>4000000000000LL) gprsVolume = 0;
|
||||||
if(gprsCharged<0) gprsCharged = 0;
|
if(gprsCharged<0) gprsCharged = 0;
|
||||||
|
|
||||||
@@ -691,15 +746,19 @@ int GetGprsCapTariffID(_state_data *shmp)
|
|||||||
|
|
||||||
static _gprs_tariff *getGprsVolumeTariffWithRoamAndCap(_state_data *shmp)
|
static _gprs_tariff *getGprsVolumeTariffWithRoamAndCap(_state_data *shmp)
|
||||||
{
|
{
|
||||||
_gprs_process *gprsProc;
|
|
||||||
_gprs_tariff *tariff;
|
_gprs_tariff *tariff;
|
||||||
int tariffID;
|
int tariffID;
|
||||||
PPS_COS_RADIUS_ITEM *radiusItem;
|
|
||||||
COSTable *cosTableItem;
|
COSTable *cosTableItem;
|
||||||
|
CosServiceControl *serviceControlItem = NULL;
|
||||||
int cosID;
|
int cosID;
|
||||||
|
#ifndef HAS_BUNDLE_ROAMING
|
||||||
shmp->process_info.cap_flag = 0;
|
_gprs_process *gprsProc;
|
||||||
|
PPS_COS_RADIUS_ITEM *radiusItem;
|
||||||
|
#endif
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
//shmp->process_info.cap_flag = 0;
|
||||||
|
tariffID = shmp->caller_info.location;// charged by cos:0 or cgi:1
|
||||||
|
#else
|
||||||
radiusItem = getCosRadiusItem(&shmp->caller_info); // user profile ==> cos ID ==> Radius Item
|
radiusItem = getCosRadiusItem(&shmp->caller_info); // user profile ==> cos ID ==> Radius Item
|
||||||
gprsProc = &shmp->process_info.ppsService.gprs_process;
|
gprsProc = &shmp->process_info.ppsService.gprs_process;
|
||||||
|
|
||||||
@@ -731,13 +790,53 @@ static _gprs_tariff *getGprsVolumeTariffWithRoamAndCap(_state_data *shmp)
|
|||||||
cosTableItem = &ppsParam.ppsTables.cosTable[cosID];
|
cosTableItem = &ppsParam.ppsTables.cosTable[cosID];
|
||||||
tariffID = cosTableItem->tariff[0].moTariffID%MAX_ZONE_NUM;
|
tariffID = cosTableItem->tariff[0].moTariffID%MAX_ZONE_NUM;
|
||||||
//}
|
//}
|
||||||
|
#endif
|
||||||
tariff = &blf_shmp->gprs_tariff[tariffID][0];
|
tariff = &blf_shmp->gprs_tariff[tariffID][0];
|
||||||
if(tariff->destIp == 0)
|
if(tariff->destIp == 0)
|
||||||
{
|
{
|
||||||
pps_print_error(shmp->process_info.logMsisdn,"[%05d]invalid gprs tariff:%d",shmp->process_info.portid,tariff->tariffID);
|
pps_print_error(shmp->process_info.logMsisdn,"[%05d]invalid gprs tariff:%d",shmp->process_info.portid,tariff->tariffID);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
shmp->process_info.cap_flag = tariff->cap_flag;//shmp->process_info.tariff.cap_flag;
|
||||||
|
/* Check Cap or Bundle is used================================
|
||||||
|
cosID = shmp->caller_info.cos_id;
|
||||||
|
cosTableItem = &ppsParam.ppsTables.cosTable[cosID];
|
||||||
|
serviceControlItem = &cosTableItem->serviceControl[0];
|
||||||
|
if(serviceControlItem->cap_or_bundle_in_tariff)// bundle is used, so we can set bundle flag and clear cap flag
|
||||||
|
{
|
||||||
|
shmp->process_info.bundle_flag = shmp->process_info.cap_flag; // cap flag is reused as bundle call
|
||||||
|
shmp->process_info.cap_flag = 0;
|
||||||
|
}*/
|
||||||
|
//==================================================
|
||||||
|
|
||||||
|
/*if(shmp->process_info.cap_flag>0)
|
||||||
|
{
|
||||||
|
tariffID = GetGprsCapTariffID(shmp);
|
||||||
|
if(tariffID >= 0)
|
||||||
|
{
|
||||||
|
tariff = &blf_shmp->gprs_tariff[tariffID][0];
|
||||||
|
if(tariff->destIp == 0)
|
||||||
|
{
|
||||||
|
pps_print_error(shmp->process_info.logMsisdn,"[%05d]invalid gprs tariff:%d",shmp->process_info.portid,tariff->tariffID);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
shmp->process_info.cap_flag = tariff->cap_flag;
|
||||||
|
pps_print_event(shmp->process_info.logMsisdn,"[%05d]Cap plan,charged by tariff id:%d",shmp->process_info.portid,tariff->tariffID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pps_print_error(shmp->process_info.logMsisdn,"[%05d]charged by cap plan error,no releated cap point",shmp->process_info.portid);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return tariff;
|
||||||
|
}
|
||||||
|
else*/
|
||||||
|
{
|
||||||
|
pps_print_event(shmp->process_info.logMsisdn,"[%05d]Normal,charged by tariff id:%d",shmp->process_info.portid,tariff->tariffID);
|
||||||
|
return tariff;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if(tariff->cap_flag)
|
if(tariff->cap_flag)
|
||||||
{
|
{
|
||||||
tariffID = GetGprsCapTariffID(shmp);
|
tariffID = GetGprsCapTariffID(shmp);
|
||||||
@@ -764,6 +863,7 @@ static _gprs_tariff *getGprsVolumeTariffWithRoamAndCap(_state_data *shmp)
|
|||||||
pps_print_event(shmp->process_info.logMsisdn,"[%05d]Normal,charged by tariff id:%d",shmp->process_info.portid,tariff->tariffID);
|
pps_print_event(shmp->process_info.logMsisdn,"[%05d]Normal,charged by tariff id:%d",shmp->process_info.portid,tariff->tariffID);
|
||||||
return tariff;
|
return tariff;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,7 +871,7 @@ static _gprs_tariff *getGprsVolumeTariffWithRoamAndCap(_state_data *shmp)
|
|||||||
static void CheckGprsCAPSMSNotification(_state_data *staPtr, _account_info *accountPtr, u_char cos_id,
|
static void CheckGprsCAPSMSNotification(_state_data *staPtr, _account_info *accountPtr, u_char cos_id,
|
||||||
float charge, int amount ) /* cap_type: 0=volume, 1=charged */
|
float charge, int amount ) /* cap_type: 0=volume, 1=charged */
|
||||||
{
|
{
|
||||||
int cap_seg, notifyFlag=0;//cap_plan,
|
int cap_plan,cap_seg, notifyFlag=0;
|
||||||
float c_threshold=0;
|
float c_threshold=0;
|
||||||
_prepaid_info *subPtr=NULL;
|
_prepaid_info *subPtr=NULL;
|
||||||
|
|
||||||
@@ -784,14 +884,18 @@ static void CheckGprsCAPSMSNotification(_state_data *staPtr, _account_info *acco
|
|||||||
if(staPtr->process_info.cap_notify_flag) /* already send notification SM in this call */
|
if(staPtr->process_info.cap_notify_flag) /* already send notification SM in this call */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//cap_plan = staPtr->process_info.cap_plan;
|
cap_plan = staPtr->process_info.cap_plan;
|
||||||
cap_seg = staPtr->process_info.cap_seg;
|
cap_seg = staPtr->process_info.cap_seg;
|
||||||
if(cap_seg>=3) return; /* reach the last CAP segment */
|
if((cap_seg>=3) || (cap_plan>=MaxGprsCapPlan)) return; /* reach the last CAP segment */
|
||||||
|
|
||||||
subPtr = &ramshm_ptr->prepaid_data.prepaid_info[accountPtr->head][accountPtr->tail];
|
subPtr = &ramshm_ptr->prepaid_data.prepaid_info[accountPtr->head][accountPtr->tail];
|
||||||
|
|
||||||
cosTableItem = &ppsParam.ppsTables.cosTable[cos_id];
|
cosTableItem = &ppsParam.ppsTables.cosTable[cos_id];
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
capPlanPtr = &cosTableItem->gprs[0].capPlan[cap_plan];
|
||||||
|
#else
|
||||||
capPlanPtr = &cosTableItem->gprs[0].capPlan[0];
|
capPlanPtr = &cosTableItem->gprs[0].capPlan[0];
|
||||||
|
#endif
|
||||||
|
|
||||||
gprsVolume = subPtr->gprsVolume;
|
gprsVolume = subPtr->gprsVolume;
|
||||||
if(gprsVolume<0 || gprsVolume>4000000000000LL)
|
if(gprsVolume<0 || gprsVolume>4000000000000LL)
|
||||||
@@ -884,6 +988,50 @@ static void UpdateGprsBundleInfo(_account_info *ptr,float charge, long long amou
|
|||||||
subPtr->gprsBalance += charge;
|
subPtr->gprsBalance += charge;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetBundleInfo(subPtr, &usr_redis);
|
||||||
|
usr_redis.data += amount;
|
||||||
|
if (usr_redis.data <=0)
|
||||||
|
{
|
||||||
|
usr_redis.data = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usr_redis.validity_date < tvnow.tv_sec)
|
||||||
|
{
|
||||||
|
usr_redis.data = 0;
|
||||||
|
}
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_BUNDLE_DATA);
|
||||||
|
subPtr->bundle_info.data = usr_redis.data;
|
||||||
|
#else
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
if(sta_ptr->process_info.bundle_flag == BUNDLE_HOME_PLMN)
|
||||||
|
{
|
||||||
|
subPtr->bundle_info.data += amount;
|
||||||
|
if (subPtr->bundle_info.data <=0)
|
||||||
|
{
|
||||||
|
subPtr->bundle_info.data = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subPtr->bundle_info.validity_date < tvnow.tv_sec)
|
||||||
|
{
|
||||||
|
subPtr->bundle_info.data = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(sta_ptr->process_info.bundle_flag == BUNDLE_OTHER_NETWORK)
|
||||||
|
{
|
||||||
|
subPtr->bundle_roam.data += amount;
|
||||||
|
if (subPtr->bundle_roam.data <=0)
|
||||||
|
{
|
||||||
|
subPtr->bundle_roam.data = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subPtr->bundle_roam.validity_date < tvnow.tv_sec)
|
||||||
|
{
|
||||||
|
subPtr->bundle_roam.data = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
subPtr->bundle_info.data += amount;
|
subPtr->bundle_info.data += amount;
|
||||||
if (subPtr->bundle_info.data <=0)
|
if (subPtr->bundle_info.data <=0)
|
||||||
{
|
{
|
||||||
@@ -894,6 +1042,8 @@ static void UpdateGprsBundleInfo(_account_info *ptr,float charge, long long amou
|
|||||||
{
|
{
|
||||||
subPtr->bundle_info.data = 0;
|
subPtr->bundle_info.data = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,6 +1068,32 @@ static void UpdateGprsCapInfo(_account_info *ptr,float charge, long long amount,
|
|||||||
{// If reach next cap, send notification or not.
|
{// If reach next cap, send notification or not.
|
||||||
CheckGprsCAPSMSNotification(sta_ptr,ptr,cos_id,charge, amount);
|
CheckGprsCAPSMSNotification(sta_ptr,ptr,cos_id,charge, amount);
|
||||||
}
|
}
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
if (sta_ptr->process_info.cap_flag == 1)// in net
|
||||||
|
{
|
||||||
|
cap_type = cosTableItem->gprs[0].capPlan[0].type;
|
||||||
|
if(cap_type==0)/* volume */
|
||||||
|
{
|
||||||
|
subPtr->gprsVolume += amount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
subPtr->gprsBalance += charge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sta_ptr->process_info.cap_flag == 2)// out net
|
||||||
|
{
|
||||||
|
cap_type = cosTableItem->gprs[0].capPlan[1].type;
|
||||||
|
if(cap_type==0)/* volume */
|
||||||
|
{
|
||||||
|
subPtr->out_net_cap_gprsVolume += amount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
subPtr->out_net_cap_gprsBalance += charge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
cap_type = cosTableItem->gprs[0].capPlan[0].type;
|
cap_type = cosTableItem->gprs[0].capPlan[0].type;
|
||||||
if(cap_type==0)/* volume */
|
if(cap_type==0)/* volume */
|
||||||
{
|
{
|
||||||
@@ -927,6 +1103,7 @@ static void UpdateGprsCapInfo(_account_info *ptr,float charge, long long amount,
|
|||||||
{
|
{
|
||||||
subPtr->gprsBalance += charge;
|
subPtr->gprsBalance += charge;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1225,12 +1402,19 @@ static void refund(_account_info *ptr, float refundFee,CHARGED_FEE *chargeFee)
|
|||||||
}
|
}
|
||||||
chargeFee->balance = refundBalance;
|
chargeFee->balance = refundBalance;
|
||||||
chargeFee->promotion= refundPromotioin;
|
chargeFee->promotion= refundPromotioin;
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserBalance(&shmp->prepaid_info[ptr->head][ptr->tail], &usr_redis);
|
||||||
|
usr_redis.usr_balance += refundBalance;
|
||||||
|
usr_redis.pro_balance += refundPromotioin;
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
shmp->prepaid_info[ptr->head][ptr->tail].promo_balance = usr_redis.pro_balance;
|
||||||
|
shmp->prepaid_info[ptr->head][ptr->tail].balance = usr_redis.usr_balance;
|
||||||
|
#else
|
||||||
shmp->prepaid_info[ptr->head][ptr->tail].promo_balance += refundPromotioin;
|
shmp->prepaid_info[ptr->head][ptr->tail].promo_balance += refundPromotioin;
|
||||||
if(refundBalance <= ppsParam.serviceControl.maxBalance)
|
shmp->prepaid_info[ptr->head][ptr->tail].balance += refundBalance;
|
||||||
shmp->prepaid_info[ptr->head][ptr->tail].balance += refundBalance;
|
#endif
|
||||||
if(shmp->prepaid_info[ptr->head][ptr->tail].balance < 0)
|
|
||||||
shmp->prepaid_info[ptr->head][ptr->tail].balance = 0;
|
|
||||||
|
|
||||||
increPoolChildCharged(ptr,-(refundBalance+refundPromotioin));
|
increPoolChildCharged(ptr,-(refundBalance+refundPromotioin));
|
||||||
debugmib.display.totalCharge -= refundBalance+refundPromotioin;
|
debugmib.display.totalCharge -= refundBalance+refundPromotioin;
|
||||||
}
|
}
|
||||||
@@ -1239,7 +1423,7 @@ static int firstAccessAcceptRefund(_state_data *shmp)
|
|||||||
{
|
{
|
||||||
_gprs_process *gprsProc;
|
_gprs_process *gprsProc;
|
||||||
_gprs_tariff *tariff;
|
_gprs_tariff *tariff;
|
||||||
//PPS_COS_RADIUS_ITEM *radiusItem;
|
PPS_COS_RADIUS_ITEM *radiusItem;
|
||||||
long long refundBytes;
|
long long refundBytes;
|
||||||
float refundFee;//,basicFee;
|
float refundFee;//,basicFee;
|
||||||
float discount;
|
float discount;
|
||||||
@@ -1248,13 +1432,10 @@ static int firstAccessAcceptRefund(_state_data *shmp)
|
|||||||
|
|
||||||
gprsProc = &shmp->process_info.ppsService.gprs_process;
|
gprsProc = &shmp->process_info.ppsService.gprs_process;
|
||||||
|
|
||||||
//radiusItem = getCosRadiusItem(&shmp->caller_info);
|
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
||||||
tariff = gprsProc->gprsTariff;
|
tariff = gprsProc->gprsTariff;
|
||||||
discount = gprsProc->discount;
|
discount = gprsProc->discount;
|
||||||
|
|
||||||
if(tariff->basicFee == 0 || (discount == 0 && shmp->process_info.cap_flag==0))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if(getReportedBytes(shmp) <= MINI_CHARGED_BYTES)
|
if(getReportedBytes(shmp) <= MINI_CHARGED_BYTES)
|
||||||
{
|
{
|
||||||
refundBytes = gprsProc->vqConsumed.integer - MINI_CHARGED_BYTES;
|
refundBytes = gprsProc->vqConsumed.integer - MINI_CHARGED_BYTES;
|
||||||
@@ -1310,9 +1491,6 @@ static int otherAccessAcceptRefund(_state_data *shmp)
|
|||||||
gprsProc->vqConsumed.integer -= refundBytes;
|
gprsProc->vqConsumed.integer -= refundBytes;
|
||||||
tariff = gprsProc->gprsTariff;
|
tariff = gprsProc->gprsTariff;
|
||||||
discount = gprsProc->discount;
|
discount = gprsProc->discount;
|
||||||
|
|
||||||
if(tariff->basicFee == 0 || (discount == 0 && shmp->process_info.cap_flag==0))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
refundFee = (refundBytes/BYTES_PER_BASIC_FEE)*tariff->basicFee*discount;
|
refundFee = (refundBytes/BYTES_PER_BASIC_FEE)*tariff->basicFee*discount;
|
||||||
|
|
||||||
@@ -1663,32 +1841,10 @@ void SendGprsCDR(_account_info *caller_info,_state_data *shmp)
|
|||||||
ulong duration,volume;
|
ulong duration,volume;
|
||||||
_gprs_process *gprsProc;
|
_gprs_process *gprsProc;
|
||||||
struct in_addr nas_addr;
|
struct in_addr nas_addr;
|
||||||
long long consumed_data_value=0;
|
|
||||||
|
|
||||||
PutLogFunID("SendGprsCDR");
|
PutLogFunID("SendGprsCDR");
|
||||||
|
|
||||||
if(shmp == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(caller_info->charge < 0.0)
|
|
||||||
return;
|
|
||||||
if(caller_info->charge > 1000000.00)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gprsProc = &shmp->process_info.ppsService.gprs_process;
|
|
||||||
|
|
||||||
if(0)
|
|
||||||
{
|
|
||||||
consumed_data_value = gprsProc->vqConsumed.integer;
|
|
||||||
}
|
|
||||||
if(1)
|
|
||||||
{
|
|
||||||
consumed_data_value = gprsProc->dqConsumed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( consumed_data_value == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
memset(&pcdr,0,sizeof(_tocdr_report));
|
memset(&pcdr,0,sizeof(_tocdr_report));
|
||||||
|
|
||||||
head = caller_info->head;
|
head = caller_info->head;
|
||||||
@@ -1696,11 +1852,12 @@ void SendGprsCDR(_account_info *caller_info,_state_data *shmp)
|
|||||||
|
|
||||||
pcdr.mtype = MO_CDR_TYPE;
|
pcdr.mtype = MO_CDR_TYPE;
|
||||||
|
|
||||||
if (consumed_data_value < 0)
|
gprsProc = &shmp->process_info.ppsService.gprs_process;
|
||||||
|
if (gprsProc->vqConsumed.integer < 0)
|
||||||
{
|
{
|
||||||
pcdr.type[0] = CT_GPRS_REFUND;// add a new cdr type for GPRS refund
|
pcdr.type[0] = CT_GPRS_REFUND;// add a new cdr type for GPRS refund
|
||||||
pcdr.type[1] = CT_GPRS_REFUND>>8;
|
pcdr.type[1] = CT_GPRS_REFUND>>8;
|
||||||
consumed_data_value = -consumed_data_value;
|
gprsProc->vqConsumed.integer = -gprsProc->vqConsumed.integer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1720,10 +1877,10 @@ void SendGprsCDR(_account_info *caller_info,_state_data *shmp)
|
|||||||
memcpy(pcdr.duration,&duration,4);
|
memcpy(pcdr.duration,&duration,4);
|
||||||
|
|
||||||
charge = caller_info->charge;
|
charge = caller_info->charge;
|
||||||
charge = (int)(charge + 0.5);// ceil ==> int
|
charge = abs(charge + 0.5);
|
||||||
memcpy(pcdr.charge,&charge,4);
|
memcpy(pcdr.charge,&charge,4);
|
||||||
balance = (int) (GetAccountBalance(head, tail) + 0.5);
|
balance = (int) (GetAccountBalance(head, tail) + 0.5);
|
||||||
memcpy(pcdr.balance,&balance,4);
|
memcpy(pcdr.balance,&balance,4);
|
||||||
|
|
||||||
GetAccountMsisdn(head,tail,&pcdr.msisdn[1]);
|
GetAccountMsisdn(head,tail,&pcdr.msisdn[1]);
|
||||||
ByteRev(pcdr.msisdn,9,0);
|
ByteRev(pcdr.msisdn,9,0);
|
||||||
@@ -1742,7 +1899,7 @@ void SendGprsCDR(_account_info *caller_info,_state_data *shmp)
|
|||||||
nas_addr.s_addr = gprsProc->destIP;
|
nas_addr.s_addr = gprsProc->destIP;
|
||||||
sprintf((char *)pcdr.gprsDestIP, "%s",inet_ntoa(nas_addr));
|
sprintf((char *)pcdr.gprsDestIP, "%s",inet_ntoa(nas_addr));
|
||||||
|
|
||||||
volume = (consumed_data_value+BYTES_PER_KB-1) >> 10;
|
volume = (gprsProc->vqConsumed.integer+BYTES_PER_KB-1) >> 10;
|
||||||
pcdr.gprsVolume[0] = volume >> 24;
|
pcdr.gprsVolume[0] = volume >> 24;
|
||||||
pcdr.gprsVolume[1] = volume >> 16;
|
pcdr.gprsVolume[1] = volume >> 16;
|
||||||
pcdr.gprsVolume[2] = volume >> 8;
|
pcdr.gprsVolume[2] = volume >> 8;
|
||||||
@@ -1750,19 +1907,17 @@ void SendGprsCDR(_account_info *caller_info,_state_data *shmp)
|
|||||||
|
|
||||||
pcdr.tcos[0] = NORMAL_CLEARING%256;
|
pcdr.tcos[0] = NORMAL_CLEARING%256;
|
||||||
|
|
||||||
memcpy(pcdr.plan_id, &shmp->process_info.rest_if.plan_id, 4);
|
|
||||||
|
|
||||||
GprsCDRStatistics(&pcdr,charge,volume);
|
GprsCDRStatistics(&pcdr,charge,volume);
|
||||||
StoreCDR(&pcdr);
|
StoreCDR(&pcdr);
|
||||||
pps_real_update_user_file(head, tail);
|
pps_real_update_user_file(head, tail);
|
||||||
sendGprsSessionInfo(shmp,consumed_data_value,duration,charge);
|
sendGprsSessionInfo(shmp,gprsProc->vqConsumed.integer,duration,charge);
|
||||||
pps_print_event(shmp->process_info.logMsisdn,"[%05d]%s send gprs cdr",shmp->process_info.portid ,caller_info->number);
|
pps_print_event(shmp->process_info.logMsisdn,"[%05d]%s send gprs cdr",shmp->process_info.portid ,caller_info->number);
|
||||||
}
|
}
|
||||||
|
|
||||||
int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
||||||
{
|
{
|
||||||
_gprs_process *gprsProc;
|
_gprs_process *gprsProc;
|
||||||
_gprs_tariff *tariff, gprsTariff;
|
_gprs_tariff *tariff;
|
||||||
float balance,chargedThisTime,quotaCharged;
|
float balance,chargedThisTime,quotaCharged;
|
||||||
float basicFee = 0.0;
|
float basicFee = 0.0;
|
||||||
float discount;
|
float discount;
|
||||||
@@ -1796,72 +1951,26 @@ int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
|||||||
pps_print_error(shmp->process_info.logMsisdn,"[%05d] Max volume(10G) per session reached",shmp->process_info.portid);
|
pps_print_error(shmp->process_info.logMsisdn,"[%05d] Max volume(10G) per session reached",shmp->process_info.portid);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
tariff = getGprsVolumeTariffWithRoamAndCap(shmp);// read Gprs tariff
|
||||||
|
if(tariff == NULL)
|
||||||
{
|
{
|
||||||
#ifdef OCS_USE_REDIS_DB// get tariff and bundle
|
strcpy(failReason,"no gprs tariff assigned");
|
||||||
pps_send_query_tariff_req(shmp->process_info.portid);
|
pps_print_error(shmp->process_info.logMsisdn,"[%05d]no gprs tariff assigned",shmp->process_info.portid);
|
||||||
#endif
|
return -4;
|
||||||
if(shmp->process_info.rest_if.query_tariff_status == 3)
|
|
||||||
{
|
|
||||||
strcpy(failReason,"no gprs tariff assigned");
|
|
||||||
pps_print_error(shmp->process_info.logMsisdn,"[%05d]no gprs tariff assigned",shmp->process_info.portid);
|
|
||||||
|
|
||||||
#ifndef OCS_USE_REDIS_DB
|
|
||||||
pps_send_query_tariff_req(shmp->process_info.portid);
|
|
||||||
#endif
|
|
||||||
return -4;
|
|
||||||
}
|
|
||||||
memset(&gprsTariff, 0x00, sizeof(_gprs_tariff));
|
|
||||||
tariff = gprsProc->gprsTariff = &gprsTariff;
|
|
||||||
gprsProc->gprsTariff->chargeUnit = shmp->process_info.rest_if.unit/1024;
|
|
||||||
gprsProc->gprsTariff->basicFee = shmp->process_info.rest_if.unit_charge;
|
|
||||||
discount = shmp->process_info.rest_if.tariff_discount;
|
|
||||||
gprsProc->discount = discount;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tariff = getGprsVolumeTariffWithRoamAndCap(shmp);// read Gprs tariff
|
gprsProc->gprsTariff = tariff;
|
||||||
if(tariff == NULL)
|
gprsProc->destIP = tariff->destIp;
|
||||||
{
|
#ifndef HAS_BUNDLE_ROAMING
|
||||||
strcpy(failReason,"no gprs tariff assigned");
|
shmp->process_info.cap_flag = tariff->cap_flag;
|
||||||
pps_print_error(shmp->process_info.logMsisdn,"[%05d]no gprs tariff assigned",shmp->process_info.portid);
|
|
||||||
return -4;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gprsProc->gprsTariff = tariff;
|
|
||||||
gprsProc->destIP = tariff->destIp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
max_quota_bytes = pps_get_quota_per_request(); //MAX_VQ_BYTES_EACH_TIME_POST;// Quota for every CCR request
|
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
if(shmp->process_info.rest_if.total_plan_value > 0)
|
|
||||||
left_bundle_volume = shmp->process_info.rest_if.total_plan_value - shmp->process_info.rest_if.used_plan_value;
|
|
||||||
if(left_bundle_volume<=0)
|
|
||||||
{
|
|
||||||
left_bundle_volume = 0;
|
|
||||||
shmp->process_info.bundle_flag = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shmp->process_info.bundle_flag = 1;
|
|
||||||
if(left_bundle_volume>max_quota_bytes)
|
|
||||||
left_bundle_volume = max_quota_bytes ;
|
|
||||||
shmp->process_info.rest_if.used_plan_value += left_bundle_volume;
|
|
||||||
shmp->process_info.rest_if.plan_value_add_this_time = left_bundle_volume;
|
|
||||||
pps_send_update_plan_value_req(shmp->process_info.portid);
|
|
||||||
}
|
|
||||||
#ifndef OCS_USE_REDIS_DB
|
|
||||||
pps_send_query_tariff_req(shmp->process_info.portid);//get next tariff
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
|
||||||
left_bundle_volume = pps_get_account_bundle_data(shmp);// remain volume in bundle of user
|
max_quota_bytes = pps_get_cos_quota(shmp);//pps_get_quota_per_request(); //MAX_VQ_BYTES_EACH_TIME_POST;// Quota for every CCR request
|
||||||
|
|
||||||
|
left_bundle_volume = pps_get_account_bundle_data(shmp);// remain volume in bundle of user
|
||||||
|
|
||||||
if(left_bundle_volume > 0)
|
if(left_bundle_volume > 0)
|
||||||
{
|
{
|
||||||
@@ -1871,7 +1980,10 @@ int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
|||||||
}
|
}
|
||||||
|
|
||||||
basicFee = 0;// use bundle, do not charge other way
|
basicFee = 0;// use bundle, do not charge other way
|
||||||
shmp->process_info.bundle_flag = 1;// bundle identifier
|
shmp->process_info.bundle_flag = shmp->process_info.cap_flag;// bundle identifier
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
shmp->process_info.cap_flag = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
subscribe_bundle_plan_send_warning_info(shmp);// low bundle reach threshold(<2048K), send SMS notification
|
subscribe_bundle_plan_send_warning_info(shmp);// low bundle reach threshold(<2048K), send SMS notification
|
||||||
}
|
}
|
||||||
@@ -1890,24 +2002,21 @@ int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
|||||||
gprsProc->vqAllocatedThisTime = 0;
|
gprsProc->vqAllocatedThisTime = 0;
|
||||||
shmp->process_info.bundle_flag = 0;
|
shmp->process_info.bundle_flag = 0;
|
||||||
|
|
||||||
subscribe_bundle_plan_send_used_up_info((char *)shmp->caller_info.number, SMS_BUNDLE_PLAN_DATA_USEDUP);
|
subscribe_bundle_plan_send_used_up_info((char *)shmp->caller_info.number, SMS_BUNDLE_PLAN_DATA_USEDUP, shmp);
|
||||||
|
|
||||||
pps_print_error(shmp->process_info.logMsisdn,"[%05d]Bundle data is used up!",shmp->process_info.portid );
|
pps_print_error(shmp->process_info.logMsisdn,"[%05d]Bundle data is used up!",shmp->process_info.portid );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(1)//no need to allocate non-charged small quote
|
if(shmp->process_info.ro_if.request_type == RT_INITIAL_REQUEST)
|
||||||
{
|
{
|
||||||
if(shmp->process_info.ro_if.request_type == RT_INITIAL_REQUEST)
|
max_quota_bytes = pps_get_cos_quota(shmp);//pps_get_postpaid_quota_for_first_request();
|
||||||
{
|
shmp->process_info.ro_if.post_charge = 1;
|
||||||
max_quota_bytes = pps_get_postpaid_quota_for_first_request();
|
|
||||||
shmp->process_info.ro_if.post_charge = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
shmp->process_info.ro_if.post_charge = 0;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
shmp->process_info.ro_if.post_charge = 0;
|
||||||
|
|
||||||
basicFee = tariff->basicFee;
|
basicFee = tariff->basicFee;
|
||||||
|
|
||||||
shmp->process_info.bundle_flag = 0;
|
shmp->process_info.bundle_flag = 0;
|
||||||
@@ -1927,16 +2036,13 @@ int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
|||||||
memset(chargedFee,0,sizeof(CHARGED_FEE));
|
memset(chargedFee,0,sizeof(CHARGED_FEE));
|
||||||
chargedThisTime = 0;
|
chargedThisTime = 0;
|
||||||
quotaCharged = 0;
|
quotaCharged = 0;
|
||||||
if(OCS_with_external_CRM())
|
discount = (float)GetDiscount(tvnow.tv_sec,tariff->discountID)/100;
|
||||||
discount = shmp->process_info.rest_if.tariff_discount/100;
|
|
||||||
else
|
|
||||||
discount = (float)GetDiscount(tvnow.tv_sec,tariff->discountID)/100;
|
|
||||||
|
|
||||||
//quotaCharged = ((max_quota_bytes+BYTES_PER_BASIC_FEE-1)/BYTES_PER_BASIC_FEE)*basicFee*discount;
|
quotaCharged = ((max_quota_bytes+BYTES_PER_BASIC_FEE-1)/BYTES_PER_BASIC_FEE)*basicFee*discount;
|
||||||
quotaCharged = (max_quota_bytes*basicFee*discount)/BYTES_PER_BASIC_FEE;
|
|
||||||
|
|
||||||
pps_print_event(shmp->process_info.logMsisdn,"[%05d]tariff:need allocate:%lld bytes,bascic fee:%0.4f,discount:%0.4f,bundle data=%lld,quotaCharged:%.4f",
|
pps_print_event(shmp->process_info.logMsisdn,"[%05d]tariff:need allocate:%lld bytes,bascic fee:%0.4f,discount:%0.4f,bundle data=%lld",
|
||||||
shmp->process_info.portid ,max_quota_bytes, basicFee,discount, left_bundle_volume,quotaCharged);
|
shmp->process_info.portid ,max_quota_bytes, basicFee,discount, left_bundle_volume);
|
||||||
|
|
||||||
if(balance >= quotaCharged)
|
if(balance >= quotaCharged)
|
||||||
{
|
{
|
||||||
@@ -1946,30 +2052,20 @@ int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
long long extraBytes;
|
||||||
|
float extraCharged;
|
||||||
|
|
||||||
if(0)
|
extraCharged = balance/discount;
|
||||||
{
|
extraBytes = (extraCharged/tariff->basicFee)*BYTES_PER_BASIC_FEE;
|
||||||
long long extraBytes;
|
gprsProc->vqAllocated.integer += extraBytes;
|
||||||
float extraCharged;
|
gprsProc->vqAllocated.exponent = 0;
|
||||||
|
gprsProc->vthAllocated.integer = 0;
|
||||||
|
gprsProc->vthAllocated.exponent = 0;
|
||||||
|
chargedThisTime = balance;
|
||||||
|
quotaBytes = extraBytes;
|
||||||
|
|
||||||
extraCharged = balance/discount;
|
shmp->process_info.ro_if.post_charge = 0;
|
||||||
extraBytes = (extraCharged/tariff->basicFee)*BYTES_PER_BASIC_FEE;
|
|
||||||
gprsProc->vqAllocated.integer += extraBytes;
|
|
||||||
gprsProc->vqAllocated.exponent = 0;
|
|
||||||
gprsProc->vthAllocated.integer = 0;
|
|
||||||
gprsProc->vthAllocated.exponent = 0;
|
|
||||||
chargedThisTime = balance;
|
|
||||||
quotaBytes = extraBytes;
|
|
||||||
|
|
||||||
shmp->process_info.ro_if.post_charge = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpy(failReason,"low fee");
|
|
||||||
pps_print_error(shmp->process_info.logMsisdn,"[%05d]low fee for a minu charge",
|
|
||||||
shmp->process_info.portid);
|
|
||||||
return -5;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gprsProc->discount = discount;
|
gprsProc->discount = discount;
|
||||||
@@ -1996,7 +2092,6 @@ int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
|||||||
instance = shmp->caller_info.head * UNIT_STORE_ACCOUNT + shmp->caller_info.tail;
|
instance = shmp->caller_info.head * UNIT_STORE_ACCOUNT + shmp->caller_info.tail;
|
||||||
SendAccountRealSync(instance,chargedFee->balance,chargedFee->promotion,OMC_OCODE_EDIT);// dual platform sync
|
SendAccountRealSync(instance,chargedFee->balance,chargedFee->promotion,OMC_OCODE_EDIT);// dual platform sync
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pps_print_event(shmp->process_info.logMsisdn,"[%05d]allocate %lld bytes,charged %0.4f(balance:%0.4f,promotion:%0.4f),vq is %lld,vth is %lld at %s",
|
pps_print_event(shmp->process_info.logMsisdn,"[%05d]allocate %lld bytes,charged %0.4f(balance:%0.4f,promotion:%0.4f),vq is %lld,vth is %lld at %s",
|
||||||
shmp->process_info.portid ,quotaBytes,chargedThisTime,chargedFee->balance,chargedFee->promotion,
|
shmp->process_info.portid ,quotaBytes,chargedThisTime,chargedFee->balance,chargedFee->promotion,
|
||||||
@@ -2008,7 +2103,7 @@ int allocate_ps_data_volume_quota(_state_data *shmp, char *failReason)
|
|||||||
int pps_refund_data_volume(_state_data *shmp)
|
int pps_refund_data_volume(_state_data *shmp)
|
||||||
{
|
{
|
||||||
_gprs_process *gprsProc;
|
_gprs_process *gprsProc;
|
||||||
_gprs_tariff *tariff, gprsTariff;
|
_gprs_tariff *tariff;
|
||||||
long long refundBytes;
|
long long refundBytes;
|
||||||
CHARGED_FEE *chargedFee;
|
CHARGED_FEE *chargedFee;
|
||||||
float discount, refundFee;
|
float discount, refundFee;
|
||||||
@@ -2027,43 +2122,18 @@ int pps_refund_data_volume(_state_data *shmp)
|
|||||||
//gprsProc->vqConsumed.integer = 0;
|
//gprsProc->vqConsumed.integer = 0;
|
||||||
gprsProc->vqConsumed.integer -= refundBytes;// negative for cdr of GPRS refund
|
gprsProc->vqConsumed.integer -= refundBytes;// negative for cdr of GPRS refund
|
||||||
}
|
}
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
memset(&gprsTariff, 0x00, sizeof(_gprs_tariff));
|
|
||||||
tariff = gprsProc->gprsTariff = &gprsTariff;
|
|
||||||
gprsProc->gprsTariff->chargeUnit = shmp->process_info.rest_if.unit/1024;
|
|
||||||
gprsProc->gprsTariff->basicFee = shmp->process_info.rest_if.unit_charge;
|
|
||||||
discount = shmp->process_info.rest_if.tariff_discount/100.00;
|
|
||||||
gprsProc->discount = discount;
|
|
||||||
|
|
||||||
|
|
||||||
pps_print_event(shmp->process_info.logMsisdn,"[%05d] Refund %lld bytes, basicFee:%.4f, unit:%d, discount:%.f, at %s",
|
|
||||||
shmp->process_info.portid ,
|
|
||||||
refundBytes,
|
|
||||||
tariff->basicFee,
|
|
||||||
tariff->chargeUnit,
|
|
||||||
discount,
|
|
||||||
__FUNCTION__);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tariff = gprsProc->gprsTariff;
|
|
||||||
discount = gprsProc->discount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
tariff = gprsProc->gprsTariff;
|
||||||
|
discount = gprsProc->discount;
|
||||||
|
|
||||||
chargedFee = &gprsProc->chargedFee;
|
chargedFee = &gprsProc->chargedFee;
|
||||||
|
|
||||||
if(shmp->process_info.bundle_flag == 1)
|
if(shmp->process_info.bundle_flag > 0)
|
||||||
{
|
{
|
||||||
refundFee = 0;
|
refundFee = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(tariff->basicFee == 0 || (discount == 0 && shmp->process_info.cap_flag==0))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
refundFee = (refundBytes/BYTES_PER_BASIC_FEE)*tariff->basicFee*discount;
|
refundFee = (refundBytes/BYTES_PER_BASIC_FEE)*tariff->basicFee*discount;
|
||||||
shmp->caller_info.charge = shmp->caller_info.charge - refundFee;
|
shmp->caller_info.charge = shmp->caller_info.charge - refundFee;
|
||||||
refund(&shmp->caller_info, refundFee,chargedFee);
|
refund(&shmp->caller_info, refundFee,chargedFee);
|
||||||
@@ -2077,19 +2147,7 @@ int pps_refund_data_volume(_state_data *shmp)
|
|||||||
}
|
}
|
||||||
if(shmp->process_info.bundle_flag)
|
if(shmp->process_info.bundle_flag)
|
||||||
{
|
{
|
||||||
if(OCS_with_external_CRM())
|
UpdateGprsBundleInfo(&shmp->caller_info,refundFee, refundBytes,shmp);
|
||||||
{
|
|
||||||
if(shmp->process_info.rest_if.used_plan_value>=refundBytes)
|
|
||||||
{
|
|
||||||
shmp->process_info.rest_if.used_plan_value -= refundBytes;
|
|
||||||
shmp->process_info.rest_if.plan_value_add_this_time = (0x8000000000000000) | refundBytes;
|
|
||||||
pps_send_update_plan_value_req(shmp->process_info.portid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateGprsBundleInfo(&shmp->caller_info,refundFee, refundBytes,shmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2105,7 +2163,7 @@ int pps_refund_data_volume(_state_data *shmp)
|
|||||||
int pps_charge_postpaid_data(_state_data *shmp, long consumed_volume, long *uncharged_volume)
|
int pps_charge_postpaid_data(_state_data *shmp, long consumed_volume, long *uncharged_volume)
|
||||||
{
|
{
|
||||||
_gprs_process *gprsProc;
|
_gprs_process *gprsProc;
|
||||||
_gprs_tariff *tariff, gprsTariff;
|
_gprs_tariff *tariff;
|
||||||
float balance,chargedThisTime,quotaCharged;
|
float balance,chargedThisTime,quotaCharged;
|
||||||
float basicFee = 0.0;
|
float basicFee = 0.0;
|
||||||
float discount;
|
float discount;
|
||||||
@@ -2117,48 +2175,31 @@ int pps_charge_postpaid_data(_state_data *shmp, long consumed_volume, long *unch
|
|||||||
gprsProc = &shmp->process_info.ppsService.gprs_process;
|
gprsProc = &shmp->process_info.ppsService.gprs_process;
|
||||||
gprsProc->vqAllocatedThisTime = 0;
|
gprsProc->vqAllocatedThisTime = 0;
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
tariff = getGprsVolumeTariffWithRoamAndCap(shmp);// read Gprs tariff
|
||||||
|
if(tariff == NULL)
|
||||||
{
|
{
|
||||||
memset(&gprsTariff, 0x00, sizeof(_gprs_tariff));
|
pps_print_error(shmp->process_info.logMsisdn,"[%05d]no gprs tariff assigned",shmp->process_info.portid);
|
||||||
tariff = gprsProc->gprsTariff = &gprsTariff;
|
return -4;
|
||||||
gprsProc->gprsTariff->chargeUnit = shmp->process_info.rest_if.unit/1024;
|
|
||||||
gprsProc->gprsTariff->basicFee = shmp->process_info.rest_if.unit_charge;
|
|
||||||
discount = shmp->process_info.rest_if.tariff_discount/100.00;
|
|
||||||
gprsProc->discount = discount;
|
|
||||||
|
|
||||||
|
|
||||||
pps_print_event(shmp->process_info.logMsisdn,"[%05d] Consumed %lld bytes, basicFee:%.4f, unit:%d, discount:%.f, at %s",
|
|
||||||
shmp->process_info.portid ,
|
|
||||||
consumed_volume,
|
|
||||||
tariff->basicFee,
|
|
||||||
tariff->chargeUnit,
|
|
||||||
discount,
|
|
||||||
__FUNCTION__);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tariff = getGprsVolumeTariffWithRoamAndCap(shmp);// read Gprs tariff
|
gprsProc->gprsTariff = tariff;
|
||||||
|
gprsProc->destIP = tariff->destIp;
|
||||||
if(tariff == NULL)
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
{
|
shmp->process_info.cap_flag = tariff->cap_flag;
|
||||||
pps_print_error(shmp->process_info.logMsisdn,"[%05d]no gprs tariff assigned",shmp->process_info.portid);
|
#endif
|
||||||
return -4;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gprsProc->gprsTariff = tariff;
|
|
||||||
gprsProc->destIP = tariff->destIp;
|
|
||||||
discount = (float)GetDiscount(tvnow.tv_sec,tariff->discountID)/100.00;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
left_bundle_volume = pps_get_account_bundle_data(shmp);// remain volume in bundle of user
|
left_bundle_volume = pps_get_account_bundle_data(shmp);// remain volume in bundle of user
|
||||||
|
|
||||||
if(left_bundle_volume > 0)
|
if(left_bundle_volume > 0)
|
||||||
{
|
{
|
||||||
if(left_bundle_volume > consumed_volume)// left bundle less than quota for each quest, allocate all left quota
|
if(left_bundle_volume > consumed_volume)// left bundle less than quota for each quest, allocate all left quota
|
||||||
{
|
{
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
shmp->process_info.bundle_flag = shmp->process_info.cap_flag;// bundle identifier
|
||||||
|
shmp->process_info.cap_flag = 0;
|
||||||
|
#endif
|
||||||
UpdateGprsBundleInfo(&shmp->caller_info, 0.0, -consumed_volume, shmp);
|
UpdateGprsBundleInfo(&shmp->caller_info, 0.0, -consumed_volume, shmp);
|
||||||
basicFee = 0;// use bundle, do not charge other way
|
basicFee = 0;// use bundle, do not charge other way
|
||||||
max_quota_bytes = 0;
|
max_quota_bytes = 0;
|
||||||
@@ -2178,11 +2219,8 @@ int pps_charge_postpaid_data(_state_data *shmp, long consumed_volume, long *unch
|
|||||||
//max_quota_bytes = consumed_volume;
|
//max_quota_bytes = consumed_volume;
|
||||||
//basicFee = tariff->basicFee;
|
//basicFee = tariff->basicFee;
|
||||||
*uncharged_volume = consumed_volume;
|
*uncharged_volume = consumed_volume;
|
||||||
//max_quota_bytes = 0;
|
max_quota_bytes = 0;
|
||||||
//basicFee = 0.0;
|
basicFee = 0.0;
|
||||||
max_quota_bytes = consumed_volume;
|
|
||||||
basicFee = tariff->basicFee;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
balance = GetBalanceWithPromotionControl(shmp,&shmp->caller_info)+GetOverdraft(&shmp->caller_info);
|
balance = GetBalanceWithPromotionControl(shmp,&shmp->caller_info)+GetOverdraft(&shmp->caller_info);
|
||||||
@@ -2197,6 +2235,7 @@ int pps_charge_postpaid_data(_state_data *shmp, long consumed_volume, long *unch
|
|||||||
memset(chargedFee,0,sizeof(CHARGED_FEE));
|
memset(chargedFee,0,sizeof(CHARGED_FEE));
|
||||||
chargedThisTime = 0;
|
chargedThisTime = 0;
|
||||||
quotaCharged = 0;
|
quotaCharged = 0;
|
||||||
|
discount = (float)GetDiscount(tvnow.tv_sec,tariff->discountID)/100;
|
||||||
|
|
||||||
quotaCharged = ((max_quota_bytes+BYTES_PER_BASIC_FEE-1)/BYTES_PER_BASIC_FEE)*basicFee*discount;
|
quotaCharged = ((max_quota_bytes+BYTES_PER_BASIC_FEE-1)/BYTES_PER_BASIC_FEE)*basicFee*discount;
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
#include "../include/ppsm.h"
|
#include "../include/ppsm.h"
|
||||||
#include "../include/param.h"
|
#include "../include/param.h"
|
||||||
|
|
||||||
_pps_prefix_node pps_prefix_table[PPS_PREFIX_NODE_NUM];
|
|
||||||
|
|
||||||
char HolidayDes[12][31][32];
|
char HolidayDes[12][31][32];
|
||||||
extern _tariff_private *blf_shmp;
|
extern _tariff_private *blf_shmp;
|
||||||
extern _ram_data *ramshm_ptr;
|
extern _ram_data *ramshm_ptr;
|
||||||
@@ -23,9 +21,7 @@ extern _state_machine *smshm_ptr;
|
|||||||
|
|
||||||
extern int GetMOTariffData();
|
extern int GetMOTariffData();
|
||||||
|
|
||||||
#ifdef OCS_WITH_CRM
|
|
||||||
int ocs_create_crm_base_tariff_tree();
|
|
||||||
#endif
|
|
||||||
int load_tariff_main()
|
int load_tariff_main()
|
||||||
{
|
{
|
||||||
int i,j,len,tariffID;
|
int i,j,len,tariffID;
|
||||||
@@ -39,19 +35,7 @@ int load_tariff_main()
|
|||||||
|
|
||||||
sprintf(prog_name,"load tariff");
|
sprintf(prog_name,"load tariff");
|
||||||
|
|
||||||
/*
|
|
||||||
#ifdef OCS_WITH_CRM
|
|
||||||
ocs_create_crm_base_tariff_tree();
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
if(OCS_with_external_CRM()==1)
|
|
||||||
{
|
|
||||||
ocs_create_crm_base_tariff_tree();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
memcpy(&blf_shmp->comm_tariff,
|
memcpy(&blf_shmp->comm_tariff,
|
||||||
&ramshm_ptr->tariff_data.comm_tariff,
|
&ramshm_ptr->tariff_data.comm_tariff,
|
||||||
sizeof(_comm_tariff)*MAX_ZONE_NUM);
|
sizeof(_comm_tariff)*MAX_ZONE_NUM);
|
||||||
@@ -354,7 +338,7 @@ int load_tariff_main()
|
|||||||
|
|
||||||
void ListTariffPlan(int tariff_id)
|
void ListTariffPlan(int tariff_id)
|
||||||
{
|
{
|
||||||
char buf[1024],bill_str[20],area[32];
|
char buf[1024],bill_str[16],area[32];
|
||||||
_bill_tariff *shmp = NULL;
|
_bill_tariff *shmp = NULL;
|
||||||
int num,i=0,j=0,len=0;
|
int num,i=0,j=0,len=0;
|
||||||
|
|
||||||
@@ -1089,59 +1073,4 @@ int pps_get_charge_prefix(u_char cosID,char *dialing_number)
|
|||||||
len = TARIFF_PREFIX_LEN;
|
len = TARIFF_PREFIX_LEN;
|
||||||
*/
|
*/
|
||||||
return pps_search_charge_prefix(cosID, dialing_number, len);
|
return pps_search_charge_prefix(cosID, dialing_number, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OCS_WITH_CRM
|
|
||||||
int ocs_create_crm_base_tariff_tree()
|
|
||||||
{
|
|
||||||
int iroot=0,len=0;
|
|
||||||
int index=0;
|
|
||||||
char tmpBuf[128];
|
|
||||||
|
|
||||||
|
|
||||||
pps_prefix_node_ptr = 1;
|
|
||||||
memset(&pps_prefix_table,0,sizeof(_pps_prefix_node)*PPS_PREFIX_NODE_NUM);
|
|
||||||
|
|
||||||
for(index=0;index<BILLING_BASE_NUM;index++)
|
|
||||||
{
|
|
||||||
|
|
||||||
strcpy(tmpBuf, ramshm_ptr->tariff_data.base_tariff[index].bill_id);
|
|
||||||
|
|
||||||
len = strlen(tmpBuf);
|
|
||||||
if(len==0 )
|
|
||||||
continue;
|
|
||||||
if(len>TARIFF_PREFIX_LEN)
|
|
||||||
len = TARIFF_PREFIX_LEN;
|
|
||||||
|
|
||||||
pps_add_charge_prefix(iroot, tmpBuf, len, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"prefix ptr=%d",pps_prefix_node_ptr);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ocs_get_charge_prefix(char *dialed_number, char *prefix, char *area_name, int *call_type)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
int index = -1;
|
|
||||||
|
|
||||||
len = strlen(dialed_number);
|
|
||||||
if(len==0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
index = pps_search_charge_prefix(0, dialed_number, len);
|
|
||||||
if(index == -1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
strcpy(prefix, ramshm_ptr->tariff_data.base_tariff[index].bill_id);
|
|
||||||
strcpy(area_name, ramshm_ptr->tariff_data.base_tariff[index].area);
|
|
||||||
*call_type = ramshm_ptr->tariff_data.base_tariff[index].call_type;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -71,7 +71,7 @@ enum{
|
|||||||
|
|
||||||
|
|
||||||
/****************************** enquiry ***********************************************/
|
/****************************** enquiry ***********************************************/
|
||||||
_prepaid_info *getPrepaidInfo(_account_info *account)
|
/*inline */_prepaid_info *getPrepaidInfo(_account_info *account)
|
||||||
{
|
{
|
||||||
int head,tail;
|
int head,tail;
|
||||||
|
|
||||||
@@ -653,7 +653,7 @@ static void playChildNumber(u_short portid,u_char *childNumber)
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
static u8 getEnquirySlaveState(u_short portid)
|
static inline u8 getEnquirySlaveState(portid)
|
||||||
{
|
{
|
||||||
_state_data *shmp;
|
_state_data *shmp;
|
||||||
MASTER_SLAVE_ENQUIRY *enquiry;
|
MASTER_SLAVE_ENQUIRY *enquiry;
|
||||||
@@ -1057,7 +1057,7 @@ static int masterEnquiryProc(u_short portid)
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
static u8 getMasterAddState(u_short portid)
|
static inline u8 getMasterAddState(portid)
|
||||||
{
|
{
|
||||||
_state_data *shmp;
|
_state_data *shmp;
|
||||||
MASTER_SLAVE_ADD *add;
|
MASTER_SLAVE_ADD *add;
|
||||||
@@ -1606,7 +1606,7 @@ static int masterAddProc(u_short portid)
|
|||||||
pps_print_event(shmp->process_info.logMsisdn,"[%05d]\33[32m%s\33[0m transfer to state \33[36m%s\33[0m", portid, __FUNCTION__, #val); \
|
pps_print_event(shmp->process_info.logMsisdn,"[%05d]\33[32m%s\33[0m transfer to state \33[36m%s\33[0m", portid, __FUNCTION__, #val); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
static u8 getMasterDelState(u_short portid)
|
static inline u8 getMasterDelState(portid)
|
||||||
{
|
{
|
||||||
_state_data *shmp;
|
_state_data *shmp;
|
||||||
MASTER_SLAVE_DEL *del;
|
MASTER_SLAVE_DEL *del;
|
||||||
@@ -2036,7 +2036,7 @@ static int masterDelProc(u_short portid)
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
static u8 getMasterSlaveState(u_short portid)
|
static inline u8 getMasterSlaveState(portid)
|
||||||
{
|
{
|
||||||
_state_data *shmp;
|
_state_data *shmp;
|
||||||
|
|
||||||
@@ -2395,10 +2395,19 @@ static int childAutoTransferInFromMaster(_prepaid_info *slave)
|
|||||||
|
|
||||||
transferFee = pA->roleParty.child.maxFeePerDay;
|
transferFee = pA->roleParty.child.maxFeePerDay;
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserBalance(slave, &usr_redis);
|
||||||
|
if(isPromotionCanBeTransfered(&masterAccount) == TRUE)
|
||||||
|
diff = transferFee - (usr_redis.usr_balance + usr_redis.pro_balance);
|
||||||
|
else
|
||||||
|
diff = transferFee - usr_redis.usr_balance;
|
||||||
|
#else
|
||||||
if(isPromotionCanBeTransfered(&masterAccount) == TRUE)
|
if(isPromotionCanBeTransfered(&masterAccount) == TRUE)
|
||||||
diff = transferFee - (slave->balance+slave->promo_balance);
|
diff = transferFee - (slave->balance+slave->promo_balance);
|
||||||
else
|
else
|
||||||
diff = transferFee - slave->balance;
|
diff = transferFee - slave->balance;
|
||||||
|
#endif
|
||||||
|
|
||||||
rst = checkTransferedPartialFee(&masterAccount,diff);
|
rst = checkTransferedPartialFee(&masterAccount,diff);
|
||||||
switch(rst)
|
switch(rst)
|
||||||
@@ -2544,7 +2553,13 @@ static BOOL isSlaveNeedTransferFee(_prepaid_info *slave)
|
|||||||
|
|
||||||
transferFee = pA->roleParty.child.maxFeePerDay;
|
transferFee = pA->roleParty.child.maxFeePerDay;
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserBalance(slave, &usr_redis);
|
||||||
|
if(usr_redis.usr_balance + usr_redis.pro_balance >= transferFee)
|
||||||
|
#else
|
||||||
if(slave->balance + slave->promo_balance >= transferFee)
|
if(slave->balance + slave->promo_balance >= transferFee)
|
||||||
|
#endif
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -2951,6 +2966,13 @@ int masterChangeSlaveCharge(_state_data *shmp,_account_info *slaveInfo)
|
|||||||
|
|
||||||
amount = getAddSlaveCharge(&shmp->caller_info);
|
amount = getAddSlaveCharge(&shmp->caller_info);
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserBalance(ptr, &usr_redis);
|
||||||
|
ptr->balance = usr_redis.usr_balance;
|
||||||
|
usr_redis.usr_balance -= amount;
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
#endif
|
||||||
ptr->balance -= amount;
|
ptr->balance -= amount;
|
||||||
|
|
||||||
SendManualOperationCDR(&shmp->caller_info,&shmp->called_info,-amount);
|
SendManualOperationCDR(&shmp->caller_info,&shmp->called_info,-amount);
|
||||||
@@ -2975,6 +2997,13 @@ int BillingChildNumberChange(_state_data *shmp)
|
|||||||
|
|
||||||
ptr = &ramshm_ptr->prepaid_data.prepaid_info[head][tail];
|
ptr = &ramshm_ptr->prepaid_data.prepaid_info[head][tail];
|
||||||
amount = ramshm_ptr->tariff_data.comm_tariff[tariff_id].childChangeChargeAmount;
|
amount = ramshm_ptr->tariff_data.comm_tariff[tariff_id].childChangeChargeAmount;
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserField(&ramshm_ptr->prepaid_data.prepaid_info[head][tail], &usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
ptr->balance = usr_redis.usr_balance;
|
||||||
|
usr_redis.usr_balance -= amount;
|
||||||
|
RedisUpdateUserField(&usr_redis, OCS_REDIS_FIELD_BALANCE);
|
||||||
|
#endif
|
||||||
ptr->balance = ptr->balance - amount;
|
ptr->balance = ptr->balance - amount;
|
||||||
shmp->caller_info.charge = amount;
|
shmp->caller_info.charge = amount;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
+17
-119
@@ -69,9 +69,9 @@ extern int ListAllPortStatus();
|
|||||||
extern int sccp_GetSSNType ( BYTE ssn );
|
extern int sccp_GetSSNType ( BYTE ssn );
|
||||||
extern int CheckPromotionLatchFlag();
|
extern int CheckPromotionLatchFlag();
|
||||||
extern int cdr_submit(unsigned char ssn, unsigned short length, char *data);
|
extern int cdr_submit(unsigned char ssn, unsigned short length, char *data);
|
||||||
extern const char * AsciiTimeYMDHMS(char *ptr, time_t time);
|
|
||||||
extern int ReplaceStr(char *sSrc, char *sMatchStr, char *sReplaceStr);
|
|
||||||
/*------------------------------------------------*/
|
/*------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
void PutWarningMessage(u_short portid)
|
void PutWarningMessage(u_short portid)
|
||||||
{
|
{
|
||||||
_state_data *shmp=(_state_data *) &smshm_ptr->state_data;
|
_state_data *shmp=(_state_data *) &smshm_ptr->state_data;
|
||||||
@@ -1292,7 +1292,7 @@ void SendSrfPlayAnnouncement(u_short portid)
|
|||||||
}else
|
}else
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
pPlayAnnouncement->informationToSend.inbandInfo.numberOfRepetitions = 3;
|
pPlayAnnouncement->informationToSend.inbandInfo.numberOfRepetitions = 1;
|
||||||
pPlayAnnouncement->informationToSend.inbandInfo.duration = 0x00;
|
pPlayAnnouncement->informationToSend.inbandInfo.duration = 0x00;
|
||||||
pPlayAnnouncement->informationToSend.inbandInfo.interval = 0x01; /* 1seconds */
|
pPlayAnnouncement->informationToSend.inbandInfo.interval = 0x01; /* 1seconds */
|
||||||
pPlayAnnouncement->optional_flag = 0x03;
|
pPlayAnnouncement->optional_flag = 0x03;
|
||||||
@@ -1672,7 +1672,7 @@ int SendAccountInfoPromptToSrf(u_short portid,u_char isOnlyBalance,u_char isLast
|
|||||||
}
|
}
|
||||||
|
|
||||||
pPlayAnnouncement->informationToSend.inbandInfo.optional_flag = 0x07;
|
pPlayAnnouncement->informationToSend.inbandInfo.optional_flag = 0x07;
|
||||||
pPlayAnnouncement->informationToSend.inbandInfo.numberOfRepetitions = 0x03;
|
pPlayAnnouncement->informationToSend.inbandInfo.numberOfRepetitions = 0x01;
|
||||||
pPlayAnnouncement->informationToSend.inbandInfo.duration = 0x00;
|
pPlayAnnouncement->informationToSend.inbandInfo.duration = 0x00;
|
||||||
pPlayAnnouncement->informationToSend.inbandInfo.interval = 0x01;
|
pPlayAnnouncement->informationToSend.inbandInfo.interval = 0x01;
|
||||||
|
|
||||||
@@ -2913,13 +2913,6 @@ int encodePPS_MO_CDR(_tocdr_report *pcdr,u_char *pdata)
|
|||||||
len = add_tlv("0-2.1",8,pcdr->imsi,0x80,asnbuf); /* served IMSI */
|
len = add_tlv("0-2.1",8,pcdr->imsi,0x80,asnbuf); /* served IMSI */
|
||||||
len = add_tlv("0-2.4",9,pcdr->caller,0x80,asnbuf); /* calling number */
|
len = add_tlv("0-2.4",9,pcdr->caller,0x80,asnbuf); /* calling number */
|
||||||
len = add_tlv("0-2.5",12,pcdr->called,0x80,asnbuf); /* called number */
|
len = add_tlv("0-2.5",12,pcdr->called,0x80,asnbuf); /* called number */
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
if (strlen(pcdr->peerAddress) > 0)
|
|
||||||
{
|
|
||||||
len = add_tlv("0-2.39",strlen((char *)pcdr->peerAddress),pcdr->peerAddress,0x80,asnbuf);/* area name */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2934,19 +2927,7 @@ int encodePPS_MO_CDR(_tocdr_report *pcdr,u_char *pdata)
|
|||||||
balance[2] = pcdr->balance[1];
|
balance[2] = pcdr->balance[1];
|
||||||
balance[3] = pcdr->balance[0];
|
balance[3] = pcdr->balance[0];
|
||||||
len = add_tlv("0-2.130",4,balance,0x80,asnbuf); /* balance */
|
len = add_tlv("0-2.130",4,balance,0x80,asnbuf); /* balance */
|
||||||
if(OCS_with_external_CRM())
|
len = add_int("0-2.131",pcdr->cos_id,0x80,asnbuf);
|
||||||
{
|
|
||||||
char plan_id[4];
|
|
||||||
plan_id[0] = pcdr->plan_id[3];
|
|
||||||
plan_id[1] = pcdr->plan_id[2];
|
|
||||||
plan_id[2] = pcdr->plan_id[1];
|
|
||||||
plan_id[3] = pcdr->plan_id[0];
|
|
||||||
len = add_tlv("0-2.131",4,(u_char *)plan_id,0x80,asnbuf); /* balance */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
len = add_int("0-2.131",pcdr->cos_id,0x80,asnbuf);
|
|
||||||
}
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2992,17 +2973,7 @@ int encodePPS_MT_CDR(_tocdr_report *pcdr,u_char *pdata)
|
|||||||
balance[2] = pcdr->balance[1];
|
balance[2] = pcdr->balance[1];
|
||||||
balance[3] = pcdr->balance[0];
|
balance[3] = pcdr->balance[0];
|
||||||
len = add_tlv("1-2.130",4,balance,0x80,asnbuf); /* balance */
|
len = add_tlv("1-2.130",4,balance,0x80,asnbuf); /* balance */
|
||||||
if(OCS_with_external_CRM())
|
len = add_int("0-2.131",pcdr->cos_id,0x80,asnbuf);
|
||||||
{
|
|
||||||
char plan_id[4];
|
|
||||||
plan_id[0] = pcdr->plan_id[3];
|
|
||||||
plan_id[1] = pcdr->plan_id[2];
|
|
||||||
plan_id[2] = pcdr->plan_id[1];
|
|
||||||
plan_id[3] = pcdr->plan_id[0];
|
|
||||||
len = add_tlv("0-2.131",4,(u_char *)plan_id,0x80,asnbuf); /* balance */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
len = add_int("0-2.131",pcdr->cos_id,0x80,asnbuf);
|
|
||||||
|
|
||||||
switch(pcdr->type[0])
|
switch(pcdr->type[0])
|
||||||
{
|
{
|
||||||
@@ -3016,27 +2987,17 @@ int encodePPS_MT_CDR(_tocdr_report *pcdr,u_char *pdata)
|
|||||||
len = add_tlv("1-2.3",9,pcdr->called,0x80,asnbuf); /* called number */
|
len = add_tlv("1-2.3",9,pcdr->called,0x80,asnbuf); /* called number */
|
||||||
len = add_tlv("1-2.4",9,pcdr->caller,0x80,asnbuf); /* calling number */
|
len = add_tlv("1-2.4",9,pcdr->caller,0x80,asnbuf); /* calling number */
|
||||||
len = add_tlv("1-2.5",9,pcdr->called,0x80,asnbuf); /* connected number */
|
len = add_tlv("1-2.5",9,pcdr->called,0x80,asnbuf); /* connected number */
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
if (strlen(pcdr->peerAddress) > 0)
|
|
||||||
{
|
|
||||||
len = add_tlv("0-2.39",strlen((char *)pcdr->peerAddress),pcdr->peerAddress,0x80,asnbuf);/* area name */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static pthread_mutex_t store_cdr_mutx = PTHREAD_MUTEX_INITIALIZER;
|
int
|
||||||
|
StoreCDR(_tocdr_report *pcdr)
|
||||||
int StoreCDR(_tocdr_report *pcdr)
|
|
||||||
{
|
{
|
||||||
int pWriteSub ,pReadSub;
|
int pWriteSub ,pReadSub;
|
||||||
int tmpLen=0;
|
int tmpLen=0;
|
||||||
|
|
||||||
pthread_mutex_lock(&store_cdr_mutx);
|
|
||||||
|
|
||||||
PutLogFunID("StoreCDR");
|
PutLogFunID("StoreCDR");
|
||||||
|
|
||||||
if((ppsParam.serviceControl.cdrFlag & 0x0f)== 0) return 0;
|
if((ppsParam.serviceControl.cdrFlag & 0x0f)== 0) return 0;
|
||||||
@@ -3078,15 +3039,12 @@ int StoreCDR(_tocdr_report *pcdr)
|
|||||||
if(pWriteSub>=MAX_CDR_LEN) pWriteSub = 0;
|
if(pWriteSub>=MAX_CDR_LEN) pWriteSub = 0;
|
||||||
pps_cdr_buffer.pWriteSub = pWriteSub;
|
pps_cdr_buffer.pWriteSub = pWriteSub;
|
||||||
AddPPSStatistics(MIBPPS_CDRNUMBER,0);
|
AddPPSStatistics(MIBPPS_CDRNUMBER,0);
|
||||||
|
|
||||||
pthread_mutex_unlock(&store_cdr_mutx);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int pps_crm_get_sms_notification_for_event_flag();
|
void
|
||||||
extern void pps_send_last_call_info(_account_info *user_ptr, int call_type, int charge, int duration);
|
SendCDR(int proc_id)
|
||||||
void SendCDR(int proc_id)
|
|
||||||
{
|
{
|
||||||
_state_data *shmp=(_state_data *) &smshm_ptr->state_data;
|
_state_data *shmp=(_state_data *) &smshm_ptr->state_data;
|
||||||
_tocdr_report *pcdr,cdrreport;
|
_tocdr_report *pcdr,cdrreport;
|
||||||
@@ -3120,7 +3078,7 @@ void SendCDR(int proc_id)
|
|||||||
if(shmp->caller_info.charge<0)
|
if(shmp->caller_info.charge<0)
|
||||||
charge = (int) shmp->caller_info.charge;
|
charge = (int) shmp->caller_info.charge;
|
||||||
else
|
else
|
||||||
charge = (int)(shmp->caller_info.charge+0.5);// ceil ==> int
|
charge = (int)(shmp->caller_info.charge+0.5);
|
||||||
|
|
||||||
switch(shmp->process_info.call_type)
|
switch(shmp->process_info.call_type)
|
||||||
{
|
{
|
||||||
@@ -3149,7 +3107,7 @@ void SendCDR(int proc_id)
|
|||||||
pcdr->type[1] = 0;
|
pcdr->type[1] = 0;
|
||||||
|
|
||||||
memcpy(pcdr->charge, &charge,4); //
|
memcpy(pcdr->charge, &charge,4); //
|
||||||
balance = ceil (GetBalance(&shmp->caller_info)) ;
|
balance = (int) (GetBalance(&shmp->caller_info)+0.5) ;
|
||||||
|
|
||||||
memcpy(pcdr->balance,&balance,4);
|
memcpy(pcdr->balance,&balance,4);
|
||||||
memcpy(pcdr->imsi,shmp->caller_info.IMSI,8);
|
memcpy(pcdr->imsi,shmp->caller_info.IMSI,8);
|
||||||
@@ -3173,16 +3131,6 @@ void SendCDR(int proc_id)
|
|||||||
|
|
||||||
pcdr->cos_id = GetAccountCosID(&shmp->caller_info);
|
pcdr->cos_id = GetAccountCosID(&shmp->caller_info);
|
||||||
|
|
||||||
memcpy(pcdr->plan_id, &shmp->process_info.rest_if.plan_id, 4);
|
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
if ((shmp->process_info.call_type != CT_BUNDLE_PLAN_CHARGE)
|
|
||||||
&& (shmp->process_info.call_type != CT_SERVICE))
|
|
||||||
{
|
|
||||||
strncpy(pcdr->peerAddress, shmp->process_info.ppsService.areaName, 31);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CDRStatistics(pcdr,shmp->caller_info.charge, 0);
|
CDRStatistics(pcdr,shmp->caller_info.charge, 0);
|
||||||
StoreCDR(pcdr);
|
StoreCDR(pcdr);
|
||||||
|
|
||||||
@@ -3198,15 +3146,14 @@ void SendCDR(int proc_id)
|
|||||||
break;
|
break;
|
||||||
case CT_LOCAL_CALL_IN:
|
case CT_LOCAL_CALL_IN:
|
||||||
case CT_TRUNK_CALL_IN:
|
case CT_TRUNK_CALL_IN:
|
||||||
case CT_IDD_CALL_IN:
|
|
||||||
case CT_MT_SM:
|
case CT_MT_SM:
|
||||||
pcdr->mtype = MT_CDR_TYPE;
|
pcdr->mtype = MT_CDR_TYPE;
|
||||||
pcdr->type[0] = shmp->process_info.call_type;
|
pcdr->type[0] = shmp->process_info.call_type;
|
||||||
pcdr->type[1] = 0;
|
pcdr->type[1] = 0;
|
||||||
|
|
||||||
charge = (int)(shmp->called_info.charge+0.5);// ceil ==> int
|
charge = (int)(shmp->called_info.charge+0.5);
|
||||||
memcpy(pcdr->charge, &charge,4); /* called_info.charge */
|
memcpy(pcdr->charge, &charge,4); /* called_info.charge */
|
||||||
balance = ceil(GetBalance(&shmp->called_info) ); /* called_info */
|
balance = (int) (GetBalance(&shmp->called_info) + 0.5); /* called_info */
|
||||||
memcpy(pcdr->balance,&balance,4);
|
memcpy(pcdr->balance,&balance,4);
|
||||||
memcpy(pcdr->imsi,shmp->called_info.IMSI,8);
|
memcpy(pcdr->imsi,shmp->called_info.IMSI,8);
|
||||||
|
|
||||||
@@ -3229,12 +3176,6 @@ void SendCDR(int proc_id)
|
|||||||
|
|
||||||
pcdr->tcos[0] = 0;
|
pcdr->tcos[0] = 0;
|
||||||
pcdr->cos_id = GetAccountCosID(&shmp->called_info);
|
pcdr->cos_id = GetAccountCosID(&shmp->called_info);
|
||||||
memcpy(pcdr->plan_id, &shmp->process_info.rest_if.plan_id, 4);
|
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
strncpy(pcdr->peerAddress, shmp->process_info.ppsService.areaName, 31);
|
|
||||||
}
|
|
||||||
CDRStatistics(pcdr,shmp->called_info.charge, 0);
|
CDRStatistics(pcdr,shmp->called_info.charge, 0);
|
||||||
StoreCDR(pcdr);
|
StoreCDR(pcdr);
|
||||||
CheckPromotionLatchFlag(&shmp->called_info);
|
CheckPromotionLatchFlag(&shmp->called_info);
|
||||||
@@ -3283,14 +3224,6 @@ void SendCDR(int proc_id)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
if(charge>0 && pps_crm_get_sms_notification_for_event_flag())
|
|
||||||
{
|
|
||||||
pps_send_last_call_info(&shmp->caller_info, shmp->process_info.call_type, charge, duration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4209,7 +4142,7 @@ void SendAccountInfoBySMPP(_account_info *ptr,char *called)
|
|||||||
_last_call_info callInfo;
|
_last_call_info callInfo;
|
||||||
int len;
|
int len;
|
||||||
char msisdn[32];
|
char msisdn[32];
|
||||||
|
unsigned char flag = 0;
|
||||||
char expire_date[64],promotion_expire_date[64]={0};
|
char expire_date[64],promotion_expire_date[64]={0};
|
||||||
char expire_date1[64];
|
char expire_date1[64];
|
||||||
|
|
||||||
@@ -4255,41 +4188,6 @@ void SendAccountInfoBySMPP(_account_info *ptr,char *called)
|
|||||||
AddPPSStatistics(MIBPPS_ACCOUNTINFO,0);
|
AddPPSStatistics(MIBPPS_ACCOUNTINFO,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pps_send_last_call_info(_account_info *user_ptr, int call_type, int charge, int duration)
|
|
||||||
{
|
|
||||||
char sms_content[256];
|
|
||||||
// char to_be_replace_str[16][32]={"[Charge]","[Charged Units]","[ACCOUNT BALANCE]","[EXPIRY DATE]"};
|
|
||||||
char to_be_replace_str[16][32]={"$C","$D","$B","$E"};
|
|
||||||
char charge_str[32],duration_str[32],balance_str[32],expire_str[32];
|
|
||||||
int balance;
|
|
||||||
long expired_day;
|
|
||||||
|
|
||||||
//SendAccountInfoBySMPP(ptr, ppsParam.ppsTables.serviceNumber[HotLineNumberPosition].number);
|
|
||||||
|
|
||||||
if(call_type == CT_MO_SM )
|
|
||||||
strcpy(sms_content, (char *)getSmsSentenceNative(0,SMS_LAST_SMS_INFO));
|
|
||||||
else
|
|
||||||
strcpy(sms_content, (char *)getSmsSentenceNative(0,SMS_LAST_CALL_INFO));
|
|
||||||
|
|
||||||
balance = GetAccountBalance(user_ptr->head, user_ptr->tail);
|
|
||||||
expired_day = GetExpiration(user_ptr);
|
|
||||||
AsciiTimeYMDHMS(expire_str,expired_day);
|
|
||||||
|
|
||||||
sprintf(charge_str, "%.2f", charge/100.00);
|
|
||||||
sprintf(duration_str, "%d", duration);
|
|
||||||
sprintf(balance_str, "%.2f", balance/100.00);
|
|
||||||
|
|
||||||
ReplaceStr(sms_content, to_be_replace_str[0], charge_str);
|
|
||||||
ReplaceStr(sms_content, to_be_replace_str[1], duration_str);
|
|
||||||
ReplaceStr(sms_content, to_be_replace_str[2], balance_str);
|
|
||||||
ReplaceStr(sms_content, to_be_replace_str[3], expire_str);
|
|
||||||
|
|
||||||
smppSendMOSM((char *)user_ptr->number,
|
|
||||||
(char *)ppsParam.ppsTables.serviceNumber[HotLineNumberPosition].number,
|
|
||||||
(u_char *)sms_content, strlen(sms_content), 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendAccountInfoBySMPPtoThirdParty(_account_info *ptr,char *called, char *third_party_number)
|
void SendAccountInfoBySMPPtoThirdParty(_account_info *ptr,char *called, char *third_party_number)
|
||||||
{
|
{
|
||||||
long balance,promotion, expired_date,promo_expired_date;
|
long balance,promotion, expired_date,promo_expired_date;
|
||||||
|
|||||||
+552
-647
File diff suppressed because it is too large.
Load diff
@@ -51,7 +51,7 @@ static int isIndexValid(ppsTableType tableType,int index)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case SmsSentenceTable:
|
case SmsSentenceTable:
|
||||||
if(index < 0 || index >= MaxSmsSentenceItem*2)
|
if(index < 0 || index >= MaxSmsSentenceItem)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case ThirdPartyInfoTable:
|
case ThirdPartyInfoTable:
|
||||||
@@ -801,7 +801,7 @@ int isIndexBusy(ppsTableType tableType,index_t *id)
|
|||||||
return ppsTablePoint->mnpPrefix[index].existFlag;
|
return ppsTablePoint->mnpPrefix[index].existFlag;
|
||||||
break;
|
break;
|
||||||
case SmsSentenceTable:
|
case SmsSentenceTable:
|
||||||
if(index >= MaxSmsSentenceItem*2)
|
if(index >= MaxSmsSentenceItem)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return ppsTablePoint->smsSentence[index].existFlag;
|
return ppsTablePoint->smsSentence[index].existFlag;
|
||||||
break;
|
break;
|
||||||
@@ -1923,20 +1923,14 @@ static void initSmsSentence()
|
|||||||
sprintf((char *)smsSentenceItem->english,"%s", "1 Check Plan Status\n2 Subscribe Bundle Plan\n0 Exit");
|
sprintf((char *)smsSentenceItem->english,"%s", "1 Check Plan Status\n2 Subscribe Bundle Plan\n0 Exit");
|
||||||
smsSentenceItem->existFlag = TRUE;
|
smsSentenceItem->existFlag = TRUE;
|
||||||
|
|
||||||
smsSentenceItem = &ppsParam.ppsTables.smsExtSentence[SMS_LAST_CALL_INFO-SMS_MAX_ITEM-1];
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
smsSentenceItem = &ppsParam.ppsTables.smsSentence[SMS_BUNDLE_PLAN_ROAM_AND_NOTROAM];
|
||||||
memset(smsSentenceItem->title,0,PpsMaxTitleLen);
|
memset(smsSentenceItem->title,0,PpsMaxTitleLen);
|
||||||
sprintf((char *)smsSentenceItem->title,"%s", "Call Event Notification");
|
sprintf((char *)smsSentenceItem->title,"%s", "Bundle Plan Name Local and Roaming");
|
||||||
memset(smsSentenceItem->english,0,MAX_SMS_LEN);
|
memset(smsSentenceItem->english,0,MAX_SMS_LEN);
|
||||||
sprintf((char *)smsSentenceItem->english,"%s", "Last Call Cost: AUD $C. Call Duration: $Ds. Your current balance is AUD $B expiring on $E.");
|
sprintf((char *)smsSentenceItem->english,"%s", "local bundle plan;roaming bundle plan");
|
||||||
smsSentenceItem->existFlag = TRUE;
|
smsSentenceItem->existFlag = TRUE;
|
||||||
|
#endif
|
||||||
smsSentenceItem = &ppsParam.ppsTables.smsExtSentence[SMS_LAST_SMS_INFO-SMS_MAX_ITEM-1];
|
|
||||||
memset(smsSentenceItem->title,0,PpsMaxTitleLen);
|
|
||||||
sprintf((char *)smsSentenceItem->title,"%s", "SMS Event Notification");
|
|
||||||
memset(smsSentenceItem->english,0,MAX_SMS_LEN);
|
|
||||||
sprintf((char *)smsSentenceItem->english,"%s", "Last SMS Cost: AUD $C. Your current balance is AUD $B expiring on $E.");
|
|
||||||
smsSentenceItem->existFlag = TRUE;
|
|
||||||
|
|
||||||
|
|
||||||
initPrep();
|
initPrep();
|
||||||
initCMB();
|
initCMB();
|
||||||
@@ -1964,18 +1958,11 @@ void initSMSTable()
|
|||||||
initSmsSentence();
|
initSmsSentence();
|
||||||
}
|
}
|
||||||
|
|
||||||
u_char *getSmsSentenceNative(u8 languageType,SMS_SENTENCE org_id)
|
u_char *getSmsSentenceNative(u8 languageType,SMS_SENTENCE id)
|
||||||
{
|
{
|
||||||
LANGUAGE_INFO *languageInfo;
|
LANGUAGE_INFO *languageInfo;
|
||||||
int id = org_id;
|
|
||||||
|
|
||||||
if(org_id>SMS_MAX_ITEM)
|
languageInfo = &ppsParam.ppsTables.smsSentence[id].language[languageType%MAX_LANGUAGE_TYPES];
|
||||||
{
|
|
||||||
id = org_id-(SMS_MAX_ITEM+1);
|
|
||||||
languageInfo = &ppsParam.ppsTables.smsExtSentence[id].language[languageType%MAX_LANGUAGE_TYPES];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
languageInfo = &ppsParam.ppsTables.smsSentence[id].language[languageType%MAX_LANGUAGE_TYPES];
|
|
||||||
|
|
||||||
switch(id)
|
switch(id)
|
||||||
{
|
{
|
||||||
@@ -1985,16 +1972,8 @@ u_char *getSmsSentenceNative(u8 languageType,SMS_SENTENCE org_id)
|
|||||||
default:
|
default:
|
||||||
if(languageInfo->language[MAX_SMS_LEN] == 0)
|
if(languageInfo->language[MAX_SMS_LEN] == 0)
|
||||||
{
|
{
|
||||||
if(org_id>SMS_MAX_ITEM)
|
ppsParam.ppsTables.smsSentence[id].english[MAX_SMS_LEN] = strlen((char *)ppsParam.ppsTables.smsSentence[id].english);
|
||||||
{
|
return ppsParam.ppsTables.smsSentence[id].english;
|
||||||
ppsParam.ppsTables.smsExtSentence[id].english[MAX_SMS_LEN] = strlen((char *)ppsParam.ppsTables.smsExtSentence[id].english);
|
|
||||||
return ppsParam.ppsTables.smsExtSentence[id].english;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ppsParam.ppsTables.smsSentence[id].english[MAX_SMS_LEN] = strlen((char *)ppsParam.ppsTables.smsSentence[id].english);
|
|
||||||
return ppsParam.ppsTables.smsSentence[id].english;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(strcasecmp((char *)languageInfo->language,"null") == 0)
|
if(strcasecmp((char *)languageInfo->language,"null") == 0)
|
||||||
return ((u_char *)"");
|
return ((u_char *)"");
|
||||||
@@ -2028,13 +2007,7 @@ int pps_get_smsSentence(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
|
|||||||
return -1;
|
return -1;
|
||||||
if(isIndexBusy(SmsSentenceTable,(index_t *)&index) == FALSE)
|
if(isIndexBusy(SmsSentenceTable,(index_t *)&index) == FALSE)
|
||||||
return -1;
|
return -1;
|
||||||
if(index>SMS_MAX_ITEM)
|
smsSentenceItem = &ppsParam.ppsTables.smsSentence[index];
|
||||||
{
|
|
||||||
index -= (SMS_MAX_ITEM+1);
|
|
||||||
smsSentenceItem = &ppsParam.ppsTables.smsExtSentence[index];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
smsSentenceItem = &ppsParam.ppsTables.smsSentence[index];
|
|
||||||
*vartype = OctetString;
|
*vartype = OctetString;
|
||||||
switch(column)
|
switch(column)
|
||||||
{
|
{
|
||||||
@@ -2100,13 +2073,7 @@ int pps_set_smsSentence(u32 column, u32 *instance, u8 *pdata, u16 datalen)
|
|||||||
{
|
{
|
||||||
strReplace(pdata,datalen,'|','\n');
|
strReplace(pdata,datalen,'|','\n');
|
||||||
}
|
}
|
||||||
if(index>SMS_MAX_ITEM)
|
smsSentenceItem = &ppsParam.ppsTables.smsSentence[index];
|
||||||
{
|
|
||||||
index -= (SMS_MAX_ITEM+1);
|
|
||||||
smsSentenceItem = &ppsParam.ppsTables.smsExtSentence[index];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
smsSentenceItem = &ppsParam.ppsTables.smsSentence[index];
|
|
||||||
switch(column)
|
switch(column)
|
||||||
{
|
{
|
||||||
case 1:/* create */
|
case 1:/* create */
|
||||||
@@ -3996,21 +3963,21 @@ int pps_set_cosTariff(u32 column, u32 *instance, u8 *pdata, u16 datalen)
|
|||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
u_char buf[32] = {0};
|
u_char buf[32] = {0};
|
||||||
//struct tm tmnow;
|
struct tm tmnow;
|
||||||
|
|
||||||
memcpy(buf,pdata,8);
|
memcpy(buf,pdata,8);
|
||||||
strcat((char *)buf+8, "000000");
|
strcat((char *)buf+8, "000000");
|
||||||
tariffCosItem->promotionUseControl.rechargePromotionStartDate = MakeTime(NULL, (char *)buf);
|
tariffCosItem->promotionUseControl.rechargePromotionStartDate = MakeTime(&tmnow, (char *)buf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
u_char buf[32] = {0};
|
u_char buf[32] = {0};
|
||||||
//struct tm tmnow;
|
struct tm tmnow;
|
||||||
|
|
||||||
memcpy(buf,pdata,8);
|
memcpy(buf,pdata,8);
|
||||||
strcat((char *)buf+8, "000000");
|
strcat((char *)buf+8, "000000");
|
||||||
tariffCosItem->promotionUseControl.rechargePromotionEndDate = MakeTime(NULL, (char *)buf);
|
tariffCosItem->promotionUseControl.rechargePromotionEndDate = MakeTime(&tmnow, (char *)buf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
@@ -4925,7 +4892,13 @@ int pps_get_cosSmsNotification(u32 column, u32 *instance, u8 *pdata, u8 *vartype
|
|||||||
case 19:
|
case 19:
|
||||||
pdata[0] = smsNotificationItem->smsNotificationWhenFriendFamilyServiceRemoved;
|
pdata[0] = smsNotificationItem->smsNotificationWhenFriendFamilyServiceRemoved;
|
||||||
break;
|
break;
|
||||||
case 20:/* rowStatus */ //2010-03-08
|
case 20:
|
||||||
|
pdata[0] = smsNotificationItem->smsNotificationWhenPromotionInsufficient;
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
pdata[0] = smsNotificationItem->insufficientPromotionThreshold;
|
||||||
|
break;
|
||||||
|
case 22:/* rowStatus */ //2010-03-08
|
||||||
*vartype = INTEGER;
|
*vartype = INTEGER;
|
||||||
pdata[0] = TABLE_ACTIVE_COMMAND;
|
pdata[0] = TABLE_ACTIVE_COMMAND;
|
||||||
break;
|
break;
|
||||||
@@ -5008,7 +4981,13 @@ int pps_set_cosSmsNotification(u32 column, u32 *instance, u8 *pdata, u16 datalen
|
|||||||
case 19:
|
case 19:
|
||||||
smsNotificationItem->smsNotificationWhenFriendFamilyServiceRemoved = pdata[0];
|
smsNotificationItem->smsNotificationWhenFriendFamilyServiceRemoved = pdata[0];
|
||||||
break;
|
break;
|
||||||
case 20:/* command */
|
case 20:
|
||||||
|
smsNotificationItem->smsNotificationWhenPromotionInsufficient = pdata[0];
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
smsNotificationItem->insufficientPromotionThreshold = pdata[0];
|
||||||
|
break;
|
||||||
|
case 22:/* command */
|
||||||
if(pdata[0] == TABLE_DESTROY_COMMAND)
|
if(pdata[0] == TABLE_DESTROY_COMMAND)
|
||||||
{
|
{
|
||||||
memset(smsNotificationItem,0,sizeof(CosSmsNotificationInquiry));
|
memset(smsNotificationItem,0,sizeof(CosSmsNotificationInquiry));
|
||||||
@@ -5700,10 +5679,41 @@ int pps_get_cosGprs(u32 column, u32 *instance, u8 *pdata, u8 *vartype)
|
|||||||
case 21:
|
case 21:
|
||||||
pdata[0] = gprsItem->capPlan[0].tariffID3;
|
pdata[0] = gprsItem->capPlan[0].tariffID3;
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
case 22:
|
||||||
|
pdata[0] = gprsItem->capPlan[1].type;
|
||||||
|
break;
|
||||||
|
case 23:
|
||||||
|
datalen = PPS_GET_INTEGER(gprsItem->capPlan[1].threshold0,pdata,vartype);
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
datalen = PPS_GET_INTEGER(gprsItem->capPlan[1].threshold1,pdata,vartype);
|
||||||
|
break;
|
||||||
|
case 25:
|
||||||
|
datalen = PPS_GET_INTEGER(gprsItem->capPlan[1].threshold2,pdata,vartype);
|
||||||
|
break;
|
||||||
|
case 26:
|
||||||
|
pdata[0] = gprsItem->capPlan[1].tariffID0;
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
pdata[0] = gprsItem->capPlan[1].tariffID1;
|
||||||
|
break;
|
||||||
|
case 28:
|
||||||
|
pdata[0] = gprsItem->capPlan[1].tariffID2;
|
||||||
|
break;
|
||||||
|
case 29:
|
||||||
|
pdata[0] = gprsItem->capPlan[1].tariffID3;
|
||||||
|
break;
|
||||||
|
case 30:/* rowStatus */
|
||||||
|
*vartype = INTEGER;
|
||||||
|
pdata[0] = TABLE_ACTIVE_COMMAND;
|
||||||
|
break;
|
||||||
|
#else
|
||||||
case 22:/* rowStatus */ //2010-03-08
|
case 22:/* rowStatus */ //2010-03-08
|
||||||
*vartype = INTEGER;
|
*vartype = INTEGER;
|
||||||
pdata[0] = TABLE_ACTIVE_COMMAND;
|
pdata[0] = TABLE_ACTIVE_COMMAND;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
@@ -5790,6 +5800,41 @@ int pps_set_cosGprs(u32 column, u32 *instance, u8 *pdata, u16 datalen)
|
|||||||
case 21:
|
case 21:
|
||||||
gprsItem->capPlan[0].tariffID3 = pdata[0];
|
gprsItem->capPlan[0].tariffID3 = pdata[0];
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
case 22:
|
||||||
|
gprsItem->capPlan[1].type = pdata[0];
|
||||||
|
break;
|
||||||
|
case 23:
|
||||||
|
gprsItem->capPlan[1].threshold0 = PPS_SET_INTEGER(pdata,datalen);
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
gprsItem->capPlan[1].threshold1 = PPS_SET_INTEGER(pdata,datalen);
|
||||||
|
break;
|
||||||
|
case 25:
|
||||||
|
gprsItem->capPlan[1].threshold2 = PPS_SET_INTEGER(pdata,datalen);
|
||||||
|
break;
|
||||||
|
case 26:
|
||||||
|
gprsItem->capPlan[1].tariffID0 = pdata[0];
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
gprsItem->capPlan[1].tariffID1 = pdata[0];
|
||||||
|
break;
|
||||||
|
case 28:
|
||||||
|
gprsItem->capPlan[1].tariffID2 = pdata[0];
|
||||||
|
break;
|
||||||
|
case 29:
|
||||||
|
gprsItem->capPlan[1].tariffID3 = pdata[0];
|
||||||
|
break;
|
||||||
|
case 30:/* command */
|
||||||
|
if(pdata[0] == TABLE_DESTROY_COMMAND)
|
||||||
|
{
|
||||||
|
memset(gprsItem,0,sizeof(PPS_COS_RADIUS_ITEM));
|
||||||
|
gprsItem->existFlag = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
#else
|
||||||
case 22:/* command */
|
case 22:/* command */
|
||||||
if(pdata[0] == TABLE_DESTROY_COMMAND)
|
if(pdata[0] == TABLE_DESTROY_COMMAND)
|
||||||
{
|
{
|
||||||
@@ -5799,6 +5844,7 @@ int pps_set_cosGprs(u32 column, u32 *instance, u8 *pdata, u16 datalen)
|
|||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+1212
-1232
File diff suppressed because it is too large.
Load diff
@@ -40,7 +40,7 @@ StringCut(char *str, int c)
|
|||||||
*/
|
*/
|
||||||
void Bstr2Hstr(char *cptr)
|
void Bstr2Hstr(char *cptr)
|
||||||
{
|
{
|
||||||
char s[12] = "";
|
char s[] = "";
|
||||||
unsigned int i, j = 0;
|
unsigned int i, j = 0;
|
||||||
|
|
||||||
while (cptr && *cptr && strchr("01", *cptr)) {
|
while (cptr && *cptr && strchr("01", *cptr)) {
|
||||||
|
|||||||
+275
-1160
File diff suppressed because it is too large.
Load diff
+225
-371
@@ -529,12 +529,6 @@ int LoadPPSParam()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_
|
|
||||||
if (ppsParam.scf_work_as_adaptor)
|
|
||||||
{
|
|
||||||
read_yx_ussd_param();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CalcSumOfParameter();
|
CalcSumOfParameter();
|
||||||
|
|
||||||
@@ -680,7 +674,7 @@ int snmpSetPPS(BYTE oidLen, DWORD *oid, BYTE *pdata, u_short dataLen)
|
|||||||
{
|
{
|
||||||
int oid0,oid1,oid2,loop;
|
int oid0,oid1,oid2,loop;
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
//struct tm tmnow;
|
struct tm tmnow;
|
||||||
int iValue=0;
|
int iValue=0;
|
||||||
|
|
||||||
PutLogFunID("snmpSetPPS");
|
PutLogFunID("snmpSetPPS");
|
||||||
@@ -831,7 +825,7 @@ int snmpSetPPS(BYTE oidLen, DWORD *oid, BYTE *pdata, u_short dataLen)
|
|||||||
case 4: /* tariff time*/
|
case 4: /* tariff time*/
|
||||||
memset(buf,0,sizeof(buf));
|
memset(buf,0,sizeof(buf));
|
||||||
memcpy(buf,pdata,dataLen);
|
memcpy(buf,pdata,dataLen);
|
||||||
ppsParam.fileOperation.nextTariffStartTime = MakeTime(NULL,buf);
|
ppsParam.fileOperation.nextTariffStartTime = MakeTime(&tmnow,buf);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
|
||||||
@@ -2276,11 +2270,11 @@ void ListData()
|
|||||||
|
|
||||||
void ListSubInfo(char *msisdn)
|
void ListSubInfo(char *msisdn)
|
||||||
{
|
{
|
||||||
int len,head,tail,instance;//,i;
|
int len,head,tail,instance,i;
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
_prepaid_info *shmp=NULL;
|
_prepaid_info *shmp=NULL;
|
||||||
//PoolParent *pParent;
|
PoolParent *pParent;
|
||||||
//PoolChild *pChild;
|
PoolChild *pChild;
|
||||||
|
|
||||||
PutLogFunID("ListSubInfo");
|
PutLogFunID("ListSubInfo");
|
||||||
|
|
||||||
@@ -2299,29 +2293,29 @@ void ListSubInfo(char *msisdn)
|
|||||||
tail = instance % UNIT_STORE_ACCOUNT;
|
tail = instance % UNIT_STORE_ACCOUNT;
|
||||||
|
|
||||||
shmp = &ramshm_ptr->prepaid_data.prepaid_info[head][tail];
|
shmp = &ramshm_ptr->prepaid_data.prepaid_info[head][tail];
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserInfo(shmp, &usr_redis);
|
||||||
|
#endif
|
||||||
DebugMsg(debugmib.display.asciiOut,
|
DebugMsg(debugmib.display.asciiOut,
|
||||||
"<<----------- Sub. Info @ <%d> --------",instance);
|
"<<----------- Sub. Info @ <%d> --------",instance);
|
||||||
DebugMsg(debugmib.display.asciiOut,"msisdn: %s",msisdn);
|
DebugMsg(debugmib.display.asciiOut,"msisdn: %s",msisdn);
|
||||||
DebugMsg(debugmib.display.asciiOut,"PIN: %s",shmp->pin);
|
DebugMsg(debugmib.display.asciiOut,"PIN: %s",shmp->pin);
|
||||||
DebugMsg(debugmib.display.asciiOut,"status: %d",shmp->status);
|
DebugMsg(debugmib.display.asciiOut,"status: %d",shmp->status);
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
DebugMsg(debugmib.display.asciiOut,"balance: %07.4f+%07.4f",
|
||||||
|
usr_redis.usr_balance,usr_redis.pro_balance);
|
||||||
|
#else
|
||||||
DebugMsg(debugmib.display.asciiOut,"balance: %07.4f+%07.4f",
|
DebugMsg(debugmib.display.asciiOut,"balance: %07.4f+%07.4f",
|
||||||
shmp->balance,shmp->promo_balance);
|
shmp->balance,shmp->promo_balance);
|
||||||
AsciiTime(buf,shmp->mo_expiration_date);
|
#endif
|
||||||
|
AsciiTime(buf,shmp->mo_expiration_date);
|
||||||
DebugMsg(debugmib.display.asciiOut,"mo expire date: %s",buf);
|
DebugMsg(debugmib.display.asciiOut,"mo expire date: %s",buf);
|
||||||
AsciiTime(buf,shmp->mt_expiration_date);
|
AsciiTime(buf,shmp->mt_expiration_date);
|
||||||
DebugMsg(debugmib.display.asciiOut,"mt expire date: %s",buf);
|
DebugMsg(debugmib.display.asciiOut,"mt expire date: %s",buf);
|
||||||
DebugMsg(debugmib.display.asciiOut,"cos id: %d, CUG ID: %d",shmp->cos_id, shmp->cug_id);
|
DebugMsg(debugmib.display.asciiOut,"cos id: %d",shmp->cos_id);
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"CRM ID: %d.%d",shmp->crm_info.account_id, shmp->crm_info.base_plan_id);
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"Rent: %d",shmp->crm_info.rent_charge);
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"free SMS status: %d",shmp->freeSMSActiveDays);
|
|
||||||
/*
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"fav numbers: %d",shmp->favorite_numbers);
|
DebugMsg(debugmib.display.asciiOut,"fav numbers: %d",shmp->favorite_numbers);
|
||||||
DebugMsg(debugmib.display.asciiOut,"fav counter: %d",shmp->fav_change_counter);
|
DebugMsg(debugmib.display.asciiOut,"fav counter: %d",shmp->fav_change_counter);
|
||||||
|
|
||||||
for(i=0;i<5;i++)
|
for(i=0;i<5;i++)
|
||||||
{
|
{
|
||||||
len = shmp->favorite_number[i][MAX_MSISDN_BLEN-1];
|
len = shmp->favorite_number[i][MAX_MSISDN_BLEN-1];
|
||||||
@@ -2330,6 +2324,8 @@ void ListSubInfo(char *msisdn)
|
|||||||
DebugMsg(debugmib.display.asciiOut,"fav number[%d]: %s",i,buf);
|
DebugMsg(debugmib.display.asciiOut,"fav number[%d]: %s",i,buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugMsg(debugmib.display.asciiOut,"free SMS status: %d",shmp->freeSMSActiveDays);
|
||||||
|
|
||||||
if(shmp->poolAccount.role == MASTER_SLAVE_CHILD)
|
if(shmp->poolAccount.role == MASTER_SLAVE_CHILD)
|
||||||
{
|
{
|
||||||
pChild = &shmp->poolAccount.roleParty.child;
|
pChild = &shmp->poolAccount.roleParty.child;
|
||||||
@@ -2358,7 +2354,7 @@ void ListSubInfo(char *msisdn)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
DebugMsg(debugmib.display.asciiOut,"pool account role: Normal account");
|
DebugMsg(debugmib.display.asciiOut,"pool account role: Normal account");
|
||||||
*/
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"Gprs volume: %lld",shmp->gprsVolume);
|
DebugMsg(debugmib.display.asciiOut,"Gprs volume: %lld",shmp->gprsVolume);
|
||||||
DebugMsg(debugmib.display.asciiOut,"Gprs balance: %0.4f",shmp->gprsBalance);
|
DebugMsg(debugmib.display.asciiOut,"Gprs balance: %0.4f",shmp->gprsBalance);
|
||||||
DebugMsg(debugmib.display.asciiOut,"Gprs volume ths month: %lld",shmp->gprsVolumeThisMonth);
|
DebugMsg(debugmib.display.asciiOut,"Gprs volume ths month: %lld",shmp->gprsVolumeThisMonth);
|
||||||
@@ -2366,6 +2362,16 @@ void ListSubInfo(char *msisdn)
|
|||||||
DebugMsg(debugmib.display.asciiOut,"Call me back times: %d",shmp->callMeBackRequestTimes);
|
DebugMsg(debugmib.display.asciiOut,"Call me back times: %d",shmp->callMeBackRequestTimes);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
AsciiTimeYMD(buf,usr_redis.validity_date);
|
||||||
|
DebugMsg(debugmib.display.asciiOut,"Bundle Info >>>");
|
||||||
|
DebugMsg(debugmib.display.asciiOut," data (KB) : %lld", (usr_redis.data + 1023) / 1024);
|
||||||
|
DebugMsg(debugmib.display.asciiOut," MO (S) : %d", usr_redis.mo_voice);
|
||||||
|
DebugMsg(debugmib.display.asciiOut," MT (S) : %d", usr_redis.mt_voice);
|
||||||
|
DebugMsg(debugmib.display.asciiOut," SMS : %d", usr_redis.sms);
|
||||||
|
DebugMsg(debugmib.display.asciiOut," Validity : %s", buf);
|
||||||
|
DebugMsg(debugmib.display.asciiOut," SMS Sent : %d", usr_redis.warning_sms_flag);
|
||||||
|
#else
|
||||||
AsciiTimeYMD(buf,shmp->bundle_info.validity_date);
|
AsciiTimeYMD(buf,shmp->bundle_info.validity_date);
|
||||||
DebugMsg(debugmib.display.asciiOut,"Bundle Info >>>");
|
DebugMsg(debugmib.display.asciiOut,"Bundle Info >>>");
|
||||||
DebugMsg(debugmib.display.asciiOut," data (KB) : %lld", (shmp->bundle_info.data + 1023) / 1024);
|
DebugMsg(debugmib.display.asciiOut," data (KB) : %lld", (shmp->bundle_info.data + 1023) / 1024);
|
||||||
@@ -2374,6 +2380,7 @@ void ListSubInfo(char *msisdn)
|
|||||||
DebugMsg(debugmib.display.asciiOut," SMS : %d", shmp->bundle_info.sms);
|
DebugMsg(debugmib.display.asciiOut," SMS : %d", shmp->bundle_info.sms);
|
||||||
DebugMsg(debugmib.display.asciiOut," Validity : %s", buf);
|
DebugMsg(debugmib.display.asciiOut," Validity : %s", buf);
|
||||||
DebugMsg(debugmib.display.asciiOut," SMS Sent : %d", shmp->bundle_info.warning_sms_flag);
|
DebugMsg(debugmib.display.asciiOut," SMS Sent : %d", shmp->bundle_info.warning_sms_flag);
|
||||||
|
#endif
|
||||||
|
|
||||||
DebugMsg(debugmib.display.asciiOut," ");
|
DebugMsg(debugmib.display.asciiOut," ");
|
||||||
|
|
||||||
@@ -2515,6 +2522,9 @@ void SumAccountBalance()
|
|||||||
len = shmp->msisdn[9];
|
len = shmp->msisdn[9];
|
||||||
if(len==0) continue;
|
if(len==0) continue;
|
||||||
balance = balance + shmp->balance + shmp->promo_balance;
|
balance = balance + shmp->balance + shmp->promo_balance;
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
// too many query in a tick if using balance of redis DB, TODO
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
DebugMsg(debugmib.display.asciiOut,"Total balance: %.0f", balance);
|
DebugMsg(debugmib.display.asciiOut,"Total balance: %.0f", balance);
|
||||||
}
|
}
|
||||||
@@ -2531,6 +2541,9 @@ int pps_set_all_balance(int balance)
|
|||||||
len = shmp->msisdn[9];
|
len = shmp->msisdn[9];
|
||||||
if(len==0) continue;
|
if(len==0) continue;
|
||||||
shmp->balance = balance;
|
shmp->balance = balance;
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
RedisSetUserBalanceFromOcs(shmp, (double)balance);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"Set balance to : %d", balance);
|
DebugMsg(debugmib.display.asciiOut,"Set balance to : %d", balance);
|
||||||
@@ -2659,9 +2672,6 @@ void PrintCmdOK()
|
|||||||
DebugMsg(debugmib.display.asciiOut,"COMMAND OK!");
|
DebugMsg(debugmib.display.asciiOut,"COMMAND OK!");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void ppsAddBalanceToAll(int balance);
|
|
||||||
extern int query_tariff_test(u_char call_type);
|
|
||||||
extern int ocs_get_charge_prefix(char *dialed_number, char *prefix, char *area_name, int *call_type);
|
|
||||||
int DecodePPSAsciiIn(int pageno, char *cmd)
|
int DecodePPSAsciiIn(int pageno, char *cmd)
|
||||||
{
|
{
|
||||||
char cvalue[128];
|
char cvalue[128];
|
||||||
@@ -2821,15 +2831,6 @@ int DecodePPSAsciiIn(int pageno, char *cmd)
|
|||||||
PrintCmdOK();
|
PrintCmdOK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!strncasecmp(cmd,"add balance to all=",19))
|
|
||||||
{
|
|
||||||
ivalue = atoi(&cmd[19]);
|
|
||||||
|
|
||||||
ppsAddBalanceToAll(ivalue);
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
if(!strncasecmp(cmd,"recreate index",12))
|
if(!strncasecmp(cmd,"recreate index",12))
|
||||||
{
|
{
|
||||||
CreatePPSDataIndexForAll();
|
CreatePPSDataIndexForAll();
|
||||||
@@ -2871,14 +2872,6 @@ int DecodePPSAsciiIn(int pageno, char *cmd)
|
|||||||
PrintCmdOK();
|
PrintCmdOK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!strcmp(cmd,"mt cdr enable"))
|
|
||||||
{
|
|
||||||
ppsParam.serviceControl.mt_not_charged_for_cdr = 0;
|
|
||||||
SavePPSParam();
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!strcmp(cmd,"pps mo release"))
|
if(!strcmp(cmd,"pps mo release"))
|
||||||
{
|
{
|
||||||
ppsParam.serviceControl.mo_release_for_no_charge = 1;
|
ppsParam.serviceControl.mo_release_for_no_charge = 1;
|
||||||
@@ -3253,23 +3246,20 @@ int DecodePPSAsciiIn(int pageno, char *cmd)
|
|||||||
PrintCmdOK();
|
PrintCmdOK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!strncasecmp(cmd,"with crm yes",12))
|
if(!strncasecmp(cmd,"external vc yes",15))
|
||||||
{
|
{
|
||||||
ppsParam.serviceControl.work_with_crm = 1;
|
ppsParam.serviceControl.external_vc = 0;
|
||||||
|
|
||||||
SavePPSParam();
|
SavePPSParam();
|
||||||
PrintCmdOK();
|
PrintCmdOK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!strncasecmp(cmd,"with crm no",11))
|
if(!strncasecmp(cmd,"external vc no",14))
|
||||||
{
|
{
|
||||||
ppsParam.serviceControl.work_with_crm = 0;
|
ppsParam.serviceControl.external_vc = 1;
|
||||||
|
|
||||||
SavePPSParam();
|
SavePPSParam();
|
||||||
PrintCmdOK();
|
PrintCmdOK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!strncasecmp(cmd,"change expiry day",17))
|
if(!strncasecmp(cmd,"change expiry day",17))
|
||||||
{
|
{
|
||||||
ppsParam.serviceControl.not_change_expiry_date_when_transfer= 0;
|
ppsParam.serviceControl.not_change_expiry_date_when_transfer= 0;
|
||||||
@@ -3375,12 +3365,7 @@ int DecodePPSAsciiIn(int pageno, char *cmd)
|
|||||||
{
|
{
|
||||||
ppsParam.scf_work_as_adaptor = atoi(&cmd[8]);
|
ppsParam.scf_work_as_adaptor = atoi(&cmd[8]);
|
||||||
SavePPSParam();
|
SavePPSParam();
|
||||||
#ifdef _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_
|
|
||||||
if (ppsParam.scf_work_as_adaptor)
|
|
||||||
{
|
|
||||||
read_yx_ussd_param();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
PrintCmdOK();
|
PrintCmdOK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -3572,67 +3557,6 @@ int DecodePPSAsciiIn(int pageno, char *cmd)
|
|||||||
PrintCmdOK();
|
PrintCmdOK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!strncasecmp(cmd,"test crm tariff=", 16))
|
|
||||||
{
|
|
||||||
u_char call_type = 1;/*1=mo call, 2=mo sms, 3=data*/
|
|
||||||
if(cmd[16] == 'c')
|
|
||||||
call_type = 1;
|
|
||||||
else if(cmd[16] == 's')
|
|
||||||
call_type = 2;
|
|
||||||
else if(cmd[16] == 'd')
|
|
||||||
call_type = 3;
|
|
||||||
|
|
||||||
query_tariff_test(call_type);
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(strstr(cmd,"reload prefix definition"))
|
|
||||||
{
|
|
||||||
ocs_get_crm_prefix_definition();
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(!strncasecmp(cmd,"free seconds=", 13))
|
|
||||||
{
|
|
||||||
ppsParam.serviceControl.crm_free_seconds = atoi(&cmd[13]);
|
|
||||||
SavePPSParam();
|
|
||||||
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(!strncasecmp(cmd,"status vd=", 10))
|
|
||||||
{
|
|
||||||
ppsParam.serviceControl.crm_status_validity = atoi(&cmd[10]);
|
|
||||||
SavePPSParam();
|
|
||||||
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(!strncasecmp(cmd,"days before vd=", 15))
|
|
||||||
{
|
|
||||||
ppsParam.serviceControl.crm_days_before_validity = atoi(&cmd[15]);
|
|
||||||
SavePPSParam();
|
|
||||||
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(!strncasecmp(cmd,"sms for event=", 14))
|
|
||||||
{
|
|
||||||
ppsParam.serviceControl.crm_notification_for_event = atoi(&cmd[14]);
|
|
||||||
SavePPSParam();
|
|
||||||
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(!strncasecmp(cmd,"crm tariff=", 11))
|
|
||||||
{
|
|
||||||
char prefix[128], areaName[32]="";
|
|
||||||
int call_type;
|
|
||||||
ocs_get_charge_prefix(&cmd[11], prefix, areaName, &call_type);
|
|
||||||
|
|
||||||
PrintCmdOK();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(!strncasecmp(cmd,"cellid in ccr=", 14))
|
if(!strncasecmp(cmd,"cellid in ccr=", 14))
|
||||||
{
|
{
|
||||||
ppsParam.serviceControl.cellid_present_in_ccr = atoi(&cmd[14]);
|
ppsParam.serviceControl.cellid_present_in_ccr = atoi(&cmd[14]);
|
||||||
@@ -3640,7 +3564,27 @@ int DecodePPSAsciiIn(int pageno, char *cmd)
|
|||||||
PrintCmdOK();
|
PrintCmdOK();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
if(!strncasecmp(cmd,"redis load", 10))
|
||||||
|
{
|
||||||
|
RedisCreateDbFromOcs();
|
||||||
|
PrintCmdOK();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(!strncasecmp(cmd,"redis save", 10))
|
||||||
|
{
|
||||||
|
RedisSaveDbToOcs();
|
||||||
|
PrintCmdOK();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(!strncasecmp(cmd,"redis test", 10))
|
||||||
|
{
|
||||||
|
RedisTest(atoi(&cmd[10]));
|
||||||
|
PrintCmdOK();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"ERROR COMMAND!");
|
DebugMsg(debugmib.display.asciiOut,"ERROR COMMAND!");
|
||||||
break;
|
break;
|
||||||
case 1: /* parameter */
|
case 1: /* parameter */
|
||||||
@@ -3859,7 +3803,7 @@ int ImportUserData(char *userdata)
|
|||||||
|
|
||||||
token = buf;
|
token = buf;
|
||||||
|
|
||||||
if(strlen(userdata)<10)
|
if(strlen(userdata)<30)
|
||||||
{
|
{
|
||||||
if(load_file.log_fp[_FILE_ID_USER_DATA] != NULL)
|
if(load_file.log_fp[_FILE_ID_USER_DATA] != NULL)
|
||||||
{
|
{
|
||||||
@@ -3870,14 +3814,14 @@ int ImportUserData(char *userdata)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int up_balance_only_flag = 0, first_id_not_nul = 0, invalid_record_flag = 0;
|
|
||||||
while(index<MAX_PPS_USER_FIELD_NUMS)
|
while(index<MAX_PPS_USER_FIELD_NUMS)
|
||||||
{
|
{
|
||||||
|
|
||||||
token = strsep((char **)&(userdata),delimiter);
|
token = strsep((char **)&(userdata),delimiter);
|
||||||
if(token == NULL )
|
if(token == NULL )
|
||||||
{
|
{
|
||||||
if((index == 0) || ((replaceableFlag == 0) && (index<21)))
|
if(index<21)
|
||||||
{
|
{
|
||||||
if(load_file.log_fp[_FILE_ID_USER_DATA] != NULL)
|
if(load_file.log_fp[_FILE_ID_USER_DATA] != NULL)
|
||||||
{
|
{
|
||||||
@@ -3888,28 +3832,11 @@ int ImportUserData(char *userdata)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (index < 21)// invalid record when replaceableFlag == 1
|
|
||||||
{
|
|
||||||
invalid_record_flag = 1;
|
|
||||||
}
|
|
||||||
index++;
|
index++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index > 0)
|
|
||||||
{
|
|
||||||
if (first_id_not_nul == 0)
|
|
||||||
{
|
|
||||||
if (strlen(token) > 0){
|
|
||||||
first_id_not_nul = index;
|
|
||||||
if ((index == 0x03) && replaceableFlag)// first index is balance
|
|
||||||
{
|
|
||||||
up_balance_only_flag = 1;// set update balance only
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strcpy(buf,token);
|
strcpy(buf,token);
|
||||||
|
|
||||||
switch(index)
|
switch(index)
|
||||||
@@ -4082,16 +4009,6 @@ int ImportUserData(char *userdata)
|
|||||||
index++;
|
index++;
|
||||||
}//while
|
}//while
|
||||||
|
|
||||||
if (invalid_record_flag && !up_balance_only_flag)
|
|
||||||
{
|
|
||||||
if(load_file.log_fp[_FILE_ID_USER_DATA] != NULL)
|
|
||||||
{
|
|
||||||
fprintf(load_file.log_fp[_FILE_ID_USER_DATA],
|
|
||||||
"Error: Wrong record : %s,index=%d\n",userdata,index);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
shmp->favorite_numbers = favorite_numbers;
|
shmp->favorite_numbers = favorite_numbers;
|
||||||
|
|
||||||
retval = FindPPSSubsStoreIndex(atoll(msisdn));
|
retval = FindPPSSubsStoreIndex(atoll(msisdn));
|
||||||
@@ -4117,46 +4034,21 @@ int ImportUserData(char *userdata)
|
|||||||
tail = retval % UNIT_STORE_ACCOUNT;
|
tail = retval % UNIT_STORE_ACCOUNT;
|
||||||
shmp_old = &ramshm_ptr->prepaid_data.prepaid_info[head][tail];
|
shmp_old = &ramshm_ptr->prepaid_data.prepaid_info[head][tail];
|
||||||
|
|
||||||
if (up_balance_only_flag)
|
if(shmp->balance != shmp_old->balance && masterFlag)
|
||||||
{
|
{
|
||||||
if(shmp->balance != shmp_old->balance && masterFlag)
|
chargeFlag |= 0x01;
|
||||||
{
|
difbalance = shmp->balance-shmp_old->balance;
|
||||||
chargeFlag |= 0x01;
|
|
||||||
difbalance = shmp->balance-shmp_old->balance;
|
|
||||||
|
|
||||||
double new_balance = shmp->balance;
|
|
||||||
memcpy(shmp, shmp_old, sizeof(_prepaid_info));
|
|
||||||
shmp->balance = new_balance;
|
|
||||||
ModifyPPSSubsData(shmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
if(shmp->promo_balance != shmp_old->promo_balance && masterFlag)
|
||||||
{
|
{
|
||||||
if(shmp->balance != shmp_old->balance && masterFlag)
|
chargeFlag |= 0x02;
|
||||||
{
|
dif_promo_balance = shmp->promo_balance - shmp_old->promo_balance;
|
||||||
chargeFlag |= 0x01;
|
|
||||||
difbalance = shmp->balance-shmp_old->balance;
|
|
||||||
}
|
|
||||||
if(shmp->promo_balance != shmp_old->promo_balance && masterFlag)
|
|
||||||
{
|
|
||||||
chargeFlag |= 0x02;
|
|
||||||
dif_promo_balance = shmp->promo_balance - shmp_old->promo_balance;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModifyPPSSubsData(shmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModifyPPSSubsData(shmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (up_balance_only_flag)
|
|
||||||
{
|
|
||||||
if(load_file.log_fp[_FILE_ID_USER_DATA] !=NULL)
|
|
||||||
{
|
|
||||||
fprintf(load_file.log_fp[_FILE_ID_USER_DATA],
|
|
||||||
"Error: can't create user from balance only record!\n");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if(debugmib.measurement.usernumber>=ppsParam.serviceControl.licenseduser)
|
if(debugmib.measurement.usernumber>=ppsParam.serviceControl.licenseduser)
|
||||||
{
|
{
|
||||||
if(load_file.log_fp[_FILE_ID_USER_DATA] !=NULL)
|
if(load_file.log_fp[_FILE_ID_USER_DATA] !=NULL)
|
||||||
@@ -5789,7 +5681,7 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
int i,vallen,chargeFlag=0,/*addFlag=0,*/charge=0;
|
int i,vallen,chargeFlag=0,/*addFlag=0,*/charge=0;
|
||||||
char buf[2048]="";
|
char buf[2048]="";
|
||||||
char valbuf[32]="";
|
char valbuf[32]="";
|
||||||
//struct tm tmnow;
|
struct tm tmnow;
|
||||||
CosServiceControl *serviceControlItem;
|
CosServiceControl *serviceControlItem;
|
||||||
CosFriendFamilyControl *friendFamilyControl;
|
CosFriendFamilyControl *friendFamilyControl;
|
||||||
int totalLen=0;
|
int totalLen=0;
|
||||||
@@ -5988,7 +5880,7 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(shmp->msisdn[MAX_MSISDN_BLEN-1]==0) {/*addFlag = 1*/;}
|
if(shmp->msisdn[MAX_MSISDN_BLEN-1]==0) /*addFlag = 1*/;
|
||||||
AsciiToBcd(shmp->msisdn, (char *)pdata2,(vallen+1)/2*2);
|
AsciiToBcd(shmp->msisdn, (char *)pdata2,(vallen+1)/2*2);
|
||||||
if(vallen%2==0)
|
if(vallen%2==0)
|
||||||
shmp->msisdn[vallen/2] = 0xFF;
|
shmp->msisdn[vallen/2] = 0xFF;
|
||||||
@@ -6126,7 +6018,7 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
||||||
{
|
{
|
||||||
BcdToAscii(buf,pdata2,vallen*2);
|
BcdToAscii(buf,pdata2,vallen*2);
|
||||||
shmp->first_used_date = MakeTime(NULL,buf);
|
shmp->first_used_date = MakeTime(&tmnow,buf);
|
||||||
if(ocode==OMC_OCODE_ADD)
|
if(ocode==OMC_OCODE_ADD)
|
||||||
{
|
{
|
||||||
shmp->first_used_date = tvnow.tv_sec;
|
shmp->first_used_date = tvnow.tv_sec;
|
||||||
@@ -6147,7 +6039,7 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
||||||
{
|
{
|
||||||
BcdToAscii(buf,pdata2,vallen*2);
|
BcdToAscii(buf,pdata2,vallen*2);
|
||||||
shmp->mo_expiration_date = MakeTime(NULL,buf);
|
shmp->mo_expiration_date = MakeTime(&tmnow,buf);
|
||||||
|
|
||||||
AsciiTime(buf,shmp->mo_expiration_date);
|
AsciiTime(buf,shmp->mo_expiration_date);
|
||||||
AsciiToBcd((BYTE *)valbuf,buf,14);
|
AsciiToBcd((BYTE *)valbuf,buf,14);
|
||||||
@@ -6165,7 +6057,7 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
}else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
}else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
||||||
{
|
{
|
||||||
BcdToAscii(buf,pdata2,vallen*2);
|
BcdToAscii(buf,pdata2,vallen*2);
|
||||||
shmp->mt_expiration_date = MakeTime(NULL,buf);
|
shmp->mt_expiration_date = MakeTime(&tmnow,buf);
|
||||||
AsciiTime(buf,shmp->mt_expiration_date);
|
AsciiTime(buf,shmp->mt_expiration_date);
|
||||||
AsciiToBcd((BYTE *)valbuf,buf,14);
|
AsciiToBcd((BYTE *)valbuf,buf,14);
|
||||||
len = 7;
|
len = 7;
|
||||||
@@ -6182,7 +6074,7 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
}else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
}else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
||||||
{
|
{
|
||||||
BcdToAscii(buf,pdata2,vallen*2);
|
BcdToAscii(buf,pdata2,vallen*2);
|
||||||
shmp->promo_date = MakeTime(NULL,buf);
|
shmp->promo_date = MakeTime(&tmnow,buf);
|
||||||
|
|
||||||
AsciiTime(buf,shmp->promo_date);
|
AsciiTime(buf,shmp->promo_date);
|
||||||
AsciiToBcd((BYTE *)valbuf,buf,14);
|
AsciiToBcd((BYTE *)valbuf,buf,14);
|
||||||
@@ -7006,6 +6898,42 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
totalLen = AddInteger(tagbuf,tmpval,0x80,asnbuf);
|
totalLen = AddInteger(tagbuf,tmpval,0x80,asnbuf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
case 55:/* KB */
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,(u32)((shmp->out_net_cap_gprsVolume+BYTES_PER_KB-1) >> 10),0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
shmp->out_net_cap_gprsVolume= (long)tmpval << 10;
|
||||||
|
totalLen = AddInteger(tagbuf,(u32)(shmp->out_net_cap_gprsVolume>>10),0x80,asnbuf);
|
||||||
|
if (shmp->out_net_cap_gprsVolume < 1)
|
||||||
|
{
|
||||||
|
shmp->cap_sms_notify_counter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 56:
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,(u32)shmp->out_net_cap_gprsBalance,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
if(tmpval>ppsParam.serviceControl.maxBalance)
|
||||||
|
{
|
||||||
|
sprintf((char *)pdata,"Too big value(%d),should be(0-%d)",
|
||||||
|
tmpval,ppsParam.serviceControl.maxBalance);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
shmp->out_net_cap_gprsBalance= (double)tmpval;
|
||||||
|
totalLen = AddInteger(tagbuf,tmpval,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#else
|
||||||
case 55:/* KB */
|
case 55:/* KB */
|
||||||
if(ocode ==OMC_OCODE_READ)
|
if(ocode ==OMC_OCODE_READ)
|
||||||
{
|
{
|
||||||
@@ -7030,6 +6958,7 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
totalLen = AddInteger(tagbuf,shmp->gprsNotificationTimes,0x80,asnbuf);
|
totalLen = AddInteger(tagbuf,shmp->gprsNotificationTimes,0x80,asnbuf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case 57:
|
case 57:
|
||||||
if(ocode ==OMC_OCODE_READ)
|
if(ocode ==OMC_OCODE_READ)
|
||||||
{
|
{
|
||||||
@@ -7215,7 +7144,7 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
}else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
}else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
||||||
{
|
{
|
||||||
BcdToAscii(buf,pdata2,vallen*2);
|
BcdToAscii(buf,pdata2,vallen*2);
|
||||||
shmp->bundle_info.validity_date = MakeTime(NULL,buf);
|
shmp->bundle_info.validity_date = MakeTime(&tmnow,buf);
|
||||||
AsciiTime(buf,shmp->bundle_info.validity_date);
|
AsciiTime(buf,shmp->bundle_info.validity_date);
|
||||||
AsciiToBcd((BYTE *)valbuf,buf,14);
|
AsciiToBcd((BYTE *)valbuf,buf,14);
|
||||||
len = 7;
|
len = 7;
|
||||||
@@ -7248,6 +7177,112 @@ int SetUserDataByOMC(BYTE oidlen, DWORD *oid, BYTE *pdata, WORD datalen)
|
|||||||
totalLen = AddInteger(tagbuf,shmp->cap_sms_notify_counter, 0x80, asnbuf);
|
totalLen = AddInteger(tagbuf,shmp->cap_sms_notify_counter, 0x80, asnbuf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
case 69: //roaming bundle data
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,(u32)((shmp->bundle_roam.data+BYTES_PER_KB-1) >> 10),0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
shmp->bundle_roam.data = (long)tmpval << 10;
|
||||||
|
totalLen = AddInteger(tagbuf,(u32)(shmp->bundle_roam.data >> 10),0x80,asnbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 70: //roaming bundle mo voice
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->bundle_roam.mo_voice,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
shmp->bundle_roam.mo_voice = tmpval;
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->bundle_roam.mo_voice,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 71: //mt voice
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->bundle_roam.mt_voice,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
shmp->bundle_roam.mt_voice = tmpval;
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->bundle_roam.mt_voice,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 72: //sms
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->bundle_roam.sms,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
shmp->bundle_roam.sms= tmpval;
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->bundle_roam.sms,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 73: //validity
|
||||||
|
if(ocode==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
AsciiTime(buf,shmp->bundle_roam.validity_date);
|
||||||
|
AsciiToBcd((BYTE *)valbuf,buf,14);
|
||||||
|
len = 7;
|
||||||
|
totalLen = add_tlv(tagbuf,len, (u_char *)valbuf,0x80,asnbuf);
|
||||||
|
}else if(ocode==OMC_OCODE_EDIT || ocode==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
BcdToAscii(buf,pdata2,vallen*2);
|
||||||
|
shmp->bundle_roam.validity_date = MakeTime(&tmnow,buf);
|
||||||
|
AsciiTime(buf,shmp->bundle_roam.validity_date);
|
||||||
|
AsciiToBcd((BYTE *)valbuf,buf,14);
|
||||||
|
len = 7;
|
||||||
|
totalLen = add_tlv(tagbuf,len, (u_char *)valbuf,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 74:
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->bundle_roam.warning_sms_flag,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
shmp->bundle_roam.warning_sms_flag= tmpval;
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->bundle_roam.warning_sms_flag,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 75:/* KB */
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,(u32)((shmp->gprsVolumeThisMonth+BYTES_PER_KB-1) >> 10),0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
shmp->gprsVolumeThisMonth = (long)tmpval << 10;
|
||||||
|
totalLen = AddInteger(tagbuf,(u32)(shmp->gprsVolumeThisMonth >> 10),0x80,asnbuf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 76:
|
||||||
|
if(ocode ==OMC_OCODE_READ)
|
||||||
|
{
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->gprsNotificationTimes,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
else if(ocode==OMC_OCODE_EDIT || ocode ==OMC_OCODE_ADD)
|
||||||
|
{
|
||||||
|
if(GetInteger(tagbuf, (int *)&tmpval ,pflag,asnbuf2)<=0) continue;
|
||||||
|
shmp->gprsNotificationTimes= tmpval;
|
||||||
|
totalLen = AddInteger(tagbuf,shmp->gprsNotificationTimes,0x80,asnbuf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
@@ -7582,11 +7617,6 @@ int UseExternalVC()
|
|||||||
return ppsParam.serviceControl.external_vc;
|
return ppsParam.serviceControl.external_vc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int OCS_with_external_CRM()
|
|
||||||
{
|
|
||||||
return ppsParam.serviceControl.work_with_crm;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pps_week_index = 8;
|
static int pps_week_index = 8;
|
||||||
|
|
||||||
int ppsGetWeekDay()
|
int ppsGetWeekDay()
|
||||||
@@ -7817,11 +7847,6 @@ int pps_mt_play_voice_flag()
|
|||||||
return ppsParam.serviceControl.mt_play_voice_flag;
|
return ppsParam.serviceControl.mt_play_voice_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pps_mt_cdr_enable_flag()
|
|
||||||
{
|
|
||||||
return ppsParam.serviceControl.mt_not_charged_for_cdr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_debug_log_flag();
|
int get_debug_log_flag();
|
||||||
int pps_debug_info(char *app_name, char *str_to_show)
|
int pps_debug_info(char *app_name, char *str_to_show)
|
||||||
{
|
{
|
||||||
@@ -8034,178 +8059,7 @@ int ocs_get_calling_card_cos_id()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pps_get_service_number(unsigned int num_pos)
|
|
||||||
{
|
|
||||||
char *ptr = NULL;
|
|
||||||
|
|
||||||
if(num_pos < MAXServicePostion)
|
|
||||||
ptr = (char *)ppsParam.ppsTables.serviceNumber[num_pos].number;
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *ocs_get_crm_prefix_filename(char *ptr)
|
|
||||||
{
|
|
||||||
if(ptr == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// strcpy(ptr , ppsParam.ocs_crm_control.base_prefix_file_name);
|
|
||||||
strcpy(ptr, "/usr/local/agt/etc/tariff/prefix_table.txt");
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ocs_get_crm_prefix_call_type_method()
|
|
||||||
{
|
|
||||||
return ppsParam.ocs_crm_control.crm_call_type.equal_or_contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char local_mobile_prefix_des[128][128]={"35","67235","0067235"};
|
|
||||||
static char local_pstn_prefix_des[128][128]={"32","67232","0067232"};
|
|
||||||
static int local_mobile_index=0, local_pstn_index=0;
|
|
||||||
|
|
||||||
void ocs_get_crm_prefix_definition()
|
|
||||||
{
|
|
||||||
char s[80],s1[80];
|
|
||||||
int len;
|
|
||||||
unsigned char conf_state=0xFF;
|
|
||||||
FILE *fpConf;
|
|
||||||
char file_name[128]={"/usr/local/agt/etc/tariff/prefix_definition.txt"};
|
|
||||||
|
|
||||||
fpConf = fopen(file_name, "rb");
|
|
||||||
|
|
||||||
if(fpConf == NULL)
|
|
||||||
{
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(s,"");
|
|
||||||
strcpy(s1,"");
|
|
||||||
while(fgets(s,1024,fpConf) !=(char *)0)
|
|
||||||
{
|
|
||||||
if( (int *)strchr(s,'#') !=NULL) continue;
|
|
||||||
if( !strlen(s) ) continue;
|
|
||||||
len = strlen(s);
|
|
||||||
if(len < 2) continue;
|
|
||||||
|
|
||||||
if(s[len-1] == 0x0d ||s[len-1] == 0x0a)
|
|
||||||
{
|
|
||||||
if(s[len-2] == 0x0d ||s[len-2] == 0x0a)
|
|
||||||
{
|
|
||||||
s[len-2] = 0;
|
|
||||||
len -= 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s[len-1] = 0;
|
|
||||||
len -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(strstr(s,"[local mobile]"))
|
|
||||||
{
|
|
||||||
conf_state = 0;
|
|
||||||
local_mobile_index = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if(strstr(s,"[local pstn]"))
|
|
||||||
{
|
|
||||||
conf_state = 1;
|
|
||||||
local_pstn_index = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(conf_state)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
if(local_mobile_index<128)
|
|
||||||
strcpy(local_mobile_prefix_des[local_mobile_index++], s);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if(local_pstn_index<128)
|
|
||||||
strcpy(local_pstn_prefix_des[local_pstn_index++], s);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fpConf);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ocs_get_crm_prefix_call_type_des(const char *prefix)
|
|
||||||
{
|
|
||||||
int len,index;
|
|
||||||
|
|
||||||
if(prefix == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for(index=0; index<=local_mobile_index; index++)
|
|
||||||
{
|
|
||||||
len = strlen(local_mobile_prefix_des[index]);
|
|
||||||
if(len<=0) continue;
|
|
||||||
if(strncasecmp(prefix, local_mobile_prefix_des[index],len) == 0)
|
|
||||||
return 0; //local mobile
|
|
||||||
}
|
|
||||||
|
|
||||||
for(index=0; index<=local_pstn_index; index++)
|
|
||||||
{
|
|
||||||
len = strlen(local_pstn_prefix_des[index]);
|
|
||||||
if(len<=0) continue;
|
|
||||||
if(strncasecmp(prefix, local_pstn_prefix_des[index],len) == 0)
|
|
||||||
return 1;//local pstn
|
|
||||||
}
|
|
||||||
|
|
||||||
return (index=4);//idd
|
|
||||||
}
|
|
||||||
|
|
||||||
int ocs_get_call_type_by_des(const char *prefix)
|
|
||||||
{
|
|
||||||
int index = 0;
|
|
||||||
//int match_method = ocs_get_crm_prefix_call_type_method();
|
|
||||||
//char configured_des[128];
|
|
||||||
|
|
||||||
index = ocs_get_crm_prefix_call_type_des(prefix);
|
|
||||||
/*
|
|
||||||
for(index=0; index<MAX_CALL_TYPE_DES; index++)
|
|
||||||
{
|
|
||||||
ocs_get_crm_prefix_call_type_des(index, configured_des);
|
|
||||||
if(match_method == 0)
|
|
||||||
{
|
|
||||||
if(strcmp(des, configured_des) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(strstr(des, configured_des) != NULL)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ocs_get_crm_free_seconds()
|
|
||||||
{
|
|
||||||
return ppsParam.serviceControl.crm_free_seconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pps_crm_get_notify_days()
|
|
||||||
{
|
|
||||||
return ppsParam.serviceControl.crm_days_before_validity;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pps_crm_get_status_vd()
|
|
||||||
{
|
|
||||||
return ppsParam.serviceControl.crm_status_validity;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pps_crm_get_sms_notification_for_event_flag()
|
|
||||||
{
|
|
||||||
return ppsParam.serviceControl.crm_notification_for_event;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ocs_get_cellid_present_flag()
|
int ocs_get_cellid_present_flag()
|
||||||
{
|
{
|
||||||
return ppsParam.serviceControl.cellid_present_in_ccr;
|
return ppsParam.serviceControl.cellid_present_in_ccr;
|
||||||
}
|
}
|
||||||
|
|
||||||
+88
-4031
File diff suppressed because it is too large.
Load diff
@@ -845,7 +845,7 @@ int SetPrepaidCardByOMC(u_char oidlen, DWORD *oid, BYTE *pdata, u_short datalen)
|
|||||||
int vallen;//chargeFlag=0;
|
int vallen;//chargeFlag=0;
|
||||||
char buf[1025]={""},workbuf[128]={""};
|
char buf[1025]={""},workbuf[128]={""};
|
||||||
char valbuf[128]="";
|
char valbuf[128]="";
|
||||||
//struct tm tmnow;
|
struct tm tmnow;
|
||||||
long long cardNo;
|
long long cardNo;
|
||||||
int totalLen=0;
|
int totalLen=0;
|
||||||
int loop=0;
|
int loop=0;
|
||||||
@@ -1131,7 +1131,7 @@ int SetPrepaidCardByOMC(u_char oidlen, DWORD *oid, BYTE *pdata, u_short datalen)
|
|||||||
else if(ocode==2 || ocode==3)
|
else if(ocode==2 || ocode==3)
|
||||||
{
|
{
|
||||||
BcdToAscii(buf,pdata2,vallen*2);
|
BcdToAscii(buf,pdata2,vallen*2);
|
||||||
shmp->updated_date = MakeTime(NULL,buf);
|
shmp->updated_date = MakeTime(&tmnow,buf);
|
||||||
|
|
||||||
AsciiTime(buf,shmp->updated_date);
|
AsciiTime(buf,shmp->updated_date);
|
||||||
AsciiToBcd((BYTE *)valbuf,buf,14);
|
AsciiToBcd((BYTE *)valbuf,buf,14);
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ int sendRadiusAccessAccept(u_short portid,BOOL volumeFlag,BOOL durationFlag)
|
|||||||
RADIUS_VENDOR_ATTRIBUTE_3GPP2_PPAQ *ppaq;
|
RADIUS_VENDOR_ATTRIBUTE_3GPP2_PPAQ *ppaq;
|
||||||
DWORD qid=0;
|
DWORD qid=0;
|
||||||
ulong meterUnit;
|
ulong meterUnit;
|
||||||
//PPS_COS_RADIUS_ITEM *radiusItem;
|
PPS_COS_RADIUS_ITEM *radiusItem;
|
||||||
|
|
||||||
|
|
||||||
shmp = (_state_data *)&smshm_ptr->state_data;
|
shmp = (_state_data *)&smshm_ptr->state_data;
|
||||||
@@ -669,7 +669,7 @@ int sendRadiusAccessAccept(u_short portid,BOOL volumeFlag,BOOL durationFlag)
|
|||||||
}
|
}
|
||||||
ppaq->qid.qid.value = qid | (gprsProc->qid & 0xffff);
|
ppaq->qid.qid.value = qid | (gprsProc->qid & 0xffff);
|
||||||
|
|
||||||
//radiusItem = getCosRadiusItem(&shmp->caller_info);
|
radiusItem = getCosRadiusItem(&shmp->caller_info);
|
||||||
|
|
||||||
|
|
||||||
if(volumeFlag == TRUE)
|
if(volumeFlag == TRUE)
|
||||||
|
|||||||
+46
-187
@@ -437,7 +437,7 @@ int ReadDataFromPeerSever()
|
|||||||
|
|
||||||
int snmpResponse(snmp_pdu *pdu, snmp_addr *addr)
|
int snmpResponse(snmp_pdu *pdu, snmp_addr *addr)
|
||||||
{
|
{
|
||||||
//int request_id;//,pdu_type;
|
//int request_id,pdu_type;
|
||||||
int instance,dataType;
|
int instance,dataType;
|
||||||
void *ptr = (void *)ramshm_ptr;
|
void *ptr = (void *)ramshm_ptr;
|
||||||
|
|
||||||
@@ -593,100 +593,34 @@ int LoadDataFromBackfile()
|
|||||||
if(fileinfo.st_size == sizeof(_prepaid_data))
|
if(fileinfo.st_size == sizeof(_prepaid_data))
|
||||||
{ //check length
|
{ //check length
|
||||||
fread(&ramshm_ptr->prepaid_data,sizeof(_prepaid_data),1,fp);
|
fread(&ramshm_ptr->prepaid_data,sizeof(_prepaid_data),1,fp);
|
||||||
}
|
}
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
else if(fileinfo.st_size == sizeof(_prepaid_data_no_bundle_roam))
|
||||||
|
{
|
||||||
|
_prepaid_data_no_bundle_roam *poldDat = (_prepaid_data_no_bundle_roam *)malloc(sizeof(_prepaid_data_no_bundle_roam));
|
||||||
|
fread(poldDat, sizeof(_prepaid_data_no_bundle_roam), 1, fp);
|
||||||
|
memset(&ramshm_ptr->prepaid_data, 0, sizeof(_prepaid_data));
|
||||||
|
int i, j;
|
||||||
|
for (i=0; i<MSISDN_HEAD_NUM; i++)
|
||||||
|
{
|
||||||
|
ramshm_ptr->prepaid_data.msisdn_head[i] = poldDat->msisdn_head[i];
|
||||||
|
for (j=0; j<UNIT_STORE_ACCOUNT; j++)
|
||||||
|
{
|
||||||
|
memcpy(&ramshm_ptr->prepaid_data.prepaid_info[i][j], &poldDat->prepaid_info[i][j], sizeof(_prepaid_info_no_bundle_roam));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(poldDat);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}else
|
||||||
|
return -1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int base_prefix_index = 0;
|
|
||||||
|
|
||||||
int ocs_set_crm_base_prefix_record(char *prefix, char *area, int call_type, int base_prefix_index)
|
|
||||||
{
|
|
||||||
_base_tariff * ptr = &ramshm_ptr->tariff_data.base_tariff[base_prefix_index];
|
|
||||||
|
|
||||||
strcpy(ptr->bill_id, prefix);
|
|
||||||
strcpy(ptr->area, area);
|
|
||||||
ptr->call_type = call_type;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int ocs_get_call_type_by_des(const char *prefix);
|
|
||||||
int ocs_parse_base_prefix(char *data)
|
|
||||||
{
|
|
||||||
const char delimiter[] = ",; ";
|
|
||||||
char buf[1024] = {""},*token;
|
|
||||||
char prefix[64], area[128];
|
|
||||||
int index = 0;
|
|
||||||
int call_type = PPS_CSTA_TYPE_BASE;
|
|
||||||
|
|
||||||
while(index<3)
|
|
||||||
{
|
|
||||||
token = strsep((char **)&(data),delimiter);
|
|
||||||
if(token == NULL )
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy(buf,token);
|
|
||||||
|
|
||||||
switch(index)
|
|
||||||
{
|
|
||||||
case 0x00: //prefix
|
|
||||||
strcpy(prefix, buf);
|
|
||||||
break;
|
|
||||||
case 0x01: //area des
|
|
||||||
strcpy(area, buf);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
index ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
call_type = ocs_get_call_type_by_des(prefix) + PPS_CSTA_TYPE_BASE;
|
|
||||||
|
|
||||||
ocs_set_crm_base_prefix_record(prefix, area, call_type, base_prefix_index);
|
|
||||||
base_prefix_index ++;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void ocs_get_crm_prefix_definition();
|
|
||||||
extern char *ocs_get_crm_prefix_filename(char *ptr);
|
|
||||||
int ocs_read_crm_base_prefix_file()
|
|
||||||
{
|
|
||||||
FILE *fp = NULL;
|
|
||||||
char file_name[128] = {""};
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
ocs_get_crm_prefix_definition();
|
|
||||||
|
|
||||||
ocs_get_crm_prefix_filename(file_name);
|
|
||||||
fp = fopen(file_name,"rb");
|
|
||||||
if(fp == NULL)
|
|
||||||
{
|
|
||||||
printf("can't open file %s\r\n", file_name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
base_prefix_index = 0;
|
|
||||||
while(fgets(buf,1023,fp) !=(char *)0)
|
|
||||||
{
|
|
||||||
if( (int *)strchr(buf,'#') !=NULL) continue;
|
|
||||||
if( !strlen(buf) ) continue;
|
|
||||||
ocs_parse_base_prefix(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ppsBackupRamDataToFile()
|
int ppsBackupRamDataToFile()
|
||||||
{
|
{
|
||||||
static int backupState = 0;
|
static int backupState = 0;
|
||||||
@@ -1248,13 +1182,7 @@ int FindPPSSubsStoreIndex(long long key)
|
|||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
int store_index = 0;
|
int store_index = 0;
|
||||||
|
|
||||||
#ifdef OCS_WITH_CRM
|
|
||||||
store_index = ocs_get_ue_index(key);
|
|
||||||
if(store_index == INVALID_UE_INDEX)
|
|
||||||
store_index = -1;
|
|
||||||
return store_index;
|
|
||||||
#endif
|
|
||||||
index = FindPPSTableIndex(key);
|
index = FindPPSTableIndex(key);
|
||||||
|
|
||||||
|
|
||||||
@@ -1286,19 +1214,7 @@ int GetAccountInfoBySortIndex(int index, char *msisdn)
|
|||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
retval = 1;
|
retval = 1;
|
||||||
#ifdef OCS_WITH_CRM
|
sprintf(msisdn,"%lld",ramshm_ptr->index_data.index_table.prim_index[index].key);
|
||||||
//if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
long long llmsisdn = ocs_get_ue_by_index(index);
|
|
||||||
sprintf(msisdn,"%lld",llmsisdn);
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
sprintf(msisdn,"%lld",ramshm_ptr->index_data.index_table.prim_index[index].key);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1315,7 +1231,6 @@ int GetPPSSubsRecord(char *msisdn, _prepaid_info *shmp)
|
|||||||
if(len<MIN_MSISDN_ALEN || len>MAX_MSISDN_ALEN) return -1;
|
if(len<MIN_MSISDN_ALEN || len>MAX_MSISDN_ALEN) return -1;
|
||||||
|
|
||||||
store_index = FindPPSSubsStoreIndex(atoll(msisdn));
|
store_index = FindPPSSubsStoreIndex(atoll(msisdn));
|
||||||
|
|
||||||
if(store_index<0) return -1;
|
if(store_index<0) return -1;
|
||||||
head = store_index /UNIT_STORE_ACCOUNT;
|
head = store_index /UNIT_STORE_ACCOUNT;
|
||||||
tail = store_index % UNIT_STORE_ACCOUNT;
|
tail = store_index % UNIT_STORE_ACCOUNT;
|
||||||
@@ -1327,7 +1242,6 @@ int GetPPSSubsRecord(char *msisdn, _prepaid_info *shmp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------subs management ----------------*/
|
/*-----------------subs management ----------------*/
|
||||||
extern int ocs_add_ue_record(long long msisdn, int store_index);
|
|
||||||
int CreatePPSSubsIndexTable()
|
int CreatePPSSubsIndexTable()
|
||||||
{
|
{
|
||||||
int loop,len,head,tail,l;
|
int loop,len,head,tail,l;
|
||||||
@@ -1395,15 +1309,7 @@ int CreatePPSSubsIndexTable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
shmp->latch_flag = 0;
|
shmp->latch_flag = 0;
|
||||||
#ifdef OCS_WITH_CRM
|
|
||||||
if(ocs_add_ue_record(atoll(msisdn), loop)==0)
|
|
||||||
{
|
|
||||||
DebugMsg(debugmib.display.asciiOut,
|
|
||||||
"msisdn %s is duplicated, delete!", msisdn);
|
|
||||||
memset(shmp,0,sizeof(_prepaid_info));
|
|
||||||
FreePPSStoreIndex(loop);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if(!AddPPSTableIndex(atoll(msisdn), loop))
|
if(!AddPPSTableIndex(atoll(msisdn), loop))
|
||||||
{
|
{
|
||||||
DebugMsg(debugmib.display.asciiOut,
|
DebugMsg(debugmib.display.asciiOut,
|
||||||
@@ -1412,12 +1318,10 @@ int CreatePPSSubsIndexTable()
|
|||||||
FreePPSStoreIndex(loop);
|
FreePPSStoreIndex(loop);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
user_counter++;
|
user_counter++;
|
||||||
UserNumberIncrement();
|
UserNumberIncrement();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
DebugMsg(debugmib.display.asciiOut,"total user: %d",user_counter);
|
DebugMsg(debugmib.display.asciiOut,"total user: %d",user_counter);
|
||||||
DebugMsg(debugmib.display.asciiOut,"free index: %d",
|
DebugMsg(debugmib.display.asciiOut,"free index: %d",
|
||||||
@@ -1428,8 +1332,7 @@ int CreatePPSSubsIndexTable()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int pps_real_update_user_file(int head, int tail);
|
int pps_real_update_user_file(int head, int tail);
|
||||||
extern int ocs_delete_ue_record(long long msisdn);
|
|
||||||
int AddPPSSubsData(_prepaid_info *shmp)
|
int AddPPSSubsData(_prepaid_info *shmp)
|
||||||
{
|
{
|
||||||
int store_index,head,tail;
|
int store_index,head,tail;
|
||||||
@@ -1448,6 +1351,9 @@ int AddPPSSubsData(_prepaid_info *shmp)
|
|||||||
lmsisdn = atoll(msisdn);
|
lmsisdn = atoll(msisdn);
|
||||||
pdata_shmp = &ramshm_ptr->prepaid_data;
|
pdata_shmp = &ramshm_ptr->prepaid_data;
|
||||||
|
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
RedisUpdateUserInfoFromOcs(shmp);
|
||||||
|
#endif
|
||||||
if(debugmib.measurement.usernumber>0)
|
if(debugmib.measurement.usernumber>0)
|
||||||
{
|
{
|
||||||
store_index = FindPPSSubsStoreIndex(lmsisdn);
|
store_index = FindPPSSubsStoreIndex(lmsisdn);
|
||||||
@@ -1477,20 +1383,13 @@ int AddPPSSubsData(_prepaid_info *shmp)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//DebugMsg(debugmib.display.asciiOut,"Subs. %s does not exist,stored at: %d!\n",msisdn,store_index);
|
//DebugMsg(debugmib.display.asciiOut,"Subs. %s does not exist,stored at: %d!\n",msisdn,store_index);
|
||||||
#ifdef OCS_WITH_CRM
|
|
||||||
if(ocs_add_ue_record(lmsisdn, store_index) == 0)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
if(!AddPPSTableIndex(lmsisdn,store_index))
|
if(!AddPPSTableIndex(lmsisdn,store_index))
|
||||||
{
|
{
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
head = store_index / UNIT_STORE_ACCOUNT;
|
head = store_index / UNIT_STORE_ACCOUNT;
|
||||||
tail = store_index % UNIT_STORE_ACCOUNT;
|
tail = store_index % UNIT_STORE_ACCOUNT;
|
||||||
memcpy(&pdata_shmp->prepaid_info[head][tail],
|
memcpy(&pdata_shmp->prepaid_info[head][tail],
|
||||||
@@ -1520,15 +1419,10 @@ int ModifyPPSSubsData(_prepaid_info *shmp)
|
|||||||
BcdToAscii(msisdn,shmp->msisdn,9*2);
|
BcdToAscii(msisdn,shmp->msisdn,9*2);
|
||||||
msisdn[len] = 0;
|
msisdn[len] = 0;
|
||||||
lmsisdn = atoll(msisdn);
|
lmsisdn = atoll(msisdn);
|
||||||
|
|
||||||
#ifdef OCS_WITH_CRM
|
|
||||||
store_index = ocs_get_ue_index(lmsisdn);
|
|
||||||
|
|
||||||
#else
|
|
||||||
store_index = FindPPSSubsStoreIndex(lmsisdn);
|
store_index = FindPPSSubsStoreIndex(lmsisdn);
|
||||||
#endif
|
|
||||||
|
|
||||||
if(store_index==-1 || store_index == INVALID_UE_INDEX)
|
if(store_index==-1)
|
||||||
{
|
{
|
||||||
//AddPPSSubsData(shmp);
|
//AddPPSSubsData(shmp);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1542,13 +1436,16 @@ int ModifyPPSSubsData(_prepaid_info *shmp)
|
|||||||
sizeof(_prepaid_info));
|
sizeof(_prepaid_info));
|
||||||
|
|
||||||
pps_real_update_user_file(head, tail);
|
pps_real_update_user_file(head, tail);
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
RedisUpdateUserInfoFromOcs(shmp);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DeletePPSSubsData(_prepaid_info *shmp)
|
int DeletePPSSubsData(_prepaid_info *shmp)
|
||||||
{
|
{
|
||||||
int store_index;
|
int index, store_index;
|
||||||
int head, tail;
|
int head, tail;
|
||||||
|
|
||||||
int len=0;
|
int len=0;
|
||||||
@@ -1565,41 +1462,32 @@ int DeletePPSSubsData(_prepaid_info *shmp)
|
|||||||
}
|
}
|
||||||
BcdToAscii(msisdn,shmp->msisdn,9*2);
|
BcdToAscii(msisdn,shmp->msisdn,9*2);
|
||||||
msisdn[len] = 0;
|
msisdn[len] = 0;
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
RedisDelUserInfoByMsisdn(msisdn);
|
||||||
|
#endif
|
||||||
lmsisdn = atoll(msisdn);
|
lmsisdn = atoll(msisdn);
|
||||||
|
|
||||||
#ifdef OCS_WITH_CRM
|
index = FindPPSTableIndex(lmsisdn);
|
||||||
store_index = ocs_get_ue_index(lmsisdn);
|
|
||||||
if(store_index == INVALID_UE_INDEX)
|
|
||||||
{
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"Subs. %s doesn't exist, cann't delete it!\n",msisdn);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ocs_delete_ue_record(lmsisdn);
|
|
||||||
|
|
||||||
DebugMsg(debugmib.display.asciiOut,"Delete subs %s ,stored at: %d!\n",msisdn, store_index);
|
|
||||||
|
|
||||||
#else
|
|
||||||
int index = FindPPSTableIndex(lmsisdn);
|
|
||||||
if(index==-1)
|
if(index==-1)
|
||||||
{
|
{
|
||||||
debugmib.watch_dog[50]++;
|
debugmib.watch_dog[50]++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
store_index = ramshm_ptr->index_data.index_table.prim_index[index].store_index;
|
store_index = ramshm_ptr->index_data.index_table.prim_index[index].store_index;
|
||||||
|
|
||||||
if(store_index==-1)/* never set to -1? , 10-12 */
|
if(store_index==-1)/* never set to -1? , 10-12 */
|
||||||
{
|
{
|
||||||
debugmib.watch_dog[51]++;
|
debugmib.watch_dog[51]++;
|
||||||
DebugMsg(debugmib.display.asciiOut,"Subs. %s doesn't exist, cann't delete it!\n",msisdn);
|
printf("Subs. %s doesn't exist, cann't delete it!\n",msisdn);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
DeletePPSTableIndex(index,store_index);
|
|
||||||
{
|
{
|
||||||
DebugMsg(debugmib.display.asciiOut,"Delete subs %s ,stored at: %d.%d!\n",msisdn,index,store_index);
|
DebugMsg(debugmib.display.asciiOut,"Delete subs %s ,stored at: %d.%d!\n",msisdn,index,store_index);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
DeletePPSTableIndex(index,store_index);
|
||||||
|
|
||||||
pdata_shmp = &ramshm_ptr->prepaid_data;
|
pdata_shmp = &ramshm_ptr->prepaid_data;
|
||||||
|
|
||||||
@@ -1690,7 +1578,6 @@ void ppsListAllSubsMSISDN()
|
|||||||
FILE *fp=NULL;
|
FILE *fp=NULL;
|
||||||
_prepaid_info *shmp;
|
_prepaid_info *shmp;
|
||||||
char msisdn[32];
|
char msisdn[32];
|
||||||
char timebuf[128];
|
|
||||||
|
|
||||||
fp = fopen("/usr/local/subsManage/pps_msisdn.txt","w");
|
fp = fopen("/usr/local/subsManage/pps_msisdn.txt","w");
|
||||||
if(fp==NULL)
|
if(fp==NULL)
|
||||||
@@ -1712,39 +1599,11 @@ void ppsListAllSubsMSISDN()
|
|||||||
}
|
}
|
||||||
BcdToAscii(msisdn,shmp->msisdn,(MAX_MSISDN_BLEN-1)*2);
|
BcdToAscii(msisdn,shmp->msisdn,(MAX_MSISDN_BLEN-1)*2);
|
||||||
msisdn[len] = 0;
|
msisdn[len] = 0;
|
||||||
AsciiTime(timebuf,shmp->mo_expiration_date);
|
fprintf(fp,"%05d %s\n", loop,msisdn);
|
||||||
fprintf(fp,"%05d %s-%d-%s-%.02f\n", loop,msisdn, shmp->status, timebuf, shmp->balance);
|
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ppsAddBalanceToAll(int balance)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
int head,tail,loop;
|
|
||||||
|
|
||||||
_prepaid_info *shmp;
|
|
||||||
//char msisdn[32];
|
|
||||||
|
|
||||||
for(loop=0;loop<MAX_SUBS_RECORD;loop++)
|
|
||||||
{
|
|
||||||
head = loop / UNIT_STORE_ACCOUNT;
|
|
||||||
tail = loop % UNIT_STORE_ACCOUNT;
|
|
||||||
|
|
||||||
if(head>=MSISDN_HEAD_NUM) continue;
|
|
||||||
shmp = &ramshm_ptr->prepaid_data.prepaid_info[head][tail];
|
|
||||||
len = shmp->msisdn[MAX_MSISDN_BLEN-1];
|
|
||||||
|
|
||||||
if(len<2)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
shmp->balance += balance;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*--------- real time write user/card data functions -------*/
|
/*--------- real time write user/card data functions -------*/
|
||||||
/*--------- definitions -------------------------------*/
|
/*--------- definitions -------------------------------*/
|
||||||
|
|||||||
+18
-1642
File diff suppressed because it is too large.
Load diff
+83
-34
@@ -594,14 +594,7 @@ int DecodeDeliverSM(SMPP_MSG *pMsg)
|
|||||||
shmp->process_info.sub_state = 0;
|
shmp->process_info.sub_state = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
{
|
|
||||||
strcpy((char *)shmp->called_info.number, short_message);
|
|
||||||
shmp->process_info.state = S_SMMP_RECHAGE_ACCOUNT;
|
|
||||||
shmp->process_info.sub_state = 2;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pps_get_adaptor_flag())
|
if(pps_get_adaptor_flag())
|
||||||
{
|
{
|
||||||
strcpy((char *)shmp->called_info.number, short_message);
|
strcpy((char *)shmp->called_info.number, short_message);
|
||||||
@@ -677,6 +670,13 @@ int DecodeDeliverSM(SMPP_MSG *pMsg)
|
|||||||
{
|
{
|
||||||
ocs_bundle_plan_query(shmp, short_message, 0, NULL);
|
ocs_bundle_plan_query(shmp, short_message, 0, NULL);
|
||||||
}
|
}
|
||||||
|
else if(action == SRV_TELL_ME_NUMBER)
|
||||||
|
{
|
||||||
|
char ret_str[256];
|
||||||
|
sprintf(ret_str, "%s %s", getSmsSentenceNative(0,SMS_TELL_ME_NUMBER), shmp->caller_info.number);
|
||||||
|
|
||||||
|
smppSendMOSM(shmp->caller_info.number, shmp->called_info.number,ret_str, strlen(ret_str), 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(0)
|
if(0)
|
||||||
@@ -701,14 +701,11 @@ int get_cos_bundle_control(int cos_id)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int subscribe_bundle_plan_send_used_up_info(char *caller_number, SMS_SENTENCE id)
|
int subscribe_bundle_plan_send_used_up_info(char *caller_number, SMS_SENTENCE id, _state_data *shmp)
|
||||||
{
|
{
|
||||||
char sms_msg[256];
|
char sms_msg[256];
|
||||||
char bundle_service_number[32];
|
char bundle_service_number[32];
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case SMS_BUNDLE_PLAN_DATA_USEDUP:
|
case SMS_BUNDLE_PLAN_DATA_USEDUP:
|
||||||
@@ -719,7 +716,33 @@ int subscribe_bundle_plan_send_used_up_info(char *caller_number, SMS_SENTENCE id
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
char bundleName[64] = "";
|
||||||
|
strcpy(bundleName, getSmsSentenceNative(0, SMS_BUNDLE_PLAN_ROAM_AND_NOTROAM));
|
||||||
|
char *found = strchr(bundleName, ';');
|
||||||
|
if (found != NULL)
|
||||||
|
{
|
||||||
|
*found = '\0';
|
||||||
|
if ((shmp == NULL) || (shmp->process_info.bundle_flag == BUNDLE_HOME_PLMN))
|
||||||
|
{
|
||||||
|
found = bundleName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
found ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
found = bundleName;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
sprintf(sms_msg, (char *)getSmsSentenceNative(0, id), found);
|
||||||
|
#else
|
||||||
sprintf(sms_msg, "%s" , getSmsSentenceNative(0, id));
|
sprintf(sms_msg, "%s" , getSmsSentenceNative(0, id));
|
||||||
|
#endif
|
||||||
sprintf(bundle_service_number, "%s",
|
sprintf(bundle_service_number, "%s",
|
||||||
ppsParam.ppsTables.serviceNumber[CreditCardRechargeNumberPosition].number);
|
ppsParam.ppsTables.serviceNumber[CreditCardRechargeNumberPosition].number);
|
||||||
|
|
||||||
@@ -739,16 +762,13 @@ int subscribe_bundle_plan_send_warning_info(_state_data *shmp)
|
|||||||
long ret_value[10], data_warning_threshold = 2, data_warning_threshold_low=1, warning_sms_counter=0;
|
long ret_value[10], data_warning_threshold = 2, data_warning_threshold_low=1, warning_sms_counter=0;
|
||||||
|
|
||||||
int cos_id;
|
int cos_id;
|
||||||
|
|
||||||
if(OCS_with_external_CRM())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
cos_id = GetAccountCosID(&shmp->caller_info);
|
cos_id = GetAccountCosID(&shmp->caller_info);
|
||||||
|
|
||||||
data_warning_threshold = ppsParam.ppsTables.cosTable[cos_id].serviceControl[0].bundle_data_warning_threashold * 5;// COS
|
data_warning_threshold = ppsParam.ppsTables.cosTable[cos_id].serviceControl[0].bundle_data_warning_threashold * 5;// COS
|
||||||
data_warning_threshold_low = ppsParam.ppsTables.cosTable[cos_id].serviceControl[0].bundle_data_warning_threashold_low * 5;// COS
|
data_warning_threshold_low = ppsParam.ppsTables.cosTable[cos_id].serviceControl[0].bundle_data_warning_threashold_low * 5;// COS
|
||||||
|
|
||||||
GetAccountBundlePlanInfo(&shmp->caller_info, ret_value);
|
GetAccountBundlePlanInfo(&shmp->caller_info, ret_value, shmp);
|
||||||
|
|
||||||
warning_sms_counter = ret_value[5];
|
warning_sms_counter = ret_value[5];
|
||||||
if(warning_sms_counter >= 2)// warning_sms_flag, don't send warning SMS, if 2 threshold warning SMS is already sent.
|
if(warning_sms_counter >= 2)// warning_sms_flag, don't send warning SMS, if 2 threshold warning SMS is already sent.
|
||||||
@@ -761,15 +781,47 @@ int subscribe_bundle_plan_send_warning_info(_state_data *shmp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret_value[1] > 0) || (ret_value[3] > 0))
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
char bundleName[64] = "";
|
||||||
|
strcpy(bundleName, getSmsSentenceNative(0, SMS_BUNDLE_PLAN_ROAM_AND_NOTROAM));
|
||||||
|
char *found = strchr(bundleName, ';');
|
||||||
|
if (found != NULL)
|
||||||
{
|
{
|
||||||
sprintf(sms_msg, (char *)getSmsSentenceNative(0, SMS_BUNDLE_PLAN_DATA_WARN_HAS_V),
|
*found = '\0';
|
||||||
ret_value[0], ret_value[1], ret_value[3]);
|
if (shmp->process_info.bundle_flag == BUNDLE_HOME_PLMN)
|
||||||
|
{
|
||||||
|
found = bundleName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
found ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
found = bundleName;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((ret_value[1] > 0) || (ret_value[3] > 0))
|
||||||
|
{
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
sprintf(sms_msg, (char *)getSmsSentenceNative(0, SMS_BUNDLE_PLAN_DATA_WARN_HAS_V),
|
||||||
|
ret_value[0], ret_value[1], ret_value[3], found);
|
||||||
|
#else
|
||||||
|
sprintf(sms_msg, (char *)getSmsSentenceNative(0, SMS_BUNDLE_PLAN_DATA_WARN_HAS_V),
|
||||||
|
ret_value[0], ret_value[1], ret_value[3]);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef HAS_BUNDLE_ROAMING
|
||||||
|
sprintf(sms_msg, (char *)getSmsSentenceNative(0, SMS_BUNDLE_PLAN_DATA_WARN),
|
||||||
|
ret_value[0], found);
|
||||||
|
#else
|
||||||
sprintf(sms_msg, (char *)getSmsSentenceNative(0, SMS_BUNDLE_PLAN_DATA_WARN),
|
sprintf(sms_msg, (char *)getSmsSentenceNative(0, SMS_BUNDLE_PLAN_DATA_WARN),
|
||||||
ret_value[0]);
|
ret_value[0]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(bundle_service_number, "%s",
|
sprintf(bundle_service_number, "%s",
|
||||||
@@ -1052,7 +1104,7 @@ int subscribe_bundle_plan_subs_index(_state_data *shmp, int plan_index, int meth
|
|||||||
|
|
||||||
SendCDR(shmp->process_info.portid);
|
SendCDR(shmp->process_info.portid);
|
||||||
|
|
||||||
GetAccountBundlePlanInfo(&shmp->caller_info, ret_value);
|
GetAccountBundlePlanInfo(&shmp->caller_info, ret_value, shmp);
|
||||||
|
|
||||||
AsciiTimeYMD(expire_date,ret_value[4]);
|
AsciiTimeYMD(expire_date,ret_value[4]);
|
||||||
|
|
||||||
@@ -1122,7 +1174,7 @@ int ocs_bundle_plan_query(_state_data *shmp, char *sms, int method, char *ret_pr
|
|||||||
|
|
||||||
if(1)
|
if(1)
|
||||||
{
|
{
|
||||||
if(GetAccountBundlePlanInfo(&shmp->caller_info, (long *)ret_value))
|
if(GetAccountBundlePlanInfo(&shmp->caller_info, (long *)ret_value, shmp))
|
||||||
{
|
{
|
||||||
AsciiTimeYMD(expire_date,ret_value[4]);
|
AsciiTimeYMD(expire_date,ret_value[4]);
|
||||||
|
|
||||||
@@ -1172,9 +1224,9 @@ int subscribe_bundle_plan(_state_data *shmp, char *sms, int method, char *ret_pr
|
|||||||
char expire_date[64];
|
char expire_date[64];
|
||||||
char sms_msg[256];
|
char sms_msg[256];
|
||||||
int menu_index=1;
|
int menu_index=1;
|
||||||
//int cos_bundle_control=0;
|
int cos_bundle_control=0;
|
||||||
|
|
||||||
//cos_bundle_control = get_cos_bundle_control(shmp->caller_info.cos_id);
|
cos_bundle_control = get_cos_bundle_control(shmp->caller_info.cos_id);
|
||||||
|
|
||||||
sms_len = strlen(sms);
|
sms_len = strlen(sms);
|
||||||
|
|
||||||
@@ -1260,7 +1312,7 @@ int subscribe_bundle_plan(_state_data *shmp, char *sms, int method, char *ret_pr
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
if(GetAccountBundlePlanInfo(&shmp->caller_info, (long *)ret_value))
|
if(GetAccountBundlePlanInfo(&shmp->caller_info, (long *)ret_value, shmp))
|
||||||
{
|
{
|
||||||
AsciiTimeYMD(expire_date,ret_value[4]);
|
AsciiTimeYMD(expire_date,ret_value[4]);
|
||||||
|
|
||||||
@@ -1595,7 +1647,7 @@ int smppSendMOSMReal(SMPP_MSG *sm_msg)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int smppSendMOSM(char *called, char *caller, u_char *msg, int msgLen,u_char dataCoding)
|
int smppSendMOSM(char *caller, char *called, u_char *msg, int msgLen,u_char dataCoding)
|
||||||
{
|
{
|
||||||
static int smpp_sm_ref_id = 0;
|
static int smpp_sm_ref_id = 0;
|
||||||
|
|
||||||
@@ -1618,16 +1670,16 @@ int smppSendMOSM(char *called, char *caller, u_char *msg, int msgLen,u_char data
|
|||||||
sm_msg.pdu.submit_sm.source_addr_ton = 0x00;
|
sm_msg.pdu.submit_sm.source_addr_ton = 0x00;
|
||||||
//Unknown , 1=international, 2=National
|
//Unknown , 1=international, 2=National
|
||||||
sm_msg.pdu.submit_sm.source_addr_npi = 0x01; //ISDN
|
sm_msg.pdu.submit_sm.source_addr_npi = 0x01; //ISDN
|
||||||
strcpy(sm_msg.pdu.submit_sm.source_addr, caller);
|
strcpy(sm_msg.pdu.submit_sm.source_addr, called);
|
||||||
sm_msg.pdu.submit_sm.dest_addr_ton = 0x01; //National
|
sm_msg.pdu.submit_sm.dest_addr_ton = 0x01; //National
|
||||||
sm_msg.pdu.submit_sm.dest_addr_npi = 0x01; //ISDN
|
sm_msg.pdu.submit_sm.dest_addr_npi = 0x01; //ISDN
|
||||||
strcpy(sm_msg.pdu.submit_sm.destination_addr, called);
|
strcpy(sm_msg.pdu.submit_sm.destination_addr, caller);
|
||||||
sm_msg.pdu.submit_sm.esm_class = 0x00;
|
sm_msg.pdu.submit_sm.esm_class = 0x00;
|
||||||
sm_msg.pdu.submit_sm.protocol_id = 0x00;
|
sm_msg.pdu.submit_sm.protocol_id = 0x00;
|
||||||
sm_msg.pdu.submit_sm.priority_flag = 0x03;
|
sm_msg.pdu.submit_sm.priority_flag = 0x03;
|
||||||
memset(sm_msg.pdu.submit_sm.schedule_delivery_time, 0,1);
|
memset(sm_msg.pdu.submit_sm.schedule_delivery_time, 0,1);
|
||||||
memset(sm_msg.pdu.submit_sm.validity_period, 0,1);
|
memset(sm_msg.pdu.submit_sm.validity_period, 0,1);
|
||||||
sm_msg.pdu.submit_sm.registered_delivery = 0x00;//0x11;
|
sm_msg.pdu.submit_sm.registered_delivery = 0x10;//0x11;
|
||||||
sm_msg.pdu.submit_sm.replace_if_present_flag = 0x01;
|
sm_msg.pdu.submit_sm.replace_if_present_flag = 0x01;
|
||||||
sm_msg.pdu.submit_sm.data_coding = dataCoding;
|
sm_msg.pdu.submit_sm.data_coding = dataCoding;
|
||||||
sm_msg.pdu.submit_sm.sm_default_msg_id = 0x01;
|
sm_msg.pdu.submit_sm.sm_default_msg_id = 0x01;
|
||||||
@@ -1859,9 +1911,6 @@ int fillMoneyAndDate(
|
|||||||
}
|
}
|
||||||
memset(buf,0,128);
|
memset(buf,0,128);
|
||||||
totalLen += len;
|
totalLen += len;
|
||||||
#ifdef _ZED_NO_CALLER_NUM_AND_EXPIRY_DATE_
|
|
||||||
return totalLen;
|
|
||||||
#endif
|
|
||||||
if(strlen((char *)getSmsSentenceNative(0,SMS_EXPIRED_ON)) || !(flag&0x80))
|
if(strlen((char *)getSmsSentenceNative(0,SMS_EXPIRED_ON)) || !(flag&0x80))
|
||||||
{
|
{
|
||||||
sprintf(buf,",");
|
sprintf(buf,",");
|
||||||
@@ -1912,11 +1961,11 @@ int smppSendAccountInfo(char *caller, char *called,
|
|||||||
|
|
||||||
char smMsgBuf[MAX_SMS_LEN*8]={0},buf[MAX_SMS_LEN*2]={0};
|
char smMsgBuf[MAX_SMS_LEN*8]={0},buf[MAX_SMS_LEN*2]={0};
|
||||||
u_char daybuf[32]={0},bcd_buf[140];
|
u_char daybuf[32]={0},bcd_buf[140];
|
||||||
int len,totalLen;//instance=0,
|
int instance=0,len,totalLen;
|
||||||
u_char dataCoding=0;
|
u_char dataCoding=0;
|
||||||
int calltype = calltype0;
|
int calltype = calltype0;
|
||||||
|
|
||||||
//instance = (flag & 0x7f)%MAX_LANGUAGE_TYPES;
|
instance = (flag & 0x7f)%MAX_LANGUAGE_TYPES;
|
||||||
//dataCoding = ppsParam.ppsTables.smsSentence[instance].smEncodeType;
|
//dataCoding = ppsParam.ppsTables.smsSentence[instance].smEncodeType;
|
||||||
|
|
||||||
memset(smMsgBuf,0,MAX_SMS_LEN*8);
|
memset(smMsgBuf,0,MAX_SMS_LEN*8);
|
||||||
@@ -2121,7 +2170,7 @@ int GetAccountPromptInfo(_account_info *caller_info,char *prompt_info)
|
|||||||
|
|
||||||
int smppSendActivicationInfo(_account_info *caller_info, char *called)
|
int smppSendActivicationInfo(_account_info *caller_info, char *called)
|
||||||
{
|
{
|
||||||
char account_info[256], msg_send[560], notify_sms[256];
|
char account_info[256], msg_send[512], notify_sms[256];
|
||||||
|
|
||||||
GetAccountPromptInfo(caller_info, account_info);
|
GetAccountPromptInfo(caller_info, account_info);
|
||||||
|
|
||||||
|
|||||||
@@ -148,20 +148,36 @@ double GetBalanceWithPromotionControl(_state_data *stateProc,_account_info *ptr
|
|||||||
|
|
||||||
if (ptr->head < MSISDN_HEAD_NUM && ptr->tail < UNIT_STORE_ACCOUNT)
|
if (ptr->head < MSISDN_HEAD_NUM && ptr->tail < UNIT_STORE_ACCOUNT)
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
OCS_usr_redis usr_redis;
|
||||||
|
RedisGetUserBalance(&shmp->prepaid_info[ptr->head][ptr->tail], &usr_redis);
|
||||||
|
if(usr_redis.usr_balance>=ppsParam.serviceControl.maxBalance)// balance overflow prevetion
|
||||||
|
#else
|
||||||
if(shmp->prepaid_info[ptr->head][ptr->tail].balance>=ppsParam.serviceControl.maxBalance)// balance overflow prevetion
|
if(shmp->prepaid_info[ptr->head][ptr->tail].balance>=ppsParam.serviceControl.maxBalance)// balance overflow prevetion
|
||||||
|
#endif
|
||||||
shmp->prepaid_info[ptr->head][ptr->tail].status = T_SUSPEND;
|
shmp->prepaid_info[ptr->head][ptr->tail].status = T_SUSPEND;
|
||||||
if(shmp->prepaid_info[ptr->head][ptr->tail].msisdn[MAX_MSISDN_BLEN-1]<=2)// msisdn length field
|
if(shmp->prepaid_info[ptr->head][ptr->tail].msisdn[MAX_MSISDN_BLEN-1]<=2)// msisdn length field
|
||||||
return 0;
|
return 0;
|
||||||
if(GetExpiration(ptr) > tvnow.tv_sec)// check validity date
|
if(GetExpiration(ptr) > tvnow.tv_sec)// check validity date
|
||||||
{
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
balance = usr_redis.usr_balance;
|
||||||
|
#else
|
||||||
balance = shmp->prepaid_info[ptr->head][ptr->tail].balance;
|
balance = shmp->prepaid_info[ptr->head][ptr->tail].balance;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pps_print_error(stateProc->process_info.logMsisdn,"[%05d]%s balance validity expired",stateProc->process_info.portid,ptr->number);
|
pps_print_error(stateProc->process_info.logMsisdn,"[%05d]%s balance validity expired",stateProc->process_info.portid,ptr->number);
|
||||||
if(isPromotionCanBeUsedAtThisPoint(stateProc))
|
if(isPromotionCanBeUsedAtThisPoint(stateProc))
|
||||||
{
|
{
|
||||||
if(GetPromotionExpiration(ptr)> tvnow.tv_sec)
|
if(GetPromotionExpiration(ptr)> tvnow.tv_sec)
|
||||||
balance += shmp->prepaid_info[ptr->head][ptr->tail].promo_balance ;
|
{
|
||||||
|
#ifdef OCS_USE_REDIS_DB
|
||||||
|
balance += usr_redis.pro_balance;
|
||||||
|
#else
|
||||||
|
balance += shmp->prepaid_info[ptr->head][ptr->tail].promo_balance;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else
|
else
|
||||||
; //pps_print_error(stateProc->process_info.logMsisdn,"[%05d]%s promotion validity expired",stateProc->process_info.portid,ptr->number);
|
; //pps_print_error(stateProc->process_info.logMsisdn,"[%05d]%s promotion validity expired",stateProc->process_info.portid,ptr->number);
|
||||||
}
|
}
|
||||||
@@ -308,7 +324,7 @@ static void supplementaryServiceChangeBasciFee(_state_data *shmp,_bill_tariff *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getTierIndex(_state_data *shmp,_bill_tariff *ptar,u32 talkTime)
|
static inline int getTierIndex(_state_data *shmp,_bill_tariff *ptar,u32 talkTime)
|
||||||
{
|
{
|
||||||
TIER_RATING *pTierRating;
|
TIER_RATING *pTierRating;
|
||||||
u8 tierNum,tierIndex;
|
u8 tierNum,tierIndex;
|
||||||
@@ -404,7 +420,7 @@ float getCurrentFee(_state_data *shmp)
|
|||||||
return pTierRating->rating[tier].base_fee + pTierRating->rating[tier].long_distance_fee;
|
return pTierRating->rating[tier].base_fee + pTierRating->rating[tier].long_distance_fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BillingFormula(_state_data *shmp,_bill_tariff *ptar,int startTime)
|
inline float BillingFormula(_state_data *shmp,_bill_tariff *ptar,int startTime)
|
||||||
{
|
{
|
||||||
float num=0;
|
float num=0;
|
||||||
u8 index;
|
u8 index;
|
||||||
@@ -448,9 +464,6 @@ float TimeToCharge(_state_data *shmp,_bill_tariff *ptar, int duration,int begin_
|
|||||||
for (i=1; i<=itimes; i++)
|
for (i=1; i<=itimes; i++)
|
||||||
{
|
{
|
||||||
curr_time = begin_time + unit_time * (i - 1);
|
curr_time = begin_time + unit_time * (i - 1);
|
||||||
if(OCS_with_external_CRM())//query tariff from CRM database
|
|
||||||
discount = shmp->process_info.rest_if.tariff_discount;
|
|
||||||
else
|
|
||||||
discount = GetDiscount(curr_time,ptar->discountID);
|
discount = GetDiscount(curr_time,ptar->discountID);
|
||||||
if (i <= ptar->mini_unit && (!init_bill))
|
if (i <= ptar->mini_unit && (!init_bill))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -710,11 +710,11 @@ static long getVasTotalFee(_state_data *shmp,u_char authOrCharge,u_char *failR
|
|||||||
static int vasPreAuth(_state_data *shmp,u_char *failReason)
|
static int vasPreAuth(_state_data *shmp,u_char *failReason)
|
||||||
{
|
{
|
||||||
_gprs_process *vasProc;
|
_gprs_process *vasProc;
|
||||||
//u_short portid;
|
u_short portid;
|
||||||
float balance;
|
float balance;
|
||||||
long totalChargedFee;
|
long totalChargedFee;
|
||||||
|
|
||||||
//portid = shmp->process_info.portid;
|
portid = shmp->process_info.portid;
|
||||||
vasProc = &shmp->process_info.ppsService.gprs_process;
|
vasProc = &shmp->process_info.ppsService.gprs_process;
|
||||||
|
|
||||||
totalChargedFee = getVasTotalFee(shmp,VAS_SELECT_PREAUTH,failReason);
|
totalChargedFee = getVasTotalFee(shmp,VAS_SELECT_PREAUTH,failReason);
|
||||||
@@ -787,12 +787,12 @@ static int vasChargeNow(_state_data *shmp,float fee,u_char *peerAddr)
|
|||||||
|
|
||||||
static int vasCharge(_state_data *shmp,u_char *failReason)
|
static int vasCharge(_state_data *shmp,u_char *failReason)
|
||||||
{
|
{
|
||||||
//_gprs_process *vasProc;
|
_gprs_process *vasProc;
|
||||||
//u_short portid;
|
u_short portid;
|
||||||
long totalChargedFee;
|
long totalChargedFee;
|
||||||
|
|
||||||
//portid = shmp->process_info.portid;
|
portid = shmp->process_info.portid;
|
||||||
//vasProc = &shmp->process_info.ppsService.gprs_process;
|
vasProc = &shmp->process_info.ppsService.gprs_process;
|
||||||
|
|
||||||
totalChargedFee = getVasTotalFee(shmp,VAS_SELECT_CHARGE,failReason);
|
totalChargedFee = getVasTotalFee(shmp,VAS_SELECT_CHARGE,failReason);
|
||||||
switch(totalChargedFee)
|
switch(totalChargedFee)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
create:
|
create:
|
||||||
cp -f ../lib/*.o .
|
cp -f ../lib/*.o .
|
||||||
cp -f ../main/*.o .
|
cp -f ../main/*.o .
|
||||||
ar r libpps.a loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o comfunc.o daemon.o debug.o error.o errorlog.o ppsfun.o iofunc.o ipcfunc.o logfunc.o queuefunc.o signal.o time.o version.o capmsg.o smppapi.o precard.o dailyreport.o rammng.o ppsm.o crd.o ppsmap.o ppsussd.o callingCardMsg.o callingCardState.o tariffApplication.o callMeBack.o freeSMS.o feeTransfer.o masterSlaveCard.o radius.o gprs.o vas.o restapi.o ocs_user_table.o pps_redis.o
|
ar r libpps.a loadtl.o message.o mfunc.o ppsmib.o ppsMibTable.o comfunc.o daemon.o debug.o error.o errorlog.o ppsfun.o iofunc.o ipcfunc.o logfunc.o queuefunc.o signal.o time.o version.o capmsg.o smppapi.o precard.o dailyreport.o rammng.o ppsm.o crd.o ppsmap.o ppsussd.o callingCardMsg.o callingCardState.o tariffApplication.o callMeBack.o freeSMS.o feeTransfer.o masterSlaveCard.o radius.o gprs.o vas.o restapi.o pps_redis.o
|
||||||
# rm -f ../../wxc2app/applib/pps/libpps.a
|
# rm -f ../../wxc2app/applib/pps/libpps.a
|
||||||
# cp -uf libpps.a /home/mnp/wxc2app/applib/pps
|
# cp -uf libpps.a /home/mnp/wxc2app/applib/pps
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
V 170618165451Z 00 unknown /DC=com/DC=example/CN=OCSP Signer for Test Certifying CA
|
V 170618165451Z 00 unknown /DC=com/DC=example/CN=OCSP Signer for Test Certifying CA
|
||||||
V 170618165451Z 01 unknown /DC=com/DC=example/mail=root@example.com/CN=localhost
|
V 170618165451Z 01 unknown /DC=com/DC=example/mail=root@example.com/CN=localhost
|
||||||
@@ -28,7 +28,6 @@ static long gx_start_ts = 0;
|
|||||||
|
|
||||||
static int gx_rec_ccr( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act);
|
static int gx_rec_ccr( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act);
|
||||||
static void gx_rec_cca(void *para, struct msg **msg);
|
static void gx_rec_cca(void *para, struct msg **msg);
|
||||||
_gy_port *gy_get_port_by_cxt_id(char *cxt_id);
|
|
||||||
|
|
||||||
static struct disp_hdl * ccr_cb_hdl = NULL; /* handler for ccr req cb */
|
static struct disp_hdl * ccr_cb_hdl = NULL; /* handler for ccr req cb */
|
||||||
//static struct disp_hdl * cca_cb_hdl = NULL; /* handler for cca req cb */
|
//static struct disp_hdl * cca_cb_hdl = NULL; /* handler for cca req cb */
|
||||||
@@ -187,35 +186,10 @@ static void gy_port_init(_gy_port *gy_port_ptr, int index)
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// start==================================
|
|
||||||
static int print_duplicated_sess_id(const char *cxt_id)
|
|
||||||
{
|
|
||||||
int loop=0;
|
|
||||||
FILE *fpSess=NULL;
|
|
||||||
|
|
||||||
fpSess = fopen("../log/dul_sess_id.txt","a");
|
|
||||||
if(fpSess == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fprintf(fpSess,"now ts=%ld, sess: %s\r\n", ts_sec, cxt_id);
|
|
||||||
|
|
||||||
fclose(fpSess);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gy_assign_port(char *cxt_id)
|
int gy_assign_port(char *cxt_id)
|
||||||
{
|
{
|
||||||
int i, index, retval = INVALID_GY_PORT;
|
int i, index, retval = INVALID_GY_PORT;
|
||||||
_gy_port *gy_port_ptr = NULL;
|
_gy_port *gy_port_ptr = NULL;
|
||||||
|
|
||||||
// check if session id already in use========start
|
|
||||||
gy_port_ptr = gy_get_port_by_cxt_id(cxt_id);
|
|
||||||
if (gy_port_ptr != NULL)
|
|
||||||
{
|
|
||||||
print_duplicated_sess_id(cxt_id);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK_POSIX_DO( pthread_mutex_lock(&gy_port_lock), { ASSERT(0); } );
|
CHECK_POSIX_DO( pthread_mutex_lock(&gy_port_lock), { ASSERT(0); } );
|
||||||
|
|
||||||
@@ -270,7 +244,6 @@ int gy_release_port(unsigned short index)
|
|||||||
if(gy_port_ptr->used_flag)
|
if(gy_port_ptr->used_flag)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&sess_hash_mutx);
|
pthread_mutex_lock(&sess_hash_mutx);
|
||||||
if(g_sess_hash != NULL)
|
|
||||||
g_hash_table_remove(g_sess_hash, gy_port_ptr->context_id);// delete hash index
|
g_hash_table_remove(g_sess_hash, gy_port_ptr->context_id);// delete hash index
|
||||||
pthread_mutex_unlock(&sess_hash_mutx);
|
pthread_mutex_unlock(&sess_hash_mutx);
|
||||||
|
|
||||||
@@ -464,26 +437,24 @@ int free_gx_sm(struct gx_sm_t *sm)
|
|||||||
|
|
||||||
int fd_get_session_id(char *src_buf, char *dst_buf, int flag)
|
int fd_get_session_id(char *src_buf, char *dst_buf, int flag)
|
||||||
{
|
{
|
||||||
//int len;
|
char *first_off, *second_off, *third_off;
|
||||||
|
int len;
|
||||||
|
|
||||||
//second_off = strchr(first_off+1, ';');
|
first_off = strchr(src_buf, ';');
|
||||||
//third_off = strchr(second_off+1, ';');
|
second_off = strchr(first_off+1, ';');
|
||||||
//len = third_off - second_off -1;
|
third_off = strchr(second_off+1, ';');
|
||||||
|
len = third_off - second_off -1;
|
||||||
|
|
||||||
//if(flag == 0)
|
//if(flag == 0)
|
||||||
/*if(0)
|
if(0)
|
||||||
{
|
{
|
||||||
memcpy(dst_buf, second_off+1, len);
|
memcpy(dst_buf, second_off+1, len);
|
||||||
dst_buf[len] = '\0';
|
dst_buf[len] = '\0';
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if(1)
|
if(1)
|
||||||
{
|
{
|
||||||
char *first_off;//, *second_off, *third_off;
|
|
||||||
first_off = strchr(src_buf, ';');
|
|
||||||
strcpy(dst_buf, first_off+1);
|
strcpy(dst_buf, first_off+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,7 +748,7 @@ static int gx_parse_cca( struct msg ** msg)
|
|||||||
|
|
||||||
if(gy_msg.request_type == RT_TERMINATE_REQUEST ||
|
if(gy_msg.request_type == RT_TERMINATE_REQUEST ||
|
||||||
gy_msg.request_type == RT_EVENT_REQUEST ||
|
gy_msg.request_type == RT_EVENT_REQUEST ||
|
||||||
(cca_ptr->result != 2001 && gy_msg.request_type != RT_UPDATE_REQUEST))
|
cca_ptr->result != 2001)
|
||||||
{
|
{
|
||||||
unsigned int gy_port;
|
unsigned int gy_port;
|
||||||
|
|
||||||
@@ -825,8 +796,7 @@ static int gx_parse_ccr( struct msg ** msg, struct gy_msg *gy_ptr)
|
|||||||
memcpy(sess_id, avphdr->avp_value->os.data, avphdr->avp_value->os.len);
|
memcpy(sess_id, avphdr->avp_value->os.data, avphdr->avp_value->os.len);
|
||||||
sess_id[avphdr->avp_value->os.len] = '\0';
|
sess_id[avphdr->avp_value->os.len] = '\0';
|
||||||
//sprintf(sess_id, "%s",avphdr->avp_value->os.data);
|
//sprintf(sess_id, "%s",avphdr->avp_value->os.data);
|
||||||
//fd_get_session_id(sess_id, gy_ptr->cxt_id, 0);
|
fd_get_session_id(sess_id, gy_ptr->cxt_id, 0);
|
||||||
strcpy(gy_ptr->cxt_id, sess_id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1016,6 +986,22 @@ static int gx_parse_ccr( struct msg ** msg, struct gy_msg *gy_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 3GPP-User-Location-Info */
|
||||||
|
struct dict_object *tgpp_user_loc_info = NULL;
|
||||||
|
SEARCH_AVP_("3GPP-User-Location-Info", 10415, &tgpp_user_loc_info);
|
||||||
|
PARSE_GRPAVP_STR(groupedavp_sub, tgpp_user_loc_info, avp, avphdr, "Parse CCR 3GPP-User-Location-Info", avphdr->avp_value->os.data)
|
||||||
|
if(avphdr != NULL )
|
||||||
|
{
|
||||||
|
if(avphdr->avp_value != NULL)
|
||||||
|
{
|
||||||
|
if((avphdr->avp_value->os.data != NULL) && (avphdr->avp_value->os.data[0]==0x82))// TAI and ECGI
|
||||||
|
{
|
||||||
|
memcpy(&gy_ptr->msg_body.ccr.cellid, &avphdr->avp_value->os.data[1], 5);// mcc, mnc and tac
|
||||||
|
gy_ptr->msg_body.ccr.cellid[5] = 0x00;
|
||||||
|
gy_ptr->msg_body.ccr.cellid[6] = avphdr->avp_value->os.data[12];// CellId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1274,7 +1260,8 @@ static int gx_parse_ccr( struct msg ** msg, struct gy_msg *gy_ptr)
|
|||||||
PARSE_AVP_U32(ccr_msg, multiple_services_indicator, avp, avphdr, "Parse CCR Multiple-Services-Indicator", avphdr->avp_value->u32)
|
PARSE_AVP_U32(ccr_msg, multiple_services_indicator, avp, avphdr, "Parse CCR Multiple-Services-Indicator", avphdr->avp_value->u32)
|
||||||
|
|
||||||
/* Multiple-Services-Credit-Control */
|
/* Multiple-Services-Credit-Control */
|
||||||
//gy_ptr->msg_body.ccr.mscc_presented = 0;
|
gy_ptr->msg_body.ccr.mscc_presented = 0;
|
||||||
|
gy_ptr->msg_body.ccr.used_unit = 0;
|
||||||
struct dict_object *multiple_services_credit_control = NULL;
|
struct dict_object *multiple_services_credit_control = NULL;
|
||||||
SEARCH_AVP_("Multiple-Services-Credit-Control", 0, &multiple_services_credit_control);
|
SEARCH_AVP_("Multiple-Services-Credit-Control", 0, &multiple_services_credit_control);
|
||||||
CHECK_FCT( fd_msg_search_avp ( ccr_msg, multiple_services_credit_control, &groupedavp) );
|
CHECK_FCT( fd_msg_search_avp ( ccr_msg, multiple_services_credit_control, &groupedavp) );
|
||||||
@@ -1285,7 +1272,7 @@ static int gx_parse_ccr( struct msg ** msg, struct gy_msg *gy_ptr)
|
|||||||
{
|
{
|
||||||
LOG_N("fj Parse CCR Multiple-Services-Credit-Control");
|
LOG_N("fj Parse CCR Multiple-Services-Credit-Control");
|
||||||
|
|
||||||
//gy_ptr->msg_body.ccr.mscc_presented = 1;
|
gy_ptr->msg_body.ccr.mscc_presented = 1;
|
||||||
/* Requested-Service-Unit */
|
/* Requested-Service-Unit */
|
||||||
struct dict_object *requested_service_unit = NULL;
|
struct dict_object *requested_service_unit = NULL;
|
||||||
SEARCH_AVP_("Requested-Service-Unit", 0, &requested_service_unit);
|
SEARCH_AVP_("Requested-Service-Unit", 0, &requested_service_unit);
|
||||||
@@ -1455,7 +1442,7 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
|||||||
long granted_value = gy_ptr->msg_body.cca.grant_value;
|
long granted_value = gy_ptr->msg_body.cca.grant_value;
|
||||||
int port = gy_ptr->fd_port;
|
int port = gy_ptr->fd_port;
|
||||||
_gy_port *gy_port = NULL;
|
_gy_port *gy_port = NULL;
|
||||||
long valid_time_len = 900;
|
//long valid_time_len = 900;
|
||||||
|
|
||||||
gy_port = gy_get_port_space(port);
|
gy_port = gy_get_port_space(port);
|
||||||
if(gy_port == NULL)
|
if(gy_port == NULL)
|
||||||
@@ -1492,23 +1479,23 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
|||||||
{
|
{
|
||||||
EN_AVP_U32(result_code, gy_ptr->msg_body.cca.result, ans, "fj CCA Result-Code");
|
EN_AVP_U32(result_code, gy_ptr->msg_body.cca.result, ans, "fj CCA Result-Code");
|
||||||
}
|
}
|
||||||
/*else if (gy_ptr->msg_body.ccr.mscc_presented==0)
|
else if (gy_ptr->msg_body.ccr.mscc_presented==0)
|
||||||
{
|
{
|
||||||
int result = gy_ptr->msg_body.cca.result;
|
int result = gy_ptr->msg_body.cca.result;
|
||||||
if (result < 2001)
|
if (result < 2001)
|
||||||
{
|
{
|
||||||
result = 2001;
|
result = 2001;
|
||||||
}
|
}
|
||||||
else if (resutl == 4012)
|
//else if (result == 4012)
|
||||||
{
|
//{
|
||||||
result = 4547;
|
// result = 4547;
|
||||||
}
|
//}
|
||||||
else if (resutl != 2001)
|
else if (result != 2001)
|
||||||
{
|
{
|
||||||
result = 5012;
|
result = 5012;
|
||||||
}
|
}
|
||||||
EN_AVP_U32(result_code, result, ans, "fj CCA Result-Code");
|
EN_AVP_U32(result_code, result, ans, "fj CCA Result-Code");
|
||||||
}*/
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CHECK_FCT_DO( fd_msg_rescode_set( ans, "DIAMETER_SUCCESS", NULL, NULL, 1 ), goto out );
|
CHECK_FCT_DO( fd_msg_rescode_set( ans, "DIAMETER_SUCCESS", NULL, NULL, 1 ), goto out );
|
||||||
@@ -1527,7 +1514,7 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
|||||||
EN_AVP_U32(check_balance_result, gy_ptr->msg_body.cca.check_balance_result, ans, "fj CCA check_balance_result");
|
EN_AVP_U32(check_balance_result, gy_ptr->msg_body.cca.check_balance_result, ans, "fj CCA check_balance_result");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else// if (gy_ptr->msg_body.ccr.mscc_presented)
|
else if(gy_ptr->msg_body.ccr.mscc_presented > 0)
|
||||||
/* Multiple-Services-Credit-Control */
|
/* Multiple-Services-Credit-Control */
|
||||||
{
|
{
|
||||||
CHECK_FCT_DO( fd_msg_avp_new ( multiple_services_credit_control, 0, &grpavp ), goto out );
|
CHECK_FCT_DO( fd_msg_avp_new ( multiple_services_credit_control, 0, &grpavp ), goto out );
|
||||||
@@ -1564,7 +1551,7 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct dict_object *valid_time = NULL;
|
struct dict_object *valid_time = NULL;
|
||||||
EN_GRPAVP_U32("Validity-Time", 0, valid_time, valid_time_len);
|
EN_GRPAVP_U32("Validity-Time", 0, valid_time, gy_ptr->msg_body.cca.validity_time);//valid_time_len);
|
||||||
|
|
||||||
if (gy_ptr->request_type != RT_TERMINATE_REQUEST)
|
if (gy_ptr->request_type != RT_TERMINATE_REQUEST)
|
||||||
{
|
{
|
||||||
@@ -1607,14 +1594,7 @@ int gx_send_cca(_gy_msg *gy_ptr)
|
|||||||
EN_GRPAVP_U32("Volume-Quota-Threshold", 10415, volume_threshold, gy_ptr->msg_body.cca.volume_threshold);
|
EN_GRPAVP_U32("Volume-Quota-Threshold", 10415, volume_threshold, gy_ptr->msg_body.cca.volume_threshold);
|
||||||
|
|
||||||
struct dict_object *quota_hold_time = NULL;
|
struct dict_object *quota_hold_time = NULL;
|
||||||
EN_GRPAVP_U32("Quota-Holding-Time", 10415, quota_hold_time, gy_ptr->msg_body.cca.time_threshold + 10);
|
EN_GRPAVP_U32("Quota-Holding-Time", 10415, quota_hold_time, gy_ptr->msg_body.cca.time_threshold);
|
||||||
|
|
||||||
if(1)
|
|
||||||
{
|
|
||||||
struct dict_object *time_threshold = NULL;
|
|
||||||
EN_GRPAVP_U32("Time-Quota-Threshold", 10415, time_threshold, gy_ptr->msg_body.cca.time_threshold);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_FCT_DO( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, grpavp ), goto out );
|
CHECK_FCT_DO( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, grpavp ), goto out );
|
||||||
@@ -1835,7 +1815,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
gx_stat_increase_send_ccr(msg_ptr->request_type);
|
gx_stat_increase_send_ccr(msg_ptr->request_type);
|
||||||
|
|
||||||
/* Create the request from template */
|
/* Create the request from template */
|
||||||
CHECK_FCT_DO( fd_msg_new( cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out1 );
|
CHECK_FCT_DO( fd_msg_new( cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
|
||||||
|
|
||||||
/* set application id */
|
/* set application id */
|
||||||
{
|
{
|
||||||
@@ -1892,32 +1872,11 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_FIRST_CHILD, avp ), goto out );
|
CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_FIRST_CHILD, avp ), goto out );
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pRealm = g_sh_conf_ext.pi_diamid_realm_peer, *pHost = g_sh_conf_ext.pi_diamid_peer;
|
|
||||||
if ((msg_ptr->service_type == ST_CS_SMS) || (msg_ptr->service_type == ST_CS_VOICE))
|
|
||||||
{
|
|
||||||
GetRoDiamIdPeer(&pRealm, &pHost, (msg_ptr->service_type == ST_CS_SMS)?1:0);
|
|
||||||
}
|
|
||||||
if (pRealm == NULL || pHost == NULL)
|
|
||||||
{
|
|
||||||
LOG_N("fj gx_send_ccr_real, no link available, pRealm[%p], pHost[%p]", pRealm, pHost);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/*if ((msg_ptr->service_type == ST_CS_SMS) && (g_rosms_conf_ext.pi_diamid_realm_peer!=NULL) && (g_rosms_conf_ext.pi_diamid_peer!=NULL))
|
|
||||||
{
|
|
||||||
pRealm = g_rosms_conf_ext.pi_diamid_realm_peer;
|
|
||||||
pHost = g_rosms_conf_ext.pi_diamid_peer;
|
|
||||||
}
|
|
||||||
else if ((msg_ptr->service_type == ST_CS_VOICE) && (g_rovoice_conf_ext.pi_diamid_realm_peer!=NULL) && (g_rovoice_conf_ext.pi_diamid_peer!=NULL))
|
|
||||||
{
|
|
||||||
pRealm = g_rovoice_conf_ext.pi_diamid_realm_peer;
|
|
||||||
pHost = g_rovoice_conf_ext.pi_diamid_peer;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* Destination-Realm */
|
/* Destination-Realm */
|
||||||
EN_AVP_STR(dest_realm, pRealm, req, "fj CCR Destination-Realm Ok");
|
EN_AVP_STR(dest_realm, g_sh_conf_ext.pi_diamid_realm_peer, req, "fj CCR Destination-Realm Ok");
|
||||||
|
|
||||||
/* Destination-Host */
|
/* Destination-Host */
|
||||||
EN_AVP_STR(dest_host, pHost, req, "fj CCR Destination-Host-Ok");
|
EN_AVP_STR(dest_host, g_sh_conf_ext.pi_diamid_peer, req, "fj CCR Destination-Host-Ok");
|
||||||
|
|
||||||
/* Origin-Host & Origin-Realm */
|
/* Origin-Host & Origin-Realm */
|
||||||
CHECK_FCT_DO( fd_msg_add_origin ( req, 0 ), goto out );
|
CHECK_FCT_DO( fd_msg_add_origin ( req, 0 ), goto out );
|
||||||
@@ -1928,14 +1887,12 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
/* Service-Context-ID */
|
/* Service-Context-ID */
|
||||||
if(msg_ptr->service_type == ST_CS_SMS)
|
if(msg_ptr->service_type == ST_CS_SMS)
|
||||||
{
|
{
|
||||||
//EN_AVP_STR(service_cxt_id, "agrandtech_sms@3gpp.org", req, "fj CCR Service-Context-ID Ok");
|
EN_AVP_STR(service_cxt_id, "agrandtech_sms@3gpp.org", req, "fj CCR Service-Context-ID Ok");
|
||||||
EN_AVP_STR(service_cxt_id, fd_g_config->service_context_sms, req, "fj CCR Service-Context-ID Ok");
|
|
||||||
//EN_AVP_STR(route_record, "ocsclient.seagullCTF.org", req , "fj CCR Route-Record OK");
|
//EN_AVP_STR(route_record, "ocsclient.seagullCTF.org", req , "fj CCR Route-Record OK");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//EN_AVP_STR(service_cxt_id, "agrandtech_ro@3gpp.org", req, "fj CCR Service-Context-ID Ok");
|
EN_AVP_STR(service_cxt_id, "agrandtech_ro@3gpp.org", req, "fj CCR Service-Context-ID Ok");
|
||||||
EN_AVP_STR(service_cxt_id, fd_g_config->service_context_voice, req, "fj CCR Service-Context-ID Ok");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CC-Request-Type */
|
/* CC-Request-Type */
|
||||||
@@ -2092,7 +2049,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
struct dict_object *service_specific_info = NULL;
|
struct dict_object *service_specific_info = NULL;
|
||||||
SEARCH_AVP_("Service-Specific-Info", SH_VND_ID, &service_specific_info);
|
SEARCH_AVP_("Service-Specific-Info", SH_VND_ID, &service_specific_info);
|
||||||
CHECK_FCT_DO( fd_msg_avp_new ( service_specific_info, 0, &grpavp_sub2 ), goto out);
|
CHECK_FCT_DO( fd_msg_avp_new ( service_specific_info, 0, &grpavp_sub2 ), goto out);
|
||||||
{ /* 根据需要应用层填入参数 */
|
{ /* ������ҪӦ�ò�������� */
|
||||||
EN_GRPAVP_U32_("Service-Specific-Type", SH_VND_ID, dict_obj_tmp, 6006, grpavp_sub2)
|
EN_GRPAVP_U32_("Service-Specific-Type", SH_VND_ID, dict_obj_tmp, 6006, grpavp_sub2)
|
||||||
EN_GRPAVP_STR("Service-Specific-Data", SH_VND_ID, dict_obj_tmp, msg_ptr->msg_body.ccr.cellid, grpavp_sub2)
|
EN_GRPAVP_STR("Service-Specific-Data", SH_VND_ID, dict_obj_tmp, msg_ptr->msg_body.ccr.cellid, grpavp_sub2)
|
||||||
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
||||||
@@ -2108,7 +2065,6 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
|
|
||||||
EN_GRPAVP_U32_("Node-Functionality", SH_VND_ID, dict_obj_tmp, 6, grpavp_sub1)
|
EN_GRPAVP_U32_("Node-Functionality", SH_VND_ID, dict_obj_tmp, 6, grpavp_sub1)
|
||||||
|
|
||||||
|
|
||||||
if(msg_ptr->msg_body.ccr.cellid_presented == 1)
|
if(msg_ptr->msg_body.ccr.cellid_presented == 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2116,7 +2072,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
struct dict_object *service_specific_info = NULL;
|
struct dict_object *service_specific_info = NULL;
|
||||||
SEARCH_AVP_("Service-Specific-Info", SH_VND_ID, &service_specific_info);
|
SEARCH_AVP_("Service-Specific-Info", SH_VND_ID, &service_specific_info);
|
||||||
CHECK_FCT_DO( fd_msg_avp_new ( service_specific_info, 0, &grpavp_sub2 ), goto out);
|
CHECK_FCT_DO( fd_msg_avp_new ( service_specific_info, 0, &grpavp_sub2 ), goto out);
|
||||||
{ /* 根据需要应用层填入参数 */
|
{ /* ������ҪӦ�ò�������� */
|
||||||
EN_GRPAVP_U32_("Service-Specific-Type", SH_VND_ID, dict_obj_tmp, 6006, grpavp_sub2)
|
EN_GRPAVP_U32_("Service-Specific-Type", SH_VND_ID, dict_obj_tmp, 6006, grpavp_sub2)
|
||||||
EN_GRPAVP_STR("Service-Specific-Data", SH_VND_ID, dict_obj_tmp, msg_ptr->msg_body.ccr.cellid, grpavp_sub2)
|
EN_GRPAVP_STR("Service-Specific-Data", SH_VND_ID, dict_obj_tmp, msg_ptr->msg_body.ccr.cellid, grpavp_sub2)
|
||||||
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
||||||
@@ -2154,7 +2110,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
EN_GRPAVP_STR("Originating-IOI", SH_VND_ID, dict_obj_tmp, fd_g_config->cnf_diamid, grpavp_sub2)
|
EN_GRPAVP_STR("Originating-IOI", SH_VND_ID, dict_obj_tmp, fd_g_config->cnf_diamid, grpavp_sub2)
|
||||||
|
|
||||||
// EN_GRPAVP_STR("Originating-IOI", SH_VND_ID, dict_obj_tmp, "agrandtech_ocs@3gpp.org", grpavp_sub2)
|
// EN_GRPAVP_STR("Originating-IOI", SH_VND_ID, dict_obj_tmp, "agrandtech_ocs@3gpp.org", grpavp_sub2)
|
||||||
EN_GRPAVP_STR("Terminating-IOI", SH_VND_ID, dict_obj_tmp, pHost, grpavp_sub2)
|
EN_GRPAVP_STR("Terminating-IOI", SH_VND_ID, dict_obj_tmp, g_sh_conf_ext.pi_diamid_peer, grpavp_sub2)
|
||||||
|
|
||||||
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
CHECK_FCT_DO( fd_msg_avp_add( grpavp_sub1, MSG_BRW_LAST_CHILD, grpavp_sub2 ), goto out );
|
||||||
}
|
}
|
||||||
@@ -2192,23 +2148,7 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg_ptr->msg_body.ccr.cellid_presented == 1)
|
|
||||||
{
|
|
||||||
if (msg_ptr->msg_body.ccr.cellid[3] == 'F')
|
|
||||||
{
|
|
||||||
char mcc[8]="";
|
|
||||||
strncpy(mcc, msg_ptr->msg_body.ccr.cellid, 3);
|
|
||||||
sprintf(tmp_buf, "3GPP-GERAN;cgi-3gpp=%s%s", mcc, &msg_ptr->msg_body.ccr.cellid[4]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(tmp_buf, "3GPP-GERAN;cgi-3gpp=%s", msg_ptr->msg_body.ccr.cellid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(tmp_buf, "XDSL;'location-info=%s'", phostAddr );
|
sprintf(tmp_buf, "XDSL;'location-info=%s'", phostAddr );
|
||||||
}
|
|
||||||
EN_GRPAVP_STR("Access-Network-Information", SH_VND_ID, dict_obj_tmp, tmp_buf, grpavp_sub1)
|
EN_GRPAVP_STR("Access-Network-Information", SH_VND_ID, dict_obj_tmp, tmp_buf, grpavp_sub1)
|
||||||
|
|
||||||
if(msg_ptr->msg_body.ccr.role_of_node == 2)
|
if(msg_ptr->msg_body.ccr.role_of_node == 2)
|
||||||
@@ -2623,9 +2563,6 @@ int gx_send_ccr_real(struct gx_sm_t **sm , struct dict_object *cmd_r, _gy_msg *m
|
|||||||
CHECK_FCT_DO( fd_msg_send( &req, gx_rec_cca, NULL ), goto out );
|
CHECK_FCT_DO( fd_msg_send( &req, gx_rec_cca, NULL ), goto out );
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if(req != NULL)
|
|
||||||
fd_msg_free(req);
|
|
||||||
out1:
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3231,7 +3168,7 @@ int gx_send_ccr_from_client(struct gy_msg *gy_ptr)
|
|||||||
|
|
||||||
gy_port_ptr->service_type = gy_ptr->request_type;
|
gy_port_ptr->service_type = gy_ptr->request_type;
|
||||||
gy_port_ptr->as_client = 1;
|
gy_port_ptr->as_client = 1;
|
||||||
fd_sess_destroy(&gy_sess[sh_port]);
|
|
||||||
gy_sess[sh_port] = NULL;
|
gy_sess[sh_port] = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3281,17 +3218,7 @@ int gx_release_port_for_timerout(unsigned short pid)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_POSIX_DO( pthread_mutex_lock(&gy_port_lock), { ASSERT(0); } );
|
|
||||||
if(1)
|
|
||||||
{
|
|
||||||
gy_port_init(gy_port, pid);
|
|
||||||
gy_space.used_ports --;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gy_release_port(pid);
|
gy_release_port(pid);
|
||||||
}
|
|
||||||
CHECK_POSIX_DO( pthread_mutex_unlock(&gy_port_lock), { ASSERT(0); } );
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,17 +73,15 @@ static int ta_init_peer_addr(struct peer_info* inf)
|
|||||||
static void peer_free_cb(struct peer_info *died_peer, void *cb_data)
|
static void peer_free_cb(struct peer_info *died_peer, void *cb_data)
|
||||||
{
|
{
|
||||||
LOG_N("peer_free_cb.%p %p", died_peer, cb_data);
|
LOG_N("peer_free_cb.%p %p", died_peer, cb_data);
|
||||||
SH_CONF_S *ptr = (SH_CONF_S *)cb_data;
|
|
||||||
if(NULL == died_peer && MODE_CLI == ta_conf->mode)
|
if(NULL == died_peer && MODE_CLI == ta_conf->mode)
|
||||||
{
|
{
|
||||||
struct peer_info inf;
|
struct peer_info inf;
|
||||||
memset(&inf, 0, sizeof(inf));
|
memset(&inf, 0, sizeof(inf));
|
||||||
inf.pi_diamid = strdup(ptr->pi_diamid_peer);//strdup(g_sh_conf_ext.pi_diamid_peer);
|
inf.pi_diamid = strdup(g_sh_conf_ext.pi_diamid_peer);
|
||||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
inf.config.pic_flags.sec = PI_SEC_NONE;
|
||||||
inf.config.pic_port = ptr->peer_port;
|
|
||||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
||||||
|
|
||||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, ptr));//NULL));
|
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, NULL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static int ta_conf_init(void)
|
static int ta_conf_init(void)
|
||||||
@@ -101,74 +99,14 @@ static int ta_conf_init(void)
|
|||||||
ta_conf->mode = g_sh_conf_ext.mode;
|
ta_conf->mode = g_sh_conf_ext.mode;
|
||||||
/* fj added 20170114. only diameter client connect to peer. In this case, connect to peer when started. */
|
/* fj added 20170114. only diameter client connect to peer. In this case, connect to peer when started. */
|
||||||
if(MODE_CLI == ta_conf->mode)
|
if(MODE_CLI == ta_conf->mode)
|
||||||
{
|
|
||||||
if (g_sh_conf_ext.pi_diamid_peer != NULL)
|
|
||||||
{
|
{
|
||||||
struct peer_info inf;
|
struct peer_info inf;
|
||||||
memset(&inf, 0, sizeof(inf));
|
memset(&inf, 0, sizeof(inf));
|
||||||
inf.pi_diamid = strdup(g_sh_conf_ext.pi_diamid_peer);
|
inf.pi_diamid = strdup(g_sh_conf_ext.pi_diamid_peer);
|
||||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
inf.config.pic_flags.sec = PI_SEC_NONE;
|
||||||
inf.config.pic_port = g_sh_conf_ext.peer_port;
|
|
||||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
|
||||||
|
|
||||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, &g_sh_conf_ext));
|
|
||||||
}
|
|
||||||
|
|
||||||
int i=0;
|
|
||||||
SH_CONF_S *pcfg = NULL;
|
|
||||||
for (i=0; i<rolkset.smslknum; i++)
|
|
||||||
{
|
|
||||||
pcfg = &rolkset.smslk[i].cfg;
|
|
||||||
if (pcfg->pi_diamid_peer != NULL)
|
|
||||||
{
|
|
||||||
struct peer_info inf;
|
|
||||||
memset(&inf, 0, sizeof(inf));
|
|
||||||
inf.pi_diamid = strdup(pcfg->pi_diamid_peer);
|
|
||||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
|
||||||
inf.config.pic_port = pcfg->peer_port;
|
|
||||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
||||||
|
|
||||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, pcfg));
|
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, NULL));
|
||||||
}
|
|
||||||
}
|
|
||||||
for (i=0; i<rolkset.voicelknum; i++)
|
|
||||||
{
|
|
||||||
pcfg = &rolkset.voicelk[i].cfg;
|
|
||||||
if (pcfg->pi_diamid_peer != NULL)
|
|
||||||
{
|
|
||||||
struct peer_info inf;
|
|
||||||
memset(&inf, 0, sizeof(inf));
|
|
||||||
inf.pi_diamid = strdup(pcfg->pi_diamid_peer);
|
|
||||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
|
||||||
inf.config.pic_port = pcfg->peer_port;
|
|
||||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
|
||||||
|
|
||||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, pcfg));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*if (g_rosms_conf_ext.pi_diamid_peer != NULL)
|
|
||||||
{
|
|
||||||
struct peer_info inf;
|
|
||||||
memset(&inf, 0, sizeof(inf));
|
|
||||||
inf.pi_diamid = strdup(g_rosms_conf_ext.pi_diamid_peer);
|
|
||||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
|
||||||
inf.config.pic_port = g_rosms_conf_ext.peer_port;
|
|
||||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
|
||||||
|
|
||||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, &g_rosms_conf_ext));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_rovoice_conf_ext.pi_diamid_peer != NULL)
|
|
||||||
{
|
|
||||||
struct peer_info inf;
|
|
||||||
memset(&inf, 0, sizeof(inf));
|
|
||||||
inf.pi_diamid = strdup(g_rovoice_conf_ext.pi_diamid_peer);
|
|
||||||
inf.config.pic_flags.sec = PI_SEC_NONE;
|
|
||||||
inf.config.pic_port = g_rovoice_conf_ext.peer_port;
|
|
||||||
// ta_init_peer_addr( (struct peer_info*)(&inf.pi_endpoints) );
|
|
||||||
|
|
||||||
ASSERT( 0 == fd_peer_add(&inf, __FILE__, peer_free_cb, &g_rovoice_conf_ext));
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ta_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
|
ta_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
{ \
|
{ \
|
||||||
SEARCH_AVP_(udr_search_name, vendor_id, &udr); \
|
SEARCH_AVP_(udr_search_name, vendor_id, &udr); \
|
||||||
CHECK_FCT_DO( fd_msg_avp_new ( udr, 0, &avp ), goto out ); \
|
CHECK_FCT_DO( fd_msg_avp_new ( udr, 0, &avp ), goto out ); \
|
||||||
val.os.data = (uint8_t*)(str); \
|
val.os.data = (uint8_t*)strdup(str); \
|
||||||
val.os.len = strlen(str); \
|
val.os.len = strlen(str); \
|
||||||
CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); \
|
CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); \
|
||||||
CHECK_FCT_DO( fd_msg_avp_add( grpavp, MSG_BRW_LAST_CHILD, avp ), goto out ); \
|
CHECK_FCT_DO( fd_msg_avp_add( grpavp, MSG_BRW_LAST_CHILD, avp ), goto out ); \
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
{ \
|
{ \
|
||||||
SEARCH_AVP_(udr_search_name, vendor_id, &udr); \
|
SEARCH_AVP_(udr_search_name, vendor_id, &udr); \
|
||||||
CHECK_FCT_DO( fd_msg_avp_new ( udr, 0, &avp ), goto out ); \
|
CHECK_FCT_DO( fd_msg_avp_new ( udr, 0, &avp ), goto out ); \
|
||||||
val.os.data = (uint8_t*)(str); \
|
val.os.data = (uint8_t*)malloc(str_len); \
|
||||||
memcpy(val.os.data, str, str_len);\
|
memcpy(val.os.data, str, str_len);\
|
||||||
val.os.len = str_len; \
|
val.os.len = str_len; \
|
||||||
CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); \
|
CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); \
|
||||||
|
|||||||
@@ -1,131 +1,7 @@
|
|||||||
#include "sh_conf.h"
|
#include "sh_conf.h"
|
||||||
|
|
||||||
Ro_LinkSet rolkset={0,0};
|
|
||||||
|
|
||||||
int GetRoDiamIdPeer(DiamId_t **realm, DiamId_t **host, int bSms)
|
|
||||||
{
|
|
||||||
struct peer_hdr*peer = NULL;
|
|
||||||
SH_CONF_S *pcfg = NULL;
|
|
||||||
int i;
|
|
||||||
int ret = -1;
|
|
||||||
int peer_state = -1;
|
|
||||||
if (bSms)
|
|
||||||
{
|
|
||||||
int curlk = rolkset.cursmslk;
|
|
||||||
for (i=0; i<rolkset.smslknum; i++)
|
|
||||||
{
|
|
||||||
curlk = (curlk + i +1) % rolkset.smslknum;
|
|
||||||
pcfg = &rolkset.smslk[curlk].cfg;
|
|
||||||
if (pcfg->pi_diamid_peer != NULL)
|
|
||||||
{
|
|
||||||
ret = fd_peer_getbyid(pcfg->pi_diamid_peer, strlen(pcfg->pi_diamid_peer), 0, &peer);
|
|
||||||
if( !ret && peer )
|
|
||||||
{
|
|
||||||
peer_state = fd_peer_get_state(peer);
|
|
||||||
if( STATE_OPEN == peer_state )
|
|
||||||
{
|
|
||||||
if (rolkset.smslk[curlk].bconn == 0)
|
|
||||||
{
|
|
||||||
printf("diam peer disconn to conn, host[%s]\r\n", pcfg->pi_diamid_peer);
|
|
||||||
rolkset.smslk[curlk].bconn = 1;
|
|
||||||
}
|
|
||||||
*realm = pcfg->pi_diamid_realm_peer;
|
|
||||||
*host = pcfg->pi_diamid_peer;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rolkset.smslk[curlk].bconn == 1)
|
|
||||||
{
|
|
||||||
printf("diam peer conn to discon, host[%s]\r\n", pcfg->pi_diamid_peer);
|
|
||||||
rolkset.smslk[curlk].bconn = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("diam peer NA, host[%s], ret[%d], peer[%p]\r\n", pcfg->pi_diamid_peer, ret, peer);
|
|
||||||
rolkset.smslk[curlk].bconn = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int curlk = rolkset.curvoicelk;
|
|
||||||
for (i=0; i<rolkset.voicelknum; i++)
|
|
||||||
{
|
|
||||||
curlk = (curlk + i +1) % rolkset.voicelknum;
|
|
||||||
pcfg = &rolkset.voicelk[curlk].cfg;
|
|
||||||
if (pcfg->pi_diamid_peer != NULL)
|
|
||||||
{
|
|
||||||
ret = fd_peer_getbyid(pcfg->pi_diamid_peer, strlen(pcfg->pi_diamid_peer), 0, &peer);
|
|
||||||
if( !ret && peer )
|
|
||||||
{
|
|
||||||
peer_state = fd_peer_get_state(peer);
|
|
||||||
if( STATE_OPEN == peer_state )
|
|
||||||
{
|
|
||||||
if (rolkset.voicelk[curlk].bconn == 0)
|
|
||||||
{
|
|
||||||
printf("diam peer disconn to conn, host[%s]\r\n", pcfg->pi_diamid_peer);
|
|
||||||
rolkset.voicelk[curlk].bconn = 1;
|
|
||||||
}
|
|
||||||
*realm = pcfg->pi_diamid_realm_peer;
|
|
||||||
*host = pcfg->pi_diamid_peer;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rolkset.voicelk[curlk].bconn == 1)
|
|
||||||
{
|
|
||||||
printf("diam peer conn to discon, host[%s]\r\n", pcfg->pi_diamid_peer);
|
|
||||||
rolkset.voicelk[curlk].bconn = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("diam peer NA, host[%s], ret[%d], peer[%p]\r\n", pcfg->pi_diamid_peer, ret, peer);
|
|
||||||
rolkset.voicelk[curlk].bconn = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AddRoLink(SH_CONF_S *cfg, uint16_t port, int bSms)
|
|
||||||
{
|
|
||||||
if (bSms)
|
|
||||||
{
|
|
||||||
if(rolkset.smslknum >= MaxRoLinkNum)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rolkset.smslk[rolkset.smslknum].cfg.pi_diamid_peer = strdup(cfg->pi_diamid_peer);
|
|
||||||
rolkset.smslk[rolkset.smslknum].cfg.pi_diamid_realm_peer = strdup(cfg->pi_diamid_realm_peer);
|
|
||||||
rolkset.smslk[rolkset.smslknum].cfg.peer_port = port;
|
|
||||||
rolkset.smslknum++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(rolkset.voicelknum >= MaxRoLinkNum)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rolkset.voicelk[rolkset.voicelknum].cfg.pi_diamid_peer = strdup(cfg->pi_diamid_peer);
|
|
||||||
rolkset.voicelk[rolkset.voicelknum].cfg.pi_diamid_realm_peer = strdup(cfg->pi_diamid_realm_peer);
|
|
||||||
rolkset.voicelk[rolkset.voicelknum].cfg.peer_port = port;
|
|
||||||
rolkset.voicelknum++;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SH_CONF_S g_sh_conf_ext;
|
SH_CONF_S g_sh_conf_ext;
|
||||||
//SH_CONF_S g_rovoice_conf_ext;
|
|
||||||
//SH_CONF_S g_rosms_conf_ext;
|
|
||||||
|
|
||||||
#define SH_PARSE_BUFFER_LEN 1024
|
#define SH_PARSE_BUFFER_LEN 1024
|
||||||
|
|
||||||
@@ -143,7 +19,7 @@ static char* shParseStr_(char* buffer, char* _key, char *ret_str, int flag_from_
|
|||||||
if(NULL != pos_2)
|
if(NULL != pos_2)
|
||||||
{
|
{
|
||||||
memcpy(ret_str, pos_1 + 1, pos_2 - pos_1 - 1);
|
memcpy(ret_str, pos_1 + 1, pos_2 - pos_1 - 1);
|
||||||
ret_str[pos_2 - pos_1] = '\0';
|
ret_str[pos_1 - pos_2] = '\0';
|
||||||
// fprintf(stderr, "%s=%s\n", _key, ret_str);
|
// fprintf(stderr, "%s=%s\n", _key, ret_str);
|
||||||
return ret_str;
|
return ret_str;
|
||||||
}
|
}
|
||||||
@@ -226,10 +102,6 @@ int shParse_(struct fd_config * conf)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf->ro_voiceport = 29100;
|
|
||||||
conf->ro_smsport = 19500;
|
|
||||||
strcpy(conf->service_context_voice, "agrandtech_ro@3gpp.org");
|
|
||||||
strcpy(conf->service_context_sms, "agrandtech_sms@3gpp.org");
|
|
||||||
/* Copy process */
|
/* Copy process */
|
||||||
while((fgets(buffer, SH_PARSE_BUFFER_LEN, fd)) != NULL)
|
while((fgets(buffer, SH_PARSE_BUFFER_LEN, fd)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -247,18 +119,6 @@ int shParse_(struct fd_config * conf)
|
|||||||
|
|
||||||
memset( ret_str, 0, strlen(ret_str) );
|
memset( ret_str, 0, strlen(ret_str) );
|
||||||
}
|
}
|
||||||
if( shParseStr(buffer, "ServiceCxtRoVoice", ret_str) )
|
|
||||||
{
|
|
||||||
strcpy(conf->service_context_voice, ret_str);
|
|
||||||
memset( ret_str, 0, strlen(ret_str) );
|
|
||||||
}
|
|
||||||
if( shParseStr(buffer, "ServiceCxtRoSms", ret_str) )
|
|
||||||
{
|
|
||||||
strcpy(conf->service_context_sms, ret_str);
|
|
||||||
memset( ret_str, 0, strlen(ret_str) );
|
|
||||||
}
|
|
||||||
shParseInt(buffer, "RoVoicePort", &conf->ro_voiceport);
|
|
||||||
shParseInt(buffer, "RoSmsPort", &conf->ro_smsport);
|
|
||||||
shParseInt(buffer, "Port", &conf->cnf_port);
|
shParseInt(buffer, "Port", &conf->cnf_port);
|
||||||
shParseInt(buffer, "SecPort", &conf->cnf_port_tls);
|
shParseInt(buffer, "SecPort", &conf->cnf_port_tls);
|
||||||
shParseInt(buffer, "SCTPStr", &conf->cnf_sctp_str);
|
shParseInt(buffer, "SCTPStr", &conf->cnf_sctp_str);
|
||||||
@@ -329,29 +189,6 @@ int shParseExt(struct fd_config * conf)
|
|||||||
g_sh_conf_ext.pi_diamid_realm_peer = strdup(ret_str);
|
g_sh_conf_ext.pi_diamid_realm_peer = strdup(ret_str);
|
||||||
memset( ret_str, 0, strlen(ret_str) );
|
memset( ret_str, 0, strlen(ret_str) );
|
||||||
}
|
}
|
||||||
g_sh_conf_ext.peer_port = fd_g_config->cnf_port;
|
|
||||||
if( shParseFlags(buffer, "ConnectPeer", "Ro_SMS") )
|
|
||||||
{
|
|
||||||
//g_rosms_conf_ext.pi_diamid_peer = strdup(g_sh_conf_ext.pi_diamid_peer);
|
|
||||||
//g_rosms_conf_ext.pi_diamid_realm_peer = strdup(g_sh_conf_ext.pi_diamid_realm_peer);
|
|
||||||
//g_rosms_conf_ext.peer_port = fd_g_config->ro_smsport;
|
|
||||||
AddRoLink(&g_sh_conf_ext, fd_g_config->ro_smsport, 1);
|
|
||||||
free(g_sh_conf_ext.pi_diamid_peer);
|
|
||||||
g_sh_conf_ext.pi_diamid_peer = NULL;
|
|
||||||
free(g_sh_conf_ext.pi_diamid_realm_peer);
|
|
||||||
g_sh_conf_ext.pi_diamid_realm_peer = NULL;
|
|
||||||
}
|
|
||||||
if( shParseFlags(buffer, "ConnectPeer", "Ro_VOICE") )
|
|
||||||
{
|
|
||||||
//g_rovoice_conf_ext.pi_diamid_peer = strdup(g_sh_conf_ext.pi_diamid_peer);
|
|
||||||
//g_rovoice_conf_ext.pi_diamid_realm_peer = strdup(g_sh_conf_ext.pi_diamid_realm_peer);
|
|
||||||
//g_rovoice_conf_ext.peer_port = fd_g_config->ro_voiceport;
|
|
||||||
AddRoLink(&g_sh_conf_ext, fd_g_config->ro_voiceport, 0);
|
|
||||||
free(g_sh_conf_ext.pi_diamid_peer);
|
|
||||||
g_sh_conf_ext.pi_diamid_peer = NULL;
|
|
||||||
free(g_sh_conf_ext.pi_diamid_realm_peer);
|
|
||||||
g_sh_conf_ext.pi_diamid_realm_peer = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,36 +13,12 @@ typedef struct _SH_CONF_S
|
|||||||
int mode;
|
int mode;
|
||||||
DiamId_t pi_diamid_peer;
|
DiamId_t pi_diamid_peer;
|
||||||
DiamId_t pi_diamid_realm_peer;
|
DiamId_t pi_diamid_realm_peer;
|
||||||
uint16_t peer_port;
|
|
||||||
}SH_CONF_S;
|
}SH_CONF_S;
|
||||||
|
|
||||||
|
|
||||||
extern SH_CONF_S g_sh_conf_ext;
|
extern SH_CONF_S g_sh_conf_ext;
|
||||||
|
|
||||||
// Ro link from scp to ocs===============================
|
|
||||||
typedef struct _Ro_Link_S
|
|
||||||
{
|
|
||||||
int bconn;
|
|
||||||
SH_CONF_S cfg;
|
|
||||||
}Ro_Link_S;
|
|
||||||
|
|
||||||
#define MaxRoLinkNum 4
|
|
||||||
typedef struct _Ro_LinkSet
|
|
||||||
{
|
|
||||||
int smslknum;
|
|
||||||
int voicelknum;
|
|
||||||
int cursmslk;
|
|
||||||
int curvoicelk;
|
|
||||||
|
|
||||||
Ro_Link_S smslk[MaxRoLinkNum];
|
|
||||||
Ro_Link_S voicelk[MaxRoLinkNum];
|
|
||||||
}Ro_LinkSet;
|
|
||||||
extern Ro_LinkSet rolkset;
|
|
||||||
//
|
|
||||||
|
|
||||||
//extern SH_CONF_S g_rosms_conf_ext;
|
|
||||||
//extern SH_CONF_S g_rovoice_conf_ext;
|
|
||||||
|
|
||||||
int shParse(struct fd_config * conf);
|
int shParse(struct fd_config * conf);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __SH_CONF_H__ */
|
#endif /* __SH_CONF_H__ */
|
||||||
@@ -1067,7 +1067,7 @@ int sh_dict_def_cmd_udr()
|
|||||||
/* User-Data-Request (UDR) Command */
|
/* User-Data-Request (UDR) Command */
|
||||||
/*
|
/*
|
||||||
The User-Data-Request (UDR) command, indicated by the Com
|
The User-Data-Request (UDR) command, indicated by the Com
|
||||||
mand-Code field set to 306 and the ‘R?bit set in the
|
mand-Code field set to 306 and the �R� bit set in the
|
||||||
Command Flags field, is sent by a Diameter client to a Diameter server in order to request user data.
|
Command Flags field, is sent by a Diameter client to a Diameter server in order to request user data.
|
||||||
Message Format:
|
Message Format:
|
||||||
|
|
||||||
@@ -1151,7 +1151,7 @@ int sh_dict_def_cmd_uda()
|
|||||||
{
|
{
|
||||||
/* User-Data-Answer (UDA) Command */
|
/* User-Data-Answer (UDA) Command */
|
||||||
/*
|
/*
|
||||||
The User-Data-Answer (UDA) command, indicated by the Command-Code field set to 306 and the ‘R?bit cleared in
|
The User-Data-Answer (UDA) command, indicated by the Command-Code field set to 306 and the �R� bit cleared in
|
||||||
the Command Flags field, is sent by a server in response to the User-Data-Request command. The Experimental-Result
|
the Command Flags field, is sent by a server in response to the User-Data-Request command. The Experimental-Result
|
||||||
AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
||||||
Message Format:
|
Message Format:
|
||||||
@@ -1209,7 +1209,7 @@ int sh_dict_def_cmd_pur()
|
|||||||
{
|
{
|
||||||
/* Profile-Update-Request (PUR) Command */
|
/* Profile-Update-Request (PUR) Command */
|
||||||
/*
|
/*
|
||||||
The Profile-Update-Request (PUR) command, indicated by the Command-Code field set to 307 and the ‘R?bit set in
|
The Profile-Update-Request (PUR) command, indicated by the Command-Code field set to 307 and the �R� bit set in
|
||||||
the Command Flags field, is sent by a Diameter client to a Diameter server in order to update user data in the server.
|
the Command Flags field, is sent by a Diameter client to a Diameter server in order to update user data in the server.
|
||||||
Message Format:
|
Message Format:
|
||||||
|
|
||||||
@@ -1270,7 +1270,7 @@ int sh_dict_def_cmd_pua()
|
|||||||
{
|
{
|
||||||
/* Profile-Update-Answer (PUA) Command */
|
/* Profile-Update-Answer (PUA) Command */
|
||||||
/*
|
/*
|
||||||
The Profile-Update-Answer (PUA) command, indicated by the Command-Code field set to 307 and the ‘R?bit cleared
|
The Profile-Update-Answer (PUA) command, indicated by the Command-Code field set to 307 and the �R� bit cleared
|
||||||
in the Command Flags field, is sent by a server in response to the Profile-Update-Request command. The Experimental-
|
in the Command Flags field, is sent by a server in response to the Profile-Update-Request command. The Experimental-
|
||||||
Result AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
Result AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
||||||
Message Format:
|
Message Format:
|
||||||
@@ -4411,7 +4411,7 @@ int sh_dict_init_bak(char * conffile)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Error: Editor’s Note: The code for DRMP AVP is to be updated when it is available within the draft-ietf-dime-drmp-02 [13]. */
|
/* Error: Editor�s Note: The code for DRMP AVP is to be updated when it is available within the draft-ietf-dime-drmp-02 [13]. */
|
||||||
/* DRMP AVP */
|
/* DRMP AVP */
|
||||||
{
|
{
|
||||||
struct dict_avp_data data = {
|
struct dict_avp_data data = {
|
||||||
@@ -4460,7 +4460,7 @@ int sh_dict_init_bak(char * conffile)
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The User-Data-Request (UDR) command, indicated by the Com
|
The User-Data-Request (UDR) command, indicated by the Com
|
||||||
mand-Code field set to 306 and the ‘R?bit set in the
|
mand-Code field set to 306 and the �R� bit set in the
|
||||||
Command Flags field, is sent by a Diameter client to a Diameter server in order to request user data.
|
Command Flags field, is sent by a Diameter client to a Diameter server in order to request user data.
|
||||||
Message Format:
|
Message Format:
|
||||||
|
|
||||||
@@ -4542,7 +4542,7 @@ int sh_dict_init_bak(char * conffile)
|
|||||||
/* User-Data-Answer (UDA) Command */
|
/* User-Data-Answer (UDA) Command */
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The User-Data-Answer (UDA) command, indicated by the Command-Code field set to 306 and the ‘R?bit cleared in
|
The User-Data-Answer (UDA) command, indicated by the Command-Code field set to 306 and the �R� bit cleared in
|
||||||
the Command Flags field, is sent by a server in response to the User-Data-Request command. The Experimental-Result
|
the Command Flags field, is sent by a server in response to the User-Data-Request command. The Experimental-Result
|
||||||
AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
||||||
Message Format:
|
Message Format:
|
||||||
@@ -4598,7 +4598,7 @@ int sh_dict_init_bak(char * conffile)
|
|||||||
/* Profile-Update-Request (PUR) Command */
|
/* Profile-Update-Request (PUR) Command */
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The Profile-Update-Request (PUR) command, indicated by the Command-Code field set to 307 and the ‘R?bit set in
|
The Profile-Update-Request (PUR) command, indicated by the Command-Code field set to 307 and the �R� bit set in
|
||||||
the Command Flags field, is sent by a Diameter client to a Diameter server in order to update user data in the server.
|
the Command Flags field, is sent by a Diameter client to a Diameter server in order to update user data in the server.
|
||||||
Message Format:
|
Message Format:
|
||||||
|
|
||||||
@@ -4657,7 +4657,7 @@ int sh_dict_init_bak(char * conffile)
|
|||||||
/* Profile-Update-Answer (PUA) Command */
|
/* Profile-Update-Answer (PUA) Command */
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The Profile-Update-Answer (PUA) command, indicated by the Command-Code field set to 307 and the ‘R?bit cleared
|
The Profile-Update-Answer (PUA) command, indicated by the Command-Code field set to 307 and the �R� bit cleared
|
||||||
in the Command Flags field, is sent by a server in response to the Profile-Update-Request command. The Experimental-
|
in the Command Flags field, is sent by a server in response to the Profile-Update-Request command. The Experimental-
|
||||||
Result AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
Result AVP may contain one of the values defined in section 6.2 or in 3GPP TS 29.229 [6].
|
||||||
Message Format:
|
Message Format:
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ extern "C" {
|
|||||||
/* #undef ERRORS_ON_TODO */
|
/* #undef ERRORS_ON_TODO */
|
||||||
/* #undef DEBUG */
|
/* #undef DEBUG */
|
||||||
|
|
||||||
#define FD_PROJECT_BINARY "agtocs"
|
#define FD_PROJECT_BINARY "freeDiameterd"
|
||||||
//#define FD_PROJECT_NAME "freeDiameter"
|
//#define FD_PROJECT_NAME "freeDiameter"
|
||||||
#define FD_PROJECT_NAME "AGT_OCS"
|
#define FD_PROJECT_NAME "AGT_OCS"
|
||||||
|
|
||||||
|
|||||||
@@ -127,10 +127,6 @@ struct fd_config {
|
|||||||
unsigned int cnf_timer_tc; /* The value in seconds of the default Tc timer */
|
unsigned int cnf_timer_tc; /* The value in seconds of the default Tc timer */
|
||||||
unsigned int cnf_timer_tw; /* The value in seconds of the default Tw timer */
|
unsigned int cnf_timer_tw; /* The value in seconds of the default Tw timer */
|
||||||
|
|
||||||
char service_context_voice[128];
|
|
||||||
char service_context_sms[128];
|
|
||||||
uint16_t ro_voiceport;// yaxin
|
|
||||||
uint16_t ro_smsport;// yaxin
|
|
||||||
uint16_t cnf_port; /* the local port for legacy Diameter (default: 3868) in host byte order */
|
uint16_t cnf_port; /* the local port for legacy Diameter (default: 3868) in host byte order */
|
||||||
uint16_t cnf_port_tls; /* the local port for Diameter/TLS (default: 5868) in host byte order */
|
uint16_t cnf_port_tls; /* the local port for Diameter/TLS (default: 5868) in host byte order */
|
||||||
uint16_t cnf_port_3436; /* Open an additional server port to listen to old TLS/SCTP clients (RFC3436, freeDiameter versions < 1.2.0) */
|
uint16_t cnf_port_3436; /* Open an additional server port to listen to old TLS/SCTP clients (RFC3436, freeDiameter versions < 1.2.0) */
|
||||||
|
|||||||
@@ -69,13 +69,13 @@ typedef struct gy_ccr
|
|||||||
char msc_addr[NUMBER_LEN];
|
char msc_addr[NUMBER_LEN];
|
||||||
char vlr_number[NUMBER_LEN];
|
char vlr_number[NUMBER_LEN];
|
||||||
char imsi[NUMBER_LEN];
|
char imsi[NUMBER_LEN];
|
||||||
char apn[GY_APN_LEN];
|
|
||||||
char cellid[16];
|
char cellid[16];
|
||||||
|
char apn[GY_APN_LEN];
|
||||||
int sgsn_ip;
|
int sgsn_ip;
|
||||||
int ggsn_ip;
|
int ggsn_ip;
|
||||||
char request_action;
|
char request_action;
|
||||||
char cellid_presented;
|
char cellid_presented;
|
||||||
//char mscc_presented;
|
char mscc_presented;
|
||||||
char role_of_node;
|
char role_of_node;
|
||||||
//long balance_to_check;
|
//long balance_to_check;
|
||||||
float req_service_unit;
|
float req_service_unit;
|
||||||
@@ -92,7 +92,8 @@ typedef struct gy_cca
|
|||||||
int check_balance_result;
|
int check_balance_result;
|
||||||
long grant_value;
|
long grant_value;
|
||||||
long volume_threshold;
|
long volume_threshold;
|
||||||
long time_threshold;
|
int validity_time;
|
||||||
|
int time_threshold;
|
||||||
int is_final;
|
int is_final;
|
||||||
}_gy_cca;
|
}_gy_cca;
|
||||||
|
|
||||||
|
|||||||
@@ -470,7 +470,6 @@ int fd_conf_parse()
|
|||||||
|
|
||||||
unsigned int verify;
|
unsigned int verify;
|
||||||
time_t now;
|
time_t now;
|
||||||
/*
|
|
||||||
GNUTLS_TRACE( gnutls_certificate_get_x509_cas (fd_g_config->cnf_sec_data.credentials, &CA_list, (unsigned int *) &CA_list_length) );
|
GNUTLS_TRACE( gnutls_certificate_get_x509_cas (fd_g_config->cnf_sec_data.credentials, &CA_list, (unsigned int *) &CA_list_length) );
|
||||||
GNUTLS_TRACE( gnutls_certificate_get_x509_crls (fd_g_config->cnf_sec_data.credentials, &CRL_list, (unsigned int *) &CRL_list_length) );
|
GNUTLS_TRACE( gnutls_certificate_get_x509_crls (fd_g_config->cnf_sec_data.credentials, &CRL_list, (unsigned int *) &CRL_list_length) );
|
||||||
CHECK_GNUTLS_DO( gnutls_x509_crt_list_verify(certs, cert_max, CA_list, CA_list_length, CRL_list, CRL_list_length, 0, &verify),
|
CHECK_GNUTLS_DO( gnutls_x509_crt_list_verify(certs, cert_max, CA_list, CA_list_length, CRL_list, CRL_list_length, 0, &verify),
|
||||||
@@ -478,7 +477,7 @@ int fd_conf_parse()
|
|||||||
TRACE_ERROR("Failed to verify the local certificate '%s' against local credentials. Please check your certificate is valid.", fd_g_config->cnf_sec_data.cert_file);
|
TRACE_ERROR("Failed to verify the local certificate '%s' against local credentials. Please check your certificate is valid.", fd_g_config->cnf_sec_data.cert_file);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
} );
|
} );
|
||||||
*/
|
|
||||||
if (verify) {
|
if (verify) {
|
||||||
fd_log_debug("TLS: Local certificate chain '%s' is invalid :", fd_g_config->cnf_sec_data.cert_file);
|
fd_log_debug("TLS: Local certificate chain '%s' is invalid :", fd_g_config->cnf_sec_data.cert_file);
|
||||||
if (verify & GNUTLS_CERT_INVALID)
|
if (verify & GNUTLS_CERT_INVALID)
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ static void core_shutdown(void)
|
|||||||
|
|
||||||
static void * core_runner_thread(void * arg)
|
static void * core_runner_thread(void * arg)
|
||||||
{
|
{
|
||||||
char cause[128]={"no cb"};
|
|
||||||
|
|
||||||
fd_log_threadname("fD Core Runner");
|
fd_log_threadname("fD Core Runner");
|
||||||
|
|
||||||
core_state_wait(CORE_RUNNING);
|
core_state_wait(CORE_RUNNING);
|
||||||
@@ -146,7 +144,6 @@ static void * core_runner_thread(void * arg)
|
|||||||
{
|
{
|
||||||
TRACE_DEBUG(NONE, "Internal error: got FDEV_TRIGGER without trigger value!");
|
TRACE_DEBUG(NONE, "Internal error: got FDEV_TRIGGER without trigger value!");
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
sprintf(cause,"Internal error: got FDEV_TRIGGER without trigger value!");
|
|
||||||
goto end;
|
goto end;
|
||||||
} );
|
} );
|
||||||
p = data;
|
p = data;
|
||||||
@@ -157,8 +154,6 @@ static void * core_runner_thread(void * arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FDEV_TERMINATE_INT:
|
case FDEV_TERMINATE_INT:
|
||||||
sprintf(cause,"Internal error: got FDEV_TERMINATE_INT!");
|
|
||||||
|
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -168,18 +163,7 @@ static void * core_runner_thread(void * arg)
|
|||||||
|
|
||||||
end:
|
end:
|
||||||
core_shutdown();
|
core_shutdown();
|
||||||
if(1)
|
|
||||||
{
|
|
||||||
FILE *fp=NULL;
|
|
||||||
|
|
||||||
fp = fopen("fd_cause.txt","w");
|
|
||||||
if(fp)
|
|
||||||
{
|
|
||||||
fprintf(fp,"%s\r\n",cause);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
exit(12);
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,7 @@
|
|||||||
/* #define OLD_SCTP_SOCKET_API */
|
/* #define OLD_SCTP_SOCKET_API */
|
||||||
|
|
||||||
/* Automatically fallback to old API if some of the new symbols are not defined */
|
/* Automatically fallback to old API if some of the new symbols are not defined */
|
||||||
//#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)))
|
#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)))
|
||||||
#if (!defined(SCTP_CONNECTX_4_ARGS) || (!defined(SCTP_RECVRCVINFO)) || (!defined(SCTP_SNDINFO)) || \
|
|
||||||
(!defined(SCTP_SEND_FAILED_EVENT)) || (!defined(SCTP_NOTIFICATIONS_STOPPED_EVENT)) )
|
|
||||||
# define OLD_SCTP_SOCKET_API
|
# define OLD_SCTP_SOCKET_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ static void set_sess_transport(gnutls_session_t session, struct sctp3436_ctx *ct
|
|||||||
/* Reset the low water value, since we don't use sockets */
|
/* Reset the low water value, since we don't use sockets */
|
||||||
#ifndef GNUTLS_VERSION_300
|
#ifndef GNUTLS_VERSION_300
|
||||||
/* starting version 2.12, this call is not needed */
|
/* starting version 2.12, this call is not needed */
|
||||||
//GNUTLS_TRACE( gnutls_transport_set_lowat( session, 0 ) );
|
GNUTLS_TRACE( gnutls_transport_set_lowat( session, 0 ) );
|
||||||
#else /* GNUTLS_VERSION_300 */
|
#else /* GNUTLS_VERSION_300 */
|
||||||
/* but in 3.0 we have to provide the pull_timeout callback */
|
/* but in 3.0 we have to provide the pull_timeout callback */
|
||||||
GNUTLS_TRACE( gnutls_transport_set_pull_timeout_function( session, sctp3436_pull_timeout ) );
|
GNUTLS_TRACE( gnutls_transport_set_pull_timeout_function( session, sctp3436_pull_timeout ) );
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <stdarg.h> /* ANSI C header file */
|
#include <stdarg.h> /* ANSI C header file */
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
//#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
#include "../../debug/src/include/debug.h"
|
#include "../../debug/src/include/debug.h"
|
||||||
#include "./include/iptrans.h"
|
#include "./include/iptrans.h"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
//#include <stropts.h>
|
#include <stropts.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <termio.h>
|
#include <termio.h>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
//#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#define _MTP3_HEAD_FILE
|
#define _MTP3_HEAD_FILE
|
||||||
|
|
||||||
#define _up_message up_message
|
#define _up_message up_message
|
||||||
#define MAX_SS7_MSG_LEN 400 //272
|
#define MAX_SS7_MSG_LEN 300 //272
|
||||||
|
|
||||||
typedef struct up_message{
|
typedef struct up_message{
|
||||||
long dest_ip;
|
long dest_ip;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
//#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|||||||
@@ -244,8 +244,6 @@ typedef struct _mtp3_state
|
|||||||
BYTE tprc_state;
|
BYTE tprc_state;
|
||||||
|
|
||||||
BYTE MTP3WatchDog[MAX_LK];
|
BYTE MTP3WatchDog[MAX_LK];
|
||||||
|
|
||||||
BYTE link_enable_sent_flag[MAX_LK];
|
|
||||||
}_mtp3_state;
|
}_mtp3_state;
|
||||||
extern _mtp3_state mtp3ObjState;
|
extern _mtp3_state mtp3ObjState;
|
||||||
|
|
||||||
|
|||||||
+17
-47
@@ -165,7 +165,6 @@ int mtp3lite_InitClientSocket(WORD lk)
|
|||||||
bzero(&sin_addr,sizeof(struct sockaddr));
|
bzero(&sin_addr,sizeof(struct sockaddr));
|
||||||
sin_addr.sin_family = AF_INET;
|
sin_addr.sin_family = AF_INET;
|
||||||
//sin_addr.sin_port = htons(mtp3lite_port);
|
//sin_addr.sin_port = htons(mtp3lite_port);
|
||||||
sin_addr.sin_addr.s_addr = GetLocalIP();
|
|
||||||
|
|
||||||
mtp3lite_link[lk].cliSockfd = -1;
|
mtp3lite_link[lk].cliSockfd = -1;
|
||||||
if (isMtp3LiteClientLink(lk) && !checkIfOveridesocket(lk))
|
if (isMtp3LiteClientLink(lk) && !checkIfOveridesocket(lk))
|
||||||
@@ -173,7 +172,7 @@ int mtp3lite_InitClientSocket(WORD lk)
|
|||||||
//sin_addr.sin_port = mtp3_para->mtp3lite_port; //server port,tmp
|
//sin_addr.sin_port = mtp3_para->mtp3lite_port; //server port,tmp
|
||||||
//sin_addr.sin_addr.s_addr = mtp3_para->lk[lk].remote_ip;
|
//sin_addr.sin_addr.s_addr = mtp3_para->lk[lk].remote_ip;
|
||||||
//bzero(&(sin_addr.sin_zero),8);
|
//bzero(&(sin_addr.sin_zero),8);
|
||||||
if ((socketfd = mtp3lite_Init_TCPSocket(sin_addr,1)) < 0)
|
if ((socketfd = mtp3lite_Init_TCPSocket(sin_addr,0)) < 0)
|
||||||
{
|
{
|
||||||
printf("MTP3LITE TCP Client Socket(%d) Init Failed!\n",mtp3_para->mtp3lite_port);
|
printf("MTP3LITE TCP Client Socket(%d) Init Failed!\n",mtp3_para->mtp3lite_port);
|
||||||
//exit(1);
|
//exit(1);
|
||||||
@@ -268,7 +267,7 @@ int mtp3lite_TcpConnectCheck()
|
|||||||
bzero(&cliaddr,(clilen = sizeof(struct sockaddr)));
|
bzero(&cliaddr,(clilen = sizeof(struct sockaddr)));
|
||||||
|
|
||||||
connfdtmp = accept(mtp3lite_listen_fd,(struct sockaddr *)&cliaddr,&clilen);
|
connfdtmp = accept(mtp3lite_listen_fd,(struct sockaddr *)&cliaddr,&clilen);
|
||||||
if (connfdtmp <= 0)//no connect request , check client socket
|
if (connfdtmp <= 0)//no connect request , check client socke
|
||||||
{
|
{
|
||||||
link = cliLk++;
|
link = cliLk++;
|
||||||
if (!isMtp3LiteClientLink(link))
|
if (!isMtp3LiteClientLink(link))
|
||||||
@@ -297,11 +296,6 @@ int mtp3lite_TcpConnectCheck()
|
|||||||
mtp3lite_CloseTcpConn(link);
|
mtp3lite_CloseTcpConn(link);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
mtp3lite_link[link].connfd = connfdtmp;
|
|
||||||
mtp3lite_updateStatus(link, MTP2_STATE_WORKING, 0);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ((link = mtp3lite_get_lk_by_ip(&cliaddr)) < 0)
|
else if ((link = mtp3lite_get_lk_by_ip(&cliaddr)) < 0)
|
||||||
@@ -315,7 +309,7 @@ int mtp3lite_TcpConnectCheck()
|
|||||||
mtp3lite_link[link].connfd = connfdtmp;
|
mtp3lite_link[link].connfd = connfdtmp;
|
||||||
mtp3lite_link[link].cliSockfd = connfdtmp;
|
mtp3lite_link[link].cliSockfd = connfdtmp;
|
||||||
mtp3lite_link[link].remote_port = cliaddr.sin_port;
|
mtp3lite_link[link].remote_port = cliaddr.sin_port;
|
||||||
mtp3_debug(MTP3DB_EVENT,"link[%d] connfd: %d, rem_port: %d\n", link, connfdtmp, ntohs(mtp3lite_link[link].remote_port));
|
printf("link[%d] connfd: %d, rem_port: %d\n", link, connfdtmp, ntohs(mtp3lite_link[link].remote_port));
|
||||||
|
|
||||||
fcntl(mtp3lite_link[link].connfd,F_SETFL,O_NONBLOCK);
|
fcntl(mtp3lite_link[link].connfd,F_SETFL,O_NONBLOCK);
|
||||||
if (setsockopt(mtp3lite_link[link].connfd,SOL_SOCKET,SO_KEEPALIVE, &keepAlive,sizeof(keepAlive)) != 0)
|
if (setsockopt(mtp3lite_link[link].connfd,SOL_SOCKET,SO_KEEPALIVE, &keepAlive,sizeof(keepAlive)) != 0)
|
||||||
@@ -332,24 +326,6 @@ int mtp3lite_TcpConnectCheck()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int send_mtp3lite_id_ack(WORD link)
|
|
||||||
{
|
|
||||||
BYTE id_ack_msg[4]={0,0x1,0xfe, 0x6};
|
|
||||||
|
|
||||||
mtp3lite_DirectSendMsg(link, 4, id_ack_msg);
|
|
||||||
mtp3_debug(MTP3DB_EVENT,"mtp3-lite link %d send Inditify ACK",link);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int send_mtp3lite_ping(WORD link)
|
|
||||||
{
|
|
||||||
BYTE id_ack_msg[4]={0x00,0x01,0xfe, 0x00};
|
|
||||||
|
|
||||||
mtp3lite_DirectSendMsg(link, 4, id_ack_msg);
|
|
||||||
mtp3_debug(MTP3DB_EVENT,"mtp3-lite link %d send PING",link);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int mtp3lite_DirectRecvMsg(WORD link)
|
int mtp3lite_DirectRecvMsg(WORD link)
|
||||||
{
|
{
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
@@ -360,19 +336,12 @@ int mtp3lite_DirectRecvMsg(WORD link)
|
|||||||
// if ((len1 = mtp3lite_rem_len[link])>0)
|
// if ((len1 = mtp3lite_rem_len[link])>0)
|
||||||
// printf("len1: %d\n", len1);
|
// printf("len1: %d\n", len1);
|
||||||
len1 = mtp3lite_rem_len[link];
|
len1 = mtp3lite_rem_len[link];
|
||||||
|
|
||||||
if(len >= MTP3LITE_MSG_BUF_SIZE_PER_LINK)
|
|
||||||
{
|
|
||||||
mtp3_debug(MTP3DB_EVENT, "mtp3lite link[%d] buffer is full!\n", link);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
nbytes = recvfrom(mtp3lite_link[link].connfd, mtp3lite_msg_buf[link] + len1,
|
nbytes = recvfrom(mtp3lite_link[link].connfd, mtp3lite_msg_buf[link] + len1,
|
||||||
MTP3LITE_MSG_BUF_SIZE_PER_LINK - len1, 0, (struct sockaddr *) &sin, &len);
|
MTP3LITE_MSG_BUF_SIZE_PER_LINK - len1, 0, (struct sockaddr *) &sin, &len);
|
||||||
|
|
||||||
if (nbytes == 0 && errno != 11)
|
if (nbytes == 0)
|
||||||
{
|
{
|
||||||
mtp3_debug(MTP3DB_EVENT, "mtp3lite tcp link[%d] error : %d\n", link, errno);
|
printf("tcp link[%d] error : %d\n", link, errno);
|
||||||
mtp3lite_CloseTcpConn(link);
|
mtp3lite_CloseTcpConn(link);
|
||||||
mtp3lite_updateStatus(link, MTP2_STATE_STOP, MTP3LITE_TCP_FAILURE);
|
mtp3lite_updateStatus(link, MTP2_STATE_STOP, MTP3LITE_TCP_FAILURE);
|
||||||
mtp3lite_rem_len[link] = 0;
|
mtp3lite_rem_len[link] = 0;
|
||||||
@@ -499,9 +468,8 @@ int mtp3lite_decode_tcp_msg(WORD total_len, WORD link)
|
|||||||
else if (sub_len == 1)
|
else if (sub_len == 1)
|
||||||
{
|
{
|
||||||
if(buf_ptr[1+2] == 0x6)
|
if(buf_ptr[1+2] == 0x6)
|
||||||
// if(buf_ptr[1+2] == 0x6 || buf_ptr[2] == 0x06)
|
|
||||||
{ // Receive Keep Alive Message
|
{ // Receive Keep Alive Message
|
||||||
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 200;
|
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 100;
|
||||||
mtp3lite_link[link].remote_inactive_timeouts = 0;
|
mtp3lite_link[link].remote_inactive_timeouts = 0;
|
||||||
//mtp3lite_print_msg(buf_ptr, 3);
|
//mtp3lite_print_msg(buf_ptr, 3);
|
||||||
total_hdl_len += (sub_len + 3);
|
total_hdl_len += (sub_len + 3);
|
||||||
@@ -510,17 +478,13 @@ int mtp3lite_decode_tcp_msg(WORD total_len, WORD link)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
//mtp3_debug(MTP3DB_EVENT,"mtp3-lite link %d RECV IPA Ping!",link);
|
|
||||||
//send_mtp3lite_ping(link);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// if ((buf_ptr[1+2] > 9) || (buf_ptr[1+2] == 0))
|
// if ((buf_ptr[1+2] > 9) || (buf_ptr[1+2] == 0))
|
||||||
// return -1;
|
// return -1;
|
||||||
|
|
||||||
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 200;
|
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 100;
|
||||||
mtp3lite_link[link].remote_inactive_timeouts = 0;
|
mtp3lite_link[link].remote_inactive_timeouts = 0;
|
||||||
|
|
||||||
//mtp3lite_print_msg(buf_ptr, sub_len + 1);
|
//mtp3lite_print_msg(buf_ptr, sub_len + 1);
|
||||||
@@ -533,7 +497,7 @@ int mtp3lite_decode_tcp_msg(WORD total_len, WORD link)
|
|||||||
//nw = mtp3_para->ls_pro[lk_set] & 3;
|
//nw = mtp3_para->ls_pro[lk_set] & 3;
|
||||||
nw = mtp3_para->ls_pro[lk_set].nw_id ;
|
nw = mtp3_para->ls_pro[lk_set].nw_id ;
|
||||||
up_msg_ptr->sio = 0x03 | (nw << 6);//sccp lite always itu message
|
up_msg_ptr->sio = 0x03 | (nw << 6);//sccp lite always itu message
|
||||||
up_msg_ptr->sio |= (mtp3_para->nw[nw].pc_type & 1)<<4;//detect ansi or itu sccp, ansi=1,itu=0
|
up_msg_ptr->sio |= (mtp3_para->nw[nw].pc_len & 1)<<4;//detect ansi or itu sccp, ansi=1,itu=0
|
||||||
up_msg_ptr->opc = mtp3_para->ls_pro[lk_set].ls_op_pc;
|
up_msg_ptr->opc = mtp3_para->ls_pro[lk_set].ls_op_pc;
|
||||||
if (pc_length(up_msg_ptr->sio >> 6) == MTP3_24BIT_PC)
|
if (pc_length(up_msg_ptr->sio >> 6) == MTP3_24BIT_PC)
|
||||||
up_msg_ptr->dpc = mtp3_para->nw[nw].opc24;
|
up_msg_ptr->dpc = mtp3_para->nw[nw].opc24;
|
||||||
@@ -553,6 +517,14 @@ int mtp3lite_decode_tcp_msg(WORD total_len, WORD link)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int send_mtp3lite_id_ack(WORD link)
|
||||||
|
{
|
||||||
|
BYTE id_ack_msg[4]={0,0x1,0xfe, 0x6};
|
||||||
|
|
||||||
|
mtp3lite_DirectSendMsg(link, 4, id_ack_msg);
|
||||||
|
mtp3_debug(MTP3DB_EVENT,"mtp3-lite link %d send Inditify ACK",link);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int get_mtp3lite_msg(WORD link)
|
int get_mtp3lite_msg(WORD link)
|
||||||
{
|
{
|
||||||
@@ -704,7 +676,7 @@ int mtp3lite_chk_lk(WORD link)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 200;
|
mtp3lite_link[link].remote_inactive = mtp3_para->lk[link].inactive * 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -715,14 +687,12 @@ int mtp3lite_chk_lk(WORD link)
|
|||||||
{
|
{
|
||||||
mtp3lite_id_fg[link] = 1;
|
mtp3lite_id_fg[link] = 1;
|
||||||
send_mtp3lite_id_ack(link);
|
send_mtp3lite_id_ack(link);
|
||||||
//send_mtp3lite_ping(link);
|
|
||||||
}
|
}
|
||||||
if (--mtp3lite_link[link].local_inactive == 0)
|
if (--mtp3lite_link[link].local_inactive == 0)
|
||||||
{
|
{
|
||||||
// mtp3lite_DirectSendMsg(link, 3, mtp3lite_ka_msg);
|
// mtp3lite_DirectSendMsg(link, 3, mtp3lite_ka_msg);
|
||||||
// put_mtp3lite_msg(&str);
|
// put_mtp3lite_msg(&str);
|
||||||
mtp3lite_link[link].local_inactive = 2000;
|
mtp3lite_link[link].local_inactive = 2000;
|
||||||
send_mtp3lite_id_ack(link);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-12
@@ -865,7 +865,6 @@ static void i_sys()
|
|||||||
mtp3ObjState.link_l3_state[i] = UNAVAILABLE;
|
mtp3ObjState.link_l3_state[i] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_l2_state[i] = UNAVAILABLE;
|
mtp3ObjState.link_l2_state[i] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_l1_state[i] = UNAVAILABLE;
|
mtp3ObjState.link_l1_state[i] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_enable_sent_flag[i] = 0;
|
|
||||||
|
|
||||||
mtp3_set_link_manager(i);
|
mtp3_set_link_manager(i);
|
||||||
|
|
||||||
@@ -993,8 +992,6 @@ int update_ls_slc_table(int link)
|
|||||||
{
|
{
|
||||||
mtp3ObjState.lk_configured[link] = PARA_CONFIGURED;
|
mtp3ObjState.lk_configured[link] = PARA_CONFIGURED;
|
||||||
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
|
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_enable_sent_flag[link] = 0;
|
|
||||||
|
|
||||||
mtp3.ls[ls].linksNum_configured++;
|
mtp3.ls[ls].linksNum_configured++;
|
||||||
ls_slc[lsx16+slc] = link;
|
ls_slc[lsx16+slc] = link;
|
||||||
// linknum_in_ls[ls]++;
|
// linknum_in_ls[ls]++;
|
||||||
@@ -1005,8 +1002,6 @@ int update_ls_slc_table(int link)
|
|||||||
{
|
{
|
||||||
mtp3ObjState.lk_configured[link] = PARA_NOT_CONFIGURED;
|
mtp3ObjState.lk_configured[link] = PARA_NOT_CONFIGURED;
|
||||||
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
|
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_enable_sent_flag[link] = 0;
|
|
||||||
|
|
||||||
mtp3_heartbeat.link_state[idiv4] = mtp3_heartbeat.link_state[idiv4] | temp;
|
mtp3_heartbeat.link_state[idiv4] = mtp3_heartbeat.link_state[idiv4] | temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1173,11 +1168,11 @@ void init_mtp3table()
|
|||||||
{
|
{
|
||||||
update_timer(i);
|
update_timer(i);
|
||||||
}
|
}
|
||||||
mtp3_para->mtp3_t10 = 126; //63;/* 40 SECOND, unit=640ms,for dpc */
|
mtp3_para->mtp3_t10 = 63;/* 40 SECOND, unit=640ms,for dpc */
|
||||||
mtp3_para->mtp3_t18 = 40;//20;
|
mtp3_para->mtp3_t18 = 20;
|
||||||
mtp3_para->mtp3_t19 = 8;//4;
|
mtp3_para->mtp3_t19 = 4;
|
||||||
mtp3_para->mtp3_t20 = 8;//4;
|
mtp3_para->mtp3_t20 = 4;
|
||||||
mtp3_para->mtp3_t21 = 750; //375;/* 30 SECOND,unit=80ms, for linkset */
|
mtp3_para->mtp3_t21 = 375;/* 30 SECOND,unit=80ms, for linkset */
|
||||||
mtp3ObjInput.tprc_input = TPRC_SP_RESTART_INDICATION;
|
mtp3ObjInput.tprc_input = TPRC_SP_RESTART_INDICATION;
|
||||||
own_sp_restarting = 1;
|
own_sp_restarting = 1;
|
||||||
tprc_mgmt_signalling_point_restart_indication();
|
tprc_mgmt_signalling_point_restart_indication();
|
||||||
@@ -1229,8 +1224,6 @@ void mtp_shm_init(WORD moduleid_systemid, DWORD local_ip, DWORD peer_ip)
|
|||||||
|
|
||||||
mtp_local_ip = local_ip;
|
mtp_local_ip = local_ip;
|
||||||
mtp_peer_ip = peer_ip;
|
mtp_peer_ip = peer_ip;
|
||||||
|
|
||||||
//mtp3_alterip = peer_ip;
|
|
||||||
printf("mtp3 complete init\n");
|
printf("mtp3 complete init\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ int mtp3_send_netcap=0;
|
|||||||
|
|
||||||
void reset_mtp3();
|
void reset_mtp3();
|
||||||
long atol(const char *nptr);
|
long atol(const char *nptr);
|
||||||
//int gettimeofday(struct timeval *tv,struct timezone *tz);
|
int gettimeofday(struct timeval *tv,struct timezone *tz);
|
||||||
struct tm *localtime(const time_t *timep);
|
struct tm *localtime(const time_t *timep);
|
||||||
void mtp3_list_link(WORD i);
|
void mtp3_list_link(WORD i);
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@ extern BOOL mtp3DebugFull;
|
|||||||
BYTE disp_flag;
|
BYTE disp_flag;
|
||||||
BYTE disp_page[16];
|
BYTE disp_page[16];
|
||||||
|
|
||||||
static BYTE * disp_ptr;
|
BYTE * disp_ptr;
|
||||||
static BYTE disp_length;
|
BYTE disp_length;
|
||||||
|
|
||||||
static DWORD debug_mask=0;
|
static DWORD debug_mask=0;
|
||||||
void mtp3_show_routine_status(BYTE nw);
|
void mtp3_show_routine_status(BYTE nw);
|
||||||
|
|||||||
@@ -2112,7 +2112,6 @@ void mtp3_setlink_to_IDLE(WORD link)
|
|||||||
otherMTP3_managed_link_unavailable(link);
|
otherMTP3_managed_link_unavailable(link);
|
||||||
mtp3ObjState.link_l2_state[link] = UNAVAILABLE;
|
mtp3ObjState.link_l2_state[link] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
|
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_enable_sent_flag[link] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3199,6 +3198,7 @@ void trap_mtp2 (BYTE oid_len,DWORD *oid_ptr,BYTE *msg_ptr,WORD msg_len,snmp_addr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mtp3_clear_all_peer_link_status();
|
||||||
void mtp3_dealtrap(BYTE oid_len,DWORD *oid_ptr,BYTE *msg_ptr,WORD msg_len,snmp_addr *addr)
|
void mtp3_dealtrap(BYTE oid_len,DWORD *oid_ptr,BYTE *msg_ptr,WORD msg_len,snmp_addr *addr)
|
||||||
{
|
{
|
||||||
DWORD mtp2_oid[20] = MTP2_HB_OID;
|
DWORD mtp2_oid[20] = MTP2_HB_OID;
|
||||||
@@ -3218,7 +3218,6 @@ void mtp3_dealtrap(BYTE oid_len,DWORD *oid_ptr,BYTE *msg_ptr,WORD msg_len,snmp_a
|
|||||||
if ((mtp3_para->MTP3SerialNum==0) ||//support old version, do not have serial number
|
if ((mtp3_para->MTP3SerialNum==0) ||//support old version, do not have serial number
|
||||||
(Bcd2Ull(&msg_ptr[39],MTP3_SERNUM_LEN)==mtp3_para->MTP3SerialNum) )
|
(Bcd2Ull(&msg_ptr[39],MTP3_SERNUM_LEN)==mtp3_para->MTP3SerialNum) )
|
||||||
{
|
{
|
||||||
|
|
||||||
if(peer_hb_timer>0)
|
if(peer_hb_timer>0)
|
||||||
{
|
{
|
||||||
if(++peer_hb_timer>4)
|
if(++peer_hb_timer>4)
|
||||||
@@ -3255,7 +3254,6 @@ int mtp3_clear_all_peer_link_status()
|
|||||||
if(mtp3ObjState.link_l3_state[link] == AVAILABLE)
|
if(mtp3ObjState.link_l3_state[link] == AVAILABLE)
|
||||||
{
|
{
|
||||||
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
|
mtp3ObjState.link_l3_state[link] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_enable_sent_flag[link] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4530,8 +4528,5 @@ void mtp3_snmp_registration(void)
|
|||||||
register_snmp_table(&mtp3_register);
|
register_snmp_table(&mtp3_register);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mtp3_get_net_pclen(int netid)
|
|
||||||
{
|
|
||||||
return mtp3_para->nw[netid%4].pc_len;
|
|
||||||
}
|
|
||||||
/*@end@*/
|
/*@end@*/
|
||||||
+58
-255
@@ -30,7 +30,7 @@ extern mtp3_routing_result routingResult;
|
|||||||
extern void mtp3_debug(int n,const char *fmt,...);
|
extern void mtp3_debug(int n,const char *fmt,...);
|
||||||
extern BYTE mtp3_check_dpc_equal_to_opc(BYTE nw, ulong dpc);
|
extern BYTE mtp3_check_dpc_equal_to_opc(BYTE nw, ulong dpc);
|
||||||
|
|
||||||
static int detail_debug_flag=0;
|
static int detail_debug_flag=1;
|
||||||
static int rc_timer=190;
|
static int rc_timer=190;
|
||||||
extern DWORD mtp_local_ip, mtp_peer_ip;
|
extern DWORD mtp_local_ip, mtp_peer_ip;
|
||||||
|
|
||||||
@@ -472,46 +472,15 @@ int priority_own_link(WORD lsno,WORD sls)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ls = &mtp3.ls[lsno];
|
ls = &mtp3.ls[lsno];
|
||||||
|
for (i=0;i<mtp3.ls[lsno].linksNum_configured;i++)
|
||||||
if(detail_debug_flag)
|
|
||||||
{
|
|
||||||
if(1)
|
|
||||||
{
|
|
||||||
char buf[256];
|
|
||||||
char strbuf[1024];
|
|
||||||
|
|
||||||
mtp3_debug(MTP3DB_EVENT, "%s, linkset=%d, sls=%d, linkconfigred=%d ",
|
|
||||||
__FUNCTION__,
|
|
||||||
lsno,
|
|
||||||
sls,
|
|
||||||
mtp3.ls[lsno].linksNum_configured);
|
|
||||||
memset(strbuf, 0x00, 16);
|
|
||||||
for(i=0;i<2; i++)
|
|
||||||
{
|
|
||||||
link = ls_sls[(lsno<<4)+i];
|
|
||||||
sprintf(buf, "ls_sls[%02d]=%d, ip=%08x, state=%d",
|
|
||||||
i,
|
|
||||||
ls_sls[(lsno<<4)+i],
|
|
||||||
mtp3_para->lk[link].e1_to_mtp3,
|
|
||||||
mtp3ObjState.link_l3_state[link]);
|
|
||||||
strcat(strbuf, buf);
|
|
||||||
}
|
|
||||||
mtp3_debug(MTP3DB_EVENT, "%s, %s ",
|
|
||||||
__FUNCTION__,
|
|
||||||
strbuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0;i<16;i++)
|
|
||||||
// for (i=0;i<mtp3.ls[lsno].linksNum_configured;i++)
|
|
||||||
{
|
{
|
||||||
link = ls_sls[(lsno<<4)+i];
|
link = ls_sls[(lsno<<4)+i];
|
||||||
|
|
||||||
if (mtp3_para->lk[link].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[link] == AVAILABLE)
|
if (mtp3_para->lk[link].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[link] == AVAILABLE)
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i<16;i++)
|
for (i=0;i<mtp3.ls[lsno].linksNum_configured;i++)
|
||||||
// for (i=0;i<mtp3.ls[lsno].linksNum_configured;i++)
|
|
||||||
{
|
{
|
||||||
link = ls_sls[(lsno<<4)+i];
|
link = ls_sls[(lsno<<4)+i];
|
||||||
|
|
||||||
@@ -607,11 +576,14 @@ int check_outbound_route(BYTE nw, long dpc, WORD sls, long opc)
|
|||||||
ls_info = &mtp3.ls[ls];
|
ls_info = &mtp3.ls[ls];
|
||||||
|
|
||||||
/* added for override link status -- start */
|
/* added for override link status -- start */
|
||||||
/*
|
|
||||||
if(m2ua_get_traffic_mode_type()==0)
|
if(m2ua_get_traffic_mode_type()==0)
|
||||||
{
|
{
|
||||||
if(ls_info->send_asp_ac_link_id>0 && ls_info->send_asp_ac_link_id != 0xffff)
|
if(ls_info->send_asp_ac_link_id>0 && ls_info->send_asp_ac_link_id != 0xffff)
|
||||||
{
|
{
|
||||||
|
if(detail_debug_flag)
|
||||||
|
mtp3_debug(MTP3DB_EVENT,
|
||||||
|
"[SCCP] M3UA ==> M2UA < %s > DPC=%d, Link=%d (asc link=%d)",__FUNCTION__, dpc, outlink,
|
||||||
|
ls_info->send_asp_ac_link_id);
|
||||||
|
|
||||||
return ls_info->send_asp_ac_link_id;
|
return ls_info->send_asp_ac_link_id;
|
||||||
}
|
}
|
||||||
@@ -619,11 +591,14 @@ int check_outbound_route(BYTE nw, long dpc, WORD sls, long opc)
|
|||||||
{
|
{
|
||||||
int link_no = get_asp_ac_link(ls,sls);
|
int link_no = get_asp_ac_link(ls,sls);
|
||||||
|
|
||||||
|
if(detail_debug_flag)
|
||||||
|
mtp3_debug(MTP3DB_EVENT,
|
||||||
|
"[SCCP] M3UA ==> M2UA < %s > DPC=%d, Link=%d (asc link=%d)",__FUNCTION__, dpc, link_no,
|
||||||
|
ls_info->send_asp_ac_link_id);
|
||||||
|
|
||||||
return link_no;
|
return link_no;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/* added for override link status -- end*/
|
/* added for override link status -- end*/
|
||||||
|
|
||||||
if (mtp3_para->lk[outlink].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[outlink] == AVAILABLE)
|
if (mtp3_para->lk[outlink].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[outlink] == AVAILABLE)
|
||||||
@@ -639,11 +614,14 @@ int check_outbound_route(BYTE nw, long dpc, WORD sls, long opc)
|
|||||||
ls_info = &mtp3.ls[ls];
|
ls_info = &mtp3.ls[ls];
|
||||||
|
|
||||||
/* added for override link status -- start */
|
/* added for override link status -- start */
|
||||||
/*
|
|
||||||
if(m2ua_get_traffic_mode_type()==0)
|
if(m2ua_get_traffic_mode_type()==0)
|
||||||
{
|
{
|
||||||
if(ls_info->send_asp_ac_link_id>0 && ls_info->send_asp_ac_link_id != 0xffff)
|
if(ls_info->send_asp_ac_link_id>0 && ls_info->send_asp_ac_link_id != 0xffff)
|
||||||
{
|
{
|
||||||
|
if(detail_debug_flag)
|
||||||
|
mtp3_debug(MTP3DB_EVENT,
|
||||||
|
"[SCCP] M3UA ==> M2UA < %s > DPC=%d(ALS), Link=%d (asc link=%d)",__FUNCTION__, dpc, outlink,
|
||||||
|
ls_info->send_asp_ac_link_id);
|
||||||
|
|
||||||
return ls_info->send_asp_ac_link_id;
|
return ls_info->send_asp_ac_link_id;
|
||||||
}
|
}
|
||||||
@@ -651,11 +629,14 @@ int check_outbound_route(BYTE nw, long dpc, WORD sls, long opc)
|
|||||||
{
|
{
|
||||||
int link_no = get_asp_ac_link(ls,sls);
|
int link_no = get_asp_ac_link(ls,sls);
|
||||||
|
|
||||||
|
if(detail_debug_flag)
|
||||||
|
mtp3_debug(MTP3DB_EVENT,
|
||||||
|
"[SCCP] M3UA ==> M2UA < %s > DPC=%d(ALS), Link=%d (asc link=%d)",__FUNCTION__, dpc, link_no,
|
||||||
|
ls_info->send_asp_ac_link_id);
|
||||||
|
|
||||||
return link_no;
|
return link_no;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/* added for override link status -- end*/
|
/* added for override link status -- end*/
|
||||||
|
|
||||||
if (mtp3_para->lk[outlink].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[outlink] == AVAILABLE)
|
if (mtp3_para->lk[outlink].e1_to_mtp3 == mtp3_localip && mtp3ObjState.link_l3_state[outlink] == AVAILABLE)
|
||||||
@@ -3035,7 +3016,7 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
|
|||||||
if( ls_disable == 0)
|
if( ls_disable == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// sp->m3ua_rc_status[spplace] = rc_status;
|
sp->m3ua_rc_status[spplace] = rc_status;
|
||||||
if(detail_debug_flag)
|
if(detail_debug_flag)
|
||||||
mtp3_debug(MTP3DB_EVENT," <%s.%d> M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
|
mtp3_debug(MTP3DB_EVENT," <%s.%d> M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
@@ -3043,19 +3024,15 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
|
|||||||
chl,
|
chl,
|
||||||
spplace, sp->routine[spplace]);
|
spplace, sp->routine[spplace]);
|
||||||
|
|
||||||
mark_normal_linkset_unavailable(&sp->routine[spplace]);
|
|
||||||
|
|
||||||
if ( ((sp->routine[spplace] >> 2) & 3) == 0 )/*alternative route available */
|
if ( ((sp->routine[spplace] >> 2) & 3) == 0 )/*alternative route available */
|
||||||
sp->routine[spplace] = (sp->routine[spplace] & 0x3f) + 0x40;/* current route change from normal linkset to alternative linkset */
|
sp->routine[spplace] = (sp->routine[spplace] & 0x3f) + 0x40;/* current route change from normal linkset to alternative linkset */
|
||||||
else/* sp not accessible */
|
else/* sp not accessible */
|
||||||
{
|
{
|
||||||
sp_unaccessable((BYTE *)&sp->routine[spplace]);
|
sp_unaccessable((BYTE *)&sp->routine[spplace]);
|
||||||
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
|
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
|
||||||
sp->m3ua_rc_status[spplace] = rc_status;
|
|
||||||
}
|
}
|
||||||
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
|
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
|
||||||
{
|
{
|
||||||
if(1)
|
|
||||||
if(mtp_peer_ip != 0)
|
if(mtp_peer_ip != 0)
|
||||||
{
|
{
|
||||||
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
|
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
|
||||||
@@ -3089,27 +3066,21 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
//sp->m3ua_rc_status[spplace] = rc_status;
|
sp->m3ua_rc_status[spplace] = rc_status;
|
||||||
if(detail_debug_flag)
|
if(detail_debug_flag)
|
||||||
mtp3_debug(MTP3DB_EVENT," <%s.%d> M3UA ALS update route info, link=%d, sppace=%d, sp->routine=%d, rc_status=%d",
|
mtp3_debug(MTP3DB_EVENT," <%s.%d> M3UA ALS update route info, link=%d, sppace=%d, sp->routine=%d",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
__LINE__,
|
__LINE__,
|
||||||
chl,
|
chl,
|
||||||
spplace, sp->routine[spplace],
|
spplace, sp->routine[spplace]);
|
||||||
sp->m3ua_rc_status[spplace]);
|
|
||||||
|
|
||||||
mark_alternative_linkset_unavailable(&sp->routine[spplace]);
|
|
||||||
|
|
||||||
if ( (sp->routine[spplace] & 3) != 0 )/* normal route unavailable */
|
if ( (sp->routine[spplace] & 3) != 0 )/* normal route unavailable */
|
||||||
{
|
{
|
||||||
sp_unaccessable((BYTE *)&sp->routine[spplace]);
|
sp_unaccessable((BYTE *)&sp->routine[spplace]);
|
||||||
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
|
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
|
||||||
sp->m3ua_rc_status[spplace] = rc_status;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
|
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
|
||||||
{
|
{
|
||||||
if(1)
|
|
||||||
if(mtp_peer_ip != 0)
|
if(mtp_peer_ip != 0)
|
||||||
{
|
{
|
||||||
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
|
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
|
||||||
@@ -3202,7 +3173,6 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
|
|||||||
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
|
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(1)
|
|
||||||
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp_peer_ip != 0)
|
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp_peer_ip != 0)
|
||||||
{
|
{
|
||||||
send_route_to_other_plat(dpc,
|
send_route_to_other_plat(dpc,
|
||||||
@@ -3222,8 +3192,6 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
|
|||||||
__LINE__,
|
__LINE__,
|
||||||
chl,
|
chl,
|
||||||
spplace, sp->routine[spplace]);
|
spplace, sp->routine[spplace]);
|
||||||
|
|
||||||
rc_timer = 100; //make sure 1 second later to send ASP_AC
|
|
||||||
|
|
||||||
}
|
}
|
||||||
sp = &mtp3.nw[nw];
|
sp = &mtp3.nw[nw];
|
||||||
@@ -3234,37 +3202,29 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
|
|||||||
// continue;
|
// continue;
|
||||||
sp->m3ua_rc_status[spplace] = rc_status;
|
sp->m3ua_rc_status[spplace] = rc_status;
|
||||||
routine = (BYTE*)&sp->routine[spplace];
|
routine = (BYTE*)&sp->routine[spplace];
|
||||||
|
if(0)
|
||||||
if(detail_debug_flag)
|
|
||||||
mtp3_debug(MTP3DB_EVENT," <%s:%d> S5 ALS,M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
|
mtp3_debug(MTP3DB_EVENT," <%s:%d> S5 ALS,M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
|
||||||
__FUNCTION__, __LINE__,
|
__FUNCTION__, __LINE__,
|
||||||
chl,
|
chl,
|
||||||
spplace, *routine);
|
spplace, sp->routine[spplace]);
|
||||||
|
|
||||||
mark_alternative_linkset_available(&mtp3.nw[nw].routine[spplace]); //17-11-07
|
if ( (*routine) >> 6 == 2 )/* no route */
|
||||||
routine = (BYTE *)&mtp3.nw[nw].routine[spplace];
|
|
||||||
|
|
||||||
if ( (*routine) >> 6 == 2 )// no route
|
|
||||||
{
|
{
|
||||||
(*routine) = ((*routine) & 0x3f) + 0x40;// current route is alternative linkset
|
(*routine) = ((*routine) & 0x3f) + 0x40;/* current route is alternative linkset */
|
||||||
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
|
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
|
||||||
}
|
}
|
||||||
{
|
mark_alternative_linkset_available(&mtp3.nw[nw].routine[spplace]);
|
||||||
|
routine = (BYTE *)&mtp3.nw[nw].routine[spplace];
|
||||||
|
|
||||||
|
/*
|
||||||
if (Nlinkset_status(*routine) == LS_AVAILABLE)
|
if (Nlinkset_status(*routine) == LS_AVAILABLE)
|
||||||
(*routine) = ((*routine) & 0x3f); // current route is normal linkset
|
(*routine) = ((*routine) & 0x3f); // current route is normal linkset
|
||||||
else if (Alinkset_status(*routine) == LS_AVAILABLE)
|
else if (Alinkset_status(*routine) == LS_AVAILABLE)
|
||||||
(*routine) = ((*routine) & 0x3f) + 0x40;
|
(*routine) = ((*routine) & 0x3f) + 0x40;
|
||||||
else
|
else
|
||||||
(*routine) = ((*routine) & 0x3f) + 0x80;
|
(*routine) = ((*routine) & 0x3f) + 0x80;
|
||||||
}
|
*/
|
||||||
|
|
||||||
if(0)
|
|
||||||
{
|
|
||||||
mark_alternative_linkset_available(&mtp3.nw[nw].routine[spplace]);
|
|
||||||
routine = (BYTE *)&mtp3.nw[nw].routine[spplace];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(1)
|
|
||||||
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp_peer_ip != 0)
|
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp_peer_ip != 0)
|
||||||
{
|
{
|
||||||
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
|
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
|
||||||
@@ -3274,15 +3234,17 @@ void m3ua_upd_route_status(WORD chl, DWORD rc, BYTE rc_status, BYTE ls_disable)
|
|||||||
chl,
|
chl,
|
||||||
opc);
|
opc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp3_para->lk[chl].e1_to_alterMTP3 !=0)
|
||||||
|
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc, nw, sp->routine[spplace], mtp3_para->lk[chl].e1_to_alterMTP3, chl, opc);
|
||||||
|
}
|
||||||
if(detail_debug_flag)
|
if(detail_debug_flag)
|
||||||
mtp3_debug(MTP3DB_EVENT," <%s:%d> S5 ALS,M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
|
mtp3_debug(MTP3DB_EVENT," <%s:%d> S5 ALS,M3UA update route info, link=%d, sppace=%d, sp->routine=%d",
|
||||||
__FUNCTION__, __LINE__,
|
__FUNCTION__, __LINE__,
|
||||||
chl,
|
chl,
|
||||||
spplace, sp->routine[spplace]);
|
spplace, sp->routine[spplace]);
|
||||||
|
|
||||||
if(mtp3ObjState.lk_mtp3[chl] == mtp3_localip && mtp3_para->lk[chl].e1_to_alterMTP3 !=0)
|
|
||||||
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc, nw, sp->routine[spplace], mtp3_para->lk[chl].e1_to_alterMTP3, chl, opc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// if ((mtp3.nw[nw].routine[dpc_index] & 0x0f) == 0x0a)// all road unavailable
|
// if ((mtp3.nw[nw].routine[dpc_index] & 0x0f) == 0x0a)// all road unavailable
|
||||||
// mark_dstSP_inaccessible(&mtp3.nw[nw].routine[dpc_index]);
|
// mark_dstSP_inaccessible(&mtp3.nw[nw].routine[dpc_index]);
|
||||||
@@ -3400,7 +3362,6 @@ int m3ua_ssnm_update_route(xua_ssnm_cmd *p_ssnm)
|
|||||||
else
|
else
|
||||||
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
|
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
|
||||||
|
|
||||||
if(1)
|
|
||||||
if(mtp3ObjState.lk_mtp3[link] == mtp3_localip && mtp_peer_ip != 0)
|
if(mtp3ObjState.lk_mtp3[link] == mtp3_localip && mtp_peer_ip != 0)
|
||||||
{
|
{
|
||||||
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
|
send_route_to_other_plat(mtp3_para->nw[nw].routing[spplace].dpc,
|
||||||
@@ -3425,12 +3386,10 @@ int m3ua_updateStatus(WORD chl, BYTE new_l2_state,BYTE command, DWORD rc, BYTE r
|
|||||||
ls_info *ls;
|
ls_info *ls;
|
||||||
int set_unaccessable = 0 ;
|
int set_unaccessable = 0 ;
|
||||||
|
|
||||||
/*
|
|
||||||
if ((mtp3ObjState.lk_configured[chl] == PARA_NOT_CONFIGURED) ||
|
if ((mtp3ObjState.lk_configured[chl] == PARA_NOT_CONFIGURED) ||
|
||||||
(mtp3ObjState.lk_mtp3[chl] != mtp3_localip))
|
(mtp3ObjState.lk_mtp3[chl] != mtp3_localip))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*/
|
|
||||||
rc_timer = 195+(mtp2_systemid%2)*5;
|
rc_timer = 195+(mtp2_systemid%2)*5;
|
||||||
|
|
||||||
if (mtp3ObjState.lk_configured[chl] == PARA_NOT_CONFIGURED)
|
if (mtp3ObjState.lk_configured[chl] == PARA_NOT_CONFIGURED)
|
||||||
@@ -3459,7 +3418,7 @@ int m3ua_updateStatus(WORD chl, BYTE new_l2_state,BYTE command, DWORD rc, BYTE r
|
|||||||
|
|
||||||
if (new_l2_state != mtp3ObjState.link_l2_state[chl])
|
if (new_l2_state != mtp3ObjState.link_l2_state[chl])
|
||||||
{
|
{
|
||||||
if(detail_debug_flag)
|
// if(detail_debug_flag)
|
||||||
{
|
{
|
||||||
mtp3_debug(MTP3DB_ERROR,"m3ua_updateStatus, link=%d, l2_state=%d, command=%d, rc=%d, rc_status=%d",
|
mtp3_debug(MTP3DB_ERROR,"m3ua_updateStatus, link=%d, l2_state=%d, command=%d, rc=%d, rc_status=%d",
|
||||||
chl, new_l2_state, command, rc, rc_status);
|
chl, new_l2_state, command, rc, rc_status);
|
||||||
@@ -3517,36 +3476,11 @@ int m3ua_updateStatus(WORD chl, BYTE new_l2_state,BYTE command, DWORD rc, BYTE r
|
|||||||
m3ua_upd_route_status(chl, rc, 5, 1);
|
m3ua_upd_route_status(chl, rc, 5, 1);
|
||||||
|
|
||||||
mtp3.ls[ls_t].links_available ++;
|
mtp3.ls[ls_t].links_available ++;
|
||||||
|
|
||||||
ls->links_available_t = scan_ls_link_available(ls_t);
|
|
||||||
|
|
||||||
if(ls->links_available_t == 1)
|
|
||||||
{
|
|
||||||
if (mtp3ObjState.lk_mtp3[chl] != mtp3_localip)
|
|
||||||
ls->send_asp_ac_link_id = chl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(0)
|
|
||||||
{
|
|
||||||
if(ls->links_available_t== 1)
|
|
||||||
{
|
|
||||||
if(ls->send_asp_ac_link_id == 0x00 || ls->send_asp_ac_link_id == 0xffff )
|
if(ls->send_asp_ac_link_id == 0x00 || ls->send_asp_ac_link_id == 0xffff )
|
||||||
{//for override mode
|
{//for override mode
|
||||||
ls->send_asp_ac_link_id = chl;
|
ls->send_asp_ac_link_id = chl;
|
||||||
|
|
||||||
m3ua_set_link_rc_to_m2ua(chl);
|
|
||||||
|
|
||||||
send_command_to_m3ua(chl, 1,M3UA_RC_CMD , rc, 0);
|
|
||||||
if(detail_debug_flag)
|
|
||||||
mtp3_debug(MTP3DB_EVENT,"<%s:%d> M3UA send RC_CMD, link=%d",
|
|
||||||
__FUNCTION__, __LINE__,
|
|
||||||
chl);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
mtp3ObjState.lk_mtp3[chl] = mtp3_localip;
|
||||||
//mtp3ObjState.lk_mtp3[chl] = mtp3_localip;
|
|
||||||
}
|
}
|
||||||
else if (mtp3ObjState.link_l2_state[chl] == MTP2_STATE_WORKING)
|
else if (mtp3ObjState.link_l2_state[chl] == MTP2_STATE_WORKING)
|
||||||
{
|
{
|
||||||
@@ -3579,7 +3513,6 @@ int m3ua_updateStatus(WORD chl, BYTE new_l2_state,BYTE command, DWORD rc, BYTE r
|
|||||||
|
|
||||||
if(ls->send_asp_ac_link_id == chl)
|
if(ls->send_asp_ac_link_id == chl)
|
||||||
ls->send_asp_ac_link_id = 0xFFFF;
|
ls->send_asp_ac_link_id = 0xFFFF;
|
||||||
|
|
||||||
ls->links_nls_asp_ac_send_flag[chl] = 0;
|
ls->links_nls_asp_ac_send_flag[chl] = 0;
|
||||||
|
|
||||||
ls->links_available_t = scan_ls_link_available(ls_t);
|
ls->links_available_t = scan_ls_link_available(ls_t);
|
||||||
@@ -3668,9 +3601,8 @@ int GetM3uaMsg(ulong port)
|
|||||||
|
|
||||||
chl = lm_lk_ptr->link;//???
|
chl = lm_lk_ptr->link;//???
|
||||||
new_l2_state = lm_lk_ptr->opercode;
|
new_l2_state = lm_lk_ptr->opercode;
|
||||||
if(new_l2_state)
|
|
||||||
m3ua_updateStatus(chl, new_l2_state, 0, 0 ,0);
|
m3ua_updateStatus(chl, new_l2_state, 0, 0 ,0);
|
||||||
mtp3_debug(MTP3DB_PRIMITIVE_MSG,"get M3UA link[%d], state=%d, heartbeat from %lx", chl, new_l2_state, msgSourceIP);
|
mtp3_debug(MTP3DB_PRIMITIVE_MSG,"get M3UA link heartbeat from %lx",msgSourceIP);
|
||||||
mtp3_showbuf(MTP3DB_PRIMITIVE_MSG,(BYTE *)mtp3_m3ua_msg,ntohs(lm_lk_ptr->len)+4);
|
mtp3_showbuf(MTP3DB_PRIMITIVE_MSG,(BYTE *)mtp3_m3ua_msg,ntohs(lm_lk_ptr->len)+4);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3787,22 +3719,9 @@ int GetM3uaMsg(ulong port)
|
|||||||
int send_command_to_m3ua(WORD link, BYTE command, BYTE xua_msg_class, DWORD rc, DWORD aff_pc)
|
int send_command_to_m3ua(WORD link, BYTE command, BYTE xua_msg_class, DWORD rc, DWORD aff_pc)
|
||||||
{
|
{
|
||||||
char charCmd[32];
|
char charCmd[32];
|
||||||
static int rc_cmd_counter=0, total_cmd_counter=0;
|
|
||||||
|
|
||||||
if(0)
|
|
||||||
{
|
|
||||||
if(rc_cmd_counter < 5 && total_cmd_counter++ < 100)
|
|
||||||
{
|
|
||||||
char buf[128];
|
|
||||||
|
|
||||||
sprintf(buf, "link=%d, cmd=%d, xmc=%d", link, command, xua_msg_class);
|
|
||||||
pub_print_traceback(buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(xua_msg_class == M3UA_RC_CMD)
|
if(xua_msg_class == M3UA_RC_CMD)
|
||||||
{
|
{
|
||||||
rc_cmd_counter ++;
|
|
||||||
mtp3_iprt.io_msg.msgLength = 5+1+4+1;
|
mtp3_iprt.io_msg.msgLength = 5+1+4+1;
|
||||||
mtp3_iprt.io_msg.msgContent[0] = xua_msg_class;
|
mtp3_iprt.io_msg.msgContent[0] = xua_msg_class;
|
||||||
mtp3_iprt.io_msg.msgContent[2] = link>>8;
|
mtp3_iprt.io_msg.msgContent[2] = link>>8;
|
||||||
@@ -3811,9 +3730,6 @@ int send_command_to_m3ua(WORD link, BYTE command, BYTE xua_msg_class, DWORD rc,
|
|||||||
mtp3_iprt.io_msg.msgContent[4] = 7;
|
mtp3_iprt.io_msg.msgContent[4] = 7;
|
||||||
mtp3_iprt.io_msg.msgContent[9] = command;
|
mtp3_iprt.io_msg.msgContent[9] = command;
|
||||||
memcpy(&mtp3_iprt.io_msg.msgContent[5], &rc, 4);
|
memcpy(&mtp3_iprt.io_msg.msgContent[5], &rc, 4);
|
||||||
|
|
||||||
sprintf(charCmd,"M3UA_ASP_Active");
|
|
||||||
|
|
||||||
}else if(xua_msg_class == M3UA_MGMT_CMD)
|
}else if(xua_msg_class == M3UA_MGMT_CMD)
|
||||||
{
|
{
|
||||||
mtp3_iprt.io_msg.msgLength = 5+1+1;
|
mtp3_iprt.io_msg.msgLength = 5+1+1;
|
||||||
@@ -3871,33 +3787,8 @@ void deactive_m3ua_lk(WORD link)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void m3ua_set_link_rc_to_m2ua(int linkno)
|
extern int m2ua_set_sg_rc(int linkno, int rc);
|
||||||
{
|
void check_m3ua_link_status()
|
||||||
int i;
|
|
||||||
WORD lsno, spplace;
|
|
||||||
BYTE nw;
|
|
||||||
DWORD rc;
|
|
||||||
network *sp;
|
|
||||||
ls_info *ls;
|
|
||||||
|
|
||||||
lsno = mtp3_para->lk[linkno].e1_to_linkset;
|
|
||||||
if (lsno >= MAX_LS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ls = &mtp3.ls[lsno];
|
|
||||||
nw = mtp3_para->ls_pro[lsno].nw_id;
|
|
||||||
sp = &mtp3.nw[nw];
|
|
||||||
|
|
||||||
for ( i=0; i<(ls->influ_dstnum_asNLS % MAX_LS_DPC_ADD1); i++ )
|
|
||||||
{
|
|
||||||
spplace = ls->influ_dstplace_intable_asNLS[i];
|
|
||||||
rc = mtp3_para->nw[nw].routing[spplace].rc;
|
|
||||||
m2ua_set_sg_rc(linkno, rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void check_m3ua_link_status(int force_flag)
|
|
||||||
{
|
{
|
||||||
int link,i;
|
int link,i;
|
||||||
WORD lsno, spplace;
|
WORD lsno, spplace;
|
||||||
@@ -3906,16 +3797,15 @@ void check_m3ua_link_status(int force_flag)
|
|||||||
network *sp;
|
network *sp;
|
||||||
ls_info *ls;
|
ls_info *ls;
|
||||||
static int link_timer=0;
|
static int link_timer=0;
|
||||||
int check_timer = ( mtp2_systemid * 30 + 400);
|
int check_timer = ( mtp2_systemid * 30 + 200);
|
||||||
int send_asp_ac_flag = 0;
|
int send_asp_ac_flag = 0;
|
||||||
|
|
||||||
if(rc_timer >= check_timer || force_flag)//2s
|
if(rc_timer >= check_timer)//2s
|
||||||
{
|
{
|
||||||
rc_timer = 0;
|
rc_timer = 0;
|
||||||
for(link=0;link<MAX_LK; link++)
|
for(link=0;link<MAX_LK; link++)
|
||||||
{
|
{
|
||||||
|
|
||||||
// if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && (mtp3_para->lk[link].admin_state& 1)&&(check_if_local_ip(mtp3ObjState.lk_mtp3[link] )) ) //mtp3_localip))
|
|
||||||
if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && (mtp3_para->lk[link].admin_state& 1)&&(mtp3ObjState.lk_mtp3[link] == mtp3_localip))
|
if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && (mtp3_para->lk[link].admin_state& 1)&&(mtp3ObjState.lk_mtp3[link] == mtp3_localip))
|
||||||
{
|
{
|
||||||
if(mtp3ObjState.link_l3_state[link] == AVAILABLE)
|
if(mtp3ObjState.link_l3_state[link] == AVAILABLE)
|
||||||
@@ -3972,38 +3862,11 @@ void check_m3ua_link_status(int force_flag)
|
|||||||
}
|
}
|
||||||
if(send_asp_ac_flag == 0)
|
if(send_asp_ac_flag == 0)
|
||||||
{
|
{
|
||||||
//ls->send_asp_ac_link_id = link; //
|
ls->send_asp_ac_link_id = link; //
|
||||||
if(0)
|
|
||||||
{
|
|
||||||
if(detail_debug_flag)
|
|
||||||
mtp3_debug(MTP3DB_EVENT,"<%s:%d> M3UA send RC_CMD, link=%d, total links=%d, sppace=%d, sp->routine=%d, act link=%d",
|
|
||||||
__FUNCTION__, __LINE__,
|
|
||||||
link,
|
|
||||||
ls->links_available_t,
|
|
||||||
spplace,
|
|
||||||
sp->routine[spplace],
|
|
||||||
ls->send_asp_ac_link_id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(ls->links_nls_asp_ac_send_flag[link] == 1)
|
|
||||||
send_asp_ac_flag = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(0)
|
|
||||||
mtp3_debug(MTP3DB_EVENT,"<%s:%d> link=%d, sppace=%d, sp->routine=%d, rc_status=%d, lk_asp_ac=%d",
|
|
||||||
__FUNCTION__, __LINE__,
|
|
||||||
link,
|
|
||||||
spplace,
|
|
||||||
sp->routine[spplace],
|
|
||||||
sp->m3ua_rc_status[spplace],
|
|
||||||
ls->links_nls_asp_ac_send_flag[link]);
|
|
||||||
|
|
||||||
|
|
||||||
if(sp->m3ua_rc_status[spplace]!=5 || ls->links_nls_asp_ac_send_flag[link] == 0 )
|
if(sp->m3ua_rc_status[spplace]!=5 || ls->links_nls_asp_ac_send_flag[link] == 0 )
|
||||||
{
|
{
|
||||||
@@ -4118,13 +3981,8 @@ void check_m3ua_link_status(int force_flag)
|
|||||||
{
|
{
|
||||||
if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && (mtp3_para->lk[link].admin_state& 1) &&(mtp3ObjState.lk_mtp3[link] == mtp3_localip))
|
if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && (mtp3_para->lk[link].admin_state& 1) &&(mtp3ObjState.lk_mtp3[link] == mtp3_localip))
|
||||||
{
|
{
|
||||||
if(mtp3ObjState.link_l3_state[link] == UNAVAILABLE || mtp3ObjState.link_enable_sent_flag[link] == 0)
|
if(mtp3ObjState.link_l3_state[link] == UNAVAILABLE)
|
||||||
{
|
|
||||||
mtp3ObjState.link_enable_sent_flag[link] = 1;
|
|
||||||
send_command_to_m3ua(link, MTP3_M3UA_ENABLE,M3UA_MGMT_CMD,0, 0);
|
send_command_to_m3ua(link, MTP3_M3UA_ENABLE,M3UA_MGMT_CMD,0, 0);
|
||||||
|
|
||||||
rc_timer = 100;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && mtp3ObjInput.lsac_input_from_mgmt[link] == LSAC_MGMT_DEACTIVATE_LINK)
|
/* if(MTP3_LINK_TYPE(link) == LKTYPE_M3UA && mtp3ObjInput.lsac_input_from_mgmt[link] == LSAC_MGMT_DEACTIVATE_LINK)
|
||||||
{
|
{
|
||||||
@@ -4144,7 +4002,7 @@ void check_m3ua_link_status(int force_flag)
|
|||||||
|
|
||||||
void m3ua_timer()
|
void m3ua_timer()
|
||||||
{
|
{
|
||||||
check_m3ua_link_status(0);
|
check_m3ua_link_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_mtp_msg(int outlink, BYTE *msgptr)
|
void send_mtp_msg(int outlink, BYTE *msgptr)
|
||||||
@@ -4264,9 +4122,7 @@ void send_mtp_msg(int outlink, BYTE *msgptr)
|
|||||||
/* debug show message */
|
/* debug show message */
|
||||||
if(pclen == MTP3_24BIT_PC)
|
if(pclen == MTP3_24BIT_PC)
|
||||||
{
|
{
|
||||||
// memmove(m3ua_ptr->msg.m3ua.content, msgptr+11+1, len-8-1);
|
memmove(m3ua_ptr->msg.m3ua.content, msgptr+11+1, len-8-1);
|
||||||
memmove(m3ua_ptr->msg.m3ua.content, msgptr+11+1, len-6-1);
|
|
||||||
|
|
||||||
dpc = 0;
|
dpc = 0;
|
||||||
opc = 0;
|
opc = 0;
|
||||||
sls = msgptr[11];
|
sls = msgptr[11];
|
||||||
@@ -4277,9 +4133,7 @@ void send_mtp_msg(int outlink, BYTE *msgptr)
|
|||||||
m3ua_ptr->msg_class = M3UA_MAUP_MSG;
|
m3ua_ptr->msg_class = M3UA_MAUP_MSG;
|
||||||
m3ua_ptr->msg.m3ua.ni = nw;
|
m3ua_ptr->msg.m3ua.ni = nw;
|
||||||
m3ua_ptr->msg.m3ua.si = msgptr[4] & 0x0f;
|
m3ua_ptr->msg.m3ua.si = msgptr[4] & 0x0f;
|
||||||
// m3ua_ptr->msg.m3ua.len = ntohs(len - 8 - 1 - 4); //m3ua_ptr->msg.m3ua.len = ntohs(len - 8-1); //modify by Jink on 2012-11-01
|
m3ua_ptr->msg.m3ua.len = ntohs(len - 8 - 1 - 4); //m3ua_ptr->msg.m3ua.len = ntohs(len - 8-1); //modify by Jink on 2012-11-01
|
||||||
m3ua_ptr->msg.m3ua.len = ntohs(len - 6 - 1 - 4); //m3ua_ptr->msg.m3ua.len = ntohs(len - 8-1); //modify by Jink on 2012-11-01
|
|
||||||
|
|
||||||
m3ua_ptr->msg.m3ua.mp = 0;
|
m3ua_ptr->msg.m3ua.mp = 0;
|
||||||
m3ua_ptr->msg.m3ua.sls = sls;
|
m3ua_ptr->msg.m3ua.sls = sls;
|
||||||
m3ua_ptr->msg.m3ua.rc = get_m3ua_rc_by_dpc(nw, m3ua_ptr->msg.m3ua.dpc, m3ua_ptr->msg.m3ua.opc);
|
m3ua_ptr->msg.m3ua.rc = get_m3ua_rc_by_dpc(nw, m3ua_ptr->msg.m3ua.dpc, m3ua_ptr->msg.m3ua.opc);
|
||||||
@@ -4419,7 +4273,6 @@ int update_route_by_other_plat(u32 dpc,BYTE nw, BYTE routine, WORD chl, u32 opc)
|
|||||||
lsno = mtp3_para->lk[chl].e1_to_linkset;
|
lsno = mtp3_para->lk[chl].e1_to_linkset;
|
||||||
ull opc_dpc=0;
|
ull opc_dpc=0;
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (lsno >= MAX_LS)
|
if (lsno >= MAX_LS)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4438,24 +4291,14 @@ int update_route_by_other_plat(u32 dpc,BYTE nw, BYTE routine, WORD chl, u32 opc)
|
|||||||
i = sort_rec->index[index];
|
i = sort_rec->index[index];
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
sp->routine[i] = routine;
|
||||||
if(detail_debug_flag)
|
if(detail_debug_flag)
|
||||||
mtp3_debug(MTP3DB_EVENT," <%s:%d> link=%d, linkset=%d, dpc=%d, sp->routine .local=%d,peer=%d",
|
mtp3_debug(MTP3DB_EVENT," <%s:%d> link=%d, linkset=%d, dpc=%d, sp->routine=%d",
|
||||||
__FUNCTION__, __LINE__,
|
__FUNCTION__, __LINE__,
|
||||||
chl,
|
chl,
|
||||||
lsno,
|
lsno,
|
||||||
dpc,
|
dpc,
|
||||||
sp->routine[i],
|
|
||||||
routine);
|
routine);
|
||||||
if(0)
|
|
||||||
if(sp->routine[i] != routine)
|
|
||||||
{
|
|
||||||
outroute = (sp->routine[i] >> 6) & 3;
|
|
||||||
if(outroute != 2)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sp->routine[i] = routine;
|
|
||||||
|
|
||||||
outroute = (routine >> 6) & 3;
|
outroute = (routine >> 6) & 3;
|
||||||
if ( outroute == 2 )/* no outbound route */
|
if ( outroute == 2 )/* no outbound route */
|
||||||
@@ -5010,15 +4853,12 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
|
|||||||
spplace = ls->influ_dstplace_intable_asNLS[i];
|
spplace = ls->influ_dstplace_intable_asNLS[i];
|
||||||
routine = (BYTE*)&sp->routine[spplace];
|
routine = (BYTE*)&sp->routine[spplace];
|
||||||
if(detail_debug_flag)
|
if(detail_debug_flag)
|
||||||
mtp3_debug(MTP3DB_EVENT,"\33[32m%s:%d : Link %d Linkset %d , routine: =%02x\33[0m",__FUNCTION__, __LINE__, chl, lsno,
|
mtp3_debug(MTP3DB_EVENT,"\33[32m%s: Link %d Linkset %d , routine: =%02x\33[0m",__FUNCTION__, chl, lsno,
|
||||||
*routine);
|
*routine);
|
||||||
|
|
||||||
mark_normal_linkset_available(routine); //117-11-07
|
|
||||||
|
|
||||||
if (Nlinkset_status(*routine) == LS_AVAILABLE)
|
if (Nlinkset_status(*routine) == LS_AVAILABLE)
|
||||||
{
|
{
|
||||||
*routine = ((*routine) & 0x3f);/* current route is normal linkset */
|
*routine = ((*routine) & 0x3f);/* current route is normal linkset */
|
||||||
if(1)
|
|
||||||
if(ls->links_nls_asp_ac_send_flag[spplace] == 0)
|
if(ls->links_nls_asp_ac_send_flag[spplace] == 0)
|
||||||
{
|
{
|
||||||
ls->links_nls_asp_ac_send_flag[spplace] = 1;
|
ls->links_nls_asp_ac_send_flag[spplace] = 1;
|
||||||
@@ -5028,7 +4868,6 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
|
|||||||
else if (Alinkset_status(*routine) == LS_AVAILABLE)
|
else if (Alinkset_status(*routine) == LS_AVAILABLE)
|
||||||
{
|
{
|
||||||
(*routine) = ((*routine) & 0x3f) + 0x40;
|
(*routine) = ((*routine) & 0x3f) + 0x40;
|
||||||
if(1)
|
|
||||||
if(ls->links_als_asp_ac_send_flag[spplace] == 0)
|
if(ls->links_als_asp_ac_send_flag[spplace] == 0)
|
||||||
{
|
{
|
||||||
ls->links_als_asp_ac_send_flag[spplace] = 1;
|
ls->links_als_asp_ac_send_flag[spplace] = 1;
|
||||||
@@ -5037,29 +4876,18 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//mark_normal_linkset_available(routine);
|
mark_normal_linkset_available(routine);
|
||||||
|
|
||||||
(*routine) = ((*routine) & 0x3f) + 0x80;
|
(*routine) = ((*routine) & 0x3f) + 0x80;
|
||||||
|
|
||||||
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
|
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,AVAILABLE);
|
||||||
}
|
}
|
||||||
if(detail_debug_flag)
|
|
||||||
mtp3_debug(MTP3DB_EVENT,"\33[32m%s:%d : Link %d Linkset %d , routine: =%02x\33[0m",__FUNCTION__, __LINE__, chl, lsno,
|
|
||||||
*routine);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i=0; i<(ls->influ_dstnum_asALS % MAX_LS_DPC_ADD1); i++ )
|
for ( i=0; i<(ls->influ_dstnum_asALS % MAX_LS_DPC_ADD1); i++ )
|
||||||
{
|
{
|
||||||
spplace = ls->influ_dstplace_intable_asALS[i];
|
spplace = ls->influ_dstplace_intable_asALS[i];
|
||||||
routine = (BYTE*)&sp->routine[spplace];
|
routine = (BYTE*)&sp->routine[spplace];
|
||||||
|
|
||||||
if(detail_debug_flag)
|
|
||||||
mtp3_debug(MTP3DB_EVENT,"\33[32m%s:%d : Link %d Linkset %d , ssplace=%d, routine: =%02x\33[0m",__FUNCTION__, __LINE__, chl, lsno,
|
|
||||||
spplace, *routine);
|
|
||||||
|
|
||||||
mark_alternative_linkset_available(routine); //17-11-07
|
|
||||||
|
|
||||||
if ( (*routine) >> 6 == 2 )/* no route */
|
if ( (*routine) >> 6 == 2 )/* no route */
|
||||||
{
|
{
|
||||||
(*routine) = ((*routine) & 0x3f) + 0x40;/* current route is alternative linkset */
|
(*routine) = ((*routine) & 0x3f) + 0x40;/* current route is alternative linkset */
|
||||||
@@ -5073,36 +4901,23 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
|
|||||||
else
|
else
|
||||||
(*routine) = ((*routine) & 0x3f) + 0x80;
|
(*routine) = ((*routine) & 0x3f) + 0x80;
|
||||||
|
|
||||||
if(1)
|
|
||||||
if(ls->links_als_asp_ac_send_flag[spplace] == 0)
|
if(ls->links_als_asp_ac_send_flag[spplace] == 0)
|
||||||
{
|
{
|
||||||
ls->links_als_asp_ac_send_flag[spplace] = 1;
|
ls->links_als_asp_ac_send_flag[spplace] = 1;
|
||||||
ls->send_asp_ac_link_id = chl;
|
ls->send_asp_ac_link_id = chl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(detail_debug_flag)
|
|
||||||
mtp3_debug(MTP3DB_EVENT,"\33[32m%s:%d : Link %d Linkset %d , routine: =%02x\33[0m",__FUNCTION__, __LINE__, chl, lsno,
|
|
||||||
*routine);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//if (mtp3ObjState.lk_mtp3[chl] == mtp3_localip) for dual alarm issue
|
//if (mtp3ObjState.lk_mtp3[chl] == mtp3_localip) for dual alarm issue
|
||||||
mtp3_send_alarm(lsno+MTP3_LINKSET_COMPONENT,0);
|
mtp3_send_alarm(lsno+MTP3_LINKSET_COMPONENT,0);
|
||||||
set_heartbeat(ALARM_LS_AVAILABLE,lsno);
|
set_heartbeat(ALARM_LS_AVAILABLE,lsno);
|
||||||
mtp3_para->ls_pro[lsno].ls_state = 1;//ALARM_LS_AVAILABLE;
|
mtp3_para->ls_pro[lsno].ls_state = 1;//ALARM_LS_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
if (mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
|
||||||
|
mtp3_send_alarm(MTP3_LINK_COMPONENT+chl,0);
|
||||||
|
|
||||||
ls->links_available_t = scan_ls_link_available(lsno);
|
ls->links_available_t = scan_ls_link_available(lsno);
|
||||||
|
|
||||||
if (mtp3ObjState.lk_mtp3[chl] == mtp3_localip)
|
|
||||||
mtp3_send_alarm(MTP3_LINK_COMPONENT+chl,0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(ls->links_available_t >= 1)
|
|
||||||
{
|
|
||||||
if(ls->send_asp_ac_link_id == 0 || ls->send_asp_ac_link_id == 0xffff)
|
|
||||||
ls->send_asp_ac_link_id = chl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ls->links_available_t > 0 )
|
if ( ls->links_available_t > 0 )
|
||||||
{
|
{
|
||||||
@@ -5115,15 +4930,12 @@ void hmrt_tcbc_update_routing_tables(WORD chl)
|
|||||||
mtp3_debug(MTP3DB_EVENT,"\33[32m%s: Link %d L3 in service,Linkset %d in service\33[0m",__FUNCTION__, chl,lsno);
|
mtp3_debug(MTP3DB_EVENT,"\33[32m%s: Link %d L3 in service,Linkset %d in service\33[0m",__FUNCTION__, chl,lsno);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(link_already_available != AVAILABLE)
|
if(link_already_available != AVAILABLE)
|
||||||
ls->links_available_t++;
|
ls->links_available_t++;
|
||||||
else
|
else
|
||||||
mtp3_debug(MTP3DB_ERROR,"update routing table fail, links=%d have already available", chl);
|
mtp3_debug(MTP3DB_ERROR,"update routing table fail, links=%d have already available", chl);
|
||||||
*/
|
|
||||||
|
|
||||||
current_measure->lk_measure1[chl][1]++;/* local changeback */
|
current_measure->lk_measure1[chl][1]++;/* local changeback */
|
||||||
|
|
||||||
// printf("\r\n tcbc %d update routine cmp link_available = %d \n\r",chl, ls->links_available_t);
|
// printf("\r\n tcbc %d update routine cmp link_available = %d \n\r",chl, ls->links_available_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5156,11 +4968,7 @@ void hmrt_tcoc_update_routing_tables(WORD chl)
|
|||||||
if (link_inhibited[chl] == TRUE)
|
if (link_inhibited[chl] == TRUE)
|
||||||
mtp3ObjState.link_l3_state[chl] = INHIBITED;
|
mtp3ObjState.link_l3_state[chl] = INHIBITED;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
mtp3ObjState.link_l3_state[chl] = UNAVAILABLE;
|
mtp3ObjState.link_l3_state[chl] = UNAVAILABLE;
|
||||||
mtp3ObjState.link_enable_sent_flag[chl] = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
set_heartbeat(ALARM_LINK_UNAVAILABLE,chl);
|
set_heartbeat(ALARM_LINK_UNAVAILABLE,chl);
|
||||||
|
|
||||||
@@ -5213,9 +5021,8 @@ void hmrt_tcoc_update_routing_tables(WORD chl)
|
|||||||
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
|
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
|
||||||
sp->m3ua_rc_status[spplace] = 0;
|
sp->m3ua_rc_status[spplace] = 0;
|
||||||
}
|
}
|
||||||
if(detail_debug_flag)
|
mtp3_debug(MTP3DB_ERROR,"%s, Link=%d, changeover DPC=%d", __FUNCTION__, chl,
|
||||||
mtp3_debug(MTP3DB_ERROR,"%s:%d, Link=%d, changeover DPC=%d, rc_status=%d", __FUNCTION__, __LINE__,
|
mtp3_para->nw[nw].routing[spplace].dpc);
|
||||||
chl, mtp3_para->nw[nw].routing[spplace].dpc, sp->m3ua_rc_status[spplace]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5228,10 +5035,6 @@ void hmrt_tcoc_update_routing_tables(WORD chl)
|
|||||||
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
|
primitive_to_userpart(nw,mtp3_para->nw[nw].routing[spplace].dpc,UNAVAILABLE);
|
||||||
sp->m3ua_rc_status[spplace] = 0;
|
sp->m3ua_rc_status[spplace] = 0;
|
||||||
}
|
}
|
||||||
if(detail_debug_flag)
|
|
||||||
mtp3_debug(MTP3DB_ERROR,"%s:%d, Link=%d, changeover DPC=%d, rc_status=%d", __FUNCTION__, __LINE__,
|
|
||||||
chl, mtp3_para->nw[nw].routing[spplace].dpc, sp->m3ua_rc_status[spplace]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//memset(&ls_sls[lsx16],MAX_LK,16);
|
//memset(&ls_sls[lsx16],MAX_LK,16);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
//#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <sys/msg.h>
|
#include <sys/msg.h>
|
||||||
#include <sys/sem.h>
|
#include <sys/sem.h>
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ static int GetSysCreatedTime()
|
|||||||
unsigned char created_time_des[128] = {0}, TmpStr[64]= {0};
|
unsigned char created_time_des[128] = {0}, TmpStr[64]= {0};
|
||||||
|
|
||||||
memset(created_time, 0, 64);
|
memset(created_time, 0, 64);
|
||||||
//sprintf(buf,"tune2fs -l /dev/sda1 | grep create >../log/created_time.txt");
|
sprintf(buf,"tune2fs -l /dev/sda1 | grep create >../log/created_time.txt");
|
||||||
sprintf(buf,"ls -lact --full-time /etc | tail -1 | awk '{print $6,$7}' >../log/created_time.txt");
|
|
||||||
system(buf);
|
system(buf);
|
||||||
fpConf = fopen("../log/created_time.txt","r");
|
fpConf = fopen("../log/created_time.txt","r");
|
||||||
if(fpConf != NULL)
|
if(fpConf != NULL)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
//#include <sys/io.h>
|
#include <sys/io.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include "scoc_if.h"
|
#include "scoc_if.h"
|
||||||
#include "../../../public/src/include/includes.h"
|
#include "../../../public/src/include/includes.h"
|
||||||
@@ -440,43 +440,43 @@ static const StringVal sp_co_instanceside_str[] =
|
|||||||
static const StringVal co_reason_str[] = {
|
static const StringVal co_reason_str[] = {
|
||||||
//reason : originated network serice provider
|
//reason : originated network serice provider
|
||||||
{REA_PDISC_ACNN,
|
{REA_PDISC_ACNN,
|
||||||
"disconnection ¨Cabnormal condition(non-transient nature)" },
|
"disconnection �Cabnormal condition(non-transient nature)" },
|
||||||
{REA_PDISC_ACTN, "disconnection ¨Cabnormal condition of transient nature"},
|
{REA_PDISC_ACTN, "disconnection �Cabnormal condition of transient nature"},
|
||||||
{REA_PDISC_IS, "disconnection ¨Cinvalid state1" },
|
{REA_PDISC_IS, "disconnection �Cinvalid state1" },
|
||||||
{REA_PDISC_RIP, "disconnection ¨Crelease in progress1" },
|
{REA_PDISC_RIP, "disconnection �Crelease in progress1" },
|
||||||
{REA_PCREF_DAU, "CREF2 ¨Cdestination address unknown " },
|
{REA_PCREF_DAU, "CREF2 �Cdestination address unknown " },
|
||||||
{REA_PCREF_DINC,
|
{REA_PCREF_DINC,
|
||||||
"CREF2 ¨Cdestination inaccessible/non-transient condition" },
|
"CREF2 �Cdestination inaccessible/non-transient condition" },
|
||||||
{REA_PCREF_DITCs, "CREF2 ¨Cdestination inaccessible/transient condition" },
|
{REA_PCREF_DITCs, "CREF2 �Cdestination inaccessible/transient condition" },
|
||||||
{REA_PCREF_QNANC, "CREF2 ¨CQOS not available/non-transient condition" },
|
{REA_PCREF_QNANC, "CREF2 �CQOS not available/non-transient condition" },
|
||||||
{REA_PCREF_QNATC, "CREF2 ¨CQOS not available/transient condition" },
|
{REA_PCREF_QNATC, "CREF2 �CQOS not available/transient condition" },
|
||||||
{REA_PCREF_RUNC, "CREF2 ¨Creason unspecified/non-transient condition" },
|
{REA_PCREF_RUNC, "CREF2 �Creason unspecified/non-transient condition" },
|
||||||
{REA_PCREF_RUTC, "CREF2 ¨Creason unspecified/transient condition" },
|
{REA_PCREF_RUTC, "CREF2 �Creason unspecified/transient condition" },
|
||||||
{REA_PCREF_LE, "CREF2 ¨Clocal error1" },
|
{REA_PCREF_LE, "CREF2 �Clocal error1" },
|
||||||
{REA_PCREF_IS, "CREF2 ¨Cinvalid state1" },
|
{REA_PCREF_IS, "CREF2 �Cinvalid state1" },
|
||||||
{REA_PCREF_NT, "CREF2 ¨Cno translation1" },
|
{REA_PCREF_NT, "CREF2 �Cno translation1" },
|
||||||
{REA_PCREF_IRP, "CREF2 ¨Cin restart phase1" },
|
{REA_PCREF_IRP, "CREF2 �Cin restart phase1" },
|
||||||
{REA_PCREF_HCV, "CREF2 ¨Chop counter violation" },
|
{REA_PCREF_HCV, "CREF2 �Chop counter violation" },
|
||||||
|
|
||||||
//reason : originated network serice user
|
//reason : originated network serice user
|
||||||
{REA_UDISC_NC, "disconnection ¨Cnormal condition" },
|
{REA_UDISC_NC, "disconnection �Cnormal condition" },
|
||||||
{REA_UDISC_ABC, "disconnection ¨Cabnormal condition" },
|
{REA_UDISC_ABC, "disconnection �Cabnormal condition" },
|
||||||
{REA_UDISC_EUC, "disconnection ¨Cend user congestion" },
|
{REA_UDISC_EUC, "disconnection �Cend user congestion" },
|
||||||
{REA_UDISC_EUF, "disconnection ¨Cend user failure" },
|
{REA_UDISC_EUF, "disconnection �Cend user failure" },
|
||||||
{REA_UDISC_SUO, "disconnection ¨CSCCP user originated" },
|
{REA_UDISC_SUO, "disconnection �CSCCP user originated" },
|
||||||
{REA_UDISC_ACC, "disconnection ¨Caccess congestion" },
|
{REA_UDISC_ACC, "disconnection �Caccess congestion" },
|
||||||
{REA_UDISC_AF, "disconnection ¨Caccess failure" },
|
{REA_UDISC_AF, "disconnection �Caccess failure" },
|
||||||
{REA_UDISC_SC, "disconnection ¨Csubsystem congestion" },
|
{REA_UDISC_SC, "disconnection �Csubsystem congestion" },
|
||||||
{REA_UCREF_NTC, "CREF2¨Cnon-transient condition" },
|
{REA_UCREF_NTC, "CREF2�Cnon-transient condition" },
|
||||||
{REA_UCREF_TC, "CREF2¨Ctransient condition" },
|
{REA_UCREF_TC, "CREF2�Ctransient condition" },
|
||||||
{REA_UCREF_IIIN, "CREF2¨Cincompatible information in NSDUs" },
|
{REA_UCREF_IIIN, "CREF2�Cincompatible information in NSDUs" },
|
||||||
{REA_UCREF_EUO, "CREF2¨Cend user originated" },
|
{REA_UCREF_EUO, "CREF2�Cend user originated" },
|
||||||
{REA_UCREF_EUC, "CREF2¨Cend user congestion" },
|
{REA_UCREF_EUC, "CREF2�Cend user congestion" },
|
||||||
{REA_UCREF_EUF, "CREF2¨Cend user failure" },
|
{REA_UCREF_EUF, "CREF2�Cend user failure" },
|
||||||
{REA_UCREF_SUO, "CREF2 ¨CSCCP user originated" },
|
{REA_UCREF_SUO, "CREF2 �CSCCP user originated" },
|
||||||
{REA_UCREF_ACC, "CREF2 ¨Caccess congestion" },
|
{REA_UCREF_ACC, "CREF2 �Caccess congestion" },
|
||||||
{REA_UCREF_AF, "CREF2 ¨Caccess failure" },
|
{REA_UCREF_AF, "CREF2 �Caccess failure" },
|
||||||
{REA_UCREF_SC, "CREF2 ¨Csubsystem congestion" },
|
{REA_UCREF_SC, "CREF2 �Csubsystem congestion" },
|
||||||
|
|
||||||
//Notice service reason : N-inform values
|
//Notice service reason : N-inform values
|
||||||
{REA_NINFO_FAIL, "work service provider failure" },
|
{REA_NINFO_FAIL, "work service provider failure" },
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ int get_raminfo(hb_sysinfo *info)
|
|||||||
unsigned char rb,prb;
|
unsigned char rb,prb;
|
||||||
int field_id=0;
|
int field_id=0;
|
||||||
int field_id2=0;
|
int field_id2=0;
|
||||||
char field_value[256][256];
|
char field_value[128][64];
|
||||||
FILE *mem_fp=NULL;
|
FILE *mem_fp=NULL;
|
||||||
|
|
||||||
if((mem_fp=fopen("/proc/meminfo","r"))==NULL)
|
if((mem_fp=fopen("/proc/meminfo","r"))==NULL)
|
||||||
|
|||||||
Reference in new issue
Block a user