전화번호 수정

main
jjLee 2 years ago
parent 404d756f5b
commit c422b56a6f

@ -293,7 +293,9 @@ func (s *IcsSession) RequestInvite(inviteto string) {
// postfix := "192.168.0.83" // postfix := "192.168.0.83"
var callid string var callid string
s.m.Lock()
s.callID = uuid.New().String() s.callID = uuid.New().String()
s.m.Unlock()
callid = s.callID callid = s.callID
// if len(s.callID) != 0 { // if len(s.callID) != 0 {
// callid = s.callID // 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()) via := fmt.Sprintf("SIP/2.0/UDP %s;rport;branch=%s", ip, sipasm.GenerateBranch())
maxforwards := "70" 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) s.uri = fmt.Sprintf("sip:%s@%s", s.AgentName, ip)
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
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) //to := fmt.Sprintf("<sip:%s@%s>", s.AgentName, ip)
// postfix := fmt.Sprintf("@%s", ip) // postfix := fmt.Sprintf("@%s", ip)
var callid string var callid string
@ -404,7 +409,9 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
// } else { // } else {
// callid = sipasm.GenerateCallID(postfix) // callid = sipasm.GenerateCallID(postfix)
// } // }
s.m.Lock()
s.callID = callid s.callID = callid
s.m.Unlock()
cseq := fmt.Sprintf("%d INVITE", s.Cseq) cseq := fmt.Sprintf("%d INVITE", s.Cseq)
s.Cseq++ s.Cseq++
contact := fmt.Sprintf("<sip:%s@%s:%d;transport=%s>", "AISB", ip, port, transport) 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) name1 := strings.SplitN(sip.To, "@", 2)
name2 := strings.SplitN(name1[0], ":", 2) name2 := strings.SplitN(name1[0], ":", 2)
ac := FindAgentConfig(name2[1]) ac := FindAgentConfig(name2[1])
s.m.Lock()
s.callID = sip.CallID
s.m.Unlock()
if ac == nil { if ac == nil {
l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "Could not found Agent Name - %s", l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "Could not found Agent Name - %s",
icserror.ICSERRUnkown.GetMessage()) icserror.ICSERRUnkown.GetMessage())
@ -1071,7 +1081,6 @@ func (s *IcsSession) ProcACKInvite(sip *icspacketparser.SIP) *icserror.IcsError
/////////////////////////////////////////// ///////////////////////////////////////////
fmt.Println(s) fmt.Println(s)
fmt.Println("loop count ", s.simLoopCount)
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(),
@ -1176,7 +1185,7 @@ func (s *IcsSession) ProcBye(sip *icspacketparser.SIP) *icserror.IcsError {
///////////////////////////////////////////// /////////////////////////////////////////////
//set call signal addr //set call signal addr
// fmt.Println(s) // 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) //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) 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() { defer func() {
if err := recover(); err != nil { if err := recover(); err != nil {
l.Printf(icslog.LOG_LEVEL_WARN, s.ID, "%s %s\n%s", 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" var inout string = "O"
@ -1396,8 +1405,10 @@ func (s *IcsSession) SendRTPCB(t *icscbtimer.IcsCBTimer) {
readPcmData, ferr := ioutil.ReadFile(voiceFilePath) readPcmData, ferr := ioutil.ReadFile(voiceFilePath)
if ferr != nil { if ferr != nil {
fmt.Println("Read Voice File error ", ferr) fmt.Println("Read Voice File error ", ferr)
l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "############ VoiceFile Read ERROR")
return return
} }
// l.Printf(icslog.LOG_LEVEL_ERROR, s.ID, "############ readPcmData %d", readPcmData)
s.m.Lock() s.m.Lock()
@ -1420,18 +1431,20 @@ func (s *IcsSession) SendRTPCB(t *icscbtimer.IcsCBTimer) {
} }
//defer s.TxConverter.Close() //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) //fmt.Println(">>>", s.payloadType, icspacketparser.RTPPayloadInfo[s.payloadType].PSize)
var rtp *icsrtp.RTP var rtp *icsrtp.RTP
if conf.CallEndInfo.Value { if conf.CallEndInfo.Value {
for lc := 0; lc < conf.CallEndInfo.Loop; lc++ { for lc := 0; lc < conf.CallEndInfo.Loop; lc++ {
fmt.Printf("@@@@@@@@@@@@@@@@@@@@@@ %d ", lc) // fmt.Printf("@@@@@@@@@@@@@@@@@@@@@@ %d ", lc)
iter := 0 iter := 0
totalSentLen := 0 totalSentLen := 0
offset := 0 offset := 0
psize := icspacketparser.RTPPayloadInfo[s.payloadType].PSize psize := icspacketparser.RTPPayloadInfo[s.payloadType].PSize
ts := s.rtpTS ts := s.rtpTS
seq := s.rtpSeq 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() { for t1 := range t.GetTick() {
if pcmDataLen < offset+psize { if pcmDataLen < offset+psize {
//fmt.Println("BREAK!", pcmDataLen, offset+psize*2) //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) //fmt.Printf("1095@@@@ %+v\n", s.rtpMediaNeter)
wlen, werr := s.rtpMediaNeter.WriteRTP(rtp.Byte()) wlen, werr := s.rtpMediaNeter.WriteRTP(rtp.Byte())
if werr != nil { 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.Println(t1, wlen, werr)
} }
//fmt.Printf("wlen: %d\r", totalSentLen) //fmt.Printf("wlen: %d\r", totalSentLen)

Loading…
Cancel
Save