//--------------------------------------------------------------------- // B2BUA event handlers // Implementation Note // ------------------- // // The basic idea here is to intercept and modify the initial dialog INVITE // request and response messages for a dialog and modify these messages // before the B2BUA passes them on to the other side of the dialog. // // At this point, this simply means determining whether the request is // coming from Microsoft Speech Server (MSS) or from the SIP trunk. // I'm hacking this decision now by assuming that any SIP traffic from // the current subnet is from MSS and should be routed outwards up the // SIP trunk and that any traffic sourced outside the subnet is from the // SIP trunk and should be routed to MSS. // // The current implementation updates the INVITE's URI to reflect the // updated routing. The B2BUA takes care of modifying the dialog related // headers including the Call-ID and the To/From tags as well as munging // the Contact headers for request and response messages. private void OnInviteRequestReceived(object sender, SipB2BUAEventArgs <object> args) { // Called when the B2BUA receives a dialog initiating INVITE request // from the initiating side of the dialog. bool fromMSS; fromMSS = Helper.InSameSubnet(localAddress, args.Request.RemoteEndpoint.Address, localSubnet); fromMSS = localAddress.Equals(args.Request.RemoteEndpoint.Address); // $todo(jeff.lill) delete this if (fromMSS) { args.Request.Uri = (string)settings.TrunkUri; } else { args.Request.Uri = (string)settings.SpeechServerUri; } }
private void OnServerResponseReceived(object sender, SipB2BUAEventArgs <object> args) { // Called when the B2BUA receives a response from the accepting side // of the bridged dialog. }
private void OnClientRequestReceived(object sender, SipB2BUAEventArgs <object> args) { // Called when the B2BUA receives a request from the initiating side // of the bridged dialog. }
private void OnSessionClosing(object sender, SipB2BUAEventArgs <object> args) { // Called when the B2BUA is in the process of closing a dialog/session. }
private void OnSessionConfirmed(object sender, SipB2BUAEventArgs <object> args) { // Called when the B2BUA receives the confirming ACK request from // the initiating side of the dialog. }
private void OnInviteResponseReceived(object sender, SipB2BUAEventArgs <object> args) { // Called when the B2BUA receives a dialog initiating INVITE response // from the accepting side of the dialog. }