2014-03-26 78 views
0

我正在使用下面的代碼來環聊使用c#的星號呼叫。但它不工作的調用不斷線。請幫助我做到這一點。我使用相同的方法登錄星號。但它的工作。手動斷開星號呼叫

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();    
} 
+0

你能從Asterisk的CLI是完整的工作粘貼CMD? – przeqpiciel

+0

不,我不能...... – user3085540

+0

好的,但您可以從CLI掛斷電話嗎?現在我正在看我的CLI,看到正確的語法來掛斷這是'掛斷請求CHANNEL_ID' – przeqpiciel

回答

0

爲1.6+版本:

pro-sip*CLI> channel request hangup 
Usage: channel request hangup <channel>|<all> 
     Request that a channel be hung up. The hangup takes effect 
     the next time the driver reads or writes from the channel. 
     If 'all' is specified instead of a channel name, all channels 
     will see the hangup request.