sippy / go-b2bua

The GO port of the Sippy B2BUA
BSD 2-Clause "Simplified" License
61 stars 16 forks source link

make test get error #4

Closed denser closed 5 years ago

denser commented 5 years ago

I am complete rookie in GO. So after make I get compiled app and run it and try to register with soft phone (XXX - real IP address)

root@voip0:/usr/src/go-b2bua# ./b2bua_simple -n 10.125.184.2 -l XXX.XXX.XXX.XXX
2018-12-25 06:32:23+00 ERROR: runtime error: invalid memory address or nil pointer dereference
2018-12-25 06:32:23+00 ERROR: goroutine 10 [running]:
2018-12-25 06:32:23+00 ERROR: sippy/log.(*errorLogger).ErrorAndTraceback(0xc420012758, 0x5566ef154fc0, 0xc4200120b0)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/log/error_logger.go:60 +0x126
2018-12-25 06:32:23+00 ERROR: sippy/utils.SafeCall.func1(0x5566ef4632c0, 0xc420012758)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/utils/safe_call.go:40 +0x62
2018-12-25 06:32:23+00 ERROR: panic(0x5566ef154fc0, 0xc4200120b0)
2018-12-25 06:32:23+00 ERROR:   /usr/lib/go-1.7/src/runtime/panic.go:458 +0x243
2018-12-25 06:32:23+00 ERROR: sippy.(*clientTransaction).Lock(0xc4200fa270)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/client_transaction.go:346 +0x28
2018-12-25 06:32:23+00 ERROR: sippy.(*sipTransactionManager).process_response(0xc42009a000, 0xc4200f4870, 0xc4200be000, 0x232, 0x2000, 0xc4200f2840, 0x20, 0xc4200f6610, 0x5566ef462f40, 0xc42009a0a0)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/sip_transaction_manager.go:268 +0xd45
2018-12-25 06:32:23+00 ERROR: sippy.(*sipTransactionManager).handleIncoming(0xc42009a000, 0xc4200be000, 0x232, 0x2000, 0xc4200f6610, 0x5566ef462f40, 0xc42009a0a0, 0xc4200f4870)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/sip_transaction_manager.go:194 +0x63f
2018-12-25 06:32:23+00 ERROR: sippy.(*sipTransactionManager).(sippy.handleIncoming)-fm(0xc4200be000, 0x232, 0x2000, 0xc4200f6610, 0x5566ef462f40, 0xc42009a0a0, 0xc4200f4870)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/sip_transaction_manager.go:90 +0x73
2018-12-25 06:32:23+00 ERROR: sippy.(*udpServer).handle_read(0xc42009a0a0, 0xc4200be000, 0x232, 0x2000, 0x5566ef4620c0, 0xc4200f4840, 0xc4200f4870)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/udp_server.go:322 +0xf0
2018-12-25 06:32:23+00 ERROR: sippy.(*asyncReceiver).run.func1()
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/udp_server.go:167 +0x6c
2018-12-25 06:32:23+00 ERROR: sippy/utils.SafeCall(0xc420047f38, 0x0, 0x0, 0x5566ef4632c0, 0xc420012758)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/utils/safe_call.go:43 +0x65
2018-12-25 06:32:23+00 ERROR: sippy.(*asyncReceiver).run(0xc420014880, 0xc42009a0a0)
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/udp_server.go:167 +0x193
2018-12-25 06:32:23+00 ERROR: created by sippy.NewAsyncReciever
2018-12-25 06:32:23+00 ERROR:   /usr/src/go-b2bua/src/sippy/udp_server.go:151 +0xb5
2018-12-25 06:32:23+00 ERROR:

So i try to make test and get another error

cd /usr/src/go-b2bua/src/sippy; GOPATH=/usr/src/go-b2bua:/usr/local/share/go go test
# sippy
./lr_test.go:174: not enough arguments in call to bye.sipMsg.routes[1].sipAddressHF.GetBody
FAIL    sippy [build failed]
GNUmakefile:11: recipe for target 'test' failed
make: *** [test] Error 2
bambyster commented 5 years ago

Both issues should be fixed now, please test once more. Thank you very much for reporting.

denser commented 5 years ago

Thankyou for answer and now i have normally start b2bua :)

I have a question if you dony mind...

I try to unsuccessfully run a app in mode when i have 2 eth adapters(one local and one real IPs) and want to simulate registration on real IP but relay it to local sip server like it was initiated from local IP where run b2bua.

For now we use ZTE b100 and it do that job but it bare metal and no replace if disaster.

Could you tell me, if there a way to force b2bua work in this condition?

I am noob in GO, noob in VOIP and try to figure out how it works.

What i realize now: i need to replace header "From" and "To" and "Contact" to register but i cant realize what to do next to make calls after register. I have rtpproxy run at 22222 localhost...

I am lost a bit and need your help to move on.

bambyster commented 5 years ago

simulate registration on real IP but relay it to local sip server like it was initiated from local IP where run b2bua.

This idea sounds wrong to me. If your registrar memorizes the address of your b2bua instead of the real address of the user UA, then an incoming call to that UA via the registrar will reach the b2bua and b2bua will not know where to send that INVITE further. The current behavior of the b2bua is correct - it receives the incoming REGISTER, does not alter the real address of the UA in the Contact and sends it to your local registrar, so the local registrar later can send incoming call to a correct address (directly or via some proxy).

This is off-topic though.