|
|
@ -275,35 +275,37 @@ func (s *IcsSession) RequestInvite(inviteto string) {
|
|
|
|
format := conf.AgentConfig[s.ID].MediaConfig.Format
|
|
|
|
format := conf.AgentConfig[s.ID].MediaConfig.Format
|
|
|
|
|
|
|
|
|
|
|
|
//sim
|
|
|
|
//sim
|
|
|
|
inviteMethod := fmt.Sprintf("sip:%s@192.168.0.83;transport=%s", s.AgentName, transport)
|
|
|
|
inviteMethod := fmt.Sprintf("sip:%s@172.31.29.47;transport=%s", s.AgentName, transport) // nlb(DNS)를 한번 갔다온 ip를 넣어줘야함.
|
|
|
|
s.uri = fmt.Sprintf("sip:%s@%s", s.AgentName, ip)
|
|
|
|
s.uri = fmt.Sprintf("sip:%s@%s", s.AgentName, ip)
|
|
|
|
to := fmt.Sprintf("<sip:%s@192.168.0.83;user=phone>", s.AgentName)
|
|
|
|
to := fmt.Sprintf("<sip:%s@%s;user=phone>", s.AgentName, ip)
|
|
|
|
if conf.Representative.Value {
|
|
|
|
if conf.Representative.Value {
|
|
|
|
inviteMethod = fmt.Sprintf("sip:%s@192.168.0.83;transport=%s", "AISB", transport)
|
|
|
|
inviteMethod = fmt.Sprintf("sip:%s@%s;transport=%s", "AISB", ip, transport)
|
|
|
|
s.uri = fmt.Sprintf("sip:%s@%s", "AISB", ip)
|
|
|
|
s.uri = fmt.Sprintf("sip:%s@%s", "AISB", ip)
|
|
|
|
to = fmt.Sprintf("<sip:%s@192.168.0.83;user=phone>", "AISB")
|
|
|
|
to = fmt.Sprintf("<sip:%s@%s;user=phone>", "AISB", ip)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
reqInvite := sipasm.NewSIPMessage(sipasm.ICSSIP_METHOD_INVITE, inviteMethod)
|
|
|
|
reqInvite := sipasm.NewSIPMessage(sipasm.ICSSIP_METHOD_INVITE, inviteMethod)
|
|
|
|
|
|
|
|
|
|
|
|
via := fmt.Sprintf("SIP/2.0/UDP 192.168.0.83:5090;branch=%s", sipasm.GenerateBranch())
|
|
|
|
via := fmt.Sprintf("SIP/2.0/UDP %s:5090;branch=%s", ip, sipasm.GenerateBranch())
|
|
|
|
maxforwards := "70"
|
|
|
|
maxforwards := "70"
|
|
|
|
from := fmt.Sprintf("<sip:%s@%s>;tag=%s", inviteto, ip, sipasm.GenerateTag())
|
|
|
|
from := fmt.Sprintf("<sip:%s@%s>;tag=%s", inviteto, ip, sipasm.GenerateTag())
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
postfix := "192.168.0.83"
|
|
|
|
// postfix := "192.168.0.83"
|
|
|
|
var callid string
|
|
|
|
var callid string
|
|
|
|
if len(s.callID) != 0 {
|
|
|
|
s.callID = uuid.New().String()
|
|
|
|
callid = s.callID
|
|
|
|
callid = s.callID
|
|
|
|
//if len(s.regiCallID) != 0 {
|
|
|
|
// if len(s.callID) != 0 {
|
|
|
|
//callid = s.regiCallID
|
|
|
|
// callid = s.callID
|
|
|
|
} else {
|
|
|
|
// //if len(s.regiCallID) != 0 {
|
|
|
|
callid = sipasm.GenerateCallID(postfix)
|
|
|
|
// //callid = s.regiCallID
|
|
|
|
}
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// callid = sipasm.GenerateCallID(postfix)
|
|
|
|
|
|
|
|
// }
|
|
|
|
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>", s.AgentName, ip, port, transport)
|
|
|
|
// contact := fmt.Sprintf("<sip:%s@%s:%d;transport=%s>", s.AgentName, ip, port, transport)
|
|
|
|
contact := fmt.Sprintf("<sip:%s@192.168.0.83:5090>", inviteto)
|
|
|
|
contact := fmt.Sprintf("<sip:%s@%s:5060>", inviteto, ip)
|
|
|
|
//expires := fmt.Sprintf("%d", conf.AgentConfig[s.ID].RegisterConfig.RegisterExpire)
|
|
|
|
//expires := fmt.Sprintf("%d", conf.AgentConfig[s.ID].RegisterConfig.RegisterExpire)
|
|
|
|
// userAgent := conf.InfoConfig.Product
|
|
|
|
// userAgent := conf.InfoConfig.Product
|
|
|
|
userAgent := "M800B/v.7.20A.204.759"
|
|
|
|
userAgent := "M800B/v.7.20A.204.759"
|
|
|
@ -312,7 +314,7 @@ func (s *IcsSession) RequestInvite(inviteto string) {
|
|
|
|
|
|
|
|
|
|
|
|
formats := strings.Split(format, " ")
|
|
|
|
formats := strings.Split(format, " ")
|
|
|
|
// reqInvite.SDP = sipasm.NewSDPMessage(ip, mediaPort, formats[:], 0)
|
|
|
|
// reqInvite.SDP = sipasm.NewSDPMessage(ip, mediaPort, formats[:], 0)
|
|
|
|
reqInvite.SDP = sipasm.NewSDPMessage("192.168.0.83", 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()))
|
|
|
|
|
|
|
|
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_VIA, via)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_VIA, via)
|
|
|
@ -322,6 +324,7 @@ func (s *IcsSession) RequestInvite(inviteto string) {
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CALL_ID, callid)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CALL_ID, callid)
|
|
|
|
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_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)
|
|
|
@ -336,7 +339,8 @@ func (s *IcsSession) RequestInvite(inviteto string) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
s.callID = callid
|
|
|
|
// s.callID = callid
|
|
|
|
|
|
|
|
// s.callID = uuid.New().String()
|
|
|
|
|
|
|
|
|
|
|
|
if conf.Representative.Value {
|
|
|
|
if conf.Representative.Value {
|
|
|
|
s.SetAgentStatus(STATUS_AGENT_READY)
|
|
|
|
s.SetAgentStatus(STATUS_AGENT_READY)
|
|
|
@ -382,11 +386,12 @@ 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", s.AgentName, ip, sipasm.GenerateTag())
|
|
|
|
from := fmt.Sprintf("<sip:%s@%s:5090>;tag=%s", "AISB", 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
|
|
|
|
to := fmt.Sprintf("<sip:%s@%s;user=phone>", "01025670081", ip)
|
|
|
|
to := fmt.Sprintf("<sip:%s@%s;user=phone>", "01025670081", 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)
|
|
|
@ -399,9 +404,10 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
// } else {
|
|
|
|
// } else {
|
|
|
|
// callid = sipasm.GenerateCallID(postfix)
|
|
|
|
// callid = sipasm.GenerateCallID(postfix)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
s.callID = callid
|
|
|
|
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>", s.AgentName, ip, port, transport)
|
|
|
|
contact := fmt.Sprintf("<sip:%s@%s:%d;transport=%s>", "AISB", ip, port, transport)
|
|
|
|
//expires := fmt.Sprintf("%d", conf.AgentConfig[s.ID].RegisterConfig.RegisterExpire)
|
|
|
|
//expires := fmt.Sprintf("%d", conf.AgentConfig[s.ID].RegisterConfig.RegisterExpire)
|
|
|
|
userAgent := conf.InfoConfig.Product
|
|
|
|
userAgent := conf.InfoConfig.Product
|
|
|
|
allow := "REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE"
|
|
|
|
allow := "REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE"
|
|
|
@ -410,6 +416,8 @@ 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)
|
|
|
|
|
|
|
|
// refer := strings.Split(sip.XAICall, "@")[0]
|
|
|
|
|
|
|
|
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_VIA, via)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_VIA, via)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_MAX_FORWARDS, maxforwards)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_MAX_FORWARDS, maxforwards)
|
|
|
@ -418,6 +426,7 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CALL_ID, callid)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CALL_ID, callid)
|
|
|
|
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_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)
|
|
|
@ -426,7 +435,11 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CONTENT_LENGTH, sdpLength)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_CONTENT_LENGTH, sdpLength)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_TERMINATOR)
|
|
|
|
reqInvite.AddSIPHeader(sipasm.ICSSIP_HEADER_TERMINATOR)
|
|
|
|
|
|
|
|
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "sip 내용 전달! %+v", sip)
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Send INVITE! [%s] -> [%s] \r\n %+v\r\n",
|
|
|
|
|
|
|
|
(*s.sipNeter).LocalAddr().String(),
|
|
|
|
|
|
|
|
(*s.sipNeter).RemoteAddr().String(),
|
|
|
|
|
|
|
|
reqInvite)
|
|
|
|
|
|
|
|
|
|
|
|
// sendINVITE := fmt.Sprintf("%+v",sip)
|
|
|
|
// sendINVITE := fmt.Sprintf("%+v",sip)
|
|
|
|
wlen, werr := (*s.sipNeter).WriteSIP([]byte(reqInvite.String()))
|
|
|
|
wlen, werr := (*s.sipNeter).WriteSIP([]byte(reqInvite.String()))
|
|
|
|
if werr != nil {
|
|
|
|
if werr != nil {
|
|
|
@ -436,8 +449,18 @@ func (s *IcsSession) PassInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Println(wlen)
|
|
|
|
fmt.Println(wlen)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s.InviteSIP = nil
|
|
|
|
s.RemoveSession()
|
|
|
|
s1 := icspacketparser.NewSIP()
|
|
|
|
|
|
|
|
err := s1.SipParser([]byte(reqInvite.String()))
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
fmt.Printf("########### ererererrererer %s \r\n %+v\r\n", reqInvite.String(), s.InviteSIP)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
s.InviteSIP = &s1
|
|
|
|
|
|
|
|
fmt.Printf("########### %+v\r\n",s1)
|
|
|
|
|
|
|
|
fmt.Printf("########### %s, \r\n %+v\r\n",reqInvite.String(), s.InviteSIP)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// s.RemoveSession()
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -808,7 +831,7 @@ func (s *IcsSession) ProcInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
func (s *IcsSession) ProcACKInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
func (s *IcsSession) ProcACKInvite(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
l := icslog.GetIcsLog()
|
|
|
|
l := icslog.GetIcsLog()
|
|
|
|
conf := icsconf.GetIcsConfig()
|
|
|
|
conf := icsconf.GetIcsConfig()
|
|
|
|
s.InviteSIP = sip
|
|
|
|
// s.InviteSIP = sip
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////
|
|
|
@ -1153,7 +1176,6 @@ func (s *IcsSession) ProcBye(sip *icspacketparser.SIP) *icserror.IcsError {
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////
|
|
|
|
//set call signal addr
|
|
|
|
//set call signal addr
|
|
|
|
// fmt.Println(s)
|
|
|
|
// 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)
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -1244,10 +1266,11 @@ func (s *IcsSession) SendRequestInvite() {
|
|
|
|
fmt.Printf("Send Call Start Sip(%s) count %d!!!!!!!", s.AgentName, s.simLoopCount)
|
|
|
|
fmt.Printf("Send Call Start Sip(%s) count %d!!!!!!!", s.AgentName, s.simLoopCount)
|
|
|
|
if s.simLoopCount < conf.SimLoopCount {
|
|
|
|
if s.simLoopCount < conf.SimLoopCount {
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Send Call Start Sip(%s) count %d!!!!!!!\r\n", s.AgentName, s.simLoopCount)
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Send Call Start Sip(%s) count %d!!!!!!!\r\n", s.AgentName, s.simLoopCount)
|
|
|
|
|
|
|
|
time.Sleep(time.Second*1)
|
|
|
|
s.RequestInvite("01024342788")
|
|
|
|
s.RequestInvite("01024342788")
|
|
|
|
s.simLoopCount += 1
|
|
|
|
s.simLoopCount += 1
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Send Call Start Sip(%s) END!!!!!!!\r\n", s.AgentName, s.simLoopCount)
|
|
|
|
l.Printf(icslog.LOG_LEVEL_INFO, s.ID, "Send Call Start Sip(%s) END %d !!!!!!!\r\n", s.AgentName, s.simLoopCount)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1994,28 +2017,34 @@ func (s *IcsSession) RequestBYE(inviteSIP *icspacketparser.SIP) {
|
|
|
|
port := conf.SIPConfig.Port
|
|
|
|
port := conf.SIPConfig.Port
|
|
|
|
transport := conf.SIPConfig.Transport
|
|
|
|
transport := conf.SIPConfig.Transport
|
|
|
|
fmt.Println(">>>contact", inviteSIP.Contact)
|
|
|
|
fmt.Println(">>>contact", inviteSIP.Contact)
|
|
|
|
contactName1 := strings.SplitN(inviteSIP.Contact, "sip:", 2)
|
|
|
|
// contactName1 := strings.SplitN(inviteSIP.Contact, "sip:", 2)
|
|
|
|
contactName := strings.SplitN(contactName1[1], "@", 2)
|
|
|
|
// contactName := strings.SplitN(contactName1[1], "@", 2)
|
|
|
|
|
|
|
|
|
|
|
|
optfunc := func() {
|
|
|
|
optfunc := func() {
|
|
|
|
optMethod := fmt.Sprintf("sip:%s@%s;transport=%s", contactName[0], conf.SIPConfig.SIPProxy, transport)
|
|
|
|
optMethod := fmt.Sprintf("sip:%s@%s;transport=%s", "AISB", conf.SIPConfig.SIPProxy, transport)
|
|
|
|
reqOpt := sipasm.NewSIPMessage(sipasm.ICSSIP_METHOD_BYE, optMethod)
|
|
|
|
reqOpt := sipasm.NewSIPMessage(sipasm.ICSSIP_METHOD_BYE, optMethod)
|
|
|
|
|
|
|
|
|
|
|
|
via := fmt.Sprintf("SIP/2.0/UDP %s:%d;branch=%s", ip, port, sipasm.GenerateBranch())
|
|
|
|
via := fmt.Sprintf("SIP/2.0/UDP %s:%d;branch=%s", ip, port, sipasm.GenerateBranch())
|
|
|
|
maxforwards := "70"
|
|
|
|
maxforwards := "70"
|
|
|
|
from := strings.SplitN(inviteSIP.From, ": ", 2)
|
|
|
|
from := fmt.Sprintf("<sip:%s@%s:5090>;tag=%s", "AISB", ip, sipasm.GenerateTag())
|
|
|
|
|
|
|
|
// from := strings.SplitN(inviteSIP.From, ": ", 2)
|
|
|
|
//from := fmt.Sprintf("<sip:%s@%s>;tag=%s", s.AgentName, ip, sipasm.GenerateTag())
|
|
|
|
//from := fmt.Sprintf("<sip:%s@%s>;tag=%s", s.AgentName, ip, sipasm.GenerateTag())
|
|
|
|
|
|
|
|
|
|
|
|
s.uri = fmt.Sprintf("sip:%s@%s", s.AgentName, ip)
|
|
|
|
s.uri = fmt.Sprintf("sip:%s@%s", "AISB", 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)
|
|
|
|
|
|
|
|
|
|
|
|
to := strings.SplitN(inviteSIP.To, ": ", 2)
|
|
|
|
to := fmt.Sprintf("<sip:%s@%s;user=phone>", "01024342788", ip)
|
|
|
|
|
|
|
|
if s.InviteSIP != nil {
|
|
|
|
|
|
|
|
from = s.InviteSIP.From
|
|
|
|
|
|
|
|
to = s.InviteSIP.To
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// to := strings.SplitN(inviteSIP.To, ": ", 2)
|
|
|
|
//to := fmt.Sprintf("<sip:%s@%s>", s.AgentName, ip)
|
|
|
|
//to := fmt.Sprintf("<sip:%s@%s>", s.AgentName, ip)
|
|
|
|
callid := inviteSIP.GetCallID()
|
|
|
|
callid := inviteSIP.GetCallID()
|
|
|
|
cseq := fmt.Sprintf("%d BYE", s.Cseq)
|
|
|
|
cseq := fmt.Sprintf("%d BYE", s.Cseq)
|
|
|
|
s.Cseq++
|
|
|
|
s.Cseq++
|
|
|
|
//referto := fmt.Sprintf("<sip:01025670081@192.168.0.221>")
|
|
|
|
//referto := fmt.Sprintf("<sip:01025670081@192.168.0.221>")
|
|
|
|
contact := fmt.Sprintf("<sip:%s@%s:%d;transport=%s>", s.AgentName, ip, port, transport)
|
|
|
|
contact := fmt.Sprintf("<sip:%s@%s:%d;transport=%s>", "AISB", ip, port, transport)
|
|
|
|
userAgent := conf.InfoConfig.Product
|
|
|
|
userAgent := conf.InfoConfig.Product
|
|
|
|
allow := "REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE"
|
|
|
|
allow := "REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE"
|
|
|
|
supported := "timer,path,replaces"
|
|
|
|
supported := "timer,path,replaces"
|
|
|
@ -2023,8 +2052,8 @@ func (s *IcsSession) RequestBYE(inviteSIP *icspacketparser.SIP) {
|
|
|
|
|
|
|
|
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_VIA, via)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_VIA, via)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_MAX_FORWARDS, maxforwards)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_MAX_FORWARDS, maxforwards)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_FROM, to[0])
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_FROM, to)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_TO, from[0])
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_TO, from)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_CALL_ID, callid)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_CALL_ID, callid)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_CSEQ, cseq)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_CSEQ, cseq)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_CONTACT, contact)
|
|
|
|
reqOpt.AddSIPHeader(sipasm.ICSSIP_HEADER_CONTACT, contact)
|
|
|
|