Added menu_id option for add_did and update_did Non-Agent API functions

git-svn-id: svn://192.168.202.10@3355 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2021-02-17 20:39:46 +00:00
parent e241c28ae2
commit 956463aecf
3 changed files with 55 additions and 7 deletions
+6 -1
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-02-16 NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-02-17
This document describes the functions of an API(Application Programming This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -173,6 +173,7 @@ Changes:
210209-2014 - Added add_did function 210209-2014 - Added add_did function
210210-1627 - Added duplicate check with more X-day options for add_lead function 210210-1627 - Added duplicate check with more X-day options for add_lead function
210216-1415 - Added list_exists_check option for add_lead function 210216-1415 - Added list_exists_check option for add_lead function
210217-1454 - Added menu_id option for add_did and update_did functions
API Functions use the 'function' variable API Functions use the 'function' variable
@@ -2047,6 +2048,7 @@ voicemail_ext - 1-10 digits
phone_extension - 1-100 characters phone_extension - 1-100 characters
server_ip - must be all numbers and dots, max 15 characters server_ip - must be all numbers and dots, max 15 characters
group - a valid in-group group_id group - a valid in-group group_id
menu_id - a valid call menu menu_id
filter_clean_cid_number - 1-20 characters filter_clean_cid_number - 1-20 characters
Example URL strings for API calls: Example URL strings for API calls:
@@ -2068,6 +2070,7 @@ ERROR: add_did VOICEMAIL EXTENSION MUST BE FROM 1 TO 10 CHARACTERS, THIS IS AN O
ERROR: add_did PHONE EXTENSION MUST BE FROM 1 TO 100 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666| ERROR: add_did PHONE EXTENSION MUST BE FROM 1 TO 100 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666|
ERROR: add_did SERVER IP MUST BE A VALID SERVER IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|0.0.0.0 ERROR: add_did SERVER IP MUST BE A VALID SERVER IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|0.0.0.0
ERROR: add_did GROUP ID MUST BE A VALID INBOUND GROUP IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|test ERROR: add_did GROUP ID MUST BE A VALID INBOUND GROUP IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|test
ERROR: add_did MENU ID MUST BE A VALID CALL MENU IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|test_menu
ERROR: add_did CLEAN CID NUMBER MUST BE FROM 1 TO 20 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666| ERROR: add_did CLEAN CID NUMBER MUST BE FROM 1 TO 20 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666|
SUCCESS: add_did DID HAS BEEN ADDED - 6666|1101 SUCCESS: add_did DID HAS BEEN ADDED - 6666|1101
@@ -2096,6 +2099,7 @@ voicemail_ext - 1-10 digits
phone_extension - 1-100 characters phone_extension - 1-100 characters
server_ip - must be all numbers and dots, max 15 characters server_ip - must be all numbers and dots, max 15 characters
group - a valid in-group group_id group - a valid in-group group_id
menu_id - a valid call menu menu_id
filter_clean_cid_number - 1-20 characters filter_clean_cid_number - 1-20 characters
delete_did - Can be one of these: 'Y','N' (default is 'N') delete_did - Can be one of these: 'Y','N' (default is 'N')
@@ -2119,6 +2123,7 @@ ERROR: update_did VOICEMAIL EXTENSION MUST BE FROM 1 TO 10 CHARACTERS, THIS IS A
ERROR: update_did PHONE EXTENSION MUST BE FROM 1 TO 100 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666| ERROR: update_did PHONE EXTENSION MUST BE FROM 1 TO 100 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666|
ERROR: update_did SERVER IP MUST BE A VALID SERVER IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|0.0.0.0 ERROR: update_did SERVER IP MUST BE A VALID SERVER IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|0.0.0.0
ERROR: update_did GROUP ID MUST BE A VALID INBOUND GROUP IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|test ERROR: update_did GROUP ID MUST BE A VALID INBOUND GROUP IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|test
ERROR: update_did MENU ID MUST BE A VALID CALL MENU IN THE SYSTEM, THIS IS AN OPTIONAL FIELD - 6666|test_menu
ERROR: update_did CLEAN CID NUMBER MUST BE FROM 1 TO 20 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666| ERROR: update_did CLEAN CID NUMBER MUST BE FROM 1 TO 20 CHARACTERS, THIS IS AN OPTIONAL FIELD - 6666|
NOTICE: update_did NO UPDATES DEFINED - 6666| NOTICE: update_did NO UPDATES DEFINED - 6666|
SUCCESS: update_did DID HAS BEEN DELETED - 6666|23|1101 SUCCESS: update_did DID HAS BEEN DELETED - 6666|23|1101
@@ -1,4 +1,4 @@
# version: 20210211025401 # version: 20210217145101
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ> users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ> users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ> users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
@@ -233,7 +233,7 @@ campaigns-dial_prefix Dial Prefix <QXZ>This field allows for more easily changin
campaigns-manual_dial_prefix Manual Dial Prefix <QXZ>This optional field allows you to set the dial prefix to be used only when placing manual dial calls from the agent interface, such as using the MANUAL DIAL feature, or Dial Next Number when in the MANUAL dial method, or manual alt number dialing, or scheduled user-only callbacks. Default is empty for disabled, which will use the Dial Prefix defined in the field above. This option does not interfere with the 3way Dial Prefix option.</QXZ> campaigns-manual_dial_prefix Manual Dial Prefix <QXZ>This optional field allows you to set the dial prefix to be used only when placing manual dial calls from the agent interface, such as using the MANUAL DIAL feature, or Dial Next Number when in the MANUAL dial method, or manual alt number dialing, or scheduled user-only callbacks. Default is empty for disabled, which will use the Dial Prefix defined in the field above. This option does not interfere with the 3way Dial Prefix option.</QXZ>
campaigns-omit_phone_code Omit Phone Code <QXZ>This field allows you to leave out the phone_code field while dialing within the system. For instance if you are dialing in the UK from the UK you would have 44 in as your phone_code field for all leads, but you just want to dial 10 digits in your dial plan extensions.conf to place calls instead of 44 then 10 digits. Default is N.</QXZ> campaigns-omit_phone_code Omit Phone Code <QXZ>This field allows you to leave out the phone_code field while dialing within the system. For instance if you are dialing in the UK from the UK you would have 44 in as your phone_code field for all leads, but you just want to dial 10 digits in your dial plan extensions.conf to place calls instead of 44 then 10 digits. Default is N.</QXZ>
campaigns-campaign_cid Campaign CallerID <QXZ>This field allows for the sending of a custom callerid number on the outbound calls. This is the number that would show up on the callerid of the person you are calling. The default is UNKNOWN. If you are using T1 or E1s to dial out this option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on, this will not work with Robbed-bit service -RBS- circuits. This will also work through most VOIP -SIP or IAX trunks- providers that allow dynamic outbound callerID. The custom callerID only applies to calls placed for the campaign directly, any 3rd party calls or transfers will not send the custom callerID. NOTE: Sometimes putting UNKNOWN or PRIVATE in the field will yield the sending of your default callerID number by your carrier with the calls. You may want to test this and put 0000000000 in the callerid field instead if you do not want to send you CallerID.</QXZ><QXZ>If all of the CallerID options are enabled, this is the priority in which each type of CallerID will be used, 1 is top priority - <BR>1 - List CallerID Override <BR>2 - CID Group entry <BR>3 - AC-CID AREACODE entry <BR>4 - Custom CallerID, Security Phrase <BR>5 - USER_CUSTOM CallerID <BR>6 - Campaign CID <BR></QXZ> campaigns-campaign_cid Campaign CallerID <QXZ>This field allows for the sending of a custom callerid number on the outbound calls. This is the number that would show up on the callerid of the person you are calling. The default is UNKNOWN. If you are using T1 or E1s to dial out this option is only available if you are using PRIs - ISDN T1s or E1s - that have the custom callerid feature turned on, this will not work with Robbed-bit service -RBS- circuits. This will also work through most VOIP -SIP or IAX trunks- providers that allow dynamic outbound callerID. The custom callerID only applies to calls placed for the campaign directly, any 3rd party calls or transfers will not send the custom callerID. NOTE: Sometimes putting UNKNOWN or PRIVATE in the field will yield the sending of your default callerID number by your carrier with the calls. You may want to test this and put 0000000000 in the callerid field instead if you do not want to send you CallerID.</QXZ><QXZ>If all of the CallerID options are enabled, this is the priority in which each type of CallerID will be used, 1 is top priority - <BR>1 - List CallerID Override <BR>2 - CID Group entry <BR>3 - AC-CID AREACODE entry <BR>4 - Custom CallerID, Security Phrase <BR>5 - USER_CUSTOM CallerID <BR>6 - Campaign CID <BR></QXZ>
campaigns-use_custom_cid Custom CallerID <QXZ>When set to Y, this option allows you to use the security_phrase field in the list table as the CallerID to send out when placing for each specific lead. If this field has no CID in it then the Campaign CallerID defined above will be used instead. This option will disable the list CallerID Override if there is a CID present in the security_phrase field. Default is N. When set to AREACODE you have the ability to go into the AC-CID submenu and define multiple callerids to be used per areacode. For MANUAL and INBOUND_MAN dial methods only, you can use one of the USER_CUSTOM selections to take a CallerID number put into one of the User Custom fields in the User Modify screen and use that for outbound manual dial calls placed by an agent. For more information on CallerID priority, see below.<BR>If all of the CallerID options are enabled, this is the priority in which each type of CallerID will be used, 1 is top priority - <BR>1 - List CallerID Override <BR>2 - CID Group entry <BR>3 - AC-CID AREACODE entry <BR>4 - Custom CallerID, Security Phrase <BR>5 - USER_CUSTOM CallerID <BR>6 - Campaign CID <BR></QXZ> campaigns-use_custom_cid Custom CallerID <QXZ>When set to Y, this option allows you to use the security_phrase field in the list table as the CallerID to send out when placing for each specific lead. If this field has no CID in it then the Campaign CallerID defined above will be used instead. This option will disable the list CallerID Override if there is a CID present in the security_phrase field. Default is N. When set to AREACODE you have the ability to go into the AC-CID submenu and define multiple callerids to be used per areacode. For MANUAL and INBOUND_MAN dial methods only, and agent manual dial calls in other dial methods, you can use one of the USER_CUSTOM selections to take a CallerID number put into one of the User Custom fields in the User Modify admin screen and use that for outbound manual dial calls placed by an agent. For more information on CallerID priority, see below.<BR>If all of the CallerID options are enabled, this is the priority in which each type of CallerID will be used, 1 is top priority - <BR>1 - List CallerID Override <BR>2 - CID Group entry <BR>3 - AC-CID AREACODE entry <BR>4 - Custom CallerID, Security Phrase <BR>5 - USER_CUSTOM CallerID <BR>6 - Campaign CID <BR></QXZ>
campaigns-cid_group_id CID Group <QXZ>If set to something other than ---DISABLED---, the selected CID Group will override all other campaign CID settings above and will use the state or areacode based CIDs that are defined in the CID Group. Default is ---DISABLED---. For more information on CallerID priority, see the CALLERID PRIORITY entry below.<BR>If all of the CallerID options are enabled, this is the priority in which each type of CallerID will be used, 1 is top priority - <BR>1 - List CallerID Override <BR>2 - CID Group entry <BR>3 - AC-CID AREACODE entry <BR>4 - Custom CallerID, Security Phrase <BR>5 - USER_CUSTOM CallerID <BR>6 - Campaign CID <BR></QXZ> campaigns-cid_group_id CID Group <QXZ>If set to something other than ---DISABLED---, the selected CID Group will override all other campaign CID settings above and will use the state or areacode based CIDs that are defined in the CID Group. Default is ---DISABLED---. For more information on CallerID priority, see the CALLERID PRIORITY entry below.<BR>If all of the CallerID options are enabled, this is the priority in which each type of CallerID will be used, 1 is top priority - <BR>1 - List CallerID Override <BR>2 - CID Group entry <BR>3 - AC-CID AREACODE entry <BR>4 - Custom CallerID, Security Phrase <BR>5 - USER_CUSTOM CallerID <BR>6 - Campaign CID <BR></QXZ>
campaigns-cid_priority CALLERID PRIORITY <QXZ>If all of the CallerID options are enabled, this is the priority in which each type of CallerID will be used, 1 is top priority - <BR>1 - List CallerID Override <BR>2 - CID Group entry <BR>3 - AC-CID AREACODE entry <BR>4 - Custom CallerID, Security Phrase <BR>5 - USER_CUSTOM CallerID <BR>6 - Campaign CID <BR></QXZ> campaigns-cid_priority CALLERID PRIORITY <QXZ>If all of the CallerID options are enabled, this is the priority in which each type of CallerID will be used, 1 is top priority - <BR>1 - List CallerID Override <BR>2 - CID Group entry <BR>3 - AC-CID AREACODE entry <BR>4 - Custom CallerID, Security Phrase <BR>5 - USER_CUSTOM CallerID <BR>6 - Campaign CID <BR></QXZ>
campaigns-opensips_cid_name Campaign CID Name <QXZ>If your system is set up to send CallerID Name, you can define it here for all outbound calls placed through this campaign. Default is blank for disabled.</QXZ> campaigns-opensips_cid_name Campaign CID Name <QXZ>If your system is set up to send CallerID Name, you can define it here for all outbound calls placed through this campaign. Default is blank for disabled.</QXZ>
+47 -4
View File
@@ -162,10 +162,11 @@
# 210209-2014 - Added add_did function # 210209-2014 - Added add_did function
# 210210-1627 - Added duplicate check with more X-day options for add_lead function # 210210-1627 - Added duplicate check with more X-day options for add_lead function
# 210216-1415 - Added list_exists_check option for add_lead function # 210216-1415 - Added list_exists_check option for add_lead function
# 210217-1454 - Added menu_id option for add_did and update_did functions
# #
$version = '2.14-139'; $version = '2.14-140';
$build = '210216-1415'; $build = '210217-1454';
$api_url_log = 0; $api_url_log = 0;
$startMS = microtime(); $startMS = microtime();
@@ -566,6 +567,8 @@ if (isset($_GET["source_user"])) {$source_user=$_GET["source_user"];}
elseif (isset($_POST["source_user"])) {$source_user=$_POST["source_user"];} elseif (isset($_POST["source_user"])) {$source_user=$_POST["source_user"];}
if (isset($_GET["list_exists_check"])) {$list_exists_check=$_GET["list_exists_check"];} if (isset($_GET["list_exists_check"])) {$list_exists_check=$_GET["list_exists_check"];}
elseif (isset($_POST["list_exists_check"])) {$list_exists_check=$_POST["list_exists_check"];} elseif (isset($_POST["list_exists_check"])) {$list_exists_check=$_POST["list_exists_check"];}
if (isset($_GET["menu_id"])) {$menu_id=$_GET["menu_id"];}
elseif (isset($_POST["menu_id"])) {$menu_id=$_POST["menu_id"];}
header ("Content-type: text/html; charset=utf-8"); header ("Content-type: text/html; charset=utf-8");
@@ -803,6 +806,7 @@ if ($non_latin < 1)
$delete_did = preg_replace('/[^0-9a-zA-Z]/','',$delete_did); $delete_did = preg_replace('/[^0-9a-zA-Z]/','',$delete_did);
$group_by_campaign = preg_replace('/[^0-9a-zA-Z]/','',$group_by_campaign); $group_by_campaign = preg_replace('/[^0-9a-zA-Z]/','',$group_by_campaign);
$source_user = preg_replace('/[^-_0-9a-zA-Z]/','',$source_user); $source_user = preg_replace('/[^-_0-9a-zA-Z]/','',$source_user);
$menu_id = preg_replace('/[^-_0-9a-zA-Z]/','',$menu_id);
} }
else else
{ {
@@ -810,6 +814,7 @@ else
$pass = preg_replace("/'|\"|\\\\|;|#/","",$pass); $pass = preg_replace("/'|\"|\\\\|;|#/","",$pass);
$source = preg_replace("/'|\"|\\\\|;|#/","",$source); $source = preg_replace("/'|\"|\\\\|;|#/","",$source);
$source_user = preg_replace("/'|\"|\\\\|;|#/","",$source_user); $source_user = preg_replace("/'|\"|\\\\|;|#/","",$source_user);
$menu_id = preg_replace("/'|\"|\\\\|;|#/",'',$menu_id);
} }
$list_exists_check = preg_replace('/[^0-9a-zA-Z]/','',$list_exists_check); $list_exists_check = preg_replace('/[^0-9a-zA-Z]/','',$list_exists_check);
@@ -6840,6 +6845,7 @@ if ($function == 'add_did')
$phone_extensionSQL=''; $phone_extensionSQL='';
$server_ipSQL=''; $server_ipSQL='';
$groupSQL=''; $groupSQL='';
$menu_idSQL='';
$filter_clean_cid_numberSQL=''; $filter_clean_cid_numberSQL='';
if (strlen($did_description) > 0) if (strlen($did_description) > 0)
@@ -6990,6 +6996,24 @@ if ($function == 'add_did')
} }
$groupSQL = " ,group_id='$group'"; $groupSQL = " ,group_id='$group'";
} }
if (strlen($menu_id) > 0)
{
$stmt="SELECT count(*) from vicidial_call_menu where menu_id='$menu_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$menu_id_exists=$row[0];
if ($menu_id_exists < 1)
{
$result = 'ERROR';
$result_reason = "update_did MENU ID MUST BE A VALID CALL MENU IN THE SYSTEM, THIS IS AN OPTIONAL FIELD";
$data = "$menu_id";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
$menu_idSQL = " ,menu_id='$menu_id'";
}
if (strlen($filter_clean_cid_number) > 0) if (strlen($filter_clean_cid_number) > 0)
{ {
if ( (strlen($filter_clean_cid_number) > 20) or (strlen($filter_clean_cid_number) < 1) ) if ( (strlen($filter_clean_cid_number) > 20) or (strlen($filter_clean_cid_number) < 1) )
@@ -7005,7 +7029,7 @@ if ($function == 'add_did')
{$filter_clean_cid_numberSQL = " ,filter_clean_cid_number='$filter_clean_cid_number'";} {$filter_clean_cid_numberSQL = " ,filter_clean_cid_number='$filter_clean_cid_number'";}
} }
$addSQL = "$did_patternSQL$did_descriptionSQL$activeSQL$did_routeSQL$record_callSQL$extensionSQL$exten_contextSQL$voicemail_extSQL$phone_extensionSQL$server_ipSQL$groupSQL$filter_clean_cid_numberSQL"; $addSQL = "$did_patternSQL$did_descriptionSQL$activeSQL$did_routeSQL$record_callSQL$extensionSQL$exten_contextSQL$voicemail_extSQL$phone_extensionSQL$server_ipSQL$groupSQL$menu_idSQL$filter_clean_cid_numberSQL";
$addSQL = preg_replace("/^ ,/",'',$addSQL); $addSQL = preg_replace("/^ ,/",'',$addSQL);
$stmt="INSERT INTO vicidial_inbound_dids SET $addSQL;"; $stmt="INSERT INTO vicidial_inbound_dids SET $addSQL;";
@@ -7140,6 +7164,7 @@ if ($function == 'update_did')
$phone_extensionSQL=''; $phone_extensionSQL='';
$server_ipSQL=''; $server_ipSQL='';
$groupSQL=''; $groupSQL='';
$menu_idSQL='';
$filter_clean_cid_numberSQL=''; $filter_clean_cid_numberSQL='';
if ($delete_did == 'Y') if ($delete_did == 'Y')
@@ -7325,6 +7350,24 @@ if ($function == 'update_did')
} }
$groupSQL = " ,group_id='$group'"; $groupSQL = " ,group_id='$group'";
} }
if (strlen($menu_id) > 0)
{
$stmt="SELECT count(*) from vicidial_call_menu where menu_id='$menu_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$menu_id_exists=$row[0];
if ($menu_id_exists < 1)
{
$result = 'ERROR';
$result_reason = "update_did MENU ID MUST BE A VALID CALL MENU IN THE SYSTEM, THIS IS AN OPTIONAL FIELD";
$data = "$menu_id";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
$menu_idSQL = " ,menu_id='$menu_id'";
}
if (strlen($filter_clean_cid_number) > 0) if (strlen($filter_clean_cid_number) > 0)
{ {
if ( (strlen($filter_clean_cid_number) > 20) or (strlen($filter_clean_cid_number) < 1) ) if ( (strlen($filter_clean_cid_number) > 20) or (strlen($filter_clean_cid_number) < 1) )
@@ -7341,7 +7384,7 @@ if ($function == 'update_did')
} }
$updateSQL = "$did_descriptionSQL$activeSQL$did_routeSQL$record_callSQL$extensionSQL$exten_contextSQL$voicemail_extSQL$phone_extensionSQL$server_ipSQL$groupSQL$filter_clean_cid_numberSQL"; $updateSQL = "$did_descriptionSQL$activeSQL$did_routeSQL$record_callSQL$extensionSQL$exten_contextSQL$voicemail_extSQL$phone_extensionSQL$server_ipSQL$groupSQL$menu_idSQL$filter_clean_cid_numberSQL";
if (strlen($updateSQL)< 3) if (strlen($updateSQL)< 3)