|
|
|
@ -293,7 +293,9 @@ func (s *IcsSession) RequestInvite(inviteto string) {
|
|
|
|
|
|
|
|
|
|
// postfix := "192.168.0.83"
|
|
|
|
|
var callid string
|
|
|
|
|
s.m.Lock()
|
|
|
|
|
s.callID = uuid.New().String()
|
|
|
|
|
s.m.Unlock()
|
|
|
|
|
callid = s.callID
|
|
|
|
|
// if len(s.callID) != 0 {
|
|
|
|
|
// callid = s.callID
|
|
|
|
@ -386,13 +388,16 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
|
|
|
|
|
|
via := fmt.Sprintf("SIP/2.0/UDP %s;rport;branch=%s", ip, sipasm.GenerateBranch())
|
|
|
|
|
maxforwards := "70"
|
|
|
|
|
from := fmt.Sprintf("<sip:%s@%s:5090>;tag=%s", "AISB", ip, sipasm.GenerateTag())
|
|
|
|
|
agentName := s.AgentName
|
|
|
|
|
agentSplit := agentName[len(agentName)-2:len(agentName)]
|
|
|
|
|
telNo := fmt.Sprintf("010243427%s", agentSplit)
|
|
|
|
|
from := fmt.Sprintf("<sip:%s@%s:5090>;tag=%s", telNo, ip, sipasm.GenerateTag())
|
|
|
|
|
|
|
|
|
|
s.uri = fmt.Sprintf("sip:%s@%s", s.AgentName, ip)
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Set URI [%s]", s.uri)
|
|
|
|
|
|
|
|
|
|
s.referto = sip.XAICall
|
|
|
|
|
to := fmt.Sprintf("<sip:%s@%s;user=phone>", "01025670081", ip)
|
|
|
|
|
to := fmt.Sprintf("<sip:%s@%s;user=phone>", "AISB", ip)
|
|
|
|
|
//to := fmt.Sprintf("<sip:%s@%s>", s.AgentName, ip)
|
|
|
|
|
// postfix := fmt.Sprintf("@%s", ip)
|
|
|
|
|
var callid string
|
|
|
|
@ -404,7 +409,9 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
|
// } else {
|
|
|
|
|
// callid = sipasm.GenerateCallID(postfix)
|
|
|
|
|
// }
|
|
|
|
|
s.m.Lock()
|
|
|
|
|
s.callID = callid
|
|
|
|
|
s.m.Unlock()
|
|
|
|
|
cseq := fmt.Sprintf("%d INVITE", s.Cseq)
|
|
|
|
|
s.Cseq++
|
|
|
|
|
contact := fmt.Sprintf("<sip:%s@%s:%d;transport=%s>", "AISB", ip, port, transport)
|
|
|
|
@ -839,6 +846,9 @@ func (s *IcsSession) ProcACKInvite(sip *icspacketparser.SIP) *icserror.IcsError
|
|
|
|
|
name1 := strings.SplitN(sip.To, "@", 2)
|
|
|
|
|
name2 := strings.SplitN(name1[0], ":", 2)
|
|
|
|
|
ac := FindAgentConfig(name2[1])
|
|
|
|
|
s.m.Lock()
|
|
|
|
|
s.callID = sip.CallID
|
|
|
|
|
s.m.Unlock()
|
|
|
|
|
if ac == nil {
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "Could not found Agent Name - %s",
|
|
|
|
|
icserror.ICSERRUnkown.GetMessage())
|
|
|
|
@ -1071,7 +1081,6 @@ func (s *IcsSession) ProcACKInvite(sip *icspacketparser.SIP) *icserror.IcsError
|
|
|
|
|
///////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
fmt.Println(s)
|
|
|
|
|
fmt.Println("loop count ", s.simLoopCount)
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Sent Data(%d) [%s]->[%s]>\n%s",
|
|
|
|
|
wlen,
|
|
|
|
|
(*s.sipNeter).LocalAddr().String(),
|
|
|
|
@ -1176,7 +1185,7 @@ func (s *IcsSession) ProcBye(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
|
//set call signal addr
|
|
|
|
|
// fmt.Println(s)
|
|
|
|
|
csraddr := icsnet.NewNetAddrWithIPPort(s.AgentInfo.IP, s.AgentInfo.Port)
|
|
|
|
|
// csraddr := icsnet.NewNetAddrWithIPPort(s.AgentInfo.IP, s.AgentInfo.Port)
|
|
|
|
|
//csladdr := icsnet.NewNetAddrWithIPPort(conf.VoiceAgentConfig.MyAddr.ServerIP, conf.VoiceAgentConfig.MyAddr.ServerPort)
|
|
|
|
|
/*
|
|
|
|
|
csraddr := icsnet.NewNetAddrWithIPPort(conf.VoiceAgentConfig.AgentInfo[s.ID].IP, conf.VoiceAgentConfig.AgentInfo[s.ID].Port)
|
|
|
|
@ -1186,7 +1195,7 @@ func (s *IcsSession) ProcBye(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
|
defer func() {
|
|
|
|
|
if err := recover(); err != nil {
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_WARN, s.ID, "%s %s\n%s",
|
|
|
|
|
icserror.ICSERRNETNotConnectError.GetMessage(), csraddr, debug.Stack())
|
|
|
|
|
icserror.ICSERRNETNotConnectError.GetMessage(), "", debug.Stack())
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
var inout string = "O"
|
|
|
|
@ -1396,8 +1405,10 @@ func (s *IcsSession) SendRTPCB(t *icscbtimer.IcsCBTimer) {
|
|
|
|
|
readPcmData, ferr := ioutil.ReadFile(voiceFilePath)
|
|
|
|
|
if ferr != nil {
|
|
|
|
|
fmt.Println("Read Voice File error ", ferr)
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "############ VoiceFile Read ERROR")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "############ readPcmData %d", readPcmData)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s.m.Lock()
|
|
|
|
@ -1420,18 +1431,20 @@ func (s *IcsSession) SendRTPCB(t *icscbtimer.IcsCBTimer) {
|
|
|
|
|
}
|
|
|
|
|
//defer s.TxConverter.Close()
|
|
|
|
|
|
|
|
|
|
fmt.Printf("@@@@@@@@@@@@@@@@@ pcmDataLen : %d, loop Count: %d \r\n", pcmDataLen, conf.CallEndInfo.Loop)
|
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "@@@@@@@@@@@@@@@@@ pcmDataLen : %d, loop Count: %d \r\n", pcmDataLen, conf.CallEndInfo.Loop)
|
|
|
|
|
// fmt.Printf("@@@@@@@@@@@@@@@@@ pcmDataLen : %d, loop Count: %d \r\n", pcmDataLen, conf.CallEndInfo.Loop)
|
|
|
|
|
//fmt.Println(">>>", s.payloadType, icspacketparser.RTPPayloadInfo[s.payloadType].PSize)
|
|
|
|
|
var rtp *icsrtp.RTP
|
|
|
|
|
if conf.CallEndInfo.Value {
|
|
|
|
|
for lc := 0; lc < conf.CallEndInfo.Loop; lc++ {
|
|
|
|
|
fmt.Printf("@@@@@@@@@@@@@@@@@@@@@@ %d ", lc)
|
|
|
|
|
// fmt.Printf("@@@@@@@@@@@@@@@@@@@@@@ %d ", lc)
|
|
|
|
|
iter := 0
|
|
|
|
|
totalSentLen := 0
|
|
|
|
|
offset := 0
|
|
|
|
|
psize := icspacketparser.RTPPayloadInfo[s.payloadType].PSize
|
|
|
|
|
ts := s.rtpTS
|
|
|
|
|
seq := s.rtpSeq
|
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "@@@@@@@@@@@@@@@@@ writRTP ERROR offset: %+v, psize: %+v, ts: %+v\r\n", offset, psize, ts)
|
|
|
|
|
for t1 := range t.GetTick() {
|
|
|
|
|
if pcmDataLen < offset+psize {
|
|
|
|
|
//fmt.Println("BREAK!", pcmDataLen, offset+psize*2)
|
|
|
|
@ -1498,6 +1511,7 @@ func (s *IcsSession) SendRTPCB(t *icscbtimer.IcsCBTimer) {
|
|
|
|
|
//fmt.Printf("1095@@@@ %+v\n", s.rtpMediaNeter)
|
|
|
|
|
wlen, werr := s.rtpMediaNeter.WriteRTP(rtp.Byte())
|
|
|
|
|
if werr != nil {
|
|
|
|
|
// l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "@@@@@@@@@@@@@@@@@ writRTP ERROR t1: %+v, wlen: %+v, werr: %+v\r\n", t1, wlen, werr)
|
|
|
|
|
fmt.Println(t1, wlen, werr)
|
|
|
|
|
}
|
|
|
|
|
//fmt.Printf("wlen: %d\r", totalSentLen)
|
|
|
|
|