302 Redirect and Box-2-Box Testing
When testing Speech Server applications in our lab we often use what we call a “Box-2-Box” test. This is where we point two Speech Server instances at each other such that “Box A” makes an outbound call to “Box B” over the local LAN. This can be useful when load testing an the application beyond the number of physical ports you have available.
One of the issues we ran into immediately however is that Speech Server issues a 302 Redirect upon answering a call to move the call to another TCP port. While most SIP endpoints will seamlessly handle the redirect, ironically the Speech Server MakeCall Activity isn’t one of them. Luckily there is a simple workaround to the issue.
Prior to initiating the outbound call you need to subscribe to the Redirecting event of the TelephonySession object.
TelephonySession.Redirecting += new EventHandler<Microsoft.SpeechServer.RedirectingEventArgs>(TelephonySession_Redirecting);
Then in the TelephonySession_Redirecting event handler you tell it to accept the redirect.
void TelephonySession_Redirecting(object sender, Microsoft.SpeechServer.RedirectingEventArgs e)
{
e.Action = Microsoft.SpeechServer.RedirectAction.TryAll;
}