2017-11-08 6 views
-1

私はOzeki.VoIP.SDKを使用して、私たちのElastixシステムで着信VoIPコールを処理しています。私がしようとしているのは、私のアプリケーションで着信コールに関する情報を表示して表示することです。は、卓上電話も鳴らします。私は大関コントローラへのVoIPプールからの電話回線を登録ときOzeki Voip SDKに電話線を登録すると、電話の呼び出しがブロックされる

問題があり、その行に着信コールは、もはや私の机の電話に鳴りません。しかし、私はその電話回線の登録を解除すると、私の卓上電話は電話を受けると再び鳴ります。

私は自分のアプリケーションで私が読んでいるコールを大金属SDKがブロックする理由は知らない。

private ISoftPhone _softphone; 
    private Dictionary<string,IPhoneLine> _phoneLines; 

    public Softphone() 
    { 
     _softphone = SoftPhoneFactory.CreateSoftPhone(IP_ADDRESS, MIN_PORT, MAX_PORT, SIP_PORT); 
     _softphone.ChangeNATSettings(Ozeki.Network.Nat.NATTraversalMethodType.NONE, "", "", ""); 
     _softphone.IncommingCall += softphone_IncommingCall; 
     _phoneLines = new Dictionary<string, IPhoneLine>(); 
    } 
    public bool IsRegistered(string username) 
    { 
     return (_phoneLines.Keys.Contains(username)); 
    } 
    public void Register(SIPAccount account) 
    { 
     if (IsRegistered(account.UserName)) 
     { 
      Unregister(account); 
      Thread.Sleep(1000); 
     } 
     //throw new Exception(string.Format("The account with username={0} already registered.", account.UserName)); 

     // With the SIP account and the NAT configuration, we can create a phoneline. 
     IPhoneLine phoneLine = _softphone.CreatePhoneLine(account); 
     // If our phoneline is created, we can register that. 
     _softphone.RegisterPhoneLine(phoneLine); 

     _phoneLines.Add(account.UserName, phoneLine); 
    } 
    public void Unregister(SIPAccount account) 
    { 
     IPhoneLine phoneLine = _softphone.CreatePhoneLine(account); 
     _phoneLines.Remove(account.UserName); 
     _softphone.UnregisterPhoneLine(phoneLine); 
    } 

    private void DispatchAsync(Action action) 
    { 
     var task = new WaitCallback(o => action.Invoke()); 
     ThreadPool.QueueUserWorkItem(task); 
    } 

    private void softphone_IncommingCall(object sender, VoIPEventArgs<IPhoneCall> e) 
    { 
     DispatchAsync(() => 
     { 
      onIncomingCall(e); 
     }); 
    } 
    private void onIncomingCall(VoIPEventArgs<IPhoneCall> e) 
    { 
     if (IncomingCall != null) 
      IncomingCall(this, e); 
    } 

この動作を以前に見たことがありますか?私は見当もつかない。

+0

あなたのVOIPプロバイダは誰ですか? – mjwills

+0

@mjwills私たちはelastixを使用しています – Bijan

+0

https://www.elastix.org/community/threads/multiple-registration.130199/ helpですか? – mjwills

答えて

関連する問題