locked
OCS 2007 extended application. [How to send the message to Client from server ] RRS feed

  • Question

  • I am currently able to log the communication with the help of arhiver sample in the SAmple of SDK.
    Now suppose There are two Client A and B.
    Client A have send some message to Clinet B.I am able to catch it. [I can also cancel it to deliver to B]
    What I want's is to send a message [let say custom error message saying your message limits over] to A without notifying B.
    My current code is like

    Code Snippet

     public void OnRequest(object sender, RequestReceivedEventArgs e)
            {          
                e.Request.SimpleProxy = true;
                e.ServerTransaction.EnableForking = false;
               
                          
                e.ServerTransaction.CreateBranch().SendRequest(e.Request);

                if (e.Request.Stamp != "Archived")
                {
                    lock (LogFile)
                    {
                        LogFile.WriteLine("-----------------------------------------------------------");
                        LogFile.WriteLine(" Request: {0} {1}", e.Request.Method, e.Request.RequestUri);

                        foreach (Header h in e.Request.AllHeaders)
                        {
                            LogFile.WriteLine("  {0}: {1}", h.Type, h.Value);
                        }

                        LogFile.WriteLine();
                        LogFile.WriteLine(e.Request.Content);
                        LogFile.Flush();                   
                    }
                    e.Request.Stamp = "Archived";
                }           
                e.Request.SetDestination(null);
            }

            public void OnResponse(object sender, ResponseReceivedEventArgs e)
            {
                e.ClientTransaction.ServerTransaction.SendResponse(e.Response);
                if (e.Response.Stamp != "Archived")
                {
                    lock (LogFile)
                    {
                        LogFile.WriteLine("-----------------------------------------------------------");
                        LogFile.WriteLine(" Response: {0} {1}", e.Response.StatusCode, e.Response.ReasonPhrase);

                        foreach (Header h in e.Response.AllHeaders)
                        {
                            LogFile.WriteLine("  {0}: {1}", h.Type, h.Value);
                        }

                        LogFile.WriteLine();
                        LogFile.WriteLine(e.Response.Content);
                        LogFile.Flush();
                    }

            }
           
    and .am file is as below   


    <?xml version="1.0"?>
        <r:applicationManifest 
          r:appUri="http://Test.com/myAppName7"
         xmlns:r="http://schemas.microsoft.com/lcs/2006/05">
       
          <!--
          - Handle all IMs, including those with strict routes
          - and those with request URIs that don't match this server's
          - domain.
          -->
          <r:requestFilter methodNames="ALL" strictRoute="true" domainSupported="false" />
          <!--<r:requestFilter methodNames="MESSAGE,INVITE,ACK,BYE" strictRoute="true" domainSupported="false" />-->
       
          <!--
          - Handle all responses.
          -->
          <r:responseFilter reasonCodes="ALL"/>
       
          <r:splScript>
            <![CDATA[
       
       
        if (sipRequest)
        {
            Dispatch("OnRequest");
        }
        else
        {
            Dispatch("OnResponse");
        }
       
        ]]>
          </r:splScript>
    </r:applicationManifest>


    Wednesday, November 12, 2008 8:51 AM

Answers

  • Any luck figuring this out? I am interested to know if you have...
    Tried using resonse(http error code, custom message) route, but the problem is OC client ignores custom error messages=( Instead it displays the error code (ex 504) and sticks a generic link to a MS page that says "unknown erro".
    • Marked as answer by Kamran Shahid Friday, June 19, 2009 11:07 AM
    Thursday, April 9, 2009 9:31 PM

All replies