Avoiding Call Throttling on Outbound Calls

Posted by The World According to Marc on July 23, 2009

imageOne of the most common ways of queuing outbound calls with Speech Server is by using the built in MSMQ support. For the most part, using a message queue is extremely straightforward and easy to implement. But there is one gotcha €“ call throttling. When an outbound call fails to connect, Speech Server will start throttling down the number of messages it pulls from the queue. The assumption is that failures are the result of your system having insufficient capacity to handle the load. The more failures your have, the more it will throttle the load. This would be acceptable if it were not for two issues:

  • Almost any failure, even acceptable ones,  can result in throttling
  • It will happy throttle you all the way down to 0, effectively shutting down your application

Disabling call throttling needs to be done on a per-call bases by binding to the TelephonySession.OpenCompleted event prior to the MakeCall Activity. Typically I do this in a Code Activity at the very top of my workflow. Inside my initWorkflow Activity I bind to the OpenCompleted like so:  TelephonySession.OpenCompleted += new EventHandler<Microsoft.SpeechServer.AsyncCompletedEventArgs>(TelephonySession_OpenCompleted); Then I use the following to disable throttling on any failure:

void TelephonySession_OpenCompleted(object sender, Microsoft.SpeechServer.AsyncCompletedEventArgs e)
    if (e.Error != null && e.Error is SipPeerException)
        SipPeerException sipEx = e.Error as SipPeerException;
        sipEx.ShouldThrottleMsmqCalls = false;