Re: NEWBIE question: pjsua sample program not behaving as expected.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rob,

What are you using for your PBX? When I was having issues with the endpoint registering with the server, I noticed my PJSIP endpoints for FreePBX were not loaded due to a configuration error that was buried deeply. I don't think this is your issue as you have occasional successes. Is your endpoint perhaps behind a NAT?

-Larry Ing

On Sun, Jun 21, 2020 at 4:41 AM <r.b.muller@xxxxxxxxx> wrote:

Larry,

 

Thanks for responding.

Wireshark tells me exactly the same, 401-unauthorized.

But the same credentials work flawlessly from windows using MicroSIP

 

This is the relevant code

 

#define SIP_DOMAIN "sip.xs4all.nl"

#define SIP_USER "userid"

#define SIP_PASSWD "****************"

 

                /* Register to SIP server by creating SIP account. */

                {

                                pjsua_acc_config cfg;

 

                                pjsua_acc_config_default(&cfg);

                                cfg.id = pj_str("sip:" SIP_USER "@" SIP_DOMAIN);

                                cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);

                                cfg.cred_count = 1;

                                cfg.cred_info[0].realm = pj_str((char *)"xs4all.nl");  //@@ was *

                                cfg.cred_info[0].scheme = pj_str("digest");

                                cfg.cred_info[0].username = pj_str(SIP_USER);

                                cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;

                                cfg.cred_info[0].data = "">

 

                                status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id);

                                if (status != PJ_SUCCESS) error_exit("Error adding account", status);

                }

 

As you can see from the log pjsua-sample does not throw the “Error adding account”

 

And, once in a blue moon the registration succeeds.

 

Would you happen to know how to debug the registration process?

 

Thanks for your time, much appreciated.

 

Met Vriendelijke Groet, Regards,

 

Rob Muller

mailto:r.b.muller@xxxxxxxxx

Phone: +31 (0)6 5343 5184

 

From: pjsip On Behalf Of Larry Ing
Sent: Saturday, June 20, 2020 18:32
To: pjsip list <pjsip@xxxxxxxxxxxxxxx>
Subject: Re: NEWBIE question: pjsua sample program not behaving as expected.

 

Hi Rob,

 

It would seem to me that you aren't successfully registering with your PBX. 

 

Have you confirmed the credentials you are exchanging?

 

Regards,

 

 

Larry Ing

 

On Sat, Jun 20, 2020, 06:36 <r.b.muller@xxxxxxxxx> wrote:

hello,

 

i have successfully compiled and installed PJSIP in my Raspberry Pi 3B. the testsuite runs without errors.

i have successfully compiled the example program pjsua-sample as well

 

however, if I call the pjsua-sample like this: ./pjsua-sample sip:mytelnr@xxxxxxxxxxxxx the call does not complete.

 

I have replaced the target phone number with mytelnr and the originating phone number with userid in attached log for privacy reasons

same goes for public ip address.

 

can anyone point me in the right direction? I am new to PJSIP, so be kind 😊

 

log @level 6:

 

pi@RPi-Rob-usb:~/socktest/siptest/pjsuasample $ ./pjsua-sample sip:mytelnr@xxxxxxxxxxxxx

15:16:12.127 os_core_unix.c !pjlib 2.9-svn for POSIX initialized

15:16:12.130 sip_endpoint.c  .Creating endpoint instance...

15:16:12.131          pjlib  .select() I/O Queue created (0x223c48)

15:16:12.131 sip_endpoint.c  .Module "mod-msg-print" registered

15:16:12.131 sip_transport.  .Transport manager created.

15:16:12.131   pjsua_core.c  .PJSUA state changed: NULL --> CREATED

15:16:12.131 sip_endpoint.c  .Module "mod-pjsua-log" registered

15:16:12.131 sip_endpoint.c  .Module "mod-tsx-layer" registered

15:16:12.131 sip_endpoint.c  .Module "mod-stateful-util" registered

15:16:12.131 sip_endpoint.c  .Module "mod-ua" registered

15:16:12.131 sip_endpoint.c  .Module "mod-100rel" registered

15:16:12.131 sip_endpoint.c  .Module "mod-pjsua" registered

15:16:12.132 sip_endpoint.c  .Module "mod-invite" registered

15:16:12.237     alsa_dev.c  ..ALSA driver found 18 devices

15:16:12.237     alsa_dev.c  ..ALSA initialized

15:16:12.238          pjlib  ..select() I/O Queue created (0x2347fc)

15:16:12.244 sip_endpoint.c  .Module "mod-evsub" registered

15:16:12.244 sip_endpoint.c  .Module "mod-presence" registered

15:16:12.244 sip_endpoint.c  .Module "mod-mwi" registered

15:16:12.244 sip_endpoint.c  .Module "mod-refer" registered

15:16:12.244 sip_endpoint.c  .Module "mod-pjsua-pres" registered

15:16:12.244 sip_endpoint.c  .Module "mod-pjsua-im" registered

15:16:12.244 sip_endpoint.c  .Module "mod-pjsua-options" registered

15:16:12.244   pjsua_core.c  .1 SIP worker threads created

15:16:12.244   pjsua_core.c  .pjsua version 2.9-svn for Linux-4.19.118/armv7l/glibc-2.28 initialized

15:16:12.244   pjsua_core.c  .PJSUA state changed: CREATED --> INIT

15:16:12.245   pjsua_core.c  SIP UDP socket reachable at 10.0.0.99:5060

15:16:12.245    udp0x2435c8  SIP UDP transport started, published address is 10.0.0.99:5060

15:16:12.245   pjsua_core.c  PJSUA state changed: INIT --> STARTING

15:16:12.245 sip_endpoint.c  .Module "mod-unsolicited-mwi" registered

15:16:12.245   pjsua_core.c  .PJSUA state changed: STARTING --> RUNNING

15:16:12.245    pjsua_acc.c  Adding account: id=sip:userid@xxxxxxxxxxxxx

15:16:12.245    pjsua_acc.c  .Account sip:userid@xxxxxxxxxxxxx added with id 0

15:16:12.245    pjsua_acc.c  .Acc 0: setting registration..

15:16:12.248   pjsua_core.c  ...TX 497 bytes Request msg REGISTER/cseq=39304 (tdta0x23c164) to UDP 194.109.16.16:5060:

REGISTER sip:sip.xs4all.nl SIP/2.0

Via: SIP/2.0/UDP 10.0.0.99:5060;rport;branch=z9hG4bKPjsh5eDyCQm2JSo2Bm8GXf5erfPT6JMoyu

Max-Forwards: 70

From: <sip:userid@xxxxxxxxxxxxx>;tag=7uSOTBe67M9DyrhJtvcO0jxlIQ3YsXip

To: <sip:userid@xxxxxxxxxxxxx>

Call-ID: 2TvmfX9qGaZcPdwCcpQoVIvg9Ca7i-zi

CSeq: 39304 REGISTER

Contact: <sip:userid@10.0.0.99:5060;ob>

Expires: 300

Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS

Content-Length:  0

 

 

--end msg--

15:16:12.248    pjsua_acc.c  ..Acc 0: Registration sent

15:16:12.248   pjsua_call.c  Making call with acc #0 to sip:0653435184@xxxxxxxxxxxxx

15:16:12.248    pjsua_aud.c  .Set sound device: capture=-1, playback=-2

15:16:12.248    pjsua_aud.c  ..Opening sound device (speaker + mic) PCM@16000/1/20ms

15:16:12.255     ec0x22fbc0  ...Speex AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=200 ms, latency=0 ms

15:16:12.255  pjsua_media.c !.Call 0: initializing media..

15:16:12.256  pjsua_media.c !..RTP socket reachable at 10.0.0.99:4000

15:16:12.256  pjsua_media.c  ..RTCP socket reachable at 10.0.0.99:4001

15:16:12.256  pjsua_media.c  ..Media index 0 selected for audio call 0

15:16:12.258   pjsua_core.c  .RX 468 bytes Response msg 401/REGISTER/cseq=39304 (rdata0x2395ac) from UDP 194.109.16.16:5060:

SIP/2.0 401 Unauthorized

Via: SIP/2.0/UDP 10.0.0.99:5060;received=publicipadress;branch=z9hG4bKPjsh5eDyCQm2JSo2Bm8GXf5erfPT6JMoyu;rport=61390

From: <sip:userid@xxxxxxxxxxxxx>;tag=7uSOTBe67M9DyrhJtvcO0jxlIQ3YsXip

To: <sip:userid@xxxxxxxxxxxxx>;tag=d56aea478912202a9e8e33cdbf0d16bf.cb0d

Call-ID: 2TvmfX9qGaZcPdwCcpQoVIvg9Ca7i-zi

CSeq: 39304 REGISTER

WWW-Authenticate: Digest realm="xs4all.nl", nonce="Xu4NSF7uDBwpurvqTR9z3/m4gndQLEHK"

Content-Length: 0

 

 

--end msg--

15:16:12.258   pjsua_core.c  ....TX 1221 bytes Request msg INVITE/cseq=1107 (tdta0x28f8fc) to UDP 194.109.16.16:5060:

INVITE sip:0653435184@xxxxxxxxxxxxx SIP/2.0

Via: SIP/2.0/UDP 10.0.0.99:5060;rport;branch=z9hG4bKPjT2.XWqJcP7iu-MeEA28uxwPF.Li3pPZJ

Max-Forwards: 70

From: sip:userid@xxxxxxxxxxxxx;tag=ASrQooUEXu0rXP6EF-xNaRCGjQn2Y167

To: sip:0653435184@xxxxxxxxxxxxx

Contact: <sip:userid@10.0.0.99:5060;ob>

Call-ID: LZdGnubNwQ3knAP7yvknzqPsBmPXO0Ww

CSeq: 1107 INVITE

Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS

Supported: replaces, 100rel, timer, norefersub

Session-Expires: 1800

Min-SE: 90

Content-Type: application/sdp

Content-Length:   619

 

v=0

o=- 3801647772 3801647772 IN IP4 10.0.0.99

s=pjmedia

b=AS:84

t=0 0

a=X-nat:0

m=audio 4000 RTP/AVP 96 97 98 99 3 0 8 9 120 121 122

c=IN IP4 10.0.0.99

b=TIAS:64000

a=rtcp:4001 IN IP4 10.0.0.99

a=sendrecv

a=rtpmap:96 speex/16000

a=rtpmap:97 speex/8000

a=rtpmap:98 speex/32000

a=rtpmap:99 iLBC/8000

a=fmtp:99 mode=30

a=rtpmap:3 GSM/8000

a=rtpmap:0 PCMU/8000

a=rtpmap:8 PCMA/8000

a=rtpmap:9 G722/8000

a=rtpmap:120 telephone-event/16000

a=fmtp:120 0-16

a=rtpmap:121 telephone-event/8000

a=fmtp:121 0-16

a=rtpmap:122 telephone-event/32000

a=fmtp:122 0-16

a=ssrc:806915523 cname:441e7b5b727a49e6

 

--end msg--

15:16:12.259            APP  .......Call 0 state=CALLING

15:16:12.259    pjsua_acc.c !....IP address change detected for account 0 (10.0.0.99:5060 --> publicipadress:61390). Updating registration (using method 4)

Press 'h' to hangup all calls, 'q' to quit

15:16:12.259   pjsua_core.c  ....TX 683 bytes Request msg REGISTER/cseq=39305 (tdta0x23c164) to UDP 194.109.16.16:5060:

REGISTER sip:sip.xs4all.nl SIP/2.0

Via: SIP/2.0/UDP publicipadress:61390;rport;branch=z9hG4bKPjmnVeK7Anb3LtZKEg5D5gqakl8C02rWxq

Max-Forwards: 70

From: <sip:userid@xxxxxxxxxxxxx>;tag=7uSOTBe67M9DyrhJtvcO0jxlIQ3YsXip

To: <sip:userid@xxxxxxxxxxxxx>

Call-ID: 2TvmfX9qGaZcPdwCcpQoVIvg9Ca7i-zi

CSeq: 39305 REGISTER

Contact: <sip:userid@publicipadress:61390;ob>

Expires: 300

Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS

Authorization: Digest username="userid", realm="xs4all.nl", nonce="Xu4NSF7uDBwpurvqTR9z3/m4gndQLEHK", uri="sip:sip.xs4all.nl", response="3052cc8cc7711aa378cfbd98ae654c37"

Content-Length:  0

 

 

--end msg--

15:16:12.267   pjsua_core.c  .RX 308 bytes Response msg 100/INVITE/cseq=1107 (rdata0x740019f4) from UDP 194.109.16.16:5060:

SIP/2.0 100 Trying

Via: SIP/2.0/UDP 10.0.0.99:5060;received=publicipadress;branch=z9hG4bKPjT2.XWqJcP7iu-MeEA28uxwPF.Li3pPZJ;rport=61390

From: sip:userid@xxxxxxxxxxxxx;tag=ASrQooUEXu0rXP6EF-xNaRCGjQn2Y167

To: sip:0653435184@xxxxxxxxxxxxx

Call-ID: LZdGnubNwQ3knAP7yvknzqPsBmPXO0Ww

CSeq: 1107 INVITE

 

 

--end msg--

15:16:12.267   pjsua_core.c  .RX 341 bytes Response msg 403/INVITE/cseq=1107 (rdata0x740019f4) from UDP 194.109.16.16:5060:

SIP/2.0 403 Forbidden

Via: SIP/2.0/UDP 10.0.0.99:5060;received=publicipadress;branch=z9hG4bKPjT2.XWqJcP7iu-MeEA28uxwPF.Li3pPZJ;rport=61390

From: sip:userid@xxxxxxxxxxxxx;tag=ASrQooUEXu0rXP6EF-xNaRCGjQn2Y167

To: <sip:0653435184@xxxxxxxxxxxxx>;tag=aprqngfrt-e4ma8e3000165

Call-ID: LZdGnubNwQ3knAP7yvknzqPsBmPXO0Ww

CSeq: 1107 INVITE

 

 

--end msg--

15:16:12.267   pjsua_core.c  ..TX 364 bytes Request msg ACK/cseq=1107 (tdta0x7400398c) to UDP 194.109.16.16:5060:

ACK sip:0653435184@xxxxxxxxxxxxx SIP/2.0

Via: SIP/2.0/UDP 10.0.0.99:5060;rport;branch=z9hG4bKPjT2.XWqJcP7iu-MeEA28uxwPF.Li3pPZJ

Max-Forwards: 70

From: sip:userid@xxxxxxxxxxxxx;tag=ASrQooUEXu0rXP6EF-xNaRCGjQn2Y167

To: sip:0653435184@xxxxxxxxxxxxx;tag=aprqngfrt-e4ma8e3000165

Call-ID: LZdGnubNwQ3knAP7yvknzqPsBmPXO0Ww

CSeq: 1107 ACK

Content-Length:  0

 

 

--end msg--

15:16:12.267            APP  .....Call 0 state=DISCONNCTD

15:16:12.267  pjsua_media.c  .....Call 0: deinitializing media..

15:16:12.267  pjsua_media.c  ......Call 0: cleaning up provisional media, prov_med_cnt=1, med_cnt=0

15:16:12.274   pjsua_core.c  .RX 529 bytes Response msg 200/REGISTER/cseq=39305 (rdata0x740019f4) from UDP 194.109.16.16:5060:

SIP/2.0 200 OK

Via: SIP/2.0/UDP publicipadress:61390;received=publicipadress;branch=z9hG4bKPjmnVeK7Anb3LtZKEg5D5gqakl8C02rWxq;rport=61390

From: <sip:userid@xxxxxxxxxxxxx>;tag=7uSOTBe67M9DyrhJtvcO0jxlIQ3YsXip

To: <sip:userid@xxxxxxxxxxxxx>;tag=d56aea478912202a9e8e33cdbf0d16bf.4810

Call-ID: 2TvmfX9qGaZcPdwCcpQoVIvg9Ca7i-zi

CSeq: 39305 REGISTER

Contact: <sip:userid@publicipadress;uniq=FB2E795FDD6ABACE43D6D56BEC380>;expires=1927

Contact: <sip:userid@publicipadress:61390;ob>;expires=1800

Content-Length: 0

 

 

--end msg--

15:16:12.274    pjsua_acc.c  ....SIP outbound status for acc 0 is not active

15:16:12.274    pjsua_acc.c  ....sip:userid@xxxxxxxxxxxxx: registration success, status=200 (OK), will re-register in 1800 seconds

15:16:12.274    pjsua_acc.c  ....Keep-alive timer started for acc 0, destination:194.109.16.16:5060, interval:15s

15:16:13.267    pjsua_aud.c  Closing sound device after idle for 1 second(s)

15:16:13.267    pjsua_aud.c  .Closing default:CARD=Dummy sound playback device and default:CARD=Dummy sound capture device

 

then the program just sit he until I press q.

 

 

Met Vriendelijke Groet, Regards,

 

Rob Muller

 

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux