Page 1 of 1

Does anyone have experience with PJSIP on RPi, I need advice

Posted: Wednesday 17 June 2020 13:05
by erem
L.S,

I ran across a post on the forum on making calls from Domoticz. (https://www.domoticz.com/forum/viewtopi ... ip#p212030)

I have looked at the website referenced in the post (https://binerry.de/post/29180946733/ras ... ng-machine) and I succeeded in compiling and installing PJSIP. The PJSIP tests indicate it is working.

Using the code DutchHans published I got it to work intermittently.
Sometimes the outgoing call will go thru, and sometimes not, without changing anything in the code so I suspect a timing or coding issue.

i have tried a SIP client on my WIN10 machine and those calls go thru every time, so i have ruled outt the network and router as a potential cause.

I am not experienced in SIP calling and PJSIP at all, so any help would be highly appreciated.

I did not publish any logs at this time, as they are now riddled with my own debug statements and would be highly confusing IMHO.

edit: i added some logging, the first invocation of the program failed, the second one, run seconds after the first succeeded
pjsip log level set to 3
Spoiler: show
pi@RPi-Rob-usb:~/socktest/siptest $ ./test-sipcall.sh
test-sipcall->Starting test-sipcall
test-sipcall->Hallo, Dit is robs raspberry pi 3B en dit is een test
SIP Call - Simple TTS-based Automated Calls
===========================================
Google TTS ... tts_google->Done.
Setting up pjsua ... 14:59:55.398 os_core_unix.c !pjlib 2.9-svn for POSIX initialized
14:59:55.431 sip_endpoint.c .Creating endpoint instance...
14:59:55.436 pjlib .select() I/O Queue created (0x11a8c48)
14:59:55.436 sip_endpoint.c .Module "mod-msg-print" registered
14:59:55.436 sip_transport. .Transport manager created.
14:59:55.436 pjsua_core.c .PJSUA state changed: NULL --> CREATED
14:59:55.587 pjsua_core.c .pjsua version 2.9-svn for Linux-4.19.118/armv7l/glibc-2.28 initialized
setup_sip->Done.
Registering account ... register_sip->Done.
Starting call ... make_sip_call->Done.
14:59:55.606 pjsua_acc.c ....IP address change detected for account 0 (10.0.0.99:5060 --> 82.95.235.135:61181). Updating registration (using method 4)
on_call_state->Call disconnected.

app_exit->start
app_exit->app_exiting initial value = 0

app_exit->Stopping application ...
Stopping application ... 14:59:55.607 pjsua_call.c .......Failed to create end session message: INVITE session already terminated (PJSIP_ESESSIONTERMINATED) [status=171140]
14:59:56.607 pjsua_call.c ........Failed to create end session message: INVITE session already terminated (PJSIP_ESESSIONTERMINATED) [status=171140]
14:59:56.607 pjsua_acc.c .......Unable to create/send REGISTER: Object is busy (PJSIP_EBUSY) [status=171001]
15:00:01.088 pjsua_acc.c .........SIP registration failed, status=503 (Service Unavailable)
15:00:01.089 sip_transport. ......Warning: 2 transmit buffer(s) not freed!
15:00:01.089 timer.c ......Dumping timer heap:
15:00:01.089 timer.c ...... Cur size: 1 entries, max: 3070
15:00:01.089 timer.c ...... Entries:
15:00:01.089 timer.c ...... _id Id Elapsed Source
15:00:01.089 timer.c ...... ----------------------------------
15:00:01.089 timer.c ...... 6 1 5.139 ../src/pjsua-lib/pjsua_acc.c:3867
app_exit->app_exiting final value = 1
app_exit->Stopping application ....
app_exit->Done.
Done.
command return code is 1
pi@RPi-Rob-usb:~/socktest/siptest $ ./test-sipcall.sh
test-sipcall->Starting test-sipcall
test-sipcall->Hallo, Dit is robs raspberry pi 3B en dit is een test
SIP Call - Simple TTS-based Automated Calls
===========================================
Google TTS ... tts_google->Done.
Setting up pjsua ... 15:00:04.328 os_core_unix.c !pjlib 2.9-svn for POSIX initialized
15:00:04.330 sip_endpoint.c .Creating endpoint instance...
15:00:04.331 pjlib .select() I/O Queue created (0x1f07c48)
15:00:04.331 sip_endpoint.c .Module "mod-msg-print" registered
15:00:04.331 sip_transport. .Transport manager created.
15:00:04.331 pjsua_core.c .PJSUA state changed: NULL --> CREATED
15:00:04.451 pjsua_core.c .pjsua version 2.9-svn for Linux-4.19.118/armv7l/glibc-2.28 initialized
setup_sip->Done.
Registering account ... register_sip->Done.
Starting call ... make_sip_call->Done.
15:00:04.469 pjsua_acc.c ....IP address change detected for account 0 (10.0.0.99:5060 --> 82.95.235.135:61181). Updating registration (using method 4)
15:00:04.478 pjsua_acc.c ....<sip:[email protected]>: registration success, status=200 (OK), will re-register in 1800 seconds
15:00:04.483 tsx0x74906ce4 .......Temporary failure in sending Request msg INVITE/cseq=26994 (tdta0x1f47754), will try next server: Unsupported transport (PJSIP_EUNSUPTRANSPORT)
Call media activated.
Creating player ... 15:00:12.343 wav_player.c .....pjmedia_wav_player_set_eof_cb() is deprecated. Use pjmedia_wav_player_set_eof_cb2() instead.
create_player->Done.
on_call_state->Call confirmed.

app_exit->start
app_exit->app_exiting initial value = 0

app_exit->Stopping application ...
Stopping application ... on_call_state->Call disconnected.

app_exit->start
app_exit->app_exiting initial value = 1
15:00:22.870 pjsua_acc.c .....<sip:[email protected]>: unregistration success
15:00:24.320 timer.c .Dumping timer heap:
15:00:24.320 timer.c . Cur size: 0 entries, max: 3070
app_exit->app_exiting final value = 1
app_exit->Stopping application ....
app_exit->Done.
Done.
command return code is 0
Thanks for reading,