Setup SIP with FlashPhoner

Max

Administrator
Staff member
Good day.
SIP connection is always establishing between WCS and SIP PBX. Only websocket signaling messages and WebRTC traffic goes between client and WCS. Please read details here.
So you should keep SIP connection between WCS and SIP PBX and, therefore, Websocket session between client and WCS to receive incoming calls. Just do not call session.disconnect until you want to receive incoming calls.
 

andrew.n

Member
@Max As I see in the examples, that session can be set up while the app is first responder. But how can I set up the SIP connection and still be available on the server side when the app is closed? :-?

Later edit: I setted up FPWCSApi2Session in `func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {` with the params from server, and after that I report the incoming call to the CallKit, but even like that I cannot hear anything from the other side. What should happen on server side to create the connection between 2 users? (one from web and one from iOS/android app)
 
Last edited:

Max

Administrator
Staff member
But how can I set up the SIP connection and still be available on the server side when the app is closed? :-?
When app is closed, websocket session is closed too. So, WCS closes SIP connection with PBX.
May be you should consider SIP call to mobile phone via PSTN gateway (see details here)?
What should happen on server side to create the connection between 2 users? (one from web and one from iOS/android app)
Please try to test a call between iOS Phone application (you should build it from sources) or Android Phone Min application (use phone-min-debug.apk from Android SDK latest bundle 1.1.0.44) and browser. Note that both can send and receive calls only if session is established.
If call is established successfully, but no sound, it may be due to codecs negotiation issue. In this case, the settings described here sholud help. Or, if your PBX supports TCP signaling, you can enable it on WCS
Code:
sip_force_tcp=true
 
Last edited:

Max

Administrator
Staff member
In Web SDK, it is possible to re-connect to existion SIP session using a special auth token:
1. Open a page, establish a WCS session, register on SIP server, remember a token
2. Close the page. SIP session should exist during 1 hour by default
3. Open a page, connect with token.
4. Receive an incoming call
We raised the ticket WCS-3361 to check this function and its availability in mobile SDKs. Will let you know here about results.
 

andrew.n

Member
@Max We seted up SIP connection and we receive the FPWCSApi2Call in the `session.onIncomingCallCallback({ call in` ... but the problem is that if the app is closed we have to report this FPWCSApi2Call object to the CallKit SDK. Even the app is open and we use call.answer(), we cannot hear each other. (We get to this point having the app first responder, but we also have to make it work when the phone is locked and the user can answer, discuss with the other user and after a while he can open the app - unlock the phone - to see each other).
 

Max

Administrator
Staff member
We seted up SIP connection and we receive the FPWCSApi2Call in the `session.onIncomingCallCallback({ call in` ... but the problem is that if the app is closed we have to report this FPWCSApi2Call object to the CallKit SDK
Receiving incoming call using push notifications relates to the function described in this post. In ticket WCS-3361 we will check if this still working, and fix if not, for Web SDK. Then, we raise corresponding tickets for mobuile SDKs if needed.
Even the app is open and we use call.answer(), we cannot hear each other.
Please reproduce this and collect a report on server side as described here, then send it using this form.
 

andrew.n

Member
@Max
Receiving incoming call using push notifications relates to the function described in this post. In ticket WCS-3361 we will check if this still working, and fix if not, for Web SDK. Then, we raise corresponding tickets for mobuile SDKs if needed.
When I click on the link, it's opening a new page with this post :| which is strange.. happening on 2 devices...

This is what I see during debugging...
<FPWCSApi2SessionOptions: 0x1591216f0>
Optional(<FPWCSApi2Session: 0x159144eb0>)

connect called... (when i call session.connect())

fpwcsSessionStatusEstablished
Optional(<FPWCSApi2Session: 0x159144eb0>)

fpwcsSessionStatusRegistered
Optional(<FPWCSApi2Session: 0x159144eb0>)

onIncomingCallCallback
// here i call call.answer()

fpwcsCallStatusRing
Optional(<FPWCSApi2Call: 0x159135910>)

2021-10-21 13:10:35.972373+0300 [8985:1743889] [FPWCSApi2MediaConnection] Set remote sdp: RTC_OBJC_TYPE(RTCSessionDescription):
offer
v=0
o=Flashphoner 0 1634811035729 IN IP4 10.90.0.2
s=Flashphoner/1.0
...... etc etc

fpwcsCallStatusEstablished
Optional(<FPWCSApi2Call: 0x159135910>)


at this point, even I respond to the call from CallKit, we don't hear each other

and after a while, without doing anything i get:
fpwcsCallStatusFinish
Optional(<FPWCSApi2Call: 0x159135910>)



For FPWCSApi2SessionOptions i set the following fields:
urlServer
sipLogin
sipRegisterRequired = true
sipAuthenticationName
sipPassword
sipDomain
sipOutboundProxy
sipPort
appKey = "defaultApp"


Also, the examples you provide are handled as the application is opened. How should I handle when the app is closed, user A is calling user B, user B responds without unlocking the phone, and after a while the user can open the app and continue in video streaming...
 
Last edited:

Max

Administrator
Staff member
at this point, even I respond to the call from CallKit, we don't hear each other
If the call itself is successfully established, this seems like SIP codecs negotiation issue. SDP may be cut during negotiation when using SIP UDP signaling because it does not fit to one standard network packet (1400 bytes).
Please set SIP signaging to use TCP if your PBX supports this
Code:
sip_force_tcp=true
If not, you should exclude exessive codecs
Code:
allow_outside_codecs=false 
codecs_exclude_sip=mpeg4-generic,flv,mpv,h264,vp8,g729,speex16,opus
In this case, only PCMA, PCMU, G722 audio codecs will be used.
If this does not help, collect a report on server side as described here, then send it using this form.
Also, the examples you provide are handled as the application is opened. How should I handle when the app is closed, user A is calling user B, user B responds without unlocking the phone, and after a while the user can open the app and continue in video streaming...
In Web SDK Phone example, it was possible to re-connect to existion SIP session using a special auth token:
1. Open a page, establish a WCS session, register on SIP server, remember an authToken (code)
2. Close the page. SIP session should exist during 1 hour by default
3. Open a page, connect with token (code)
4. Receive an incoming call (code).
But this seems to be broken now. We will fix it in ticket WCS-3361. Note that this functions is not supported in mobile SDKs yet, so we will create a corresponding tickets to implement this after WCS-3361 resolution.
 

Max

Administrator
Staff member
Good day.
We fixed the connection to an existing session issue in WCS build 5.2.1087, Phone Min example corresponding fix is in WebSDK build 2.0.206. Please read this docs for details: Connection to an existing session
We also raised the tickets to implement this feature support in Android SDK (WCS-3392) and iOS SDK (WCS-3393)
 

andrew.n

Member
@Max what about iOS examples? :-?
For example, I set up just audio. And the users can hear each other while the phone is locked.
How can I transfer the streaming/session from CallKitManager object to the video call screen, but also enable video, without having to rebuild the whole flow? :-? (The flow should work right away, without making users to wait for video enabling)
 
Last edited:

Max

Administrator
Staff member
Good day.
Since iOS SDK build 2.6.76, it is possible to connect to an existing websocket session on the server to accept an incoming call when push notification is received. Please read details here: Connection to an existing session
We're still working on CallKit example in ticket WCS-3420.
 
Top