예제 #1
0
        /// <summary>
        /// Method makeCall creates call session. Checks the 1st parameter
        /// format is SIP URI, if not build one.
        /// </summary>
        /// <param name="dialedNo"></param>
        /// <param name="accountId"></param>
        /// <returns>SessionId chosen by pjsip stack</returns>
        public override int makeCall(string dialedNo, int accountId)
        {
            string sipuri = "";

            // check if call by URI
            if (dialedNo.IndexOf("sip:") == 0)
            {
                // do nothing...
                sipuri = dialedNo;
            }
            else
            {
                // prepare URI
                sipuri = "sip:" + dialedNo + "@" + Config.Accounts[accountId].HostName;
            }
            // Select configured transport for this account: udp, tcp, tls
            sipuri = pjsipStackProxy.Instance.SetTransport(accountId, sipuri);

            // Don't forget to convert accontId here!!!
            // Store session identification for further requests
            SessionId = PjsipMethods.dll_makeCall(Config.Accounts[accountId].Index, sipuri);

            return(SessionId);
        }