Android Sample Problem: Incoming & Outgoing Calls

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

 



Hi all, 

It's been more than a week that I'm trying to get PJSIP under Android NDK working.

As first step,I followed Android Getting-Started Guide and I based on the sample app provided under r5609: 
$PJSIP_DIR/pjsip-apps/src/swig/java/android/
I checked the creation of the libpjsip2.so and that is available under jniLibs/armeabi in the Android project. 

Other settings that I used were:
Configuration: NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-21 TARGET_ABI=armeabi ./configure-android --use-ndk-cflags

Min SDK: 16, Target-SDK: 21 (Manifest and Gradle files)

I run the app and give the SIP Configurations (Asterisk SIP server) as follows:
  ID: sip:<client-nr>@<sip-server-ip>
  Registrar: sip:<sip-server-ip>
  Proxy:
  Username: <client-nr>
  Password: ****


The registration succeeds as:
        pjsua_core.c  .RX 613 bytes Response msg 200/REGISTER/cseq=46791 (rdata0xe593d014) from UDP org.pjsip.pjsua2.app I/System.out: SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.16.90.224:6000;branch=z9hG4bKPjb8ad6948-ec21-43c1-b386-851248b5faaf;received=10.16.90.224;rport=6000
From: <sip:8090404@10.16.90.13>;tag=a6c0cdd0-a1cd-431e-a81b-7155506858ca
To: <sip:8090404@10.16.90.13>;tag=as6c12fc38
Call-ID: e9646757-dbb2-4d62-ae2c-79dd7d417602
CSeq: 46791 REGISTER
Server: Asterisk PBX 1.8.13.1~dfsg1-3+deb7u4
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Expires: 300
Contact: <sip:8090404@10.16.90.224:6000;ob>;expires=300
Date: Wed, 28 Jun 2017 14:09:20 GMT
Content-Length: 0
--end msg--
13:54:06.640    pjsua_acc.c  ....SIP outbound status for acc 0 is not active
13:54:06.642    pjsua_acc.c  ....sip:8090404@10.16.90.13: registration success, status=200 (OK), will re-register in 300 seconds
13:54:06.644    pjsua_acc.c  ....Keep-alive timer started for acc 0, destination:10.16.90.13:5060, interval:15s
org.pjsip.pjsua2.app I/ViewRootImpl: ViewRoot's Touch Event : ACTION_DOWN

Hoever when I receive calls from other parties registered in the SIP system, the call is not shown until the other party hangs up the phone. The logs looks as following:
13:54:37.828   pjsua_core.c  .RX 855 bytes Request msg INVITE/cseq=102 (rdata0xe593d014) from UDP 10.16.90.13:5060:
INVITE sip:8090404@10.16.90.224:6000;ob SIP/2.0
Via: SIP/2.0/UDP 10.16.90.13:5060;branch=z9hG4bK7bb6182a;rport
Max-Forwards: 70
From: "ZuB mobile 8" <sip:8090402@10.16.90.13>;tag=as36e6e307
To: <sip:8090404@10.16.90.224:6000;ob>
Contact: <sip:8090402@10.16.90.13:5060>
Call-ID: 37bdcb3d69838c761f0397767c1648fa@10.16.90.13:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.13.1~dfsg1-3+deb7u4
Date: Wed, 28 Jun 2017 14:09:51 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 250
v=0
o=root 1541597689 1541597689 IN IP4 10.16.90.13
s=Asterisk PBX 1.8.13.1~dfsg1-3+deb7u4
c=IN IP4 10.16.90.13
t=0 0
m=audio 12074 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
--end msg--
13:54:37.837   pjsua_call.c  .Incoming Request msg INVITE/cseq=102 (rdata0xe593d014)
13:54:37.840  pjsua_media.c  ..Call 0: initializing media..
13:54:37.840   pjsua_core.c  ...Trying STUN server stun.pjsip.org (1 of 1)..
13:54:45.745 utsx0xd5c5ef50  ...STUN timeout waiting for response
13:54:45.748    stunresolve  ....Session failed because STUN Binding request failed: STUN transaction has timed out (PJNATH_ESTUNTIMEDOUT)
13:54:45.749   pjsua_core.c  ....STUN resolution for stun.pjsip.org failed: STUN transaction has timed out (PJNATH_ESTUNTIMEDOUT)
13:54:45.751   pjsua_core.c  ....STUN resolution failed: STUN transaction has timed out (PJNATH_ESTUNTIMEDOUT)
13:54:45.805   pjsua_core.c  ...Ignoring STUN resolution failure (by setting)
13:54:45.807        icetp00  ...Creating ICE stream transport with 2 component(s)
13:54:45.812        icetp00  ....Comp 1/0: host candidate 
10.16.90.224:37054 (tpid=64) added
13:54:45.814        icetp00  ....Comp 2/0: host candidate 
10.16.90.224:43063 (tpid=64) added
13:54:45.815        icetp00  ....ICE stream transport 0xd5c74614 created
13:54:45.815  pjsua_media.c  ...Media index 0 selected for audio call 0
13:54:45.816   pjsua_core.c  .....TX 308 bytes Response msg 100/INVITE/cseq=102 (tdta0xd5c1e064) to UDP 10.16.90.13:5060:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.16.90.13:5060;rport=5060;received=10.16.90.13;branch=z9hG4bK7bb6182a
Call-ID: 37bdcb3d69838c761f0397767c1648fa@10.16.90.13:5060
From: "ZuB mobile 8" <sip:8090402@10.16.90.13>;tag=as36e6e307
To: <sip:8090404@10.16.90.224;ob>
CSeq: 102 INVITE
Content-Length:  0
--end msg--
======== Incoming call ======== 
13:54:45.818   pjsua_call.c !Answering call 0: code=180
13:54:45.818   pjsua_call.c  .Pending answering call 0 upon completion of media transport
Activity_launch_request id:org.pjsip.pjsua2.app time:8914524
13:54:45.817   pjsua_core.c  .RX 855 bytes Request msg INVITE/cseq=102 (rdata0xe593d014) from UDP 10.16.90.13:5060:
INVITE sip:8090404@10.16.90.224:6000;ob SIP/2.0
Via: SIP/2.0/UDP 10.16.90.13:5060;branch=z9hG4bK7bb6182a;rport
Max-Forwards: 70
From: "ZuB mobile 8" <sip:8090402@10.16.90.13>;tag=as36e6e307
To: <sip:8090404@10.16.90.224:6000;ob>
Contact: <sip:8090402@10.16.90.13:5060>
Call-ID: 37bdcb3d69838c761f0397767c1648fa@10.16.90.13:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.13.1~dfsg1-3+deb7u4
Date: Wed, 28 Jun 2017 14:09:51 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 250
v=0
o=root 1541597689 1541597689 IN IP4 10.16.90.13
s=Asterisk PBX 1.8.13.1~dfsg1-3+deb7u4
c=IN IP4 10.16.90.13
t=0 0
m=audio 12074 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
--end msg--


At last I cannot place calls. They never come/appear on the handset of the other party. On the other parties I have a funcitoning SIP - Client App, hence they are in place to make and receive SIP calls. In the following the Android logcat I can see that the call is initiated but cannot be really placed later.


14:28:16.793   pjsua_call.c  Making call with acc #0 to sip:8090404@10.16.90.13
14:28:16.793    pjsua_aud.c  .Set sound device: capture=-1, playback=-2
14:28:16.793    pjsua_aud.c  ..Opening sound device (speaker + mic) PCM@16000/1/20ms
14:28:16.793 android_jni_de  ...Creating Android JNI stream
getMinFrameCount 640
getIoDescriptor: ioHandle = 21, index = 1, mIoDescriptors = 0xd5c65c38
getSamplingRate() ioHandle 21, sampling rate 48000
getIoDescriptor: ioHandle = 21, index = 1, mIoDescriptors = 0xd5c65c38
getFrameCount() ioHandle 21, frameCount 1920
getIoDescriptor: ioHandle = 21, index = 1, mIoDescriptors = 0xd5c65c38
getLatency() output 21, latency 80
calculateMinFrameCount afLatency 80  afFrameCount 1920  afSampleRate 48000  sampleRate 16000  speed 1.000000  minBufCount: 2
V/AudioTrack: getMinFrameCount=1288: afFrameCount=1920, afSampleRate=48000, afLatency=80
14:28:16.798 android_jni_de  ...Using audio input source : 7
set(): inputSource 7, sampleRate 16000, format 0x1, channelMask 0x10, frameCount 640, notificationFrames 0, sessionId 0, transferType 0, flags 0, opPackageName org.pjsip.pjsua2.app uid -1, pid -1
Building AudioRecord with attributes: source=7 flags=0x0 tags=[]
set(): mSessionId 969
set: Create AudioRecordThread
getIoDescriptor: ioHandle = 286, index = -2, mIoDescriptors = 0xd5c65c38
ioConfigChanged: [Update mIoDescriptors] add ioHandle = 286 -> descriptor = 0xe5d17734
ioConfigChanged() new input opened 286 samplingRate 16000, format 0x1 channel mask 0x10 frameCount 320 deviceId 0
getIoDescriptor: ioHandle = 286, index = 3, mIoDescriptors = 0xd5c65c38
getSamplingRate() ioHandle 286, sampling rate 16000
14:28:16.814 android_jni_de  ...Audio record initialized successfully.
14:28:16.815 android_jni_de !Setting thread priority successful
start, sync event 0 trigger session 0
mAudioRecord->start()
set(): streamType -1, sampleRate 16000, format 0x1, channelMask 0x1, frameCount 1288, flags #0, notificationFrames 0, sessionId 0, transferType 3, uid -1, pid -1
set() streamType -1 frameCount 1288 flags 0000
Building AudioTrack with attributes: usage=2 content=1 flags=0x0 tags=[]
set: Create AudioTrackThread
getIoDescriptor: ioHandle = 286, index = 3, mIoDescriptors = 0xd5c65c38
ioConfigChanged() new config for input 286 samplingRate 16000, format 0x1 channel mask 0x10 frameCount 320 frameCountHAL 320 deviceId 7
etIoDescriptor: ioHandle = 13, index = 0, mIoDescriptors = 0xd5c65c38
getLatency() output 13, latency 48
createTrack_l() output 13 afLatency 48
getIoDescriptor: ioHandle = 13, index = 0, mIoDescriptors = 0xd5c65c38
getFrameCount() ioHandle 13, frameCount 960
getIoDescriptor: ioHandle = 13, index = 0, mIoDescriptors = 0xd5c65c38
getFrameCountHAL() ioHandle 13, frameCount 192
getIoDescriptor: ioHandle = 13, index = 0, mIoDescriptors = 0xd5c65c38
getSamplingRate() ioHandle 13, sampling rate 48000
calculateMinFrameCount afLatency 48  afFrameCount 960  afSampleRate 48000  sampleRate 16000  speed 1.000000  minBufCount: 2
this(0xc6437aa0), mCblk(0xc7c80000), front(0), mIsOut 0, interrupt() FUTEX_WAKE
D/AudioRecord: AudioRecord->stop()
Client defaulted notificationFrames to 429 for frameCount 1288
14:28:16.838 android_jni_de !...Audio track initialized successfully.
14:28:16.840   ec0xc649d500  ...AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=200 ms, latency=0 ms
14:28:16.840 android_jni_de  ...Android JNI stream started
14:28:16.842  pjsua_media.c  .Call 2: initializing media..
14:28:16.842   pjsua_core.c  ..Trying STUN server stun.pjsip.org (1 of 1)..
start, sync event 0 trigger session 0
mAudioRecord->start()
14:28:16.845 android_jni_de !Setting thread priority successful
start(): 0xc6403600
getIoDescriptor: ioHandle = 13, index = 0, mIoDescriptors = 0xd5c65c38
ioConfigChanged() new config for output 13 samplingRate 48000, format 0x5 channel mask 0x3 frameCount 960 frameCountHAL 192 deviceId 1
14:28:19.741   pjsua_core.c !.RX 572 bytes Request msg OPTIONS/cseq=102 (rdata0xe593d014) from UDP 10.16.90.13:5060:
OPTIONS sip:8090404@10.16.90.224:6000;ob SIP/2.0
Via: SIP/2.0/UDP 10.16.90.13:5060;branch=z9hG4bK61100e51;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@10.16.90.13>;tag=as41eca3c3
To: <sip:8090404@10.16.90.224:6000;ob>
Contact: <sip:asterisk@10.16.90.13:5060>
Call-ID: 3424500427a340620363ba0421441046@10.16.90.13:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.13.1~dfsg1-3+deb7u4
Date: Wed, 28 Jun 2017 14:43:33 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

....

14:28:29.706 tcpc0xc6451814  TCP connect() error: Connection refused [code=120111]
14:28:29.707  tsx0xe594a064  Temporary failure in sending Request msg INVITE/cseq=2291 (tdta0xd5c1e064), will try next server: Connection refused
14:28:29.707   pjsua_core.c  TX 1458 bytes Request msg INVITE/cseq=2291 (tdta0xd5c1e064) to UDP 10.16.90.13:5060:
INVITE sip:8090404@10.16.90.13 SIP/2.0
Via: SIP/2.0/UDP 10.16.90.224:6000;rport;branch=z9hG4bKPjcec14480-39f2-4b56-9c6a-24d709db0644
Max-Forwards: 70
From: sip:8090404@10.16.90.13;tag=25df7888-cca1-4590-9a3d-0c564305c5a9
To: sip:8090404@10.16.90.13
Contact: <sip:8090404@10.16.90.224:6000;ob>
Call-ID: df757a02-4bf9-4236-b9be-daae0d8a7ee7
CSeq: 2291 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
User-Agent: Pjsua2 Android 2.6-svn
Authorization: Digest username="8090404", realm="asterisk", nonce="10191c35", uri="sip:8090404@10.16.90.13", response="e1596f80d122fa5162b3898680143441", algorithm=MD5
Content-Type: application/sdp
Content-Length:   651
v=0
o=- 3707641709 3707641709 IN IP4 10.16.90.224
s=pjmedia
b=AS:84
t=0 0
a=X-nat:0
m=audio 41449 RTP/AVP 98 97 99 104 3 0 8 9 96
c=IN IP4 10.16.90.224
b=TIAS:64000
a=rtcp:35730 IN IP4 10.16.90.224
a=sendrecv
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:99 speex/32000
a=rtpmap:104 iLBC/8000
a=fmtp:104 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
a=ice-ufrag:43d7fa21
a=ice-pwd:506ecc17
a=candidate:Ha105ae0 1 UDP 2130706431 10.16.90.224 41449 typ host
a=candidate:Ha105ae0 2 UDP 2130706430 10.16.90.224 35730 typ host


When I build and check the sample app using my mac-book (I simply followed MacOS/Linux/BSD Getting-Started Guide) I could run the sample app while I could replace and answer SIP callls. Can you please give me any hints if you have any. Or do you see any problem at the current android sample.

Thanks a lot in advance,

Cheers
Tunç






_______________________________________________
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