VoIPGRID / VialerSIPLib

An Objective-c wrapper for PJSIP
GNU General Public License v3.0
133 stars 69 forks source link

Outgoing calls on TCP #234

Open ismaiI1 opened 3 years ago

ismaiI1 commented 3 years ago

Version

3.7.3

Expected behavior

I should make outgoing calls on TCP transport.

Actual behavior

I can get Incoming call on TCP but I couldn't make outgoing calls. It gives Unsupported transport (PJSIP_EUNSUPTRANSPORT) error (see in stacktrace)

Stacktrace / Error message

πŸ’š DEBUG 09:17:01.482 [VSLAccount -[VSLAccount registerAccountWithCompletion:]:255] Account valid: YES πŸ’š DEBUG 09:17:01.483 [VSLAccount -[VSLAccount registerAccountWithCompletion:]:256] Should force registration: NO πŸ’œ VERBOSE 09:17:01.484 [VSLAccount -[VSLAccount registerAccountWithCompletion:]:283] Sending registration for account: 0 πŸ’š DEBUG 09:17:01.484 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_acc.c !Acc 0: setting registration.. πŸ’š DEBUG 09:17:01.492 [VSLEndpoint void logCallBack(int, const char , int):634] tcpc0x10c86c228 .TCP client transport created πŸ’š DEBUG 09:17:01.493 [VSLEndpoint void logCallBack(int, const char , int):634] tcpc0x10c86c228 .TCP transport 192.168.2.3:65531 is connecting to 185.88.7.98:5070... πŸ’š DEBUG 09:17:01.496 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_acc.c .Contact for acc 0 updated: sip:198@192.168.2.3:65531;transport=TCP;ob;reg-id=1;+sip.instance="" πŸ’š DEBUG 09:17:01.499 [VSLEndpoint void logCallBack(int, const char *, int):634] pjsua_core.c ..TX 677 bytes Request msg REGISTER/cseq=23302 (tdta0x10c0800a8) to TCP 185.88.7.98:5070: REGISTER sip:proxysip.domain.com:5070;transport=tcp SIP/2.0

Via: SIP/2.0/TCP 192.168.2.3:65531;rport;branch=z9hG4bKPjgIYrKmZL5SzvCKZ.xS6o.MEcE1JC6Aw3;alias

Max-Forwards: 70

From: sip:198@proxysip.domain.com;tag=G3IzwWrjR8tYxvUupbMX9U6a3g5-4pmd

To: sip:198@proxysip.domain.com

Call-ID: 9F48TnjDUljAssy1nmxwld33l7FHZzGU

CSeq: 23302 REGISTER

User-Agent: My Project IOS 2.1

Supported: outbound, path

Contact: sip:198@192.168.2.3:65531;transport=TCP;ob;reg-id=1;+sip.instance=""

Expires: 800

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

Content-Length: 0

--end msg-- πŸ’š DEBUG 09:17:01.502 [VSLEndpoint void logCallBack(int, const char , int):634] tcpc0x10c86c228 !TCP transport 192.168.2.3:65531 is connected to 185.88.7.98:5070 πŸ’œ VERBOSE 09:17:01.504 [VSLEndpoint void onTransportStateChanged(pjsip_transport , pjsip_transport_state, const pjsip_transport_state_info ):1024] Transport state changed to: PJSIP_TP_STATE_CONNECTED πŸ’œ VERBOSE 09:17:01.569 [VSLEndpoint void onRegStarted2(pjsua_acc_id, pjsua_reg_info ):705] PJSUA callback: registration or unregistration has been initiated. πŸ’š DEBUG 09:17:01.570 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_acc.c .Acc 0: Registration sent πŸ’š DEBUG 09:17:01.574 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_core.c .RX 543 bytes Response msg 401/REGISTER/cseq=23302 (rdata0x10c86c530) from TCP 185.88.7.98:5070: SIP/2.0 401 Unauthorized

Via: SIP/2.0/TCP 192.168.2.3:65531;rport=48921;branch=z9hG4bKPjgIYrKmZL5SzvCKZ.xS6o.MEcE1JC6Aw3;alias;received=192.168.0.119

From: sip:198@proxysip.domain.com;tag=G3IzwWrjR8tYxvUupbMX9U6a3g5-4pmd

To: sip:198@proxysip.domain.com;tag=19c947e85d414e2eb14bb886ac6b5862.d788

Call-ID: 9F48TnjDUljAssy1nmxwld33l7FHZzGU

CSeq: 23302 REGISTER

WWW-Authenticate: Digest realm="proxysip.domain.com", nonce="YD3YmWA92F3F8RnPa3aCsyiAw03q253zCxoYsoA="

Server: kamailio (5.2.3 (x86_64/linux))

Content-Length: 0

--end msg-- πŸ’™ INFO 09:17:01.578 [VSLEndpoint void logCallBack(int, const char , int):631] pjsua_acc.c ....IP address change detected for account 0 (192.168.2.3:65531 --> 192.168.0.119:48921). Updating registration (using method -1328789008) πŸ’š DEBUG 09:17:01.580 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_acc.c ....Contact for acc 0 updated: sip:198@192.168.0.119:48921;transport=TCP;ob;reg-id=1;+sip.instance="" πŸ’š DEBUG 09:17:01.582 [VSLEndpoint void logCallBack(int, const char *, int):634] pjsua_core.c ....TX 899 bytes Request msg REGISTER/cseq=23303 (tdta0x10c0800a8) to TCP 185.88.7.98:5070: REGISTER sip:proxysip.domain.com:5070;transport=tcp SIP/2.0

Via: SIP/2.0/TCP 192.168.0.119:48921;rport;branch=z9hG4bKPj5RhkpZReLAp6TojeMLq3ql0dDb4gMY7h;alias

Max-Forwards: 70

From: sip:198@proxysip.domain.com;tag=G3IzwWrjR8tYxvUupbMX9U6a3g5-4pmd

To: sip:198@proxysip.domain.com

Call-ID: 9F48TnjDUljAssy1nmxwld33l7FHZzGU

CSeq: 23303 REGISTER

User-Agent: My Project IOS 2.1

Supported: outbound, path

Contact: sip:198@192.168.0.119:48921;transport=TCP;ob;reg-id=1;+sip.instance=""

Expires: 800

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

Authorization: Digest username="198", realm="proxysip.domain.com", nonce="YD3YmWA92F3F8RnPa3aCsyiAw03q253zCxoYsoA=", uri="sip:proxysip.domain.com:5070;transport=tcp", response="e41bfb633918c2239fcf019d10265647"

Content-Length: 0

--end msg-- πŸ’š DEBUG 09:17:01.620 [VSLEndpoint void logCallBack(int, const char *, int):634] pjsua_core.c .RX 619 bytes Response msg 200/REGISTER/cseq=23303 (rdata0x10c86c530) from TCP 185.88.7.98:5070: SIP/2.0 200 OK

Via: SIP/2.0/TCP 192.168.0.119:48921;rport=48921;branch=z9hG4bKPj5RhkpZReLAp6TojeMLq3ql0dDb4gMY7h;alias;received=192.168.0.119

From: sip:198@proxysip.domain.com;tag=G3IzwWrjR8tYxvUupbMX9U6a3g5-4pmd

To: sip:198@proxysip.domain.com;tag=19c947e85d414e2eb14bb886ac6b5862.1a8d

Call-ID: 9F48TnjDUljAssy1nmxwld33l7FHZzGU

CSeq: 23303 REGISTER

Contact: sip:198@192.168.0.119:48921;transport=TCP;ob;expires=800;received="sip:192.168.0.119:48921;transport=tcp";+sip.instance="";reg-id=1

Server: kamailio (5.2.3 (x86_64/linux))

Content-Length: 0

--end msg-- πŸ’š DEBUG 09:17:01.633 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_acc.c ....SIP outbound status for acc 0 is not active πŸ’™ INFO 09:17:01.634 [VSLEndpoint void logCallBack(int, const char , int):631] pjsua_acc.c ....sip:198@proxysip.domain.com:5070;transport=tcp: registration success, status=200 (OK), will re-register in 800 seconds πŸ’œ VERBOSE 09:17:01.634 [VSLEndpoint void onRegState2(pjsua_acc_id, pjsua_reg_info ):712] PJSUA callback: registration status has changed. πŸ’š DEBUG 09:17:01.634 [VSLAccount -[VSLAccount setAccountState:]:54] AccountState will change from VSLAccountStateOffline(0) to VSLAccountStateConnected(2) πŸ’œ VERBOSE 09:17:01.635 [VSLAccount -[VSLAccount accountStateChanged]:383] Account registered succesfully πŸ’š DEBUG 09:17:01.635 [VSLAccount -[VSLAccount registerAccountWithCompletion:]:255] Account valid: YES πŸ’š DEBUG 09:17:01.635 [VSLAccount -[VSLAccount registerAccountWithCompletion:]:256] Should force registration: NO πŸ’œ VERBOSE 09:17:01.635 [VSLAccount -[VSLAccount registerAccountWithCompletion:]:299] VSLAccount registered or registration in progress, cannot sent another registration πŸ’œ VERBOSE 09:17:01.635 [VSLAccount -[VSLAccount registerAccountWithCompletion:]:300] VSLAccount state: 2 πŸ’œ VERBOSE 09:17:01.636 [VSLCallManager -[VSLCallManager addCall:]:216] Call(C8B0579C-4039-4463-A422-B0AFE6F4C5F2) added. Calls count:1 πŸ’™ INFO 09:17:01.648 [VSLCallManager -[VSLCallManager startCallToNumber:forAccount:completion:]_block_invoke_2:85] "Start Call Transaction" requested succesfully for Call(C8B0579C-4039-4463-A422-B0AFE6F4C5F2) with account(0) πŸ’œ VERBOSE 09:17:01.650 [VSLCallManager -[VSLCallManager callWithUUID:]:261] Looking for a call with UUID:C8B0579C-4039-4463-A422-B0AFE6F4C5F2 πŸ’š DEBUG 09:17:01.650 [VSLCallManager -[VSLCallManager callWithUUID:]:271] VSLCall found for UUID:C8B0579C-4039-4463-A422-B0AFE6F4C5F2 VSLCall:<VSLCall: 0x283c0bd00> πŸ’œ VERBOSE 09:17:01.651 [VSLAudioController -[VSLAudioController configureAudioSession]:60] Setting AVAudioSessionCategory to "Play and Record" πŸ’œ VERBOSE 09:17:01.652 [VSLAudioController -[VSLAudioController configureAudioSession]:69] Setting AVAudioSessionCategory to "Mode Voice Chat" πŸ’š DEBUG 09:17:01.652 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_call.c !Making call with acc #0 to sip:164@proxysip.domain.com:5070 πŸ’š DEBUG 09:17:01.652 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c .Call 0: initializing media.. πŸ’š DEBUG 09:17:01.657 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c ..Note: STUN mapped RTCP port 42515 is not adjacent to RTP port 49021 πŸ’š DEBUG 09:17:01.657 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c ..RTP socket reachable at 192.168.0.119:49021 πŸ’š DEBUG 09:17:01.657 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c ..RTCP socket reachable at 192.168.0.119:42515 πŸ’š DEBUG 09:17:01.658 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c ..Media index 0 selected for audio call 0 πŸ’™ INFO 09:17:01.660 [VSLEndpoint void logCallBack(int, const char , int):631] tsx0x1088206a8 ....Failed to send Request msg INVITE/cseq=3881 (tdta0x108c6b0a8)! err=171060 (Unsupported transport (PJSIP_EUNSUPTRANSPORT)) πŸ’œ VERBOSE 09:17:01.660 [VSLEndpoint void onTxStateChange(pjsua_call_id, pjsip_transaction , pjsip_event ):771] PJSUA callback: transaction within the call has changed state. πŸ’œ VERBOSE 09:17:01.661 [VSLEndpoint void onCallState(pjsua_call_id, pjsip_event ):673] PJSUA callback: call state changed to VSLCallStateDisconnected. πŸ’š DEBUG 09:17:01.661 [VSLCall -[VSLCall setCallState:]:141] Call(C8B0579C-4039-4463-A422-B0AFE6F4C5F2). CallState will change from VSLCallStateNull(0) to VSLCallStateDisconnected(6) πŸ’š DEBUG 09:17:01.661 [VSLCall -[VSLCall calculateStats]:987] Stream is not active! πŸ’™ INFO 09:17:01.661 [VSLRingback -[VSLRingback stop]:100] Stop ringback, isPlaying: NO πŸ’œ VERBOSE 09:17:01.661 [VSLCallManager -[VSLCallManager removeCall:]:226] Call(C8B0579C-4039-4463-A422-B0AFE6F4C5F2) removed. Calls count: 0 πŸ’š DEBUG 09:17:01.661 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_acc.c .......Acc 0: setting unregistration.. πŸ’š DEBUG 09:17:01.663 [VSLEndpoint void logCallBack(int, const char *, int):634] pjsua_core.c .........TX 581 bytes Request msg REGISTER/cseq=23304 (tdta0x108c6d0a8) to TCP 185.88.7.98:5070: REGISTER sip:proxysip.domain.com:5070;transport=tcp SIP/2.0

Via: SIP/2.0/TCP 192.168.0.119:48921;rport;branch=z9hG4bKPjBotUt4wp5a7gtgZm0xqUERErLDv8ZDyw;alias

Max-Forwards: 70

From: sip:198@proxysip.domain.com;tag=HC..fJjXAJ3KFagwEsqsfbGox68LIGMU

To: sip:198@proxysip.domain.com

Call-ID: 9F48TnjDUljAssy1nmxwld33l7FHZzGU

CSeq: 23304 REGISTER

User-Agent: My Project IOS 2.1

Supported: outbound, path

Contact: sip:198@192.168.0.119:48921;transport=TCP;ob;reg-id=1;+sip.instance=""

Expires: 0

Content-Length: 0

--end msg-- πŸ’œ VERBOSE 09:17:01.669 [VSLEndpoint void onRegStarted2(pjsua_acc_id, pjsua_reg_info ):705] PJSUA callback: registration or unregistration has been initiated. πŸ’š DEBUG 09:17:01.669 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_acc.c ........Acc 0: Unregistration sent πŸ’™ INFO 09:17:01.670 [VSLAccount -[VSLAccount unregisterAccount:]:343] Account unregistered succesfully πŸ’š DEBUG 09:17:01.670 [CallKitProviderDelegate -[CallKitProviderDelegate callStateChanged:]:318] Call never connected, in DISCONNECTED state, with UUID: C8B0579C-4039-4463-A422-B0AFE6F4C5F2 πŸ’œ VERBOSE 09:17:01.670 [VSLEndpoint -[VSLEndpoint stopNetworkMonitoring]:915] No active calls for any account, stopping network monitor πŸ’š DEBUG 09:17:01.671 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c .......Call 0: deinitializing media.. πŸ’š DEBUG 09:17:01.671 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c ........Call 0: cleaning up provisional media, prov_med_cnt=1, med_cnt=0 πŸ’š DEBUG 09:17:01.671 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c .Call 0: deinitializing media.. πŸ’š DEBUG 09:17:01.671 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_media.c .Call 0: deinitializing media.. πŸ’œ VERBOSE 09:17:01.671 [VSLCall -[VSLCall startWithCompletion:]:373] Call(C8B0579C-4039-4463-A422-B0AFE6F4C5F2) started with id:0 ❗ ERROR 09:17:01.671 [VSLCall -[VSLCall startWithCompletion:]:379] Error creating call, status: Unsupported transport (PJSIP_EUNSUPTRANSPORT) ❗ ERROR 09:17:01.672 [CallKitProviderDelegate -[CallKitProviderDelegate provider:performStartCallAction:]_block_invoke:198] Error starting call(C8B0579C-4039-4463-A422-B0AFE6F4C5F2) error: Error Domain=VialerSIPLib.VSLCall Code=1 "Could not setup call" UserInfo={NSLocalizedDescription=Could not setup call, NSLocalizedFailureReason=PJSIP status code: 171060} πŸ’š DEBUG 09:17:01.673 [VSLEndpoint void logCallBack(int, const char *, int):634] pjsua_core.c .RX 545 bytes Response msg 401/REGISTER/cseq=23304 (rdata0x10c86c530) from TCP 185.88.7.98:5070: SIP/2.0 401 Unauthorized

Via: SIP/2.0/TCP 192.168.0.119:48921;rport=48921;branch=z9hG4bKPjBotUt4wp5a7gtgZm0xqUERErLDv8ZDyw;alias;received=192.168.0.119

From: sip:198@proxysip.domain.com;tag=HC..fJjXAJ3KFagwEsqsfbGox68LIGMU

To: sip:198@proxysip.domain.com;tag=19c947e85d414e2eb14bb886ac6b5862.64f1

Call-ID: 9F48TnjDUljAssy1nmxwld33l7FHZzGU

CSeq: 23304 REGISTER

WWW-Authenticate: Digest realm="proxysip.domain.com", nonce="YD3YmWA92F1UmVXvXU+7FVriSFPEIbNiCxoZs4A="

Server: kamailio (5.2.3 (x86_64/linux))

Content-Length: 0

--end msg-- πŸ’š DEBUG 09:17:01.673 [VSLEndpoint void logCallBack(int, const char *, int):634] pjsua_core.c ....TX 799 bytes Request msg REGISTER/cseq=23305 (tdta0x108c6d0a8) to TCP 185.88.7.98:5070: REGISTER sip:proxysip.domain.com:5070;transport=tcp SIP/2.0

Via: SIP/2.0/TCP 192.168.0.119:48921;rport;branch=z9hG4bKPjggjAlc-lbY5pYCAygPpbxPv-5HrG6lBQ;alias

Max-Forwards: 70

From: sip:198@proxysip.domain.com;tag=HC..fJjXAJ3KFagwEsqsfbGox68LIGMU

To: sip:198@proxysip.domain.com

Call-ID: 9F48TnjDUljAssy1nmxwld33l7FHZzGU

CSeq: 23305 REGISTER

User-Agent: My Project IOS 2.1

Supported: outbound, path

Contact: sip:198@192.168.0.119:48921;transport=TCP;ob;reg-id=1;+sip.instance=""

Expires: 0

Authorization: Digest username="198", realm="proxysip.domain.com", nonce="YD3YmWA92F1UmVXvXU+7FVriSFPEIbNiCxoZs4A=", uri="sip:proxysip.domain.com:5070;transport=tcp", response="11a2cb6071ee98fd8b5c056683b462aa"

Content-Length: 0

--end msg-- πŸ’š DEBUG 09:17:01.691 [VSLEndpoint void logCallBack(int, const char *, int):634] pjsua_core.c .RX 428 bytes Response msg 200/REGISTER/cseq=23305 (rdata0x10c86c530) from TCP 185.88.7.98:5070: SIP/2.0 200 OK

Via: SIP/2.0/TCP 192.168.0.119:48921;rport=48921;branch=z9hG4bKPjggjAlc-lbY5pYCAygPpbxPv-5HrG6lBQ;alias;received=192.168.0.119

From: sip:198@proxysip.domain.com;tag=HC..fJjXAJ3KFagwEsqsfbGox68LIGMU

To: sip:198@proxysip.domain.com;tag=19c947e85d414e2eb14bb886ac6b5862.ee6b

Call-ID: 9F48TnjDUljAssy1nmxwld33l7FHZzGU

CSeq: 23305 REGISTER

Server: kamailio (5.2.3 (x86_64/linux))

Content-Length: 0

--end msg-- πŸ’™ INFO 09:17:01.696 [VSLEndpoint void logCallBack(int, const char , int):631] pjsua_acc.c ....sip:198@proxysip.domain.com:5070;transport=tcp: unregistration success πŸ’œ VERBOSE 09:17:01.697 [VSLEndpoint void onRegState2(pjsua_acc_id, pjsua_reg_info ):712] PJSUA callback: registration status has changed. πŸ’š DEBUG 09:17:01.697 [VSLAccount -[VSLAccount setAccountState:]:54] AccountState will change from VSLAccountStateConnected(2) to VSLAccountStateDisconnected(3) πŸ’š DEBUG 09:17:01.697 [VSLEndpoint void logCallBack(int, const char , int):634] utsx0x10c016c30 STUN timeout waiting for response πŸ’› WARNING 09:17:01.697 [VSLEndpoint void onNatDetect(const pj_stun_nat_detect_result ):1047] NAT detection failed YES πŸ’š DEBUG 09:17:01.741 [VSLAudioController -[VSLAudioController activateSoundDevice]:85] Activating audiosession πŸ’š DEBUG 09:17:01.741 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_aud.c !Set sound device: capture=-1, playback=-2 πŸ’š DEBUG 09:17:01.741 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_aud.c .Opening sound device (speaker + mic) PCM@16000/1/20ms πŸ’š DEBUG 09:17:01.742 [VSLEndpoint void logCallBack(int, const char , int):634] coreaudio_dev.c ..Using VoiceProcessingIO audio unit πŸ’š DEBUG 09:17:02.118 [VSLEndpoint void logCallBack(int, const char , int):634] coreaudio_dev.c ..core audio stream started πŸ’š DEBUG 09:17:02.125 [VSLAudioController -[VSLAudioController deactivateSoundDevice]:111] Deactivating audiosession πŸ’š DEBUG 09:17:02.130 [VSLEndpoint void logCallBack(int, const char , int):634] pjsua_aud.c .Closing iPhone IO device sound playback device and iPhone IO device sound capture device πŸ’š DEBUG 09:17:02.143 [VSLEndpoint void logCallBack(int, const char , int):634] coreaudio_dev.c .core audio stream stopped

Other info

on UDP, It's working but sometimes it couldn't register to server when my app got the voip push notification. So I want to try TCP

Roman-Scherbakov commented 3 years ago

Hello @invisible66 have you resolved this? I have the same issue

ismaiI1 commented 3 years ago

Unfortunately no

fukemy commented 3 years ago

same issues for incomming call only

Roman-Scherbakov commented 3 years ago

Guys, I found solution, you should explicitly indicate the transport protocol for tcp. Something like this: