Agent 3-way Press-1 Calls DOC	Started: 2023-11-13	Updated: 2023-11-18


This document will go over how to set up Agent Screen 3-way calls with outside
users that have to press-1 on their phone to be bridged with the agent and 
customer.

NOTE: This requires svn/trunk revision 3778 or higher!!!


What is an Agent Screen 3-way calls with an outside user that has to press-1?

The purpose of this feature is to allow agents using the Agent Screen the ability to call an outside number as part of a 3-way call and require that the outside called party press 1 on their phone before they will be bridged to the agent and their customer. To make this work, instead of just sending the "phone_number" you want to call by itself, you will need to send a dial-string that has a reserved prefix for this feature (this is "49907"), then you will need to add the dial_prefix you want to use for the call to the outside-agent(for example: '9'), then the phone_code of '1' then the "phone_number" (for this example: '7275551212'), so the resulting dialstring you would want to use would be "49907917275551212", you will also must check the DIAL OVERRIDE checkbox before clicking on the "DIAL WITH CUSTOMER" button for this to work properly. Alternatively, you can use the Agent API's "transfer_conference" function with the phone_number field set to "49907917275551212" and the "dial_override" variable to "YES".

On the agent side, after placing the 3-way call while waiting for the called-party to answer and press-1, the agent and customer will only hear a quiet hold tone once every 5 seconds until the call is bridged. If the called-party does not press-1 after answering, then the call will time out after 20 seconds(this is configurable in the custom dialplan below), they will hear a quick buzz sound, and the Xfer line will hang up.

All activity for these calls are logged, with the logs being visible in the Admin Modify Lead page, in the "3-WAY PRESS LOGS FOR THIS LEAD" section.



How do I configure this on my system?

All that is required is the lines below be added to the System Settings "Custom Dialplan Entry", and the "Reload Dialplan On Servers" option set to '1' before submitting the changes.



SYSTEM SETTINGS DIALPLAN ENTRIES, PUT AT THE BOTTOM OF THE ENTRY!!! :
-------------------------------------------------------------------------


; VICIdial agent initation of outside-agent transfer:
exten => _49907.,1,Dial(${TRUNKloop}/499${EXTEN},,to)
exten => _49907.,n,Hangup()
exten => _49949907.,1,Goto(xfer_press_dialplan,${EXTEN:3},1)
exten => _49949907.,n,Hangup()

; VICIdial outside-agent transfer after initiated by agent:
[xfer_press_dialplan]
exten => s,1,Answer
exten => s,n,NoOp(${call_3way_id})
exten => s,n,NoOp(${CALLERID(name)})
exten => s,n,AGI(agi-3way_press_outside.agi,answered)
exten => s,n,Playback(sip-silence)
exten => s,n,Background(outside-sales)
exten => s,n,Background(press-1)
exten => s,n,Background(now)
exten => s,n,WaitExten(20)
exten => s,n,AGI(agi-3way_press_outside.agi,declined)
exten => s,n,Hangup

exten => 1,1,NoOp(${call_3way_id})
exten => 1,n,NoOp(${CALLERID(name)})
exten => 1,n,AGI(agi-3way_press_outside.agi,accepted)
exten => 1,n,Hangup()

exten => t,1,Playback(buzz)
exten => t,n,Hangup()

exten => i,1,Playback(buzz)
exten => i,n,Hangup()

; VICIdial agent initation of outside-agent transfer:
exten => _49907.,1,Answer
exten => _49907.,n,NoOp(${CALLERID(name)})
exten => _49907.,n,Playback(sip-silence)
exten => _49907.,n,AGI(agi-3way_press_agent.agi,start)
exten => _49907.,n,Hangup


-------------------------------------------------------------------------





DATABASE CHANGES FOR REFERENCE ONLY!!!!!!!!!

CREATE TABLE vicidial_3way_press_live (
call_date DATETIME(6),
caller_code VARCHAR(30) NOT NULL,
call_3way_id VARCHAR(30) NOT NULL,
lead_id INT(9) UNSIGNED,
phone_number VARCHAR(18),
dialstring VARCHAR(28),
outbound_cid VARCHAR(20),
user VARCHAR(20),
session_id VARCHAR(20),
server_ip VARCHAR(15),
session_id_3way VARCHAR(20) default '',
status VARCHAR(40),
index(call_date),
index(caller_code),
index(call_3way_id),
index(lead_id)
) ENGINE=MyISAM;

CREATE TABLE vicidial_3way_press_log (
call_date DATETIME(6),
caller_code VARCHAR(30) NOT NULL,
call_3way_id VARCHAR(30) NOT NULL,
lead_id INT(9) UNSIGNED,
phone_number VARCHAR(18),
dialstring VARCHAR(28),
outbound_cid VARCHAR(20),
user VARCHAR(20),
session_id VARCHAR(20),
server_ip VARCHAR(15),
session_id_3way VARCHAR(20) default '',
result TEXT,
index(call_date),
index(caller_code),
index(call_3way_id),
index(lead_id)
) ENGINE=MyISAM;

CREATE TABLE vicidial_3way_press_log_archive LIKE vicidial_3way_press_log;
CREATE UNIQUE INDEX vdpla on vicidial_3way_press_log_archive (call_date,caller_code,user);
