go-sip-ua icon indicating copy to clipboard operation
go-sip-ua copied to clipboard

Multiple network interface does not work and others problems

Open pascal-pro opened this issue 4 years ago • 2 comments

I'm trying to use your pkg, and I find myself facing multiple worries.

First of all, in the endpoint.go file, the GetNetworkInfo function doesn't take the value Endpoint.ip

It makes errors when sending a call, or the caller can't find his interlocutor. in the logs of my sip server, I have two different IPs, in LAN IP I have address 1 and in IP I have address 2.

Here is the function that works:

func (e EndPoint) GetNetworkInfo(protocol string) *transport.Target {
	//logger := e.Log() // Comment this because UNUSED 

	var target transport.Target

	target.Host = e.ip.String() //CHANGE HERE
	//the check do in the creation of the endpoint

	network := strings.ToUpper(protocol)
	if p, ok := e.listenPorts[network]; ok {
		target.Port = p
	} else {
		defPort := transport.DefaultPort(network)
		target.Port = &defPort
	}
	return &target
}

My second concern is the receptionand sending of audio, I can't find any example or any function allowing me to read or write the streams. Thank you for making this library :D

pascal-pro avatar Nov 18 '20 17:11 pascal-pro

The SIP Stack seem to find a wrong network interface,and write a wrong ip address to sip protocol.Because the lib create sip stack in advacnce,and then listen to a udp port.So the SipStackConfig.Host has been set a wrong address, unless you set a correct host.

Windforce17 avatar Mar 19 '21 06:03 Windforce17

SIP protocol not handle other data transform. In my case,the audio data encoded by PCMU and use RTP protocol.This information defined in sip's payload by sdp protocol:

SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.100.27:5060;branch=z9hG4bK.LXjpfN0we17IlFyjNLBbxL30NJbsuYz7
From: "nightingale" <sip:[email protected]:5060>;tag=Qp1Mmnwu
To: <sip:[email protected]>;tag=7cf111ddb4ae263d724df31f014fa639
Call-ID: COFVXP23YzwPjHNxqMsDC6TRmwxlQflc
CSeq: 1 INVITE
Contact: "Anonymous" <sip:6.6.6.6:5060>
Content-Type: application/sdp
Content-Length: 192

v=0
o=- 8395 8395 IN IP4 7.7.7.7.7
s=-
c=IN IP4 7.7.7.7.7
t=0 0
m=audio 15520 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv

the sip server(6.6.6.6) use rtp protocol and PCMU format to transform data through 7.7.7.7:15520

Windforce17 avatar Mar 19 '21 07:03 Windforce17