tomek-o / tSIP

SIP softphone
149 stars 32 forks source link

Not able to hear the input wave file when receiving calls #36

Closed etonline closed 1 year ago

etonline commented 1 year ago

Hello,

I set a wave file as Input, it works when calling to other phones with tSIP. However, if I answer the call with tSIP, I can hear nothing.

Log gives no error message, not sure what's wrong.

Below is the log with success wave file sound (calling to another phone):

===================
Application started
Main config file: C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\tSIP.json
--- Network debug ---
 Preferred AF:  AF_UNSPEC
 Local IPv4:           - ?
 Net interfaces:
Enumerating phone device dlls...
Directory: C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\phone\
 {D9AF344E-E286-4098-864E-AE2CAA53282B}:  192.168.102.56
 {6CA398C6-81EF-4B52-A700-DEAE8110B367}:  0.0.0.0
 {B49932CB-6008-45D2-A7F8-EB2B7CBE9900}:  0.0.0.0
 {FDFDACC8-780B-4ABF-B73C-F4C999301F2F}:  0.0.0.0
 {2FC9FA46-FD59-49F6-8AD7-758FBA04D95C}:  0.0.0.0
 {CB5FFB40-7BAD-481D-8DD0-F3C636CBD24B}:  0.0.0.0
 {1212295C-14A5-4FAC-80D9-8E2D1A94F7A0}:  0.0.0.0
 DNS Servers: (1)
   0: 192.168.102.1:53
aucodec: PCMU/8000/1
aucodec: PCMA/8000/1
aucodec: G722/8000/1
aucodec: G726-32/8000/1
aucodec: GSM/8000/1
aucodec: speex/32000/2
aucodec: speex/16000/2
aucodec: speex/8000/2
aucodec: speex/32000/1
aucodec: speex/16000/1
aucodec: speex/8000/1
aucodec: L16/48000/2
aucodec: L16/44100/2
aucodec: L16/32000/2
aucodec: L16/16000/2
aucodec: L16/8000/2
aucodec: L16/48000/1
aucodec: L16/44100/1
aucodec: L16/32000/1
aucodec: L16/16000/1
aucodec: L16/8000/1
aucodec: opus/48000/2
Portaudio driver: Device count 5
 device 0: 主要音效擷取驅動程式 (channels in: 2, out: 0)
 device 1: 插孔麥克風 (Realtek(R) Audio) (channels in: 2, out: 0)
 device 2: 主要音效驅動程式 (channels in: 0, out: 2)
 device 3: Speakers/Headphones (Realtek(R) Audio) (channels in: 0, out: 2)
 device 4: DELL U2417H (Intel(R) 顯示器音效) (channels in: 0, out: 2)
ausrc: portaudio
auplay: portaudio
winwave: output devices: 2, input devices: 1
ausrc: winwave
auplay: winwave
winwave2: output devices: 2, input devices: 1
ausrc: winwave2
auplay: winwave2
ausrc: aufile
ausrc: aufile_mm
ausrc: nullaudio
auplay: nullaudio
aufilt: softvol
medianat: stun
mediaenc: zrtp
mediaenc: srtp
mediaenc: srtp-mand
mediaenc: srtp-mandf
Binding to interface '{D9AF344E-E286-4098-864E-AE2CAA53282B}'
Local network address: IPv4={D9AF344E-E286-4098-864E-AE2CAA53282B}:192.168.102.56
TLS: add 56 certificate(s) from Windows store
Loading module dlls...
Populated 22 audio codecs
Populated 1 audio filter
5005@192.168.103.10: Registration {0/UDP/v4} 200 OK (SONUS SBC1000 9.0.6v601 Ribbon) [1 binding]
connecting to 'sip:1001@192.168.103.10;transport=udp'..
call: SIP Progress: 100 Trying (/)
call: SIP Progress: 183 Session Progress (application/sdp)
5005@192.168.103.10: Call in-progress: sip:1001@192.168.103.10;transport=udp
Set audio encoder: PCMU 8000Hz 1ch
starting player...
start_player
starting source...
start_source
ausrc_alloc
aufile: loading input file 'C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\cpr-tempo-8000-16bit-short.wav'
aufile: C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\cpr-tempo-8000-16bit-short.wav: 8000 Hz, 1 channels
aufile: audio ptime=20 sampc=160 aubuf=[16000:320000]
aufile: end of file
aufile: loaded 4604198 bytes
ausrc_alloc status = 0
start_source: end
Set audio decoder: PCMU 8000Hz 1ch
ac: no decupdh
audio_decoder_set: audio_start
starting player...
start_player
auplay_alloc
auplay_alloc status = 0
start_player: end
starting source...
start_source
start_source: end
audio tx pipeline:      aufile ---> softvol ---> PCMU
audio rx pipeline:   nullaudio <--- softvol <--- PCMU
audio_decoder_set: status = 0
starting player...
start_player
start_player: end
starting source...
start_source
start_source: end
Set audio decoder: PCMU 8000Hz 1ch (not changed)
ac: no decupdh
audio_decoder_set: status = 0
call: SIP Progress: 180 Ringing (/)
aufile: player thread exited
Set audio decoder: PCMU 8000Hz 1ch (not changed)
ac: no decupdh
audio_decoder_set: status = 0
starting player...
start_player
auplay_alloc
auplay_alloc status = 0
start_player: end
starting source...
start_source
ausrc_alloc
aufile: loading input file 'C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\cpr-tempo-8000-16bit-short.wav'
aufile: C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\cpr-tempo-8000-16bit-short.wav: 8000 Hz, 1 channels
aufile: audio ptime=20 sampc=160 aubuf=[16000:320000]
aufile: end of file
aufile: loaded 4604198 bytes
ausrc_alloc status = 0
start_source: end
Set audio decoder: PCMU 8000Hz 1ch (not changed)
ac: no decupdh
audio_decoder_set: status = 0
starting player...
start_player
start_player: end
starting source...
start_source
start_source: end
5005@192.168.103.10: Call established: sip:1001@192.168.103.10;transport=udp
terminate call with sip:1001@192.168.103.10;transport=udp
aufile: player thread exited
sip:5005@192.168.103.10:5060: Call with sip:1001@192.168.103.10;transport=udp terminated (duration: 5 secs)
Finalizing...
Stopping 1 useragent.. 
Useragent(s) stopped
Checking for memory leaks...
main exit w/o error, waiting for restart or termination

And below is answered call that's without sound (below example is with auto answer, bot neither anto nor manual answer can hear the set wave file input):

===================
Application started
Main config file: C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\tSIP.json
--- Network debug ---
 Preferred AF:  AF_UNSPEC
 Local IPv4:           - ?
 Net interfaces:
Enumerating phone device dlls...
Directory: C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\phone\
 {D9AF344E-E286-4098-864E-AE2CAA53282B}:  192.168.102.56
 {6CA398C6-81EF-4B52-A700-DEAE8110B367}:  0.0.0.0
 {B49932CB-6008-45D2-A7F8-EB2B7CBE9900}:  0.0.0.0
 {FDFDACC8-780B-4ABF-B73C-F4C999301F2F}:  0.0.0.0
 {2FC9FA46-FD59-49F6-8AD7-758FBA04D95C}:  0.0.0.0
 {CB5FFB40-7BAD-481D-8DD0-F3C636CBD24B}:  0.0.0.0
 {1212295C-14A5-4FAC-80D9-8E2D1A94F7A0}:  0.0.0.0
 DNS Servers: (1)
   0: 192.168.102.1:53
aucodec: PCMU/8000/1
aucodec: PCMA/8000/1
aucodec: G722/8000/1
aucodec: G726-32/8000/1
aucodec: GSM/8000/1
aucodec: speex/32000/2
aucodec: speex/16000/2
aucodec: speex/8000/2
aucodec: speex/32000/1
aucodec: speex/16000/1
aucodec: speex/8000/1
aucodec: L16/48000/2
aucodec: L16/44100/2
aucodec: L16/32000/2
aucodec: L16/16000/2
aucodec: L16/8000/2
aucodec: L16/48000/1
aucodec: L16/44100/1
aucodec: L16/32000/1
aucodec: L16/16000/1
aucodec: L16/8000/1
aucodec: opus/48000/2
Portaudio driver: Device count 5
 device 0: 主要音效擷取驅動程式 (channels in: 2, out: 0)
 device 1: 插孔麥克風 (Realtek(R) Audio) (channels in: 2, out: 0)
 device 2: 主要音效驅動程式 (channels in: 0, out: 2)
 device 3: Speakers/Headphones (Realtek(R) Audio) (channels in: 0, out: 2)
 device 4: DELL U2417H (Intel(R) 顯示器音效) (channels in: 0, out: 2)
ausrc: portaudio
auplay: portaudio
winwave: output devices: 2, input devices: 1
ausrc: winwave
auplay: winwave
winwave2: output devices: 2, input devices: 1
ausrc: winwave2
auplay: winwave2
ausrc: aufile
ausrc: aufile_mm
ausrc: nullaudio
auplay: nullaudio
aufilt: softvol
medianat: stun
mediaenc: zrtp
mediaenc: srtp
mediaenc: srtp-mand
mediaenc: srtp-mandf
Binding to interface '{D9AF344E-E286-4098-864E-AE2CAA53282B}'
Local network address: IPv4={D9AF344E-E286-4098-864E-AE2CAA53282B}:192.168.102.56
TLS: add 56 certificate(s) from Windows store
Loading module dlls...
Populated 22 audio codecs
Populated 1 audio filter
5005@192.168.103.10: Registration {0/UDP/v4} 200 OK (SONUS SBC1000 9.0.6v601 Ribbon) [1 binding]
Delayed auto answer, time = 126 ms
Answering...
answering call from sip:1001@192.168.103.10:5060;user=phone with 200
Set audio decoder: PCMU 8000Hz 1ch
ac: no decupdh
audio_decoder_set: audio_start
starting player...
start_player
auplay_alloc
auplay_alloc status = 0
start_player: end
starting source...
start_source
audio_decoder_set: status = 0
Set audio encoder: PCMU 8000Hz 1ch
starting player...
start_player
start_player: end
starting source...
start_source
ausrc_alloc
aufile: loading input file 'C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\cpr-tempo-8000-16bit-short.wav'
aufile: C:\Users\user\Downloads\tSIP_0_2_09_bin\tSIP_0_2_09_bin\cpr-tempo-8000-16bit-short.wav: 8000 Hz, 1 channels
aufile: audio ptime=20 sampc=160 aubuf=[16000:320000]
aufile: end of file
aufile: loaded 4604198 bytes
ausrc_alloc status = 0
start_source: end
audio tx pipeline:      aufile ---> softvol ---> PCMU
audio rx pipeline:   nullaudio <--- softvol <--- PCMU
Answered
Set audio decoder: PCMU 8000Hz 1ch (not changed)
ac: no decupdh
audio_decoder_set: status = 0
starting player...
start_player
start_player: end
starting source...
start_source
start_source: end
5005@192.168.103.10: Call established: sip:1001@192.168.103.10:5060;user=phone
sip:1001@192.168.103.10:5060;user=phone: session closed: End of call (BYE received)
aufile: player thread exited
sip:5005@192.168.103.10:5060: Call with sip:1001@192.168.103.10:5060;user=phone terminated (duration: 7 secs)
Finalizing...
Stopping 1 useragent.. 
Useragent(s) stopped
Checking for memory leaks...
main exit w/o error, waiting for restart or termination
tomek-o commented 1 year ago

My guess is this is some kind of NAT issue. I see IP addresses that would typically belong to two different networks: 192.168.102.56 and 192.168.103.10. Wireshark log would probably show more details. Is your SBC handling NAT traversal in this case? Could you try sip2sip.info (accounts can be created for free) for comparison?

etonline commented 1 year ago

My guess is this is some kind of NAT issue. I see IP addresses that would typically belong to two different networks: 192.168.102.56 and 192.168.103.10. Wireshark log would probably show more details. Is your SBC handling NAT traversal in this case? Could you try sip2sip.info (accounts can be created for free) for comparison?

Thank you for the fast reply! That comes to my mind as well, but it works of I change the input to my microphone instead of wav file. I'll try sip2sip.info soon!

tomek-o commented 1 year ago

it works of I change the input to my microphone instead of wav file

Oh, this makes NAT issue less likely. It would be worth to look into Wireshark traces then (maybe on both sides of the call).

etonline commented 1 year ago

As you said, sip2sip.info works fine. After several tests, I found it's indeed mis-configured NAT hairpin issue causing the problem, thanks a lot!!

tomek-o commented 1 year ago

Thanks for the update!