update_lead NOT AN ALLOWED LIST ID

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

update_lead NOT AN ALLOWED LIST ID

Postby rockgeneral » Wed Mar 08, 2023 1:16 pm

I am trying to use the non-agent API update_lead function to upsert a lead into one of our Vicidial servers. The api user level is >= 8 and Modify Leads = 1 on the users ADMIN INTERFACE OPTIONS section. Agent API Access = 1 API Allowed Functions = ALL_FUNCTIONS

However, when I execute the following I am receiving an error: (sensitive bits have been replaced with X)
http://XXX.XXX.XXX.XXX/vicidial/non_agent_api.php?user=XXXX&pass=XXXXXXX&function=update_lead&source=ringba_upsert_lead&search_method=PHONE_NUMBER&search_location=LIST&list_id=1277&insert_if_not_found=Y&phone_code=1&phone_number=7327522761&source_id=aabbccdd

NOTICE: update_lead NO MATCHES FOUND IN THE SYSTEM: |XXXX|||7327522761
ERROR: update_lead NOT AN ALLOWED LIST ID - 7327522761|1277

Are there any other settings that need to be applied to allow the update_lead api function to work on list_id 1277 ?
System Info:
ViciBox_v9.x86_64-9.0.2.iso | Version: 2.14b0.5 SVN: 3551 | DB Schema Version: 1650 | Asterisk 13.29.2-vici | Single Server
rockgeneral
 
Posts: 93
Joined: Thu Mar 04, 2010 9:28 pm

Re: update_lead NOT AN ALLOWED LIST ID

Postby jjohnson78 » Wed Mar 08, 2023 1:57 pm

"ERROR: update_lead NOT AN ALLOWED LIST ID - 7327522761|1277"

This happens when the list you're trying to insert/update to is not an "allowed list". Users belong to user groups, which in turn have campaigns they are allowed access to. Allowed lists would be lists from those campaigns.

Three things to check:

1. What user group the user specified by the string "user=XXXX&pass=XXXXXXX" in your non_agent_api.php URL call belongs to.
2. Make sure that user group from #1 has allowed campaigns set on it.
3. Make sure list ID 1277 belongs to one of the campaigns that the user group is allowed access to.
jjohnson78
 
Posts: 57
Joined: Thu May 08, 2008 8:18 am

Re: update_lead NOT AN ALLOWED LIST ID

Postby rockgeneral » Wed Mar 08, 2023 4:08 pm

The user is in the User Group = ADMIN

The User Group ADMIN has ALL-CAMPAIGN selected in the Allowed Campaigns section

The campaign ID that this list is associated with = INSURANC

The Admin User Group on the INSURANC campaign = ADMIN

I even tried setting the Admin User Group in the INSURANC campaign = ---ALL--- and still no luck.

Is there anything else I can try?
System Info:
ViciBox_v9.x86_64-9.0.2.iso | Version: 2.14b0.5 SVN: 3551 | DB Schema Version: 1650 | Asterisk 13.29.2-vici | Single Server
rockgeneral
 
Posts: 93
Joined: Thu Mar 04, 2010 9:28 pm

Re: update_lead NOT AN ALLOWED LIST ID

Postby jjohnson78 » Wed Mar 08, 2023 4:26 pm

Make sure the "Allow Web DB Debug" setting is turned on in your system settings, and retry the URL again, except append a "&DB=1" to the end of it like so:

http://XXX.XXX.XXX.XXX/vicidial/non_age ... d=aabbccdd&DB=1

Show the entire output of the attempt - included among the output will be a statement that reads

"SELECT list_id from vicidial_lists ... order by list_id;"

Right after that there should be text reading

"Allowed lists:|< allowed lists for user>|<SQL clause used to compile approved lists>|"

This will tell you how the API is determining what lists the user account you're using the API with is allowed to post to.
jjohnson78
 
Posts: 57
Joined: Thu May 08, 2008 8:18 am

Re: update_lead NOT AN ALLOWED LIST ID

Postby rockgeneral » Wed Mar 08, 2023 4:36 pm

Thanks again for the help. 1277 appears in the Allowed Lists.

I wonder, have I hit some sort of limit by having too many list_id in the system?

DEBUG: auth query - SELECT api_list_restrict,api_allowed_functions,user_group,selected_language from vicidial_users
where user='6667' and active='Y';
|SELECT allowed_campaigns from vicidial_user_groups where user_group='ADMIN';|
|SELECT list_id from vicidial_lists order by list_id;|
Allowed lists:| 860 980 981 982 983 984 985 986 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012
1013 1014 1015 1016 1017 1018 1019 1020 1021 1023 1024 1025 1026 1027 1028 1030 1031 1032 1033 1034 1035 1036 1037 1038
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1088
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208
1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256
1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 |
DEBUG: Checking for phone_number - 7327522761
NOTICE: update_lead NO MATCHES FOUND IN THE SYSTEM: |6667|||7327522761
ERROR: update_lead NOT AN ALLOWED LIST ID - 7327522761|1277
System Info:
ViciBox_v9.x86_64-9.0.2.iso | Version: 2.14b0.5 SVN: 3551 | DB Schema Version: 1650 | Asterisk 13.29.2-vici | Single Server
rockgeneral
 
Posts: 93
Joined: Thu Mar 04, 2010 9:28 pm

Re: update_lead NOT AN ALLOWED LIST ID

Postby rockgeneral » Wed Mar 08, 2023 5:02 pm

I was comparing the output of the query below on the server where updated_lead was NOT working vs another server where update_lead was working.

SELECT api_list_restrict,api_allowed_functions,user_group,selected_language from vicidial_users
where user='6667' and active='Y';

api_list_restrict = 1 on the server that is not working
api_list_restrict = 0 on the server that it was working

I went into User 6667 on the server that is NOT working and updated API List Restrict = 0

After changing this setting update_lead call is NOW working.

I am still confused as to why it was not working when the user group that this user was in had ALL campaigns allowed and the debug output showed the list I was trying to update, but at least it is working...
System Info:
ViciBox_v9.x86_64-9.0.2.iso | Version: 2.14b0.5 SVN: 3551 | DB Schema Version: 1650 | Asterisk 13.29.2-vici | Single Server
rockgeneral
 
Posts: 93
Joined: Thu Mar 04, 2010 9:28 pm

Re: update_lead NOT AN ALLOWED LIST ID

Postby jjohnson78 » Wed Mar 08, 2023 5:14 pm

It's because of this section of coding starting at line 14293:

Code: Select all
                        if ( ($api_list_restrict > 0) and ($list_id >= 99) )
                           {
                           if (!preg_match("/ $search_lead_list[$n] /",$allowed_lists))
                              {
                              $result = 'ERROR';
                              $result_reason = "update_lead NOT AN ALLOWED LIST ID";
                              $data = "$phone_number|$list_id";
                              echo "$result: $result_reason - $data\n";
                              api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
                              exit;
                              }
                           }


See, with the api_list_restrict set to 1, and the list_id being 1277 (i.e. greater than 99), the coding within that "if" statement is doing that allowed list ID check that keeps failing.

By setting the api_list_restrict to 0, it's skipping that "if" section, i.e. not doing the allowed list check.
jjohnson78
 
Posts: 57
Joined: Thu May 08, 2008 8:18 am

Re: update_lead NOT AN ALLOWED LIST ID

Postby jjohnson78 » Wed Mar 08, 2023 5:18 pm

Additionally, is phone number 7327522761 on any list at all in your system? Because if not, then this may be a bug that needs a minor tweak.

Because the "if (!preg_match("/ $search_lead_list[$n] /",$allowed_lists))" statement here is failing. There should be a value for "$search_lead_list[$n]", which is an array that stores all the list ID matches in your system. If that phone number is not in your system at all, then the $search_lead_list array is empty, and that's causing the failure. $search_lead_list should at least contain the list ID 1277 that you're trying to insert into, I think.

OR, that statement should read:

"if (!preg_match("/ $list_id /",$allowed_lists))"

Of course, if the user account you're using is a "super user" account that should have access to all the lists, then what you did by turning off the "API List Restrict" setting should be sufficient, as that user setting is specifically to enforce user list restrictions, and a high-level admin user account wouldn't need that.
jjohnson78
 
Posts: 57
Joined: Thu May 08, 2008 8:18 am

Re: update_lead NOT AN ALLOWED LIST ID

Postby rockgeneral » Wed Mar 08, 2023 5:59 pm

jjohnson78 Thanks so much for all you help!
System Info:
ViciBox_v9.x86_64-9.0.2.iso | Version: 2.14b0.5 SVN: 3551 | DB Schema Version: 1650 | Asterisk 13.29.2-vici | Single Server
rockgeneral
 
Posts: 93
Joined: Thu Mar 04, 2010 9:28 pm


Return to Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 82 guests