Asterisk calls hangout using c#

romiltonfdo
Joined: Wed 26 of Mar, 2014

Asterisk calls hangout using c#

Posted:Wed 26 of Mar, 2014 (11:28 UTC)
I am using the below code to hangout the asterisk calls using c#. But its not working calls not disconnected.Please help me to do this.I am using the same method to login asterisk.But its working.


    if (this.parser == null)
                {
                    this.parser = new ProtocolParser();
                    this.parser.Parsed += new ProtocolParser.OnParsed(ParserParsed);
                }
                if (this.socketmanager == null)
                {
                    this.socketmanager = new SocketManager(ConfigurationManager.AppSettings["SERVER_LISTEN_IP"], 8999); 
    
                    this.socketmanager.Connected += new SocketManager.OnConnected(SocketManagerConnected);
                    this.socketmanager.Disconnected += new SocketManager.OnDisconnected(SocketManagerDisconnected);
                    this.socketmanager.DataArrival += new SocketManager.OnDataArrival(SocketManagerDataArrival);
                    this.socketmanager.SocketError += new SocketManager.OnSocketError(SocketManagerSocketError);
                    socketmanager.Connect();
                }
                if (this.parser != null & this.socketmanager != null)
                {
                    //Extnston = txt_agentex.Text;
                    string application = string.Empty;
                    application = "Hangup";
                    string cmd = "Hangup/SIP/10.xxx.xx.xx-0000003d|1395833122.145|21";
                    ExtnStrg = "IAX2/" + Extnston;
                   
                    if (this.socketmanager.SendData(cmd))
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>show('success','" + ConfigurationManager.AppSettings["SUCS-WLK"].ToString() + "');</script>", false);
                    }
                    else
                    {
                        this.socketmanager.Disconnect();
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>show('error','" + ConfigurationManager.AppSettings["ERROR-AUT"].ToString() + "');</script>", false);
                        return;
                }
                //this.socketmanager.Disconnect();               
            }