Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        protected bool TryCall(SipChannel ch, SipPath path)
        {
            string dstParams = "";
            string remoteId  = path.Remote.Ids[0];

            if (!path.Line.centralIP)
            {
                //Estos parametros son internos, sirven para dar información a la pasarela
                //En encaminamiento IP no se deben usar
                if ((ch.Prefix != Cd40Cfg.INT_DST) &&
                    ((ch.Prefix != Cd40Cfg.PP_DST) || (string.Compare(remoteId, path.Line.Id) != 0)))
                {
                    dstParams += string.Format(";cd40rs={0}", path.Line.Id);
                }
            }

            string dstUri = string.Format("<sip:{0}@{1}{2}>", remoteId, path.Line.Ip, dstParams);

            try
            {
                CORESIP_CallFlags flags = CORESIP_CallFlags.CORESIP_CALL_NO_FLAGS;
                if (path.ModoSinProxy == false)
                {
                    flags |= CORESIP_CallFlags.CORESIP_CALL_EXTERNAL_IP;
                }
                int sipCallId = SipAgent.MakeLcCall(ch.AccId, dstUri, flags);
                _SipCallTx.Update(sipCallId, ch.AccId, remoteId, ch, path.Remote, path.Line);

                return(true);
            }
            catch (Exception ex)
            {
                ch.SetCallResult(path.Remote, path.Line, _SipCallTx.Priority, -1);
                _Logger.Warn("ERROR llamando a " + dstUri, ex);
            }

            return(false);
        }