Jump to content


< Back to Forum


 

Pbx Functionality Using Vg Scripts - Termination


  • Please log in to reply

#1 Maciej 16 June 2016 - 05:53 PM

Hi,

 

We have PBX script and we need to terminate call depend of termination source.

 

Our task:

  • client calling Agent1 (transfer module)
  • Agent1 decide to forwarding call to other Agent2 so using VBscript vg.Bridge_Disconnect we divide two channels.
  • Using vg.RvSet_RvList we share some data to Agent channel ([Conf_LineId_1], [session_id] and other)
  • Client is forwarded to play module to wait
  • Agent1 calling Agent 2 using transfer module

Options:

  1. Agent1 reconnect Client using vg.Bridge_Connect $RV[caller_lineid],$RV[agent1_line_id]
  2. Agent1 joining Agent2 and client using
    vg.Bridge_Disconnect $RV[agent1_line_id], $RV[agent2_line_id]
    vg.Bridge_Connect $RV[caller_lineid], $RV[agent2_line_id]

Problem is how to make secure termination sheet in each steps. main problem is how to not terminate other channels not active in current call.

After disconnect each of channel used in connection we have two main sides: Client and Agents.

Our main problem is: terminate other channel but only when is active for this thread.

Client call must terminate Agent1 or(and) Agent2 channel when hang up.

Agent1 hang up must hung up Agent1 or Agent2 depend of his activity.

 

Have You any experience in such kind of cases?



#2 SupportTeam 16 June 2016 - 07:12 PM

Could you please describe in more detail what you would require to be performed as part of the "secure termination sheet".

 

What would you like the system to do when Client hangs up while Agent1 and Agent2 are talking? Usually the Agent1<->Agent2 call should continue until Agent1 or Agent 2 is going to be connected back to Client - at which stage the system plays message that client has hung up. Is this what you need, or something else?

 

This can all be achieved with setting $RVs on each channel so that everybody knows on what channel the Client and Agent1 and Agent2 are on, and then the OnHangup scripts can advise the other parties if someone has hung up by setting $RVs in those channels.

 

eg:

 

These $RVs are defined on each channel:

 

$RV[lineClient]

$RV[lineAgentMain]

$RV[lineAgentConsult]

 

So:

 

When Client connects to 1st agent the $RV[lineClient] and $RV[lineAgentMain]are set in scripts for both parties, and $RV[lineAgentConsult] is set to 0 on both lines as well.

 

The $RVs above would hold the same value in them on all channels.

 

When Agent1 calls Agent2 the $RV[lineAgentConsult] is set on all 3 channels as well. (and Agent2 has $RV[lineClient] and $RV[lineAgentMain] set as well)

 

If Agent2 is disconnected and Agent1 talks to Client again then $RV[lineAgentConsult] is again set to 0 in Client and Agent1 scripts.

 

If Agent2 is connected to the client and Agent1 disconnects then the $RV[lineAgentMain] is set the LineID of the line connected to Agent2 - ie. Agent 2 becomes Agent1 (and $RV[lineAgentConsult] is again set to 0)

 

 

The OnHangup script for Client always knows LineIDs for the Agent(s) they are in $RV[lineAgentMain] and $RV[lineAgentConsult], so it knows on what lines to RVSet the $RV[lineClient] to 0 to indicate that Client is no longer there. That's all it needs to do - just set those $RVs.

 

 

The OnHangup script for Agent2 would set $RV[lineAgentConsult] to 0 for LineIDs stored in it's $RV[lineClient] and $RV[lineAgentMain] (see how if $RV[lineClient] is 0 then that RVSet would not affect any line) and can Script_Goto the script for Agent1 (line stored in  $RV[lineAgentMain] )  to module that plays "connecting back to Client" and then goes onto module that bridges the two lines (using value stored in $RV[lineClient] )

 

 

The OnHangup script for Agent1 would do this:

if $RV[lineAgentConsult] is not 0 and $RV[lineClient] is not 0, then bridge the Client and Agent2 and set $RV[lineAgentMain] on LineIDs stored in $RV[lineClient] and $RV[lineAgentConsult] to be the value stored in $RV[lineAgentConsult] and set on all $RV[lineAgntConsult] lines to 0

 

if $RV[lineAgentConsult] is 0 then just hangup the Client as well.

 

if $RV[lineClient] is 0 then do not bridge Client and Agent2 - instead Script_Goto the script for Agent2 to a module that just plays "the client has hung up"...

 

 

 

Please let us know if you need anything to be expanded on.



#3 Maciej 16 June 2016 - 10:04 PM

Additional question:

How to declare HangupCall sScriptToRunOnHangup for channel?

 

After connecting VBScript between lineClient and lineAgentConsult and after hanging up call by lineAgentConsult VGscript not forwarding to termination script.



#4 SupportTeam 16 June 2016 - 10:16 PM

The 'Script to run when call has finished' (ie: the 'On Hangup' script) can be set in the Script Designer: Open the script Script Designer and select Edit -> Script Properties.

 

It can also be set dynamically by setting the $RV[RUNAFTERHANGUP] to hold the filename of the OnHangup script to use.

From http://www.voiceguide.com/vghelp/source/html/resultvariables.htm :
$RV[RUNAFTERHANGUP]

The filename of the script ran when the caller hangs up. This filename can be set in the Evaluate Expression module. 
Setting of $RV[RUNAFTERHANGUP] is only valid during the current script. 
This "OnHangup Script" setting is wiped whenever a goto/gosub is made to another script, and the new script's "OnHanup Script" setting is used. 



#5 Maciej 16 June 2016 - 11:13 PM

Problem is because in case of redirecting call to Agent 2 (lineAgentConsult) VG returning this

150030.293   7  62  21       rv    add   Hangup Source|LineEvCallState_DISCONNECTED
150030.293   7  62  21       HangupCall sScriptToRunOnHangup=[termination.vgs]
150030.293   7  62  21       no script running on this line. AfterHangup script will not be ran.


#6 SupportTeam 16 June 2016 - 11:58 PM

Please post full trace that captures all the calls. We can then see what is happening on the system and comment.

 

But generally speaking, if there is no script running on the line at the time of disconnection then no 'after hangup' script will be started when that line is disconnected - as a scripting engine is not used by that line.



#7 Maciej 08 July 2016 - 09:05 PM

I solved problem. I declare script to run on other line.

New problem is:

After

 

vg.Line_Hangup $RV[caller_lineid]

 

VG script forwarding client to HangupCall sScriptToRunOnHangup=[termination.vgs]

but not disconnecting call. Client is still connected until termination script ended.

 

Can we to disconnect client and next finish terminating scipt?



#8 SupportTeam 09 July 2016 - 08:41 AM

Can you please create new thread on this new issue and post full traces capturing the call(s).

 

We can then see what is happening on the system and comment.