원번호 적용

main
Jaehwan Lee 2 years ago
parent 72e3723564
commit cc037e905d

@ -82,6 +82,7 @@ type SIP struct {
ResType string ResType string
XAICall string XAICall string
XAICallNumber string
Media string Media string
// direction bool // direction bool
@ -343,6 +344,8 @@ func (s *SIP) setSipStruct(name string, value string) (icserr *icserror.IcsError
return nil return nil
case "X-AICALL": case "X-AICALL":
s.XAICall = value s.XAICall = value
case "X-AINUMBER":
s.XAICallNumber = value
case "MEDIA": case "MEDIA":
s.Media = value s.Media = value
default: default:

@ -1,8 +1,9 @@
package icssessionmanager package icssessionmanager
import ( import (
"io/ioutil"
"fmt" "fmt"
"io/ioutil"
// "net" // "net"
"math/rand" "math/rand"
"runtime/debug" "runtime/debug"
@ -334,6 +335,7 @@ func (s *IcsSession) RequestInvite(inviteto string) {
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CSEQ, cseq) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CSEQ, cseq)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CONTACT, contact) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CONTACT, contact)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_XAICALL, s.referto) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_XAICALL, s.referto)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_XAINUMBER, s.xaiNumber)
//reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_EXPIRES, expires) //reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_EXPIRES, expires)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_USER_AGENT, userAgent) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_USER_AGENT, userAgent)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_ALLOW, allow) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_ALLOW, allow)
@ -357,7 +359,6 @@ func (s *IcsSession) RequestInvite(inviteto string) {
s.SetAgentStatus(STATUS_AGENT_CALLING) s.SetAgentStatus(STATUS_AGENT_CALLING)
} }
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Sent Data(%d) [%s]->[%s]>\n%s", l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Sent Data(%d) [%s]->[%s]>\n%s",
wlen, wlen,
(*s.sipNeter).LocalAddr().String(), (*s.sipNeter).LocalAddr().String(),
@ -408,6 +409,7 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Set URI [%s]", s.uri) l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Set URI [%s]", s.uri)
s.referto = sip.XAICall s.referto = sip.XAICall
s.xaiNumber = sip.XAICallNumber
to := fmt.Sprintf("<sip:%s@%s;user=phone>", "AISB", ip) to := fmt.Sprintf("<sip:%s@%s;user=phone>", "AISB", ip)
//to := fmt.Sprintf("<sip:%s@%s>", s.AgentName, ip) //to := fmt.Sprintf("<sip:%s@%s>", s.AgentName, ip)
// postfix := fmt.Sprintf("@%s", ip) // postfix := fmt.Sprintf("@%s", ip)
@ -436,7 +438,7 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
formats := strings.Split(format, " ") formats := strings.Split(format, " ")
reqInvite.SDP = sipasm.NewSDPMessage(ip, mediaPort, formats[:], 0) reqInvite.SDP = sipasm.NewSDPMessage(ip, mediaPort, formats[:], 0)
sdpLength := fmt.Sprintf("%d", len(reqInvite.SDP.String())) sdpLength := fmt.Sprintf("%d", len(reqInvite.SDP.String()))
// fmt.Println("###### X-AICALL ", sip.XAICall) //fmt.Println("###### X-AINUMBER ", sip.XAICall)
// refer := strings.Split(sip.XAICall, "@")[0] // refer := strings.Split(sip.XAICall, "@")[0]
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_VIA, via) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_VIA, via)
@ -447,6 +449,7 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CSEQ, cseq) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CSEQ, cseq)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CONTACT, contact) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CONTACT, contact)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_XAICALL, sip.XAICall) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_XAICALL, sip.XAICall)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_XAINUMBER, s.xaiNumber)
//reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_EXPIRES, expires) //reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_EXPIRES, expires)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_USER_AGENT, userAgent) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_USER_AGENT, userAgent)
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_ALLOW, allow) reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_ALLOW, allow)
@ -1055,7 +1058,6 @@ func (s *IcsSession) ProcACKInvite(sip *icspacketparser.SIP) *icserror.IcsError
// s.rtpMediaNeter.SetRemoteAddr(&remoteAddr) // s.rtpMediaNeter.SetRemoteAddr(&remoteAddr)
// l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Set media remote address - %s(%s)", remoteAddr, s.rtpMediaNeter.RemoteAddr()) // l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Set media remote address - %s(%s)", remoteAddr, s.rtpMediaNeter.RemoteAddr())
/////////////////////////////////////////// ///////////////////////////////////////////
/////////////////////////////////////////// ///////////////////////////////////////////
// send call signal // send call signal
@ -1419,7 +1421,6 @@ func (s *IcsSession) SendRTPCB(t *icscbtimer.IcsCBTimer) {
// ts := s.rtpTS // ts := s.rtpTS
// seq := s.rtpSeq // seq := s.rtpSeq
// voiceFilePath := "/home/leejj9612/sim/voice/9001-RX-1648533187911907029.pcm" // voiceFilePath := "/home/leejj9612/sim/voice/9001-RX-1648533187911907029.pcm"
voiceFilePath := "/home/icsvsim/voice/Sample.pcm" voiceFilePath := "/home/icsvsim/voice/Sample.pcm"
readPcmData, ferr := ioutil.ReadFile(voiceFilePath) readPcmData, ferr := ioutil.ReadFile(voiceFilePath)
@ -1430,7 +1431,6 @@ func (s *IcsSession) SendRTPCB(t *icscbtimer.IcsCBTimer) {
} }
// l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "############ readPcmData %d", readPcmData) // l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "############ readPcmData %d", readPcmData)
s.m.Lock() s.m.Lock()
// pcmDataLen := len(s.tts) // pcmDataLen := len(s.tts)
pcmDataLen := len(readPcmData) pcmDataLen := len(readPcmData)

@ -2,10 +2,10 @@ package icssessionmanager
import ( import (
"fmt" "fmt"
"net"
"strings" "strings"
"sync" "sync"
"time" "time"
"net"
"gitlab.com/ics_cinnamon/joy4/format" "gitlab.com/ics_cinnamon/joy4/format"
"gitlab.com/ics_cinnamon/voicegateway/icscbtimer" "gitlab.com/ics_cinnamon/voicegateway/icscbtimer"
@ -137,13 +137,13 @@ type IcsSession struct {
//tmp refer to //tmp refer to
referto string referto string
simLoopCount int simLoopCount int
xaiNumber string
// ExpTimer *icscbtimer.IcsCBTimer // ExpTimer *icscbtimer.IcsCBTimer
expRead time.Time expRead time.Time
readTimer time.Ticker readTimer time.Ticker
expCheck bool expCheck bool
mychannel chan bool mychannel chan bool
m *sync.Mutex m *sync.Mutex
} }

@ -45,6 +45,7 @@ const (
ICSSIP_HEADER_CSEQ ICSSIP_HEADER_CSEQ
ICSSIP_HEADER_CONTACT ICSSIP_HEADER_CONTACT
ICSSIP_HEADER_XAICALL ICSSIP_HEADER_XAICALL
ICSSIP_HEADER_XAINUMBER
ICSSIP_HEADER_ACCEPT ICSSIP_HEADER_ACCEPT
ICSSIP_HEADER_ACCEPT_ENCODING ICSSIP_HEADER_ACCEPT_ENCODING
ICSSIP_HEADER_ACCEPT_LANGUAGE ICSSIP_HEADER_ACCEPT_LANGUAGE
@ -182,6 +183,7 @@ func initHeaderString() {
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CALL_INFO] = "Call-Info: %s\r\n" ICSSIP_HEADER_STRING[ICSSIP_HEADER_CALL_INFO] = "Call-Info: %s\r\n"
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTACT] = "Contact: %s\r\n" ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTACT] = "Contact: %s\r\n"
ICSSIP_HEADER_STRING[ICSSIP_HEADER_XAICALL] = "X-AICALL: %s\r\n" ICSSIP_HEADER_STRING[ICSSIP_HEADER_XAICALL] = "X-AICALL: %s\r\n"
ICSSIP_HEADER_STRING[ICSSIP_HEADER_XAINUMBER] = "X-AINUMBER: %s\r\n"
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_DISPOSITION] = "Content-Disposition: %s\r\n" ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_DISPOSITION] = "Content-Disposition: %s\r\n"
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_ENCODING] = "Content-Encoding: %s\r\n" ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_ENCODING] = "Content-Encoding: %s\r\n"
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_LANGUAGE] = "Content-Language: %s\r\n" ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_LANGUAGE] = "Content-Language: %s\r\n"
@ -233,6 +235,7 @@ func initHeaderString() {
ICSSIP_HEADER_STRING2TYPE["CALL-INFO"] = ICSSIP_HEADER_CALL_INFO ICSSIP_HEADER_STRING2TYPE["CALL-INFO"] = ICSSIP_HEADER_CALL_INFO
ICSSIP_HEADER_STRING2TYPE["CONTACT"] = ICSSIP_HEADER_CONTACT ICSSIP_HEADER_STRING2TYPE["CONTACT"] = ICSSIP_HEADER_CONTACT
ICSSIP_HEADER_STRING2TYPE["XAICALL"] = ICSSIP_HEADER_XAICALL ICSSIP_HEADER_STRING2TYPE["XAICALL"] = ICSSIP_HEADER_XAICALL
ICSSIP_HEADER_STRING2TYPE["XAINUMBER"] = ICSSIP_HEADER_XAINUMBER
ICSSIP_HEADER_STRING2TYPE["CONTENT-DISPOSITION"] = ICSSIP_HEADER_CONTENT_DISPOSITION ICSSIP_HEADER_STRING2TYPE["CONTENT-DISPOSITION"] = ICSSIP_HEADER_CONTENT_DISPOSITION
ICSSIP_HEADER_STRING2TYPE["CONTENT-ENCODING"] = ICSSIP_HEADER_CONTENT_ENCODING ICSSIP_HEADER_STRING2TYPE["CONTENT-ENCODING"] = ICSSIP_HEADER_CONTENT_ENCODING
ICSSIP_HEADER_STRING2TYPE["CONTENT-LANGUAGE"] = ICSSIP_HEADER_CONTENT_LANGUAGE ICSSIP_HEADER_STRING2TYPE["CONTENT-LANGUAGE"] = ICSSIP_HEADER_CONTENT_LANGUAGE

Loading…
Cancel
Save