Hello guys,
When the caller pressed a number key on the keypad, the method tries to get the actual node's child that is attached to that DTMF signal. If there is no such child, the message will go on without any jumping in the tree structure. If the incoming DTMF signal refers to a valid child, the program will jump in the tree structure to the specified child and its message will be started. The GUI will be also refreshed for showing the latest selected node.
Code for incoming DTMF signal handling:
private void call_DtmfReceived(object sender, VoIPEventArgs e)
{
DtmfInfo dtmfInfo = e.Item;
InvokeGUIThread(() =>
{
label1.Text = String.Format("DTMF signal received: {0} ", dtmfInfo.Signal.Signal);
});
//you can restart the actual message by pressing star
if (dtmfInfo.Signal.Signal == 10)
{
ivrReader.StopStreaming();
ivrReader.AddAndStartText(selectedNode.message);
}
//pressing hash gets you back to the main menu
if (dtmfInfo.Signal.Signal == 11 && !atRoot)
{
atRoot = true;
selectedNode = root;
selectedTreeNode = root.treeNode;
InvokeGUIThread(() =>
{
treeView1.SelectedNode.ForeColor = Color.Black;
treeView1.SelectedNode = selectedTreeNode;
treeView1.SelectedNode.ForeColor = Color.Red;
});
ivrReader.StopStreaming();
ivrReader.AddAndStartText(selectedNode.message);
}
//stepping into a submenu if exists
if (selectedNode.getChild(dtmfInfo.Signal.Signal) != null)
{
atRoot = false;
ivrReader.StopStreaming();
selectedNode = selectedNode.getChild(dtmfInfo.Signal.Signal);
selectedTreeNode = selectedNode.treeNode;
InvokeGUIThread(() =>
{
treeView1.SelectedNode.ForeColor = Color.Black;
treeView1.SelectedNode = selectedTreeNode;
treeView1.SelectedNode.ForeColor = Color.Red;
});
ivrReader.AddAndStartText(selectedNode.message);
}
}
A DTMF navigated IVR tree structure is the easiest and most simple way for the IVR system building purpose. If you have questions, you can look at the next page: http://voip-sip-sdk.com/p_411-voip-ivr-dtmf-navigation-voip.html
Cheers,
Niklas
Madison BaileyPosted Jul 1, 2014, 5:12 AM
Many times a video is worth more than a stack of written lines. I found an awesome video series about IVR development that also explains the DTMF singalling: http://www.youtube.com/watch?v=A8yX0jOCgV0 And it is also based on Ozeki VoIP SIP SDK like your solution.
Regards