|
@@ -313,6 +313,7 @@ mytime()\
|
|
|
printf("some feild is empty!\n");
|
|
|
continue;
|
|
|
}
|
|
|
+ int setout = 1;
|
|
|
fprintf(conf_fp, "[DialRule_%s]\n",g_row[1]);
|
|
|
memset(sql_tmp,0,sizeof(sql_tmp));
|
|
|
sprintf(sql_tmp,"select exten from t_paging_deviceGroups JOIN t_paging_groups on t_paging_groups.id = t_paging_deviceGroups.GroupId where DeviceId = %s",g_row[0]);
|
|
@@ -328,6 +329,36 @@ mytime()\
|
|
|
}
|
|
|
fprintf(conf_fp, "include => extens-group-%s\n", d_row[0]);
|
|
|
}
|
|
|
+ memset(sql_tmp,0,sizeof(sql_tmp));
|
|
|
+ sprintf(sql_tmp,"select exten,t_paging_userServices.tPagingServiceId as service_id from t_paging_groups\
|
|
|
+ JOIN t_paging_userGroups on t_paging_groups.id = t_paging_userGroups.GroupId\
|
|
|
+ JOIN t_paging_userServices on t_paging_userServices.UserId = t_paging_userGroups.UserId\
|
|
|
+ where t_paging_userServices.tPagingServiceId in(1,4,9) and t_paging_userGroups.UserId\
|
|
|
+ in(select t_paging_users.id from t_paging_users join t_paging_devices on t_paging_users.id = t_paging_devices.user_id\
|
|
|
+ where t_paging_devices.exten=%s) order by t_paging_userServices.tPagingServiceId",g_row[1]);
|
|
|
+ if (executesql(sql_tmp)){
|
|
|
+ print_mysql_error(NULL);
|
|
|
+ exit(1);
|
|
|
+ }
|
|
|
+ d_res = mysql_store_result(g_conn); // 从服务器传送结果集至本地,mysql_use_result直接使用服务器上的记录集
|
|
|
+ while ((d_row=mysql_fetch_row(d_res))){ // 打印结果集
|
|
|
+ if (d_row[0] == NULL || d_row[1] == NULL){
|
|
|
+ printf("some feild is empty!\n");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ int id = atoi(d_row[1]);
|
|
|
+ switch(id){
|
|
|
+ case 1:
|
|
|
+ fprintf(conf_fp, "include => paging-group-%s\n", d_row[0]);
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ if(setout){
|
|
|
+ fprintf(conf_fp, "include => CallingRule_OutCall\n");
|
|
|
+ setout = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//IP话机根据所绑定的用户赋予所在group的权限。
|
|
@@ -343,6 +374,7 @@ mytime()\
|
|
|
printf("some feild is empty!\n");
|
|
|
continue;
|
|
|
}
|
|
|
+ int setout = 1;
|
|
|
fprintf(conf_fp, "[DialRule_%s]\n",g_row[0]);
|
|
|
memset(sql_tmp,0,sizeof(sql_tmp));
|
|
|
sprintf(sql_tmp,"select exten,t_paging_userServices.tPagingServiceId as service_id from t_paging_groups\
|
|
@@ -350,7 +382,7 @@ mytime()\
|
|
|
JOIN t_paging_userServices on t_paging_userServices.UserId = t_paging_userGroups.UserId\
|
|
|
where t_paging_userServices.tPagingServiceId in(1,4,9) and t_paging_userGroups.UserId\
|
|
|
in(select t_paging_users.id from t_paging_users join t_paging_devices on t_paging_users.id = t_paging_devices.user_id\
|
|
|
- where t_paging_devices.exten=%s)",g_row[0]);
|
|
|
+ where t_paging_devices.exten=%s) order by t_paging_userServices.tPagingServiceId",g_row[0]);
|
|
|
if (executesql(sql_tmp)){
|
|
|
print_mysql_error(NULL);
|
|
|
exit(1);
|
|
@@ -370,7 +402,10 @@ mytime()\
|
|
|
fprintf(conf_fp, "include => extens-group-%s\n", d_row[0]);
|
|
|
break;
|
|
|
case 9:
|
|
|
- fprintf(conf_fp, "include => CallingRule_OutCall\n");
|
|
|
+ if(setout){
|
|
|
+ fprintf(conf_fp, "include => CallingRule_OutCall\n");
|
|
|
+ setout = 0;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|