ToString() public method

Returns a System.String that represents this instance. For easy printing / reading.
public ToString ( ) : string
return string
Beispiel #1
0
 public override void Sending(UserAgent ua, Message message, SIPStack stack)
 {
     if (Helpers.IsRequest(message))
     {
         Log.Info("Sending request with method " + message.Method);
     }
     else
     {
         Log.Info("Sending response with code " + message.ResponseCode);
     }
     Log.Debug("\n\n" + message.ToString());
     //TODO: Allow App to modify message before it gets sent?;
 }
Beispiel #2
0
 public override void ReceivedResponse(UserAgent ua, Message response, SIPStack stack)
 {
     Log.Info("Received response with code " + response.ResponseCode + " " + response.ResponseText);
     Log.Debug("\n\n" + response.ToString());
     if (ResponseRecvEvent != null)
     {
         ResponseRecvEvent(this, new SipMessageEventArgs(response));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Function used to determine how to handle a received response.
        /// </summary>
        /// <param name="ua">The ua.</param>
        /// <param name="response">The response.</param>
        /// <param name="stack">The stack.</param>
        public override void ReceivedResponse(UserAgent ua, Message response, SIPStack stack)
        {
            _log.Info("Received response with code " + response.ResponseCode + " " + response.ResponseText);
            _log.Debug("\n\n" + response.ToString());
            switch (response.ResponseCode)
            {
                case 180:
                    {

                        break;
                    }
                case 200:
                    {

                        break;
                    }
                case 401:
                    {
                        _log.Error("Transaction layer did not handle registration - APP received  401");
                        //UserAgent ua = new UserAgent(this.stack, null, false);
                        //ua.authenticate(response, transaction);
                        break;
                    }
                default:
                    {
                        _log.Info("Response code of " + response.ResponseCode + " is unhandled ");
                    }
                    break;
            }
        }
Beispiel #4
0
 public override void ReceivedRequest(UserAgent ua, Message request, SIPStack stack)
 {
     Log.Info("Received request with method " + request.Method.ToUpper());
     Log.Debug("\n\n" + request.ToString());
     if (RequestRecvEvent != null)
     {
         RequestRecvEvent(this, new SipMessageEventArgs(request, ua));
     }
 }
Beispiel #5
0
        /// <summary>
        /// Function used to determine how to handle a received request.
        /// </summary>
        /// <param name="ua">The ua.</param>
        /// <param name="request">The request.</param>
        /// <param name="stack">The stack.</param>
        public override void ReceivedRequest(UserAgent ua, Message request, SIPStack stack)
        {
            _log.Info("Received request with method " + request.Method.ToUpper());
            _log.Debug("\n\n" + request.ToString());
            switch (request.Method.ToUpper())
            {
                case "INVITE":
                    {
                        // Auto accepts any SIP INVITE request
                        _log.Info("Generating 200 OK response for INVITE");
                        Message m = ua.CreateResponse(200, "OK");
                        ua.SendResponse(m);
                        break;
                    }
                case "CANCEL":
                    {
                        break;
                    }
                case "ACK":
                    {
                        break;
                    }
                case "BYE":
                    {
                        break;
                    }
                case "MESSAGE":
                    {
                        // Logs any received request
                        _log.Info("MESSAGE: " + request.Body);

                        // Can also echo back any received message for testing purposes
                        //Address from = (Address) request.first("From").value;
                        //this.Message(from.uri.ToString(), request.body);
                        break;
                    }
                case "OPTIONS":
                case "REFER":
                case "SUBSCRIBE":
                case "NOTIFY":
                case "PUBLISH":
                case "INFO":
                default:
                    {
                        _log.Info("Request with method " + request.Method.ToUpper() + " is unhandled");
                        break;
                    }
            }
        }