SIP: How to drop/hang up a SIP line via a Virtual Client
We received a question from a customer on how to drop a sip line from a Station IC panel. Normally, the way to drop a line is to hold down the listen button on a physical panel. Doing the same on a virtual client panel wont drop the line, but we can add an extra button, a control, to do the line drop for us.
Building the Control
First, we need to make one control, which I called “Hang UP 1”. Check the box in properties to make it latch disabled. Second, we need to identify the SIP control for the port we’re using, which gets automatically created when we make a sip port and placed in the secondary action field in Hardware>Cards and ports.
Logic - Control Macro
We are going to make a control macro in the logic page. Go to configuration>logic, hit new, and select Control Macro in the type dropdown.
In the end, your code should look something like this:
using System;
using ClearCom.ScriptHost;
using ClearCom.ScriptLibrary;
using ClearCom.Entities;
using EMS.MapClient;
using EMS.MapClient.Tables;
using Shared.Enums;
using Action = EMS.MapClient.Tables.Actions.Action;
namespace CustomScript
{
public class UserScript : ScriptBase
{
public override void OnUserStart()
{
ControlMacro CT_SIP119 = ControlMacro.GetControl("CT-SI", "P119");
ControlMacro Hang_UP_1 = ControlMacro.GetControl("hang ", "up 1 ");
Hang_UP_1.Inhibits(CT_SIP119);
}
}
}The Macro editor will start looking like this, all we have to add is three lines:
Under Configuration entries, then GPSF, you will see the controls on your frame. First, get rid of the commented line “user script entered here”, then double click on the SIP control for the line you want to drop, for me “CT-SIP119”. It will automatically write the line as you see in the code snippet above. Then go to the next line and do the same for the control you just made, in my case “Hang UP 1”. Then, for the final line, copy the exact syntax for the name of the control you made, on the second line, after where it says ControlMacro then “XXXXXX”. Capitols Matter.
ControlMacro CT_SIP119 = ControlMacro.GetControl("CT-SI", "P119");
ControlMacro Hang_UP_1 = ControlMacro.GetControl("hang ", "up 1 ");
Hang_UP_1.Inhibits(CT_SIP119);
In my case, the control I named “Hang UP 1” changes to “Hang_UP_1”. Then add a period, and a dialog box will come up, select inhibit, and then type “(yourcontrol);”. See above for what the syntax looks like.
The control names will be different but your syntax should look identical. When finished, hit save. If you got anything wrong, either there will be a message in red on the bottom of the dialog box, or when you hit apply map to matrix to send this logic, it will error out. If that happens, double check your work. You can Copy the three lines from this code snippet wholesale into the control macro, but because you need to change all the control names to what yours are, it is probably easier to do it from scratch.
Final Actions
If we’ve done everything correctly, we now have a control that, when it’s pulsed, will drop a line that’s in use. And, because we made the control latch disabled, it can’t stay on forever, because if it could, that line would no longer dial out for as long as the control is latched. In my case, I made another one for a second line, repeating this process, just replacing each of the two controls in my control macro:
using System;
using ClearCom.ScriptHost;
using ClearCom.ScriptLibrary;
using ClearCom.Entities;
using EMS.MapClient;
using EMS.MapClient.Tables;
using Shared.Enums;
using Action = EMS.MapClient.Tables.Actions.Action;
namespace CustomScript
{
public class UserScript : ScriptBase
{
public override void OnUserStart()
{
ControlMacro CT_SIP120 = ControlMacro.GetControl("CT-SI", "P120");
ControlMacro Hang_UP_2 = ControlMacro.GetControl("hang ", "up 2 ");
Hang_UP_2.Inhibits(CT_SIP120);
}
}
}
With these two controls, put into a Virtual Client just like any other button in Configuration>Panels, you can listen, talk, and hang up a line all from Station or Agent IC.