[HELP] SaraPhone Tones
Hello Everyone, How is possible enable tones ( dial tones ) for outbound call ?
Ciao Volga,
actually is enabled... I mean, it works for IVRs etc... IIRC is using INFO because that was the only supported in old sip.js lib (in future there will be a new version/release using sip.js 0.15.latest, IIRC supports all kind of dtmf) can you check the dtmf are working, or better explain the problem?
Hello Giovanni, Sorry If I miss spelled you name. In fusion pbx no dial tone during outbound calls only silence until connected.
I think that portion saraphone.lua
if(saraphone_bind == "false") then
session:execute("export","saraphone_bind=true");
local saraphone_is_caller = string.find(saraphone_caller_user_agent, "SaraPhone");
if(saraphone_is_caller) then
saraphone_is_caller = "true"
session:execute("export","ignore_early_media=false");
session:setVariable("ringback", saraphone_ringback);
session:setVariable("instant_ringback", "true");
session:answer()
api:execute("msleep", "1000");
end
where it defined saraphone_ringback ?
I think this portion failing
local saraphone_ringback = session:getVariable("us-ring");
if(saraphone_ringback == nil) then saraphone_ringback = "%(2000,4000,440,480)" end
Based on dial plan it never set ring_tone
EXECUTE [depth=0] sofia/internal-proxy/[email protected] lua(saraphone.lua)
EXECUTE [depth=0] sofia/internal-proxy/[email protected] export(saraphone_bind=true)
EXECUTE [depth=0] sofia/internal-proxy/[email protected] export(saraphone_is_both=true)
EXECUTE [depth=0] sofia/internal-proxy/[email protected] bind_digit_action(saraphone_local,*299,exec:execute_extension,saraphone_hold XML contactbox.colpbx.com,aleg,bleg)
2021-01-11 11:05:09.039244 [INFO] switch_ivr_async.c:219 Digit parser DPTOOLS: Setting realm to 'saraphone_local'
EXECUTE [depth=0] sofia/internal-proxy/[email protected] bind_digit_action(saraphone_local,*399,exec:execute_extension,saraphone_hold XML contactbox.colpbx.com,peer,peer)
2021-01-11 11:05:09.039244 [INFO] switch_ivr_async.c:219 Digit parser DPTOOLS: Setting realm to 'saraphone_local'
EXECUTE [depth=0] sofia/internal-proxy/[email protected] bind_digit_action(saraphone_local,*499,exec:execute_extension,saraphone_dx XML contactbox.colpbx.com,aleg,bleg)
EXECUTE [depth=0] sofia/internal-proxy/[email protected] bind_digit_action(saraphone_local,*599,exec:execute_extension,saraphone_dx XML contactbox.colpbx.com,peer,peer)
EXECUTE [depth=0] sofia/internal-proxy/[email protected] bind_digit_action(saraphone_local,*699,exec:execute_extension,saraphone_att_xfer XML contactbox.colpbx.com,aleg,bleg)
EXECUTE [depth=0] sofia/internal-proxy/[email protected] bind_digit_action(saraphone_local,*799,exec:execute_extension,saraphone_att_xfer XML contactbox.colpbx.com,peer,peer)
EXECUTE [depth=0] sofia/internal-proxy/[email protected] digit_action_set_realm(saraphone_local)
ah ok, I misread dialtones (ringback) for dtmfs :)
the LUA script creates the
local saraphone_ringback
variable, and assign to it the value of US ringtone as is in the channel variables if that US ringtone is not defined in channel variables, LUA script assign it explicitly
if(saraphone_ringback == nil) then saraphone_ringback = "%(2000,4000,440,480)" end
If this do not works for you, the trick is to have the FPBX to answer immediately the call from SaraPhone, at the INVITE moment, and have the FPBX send media to it.
No way to have early media played before answering, that SIP.JS version does not support early media
maybe you want to substitute this:
local saraphone_ringback = session:getVariable("us-ring"); if(saraphone_ringback == nil) then saraphone_ringback = "%(2000,4000,440,480)" end
with this:
local saraphone_ringback = "%(2000,4000,440,480)"
just to be on the safe side
I tested still no ring back. I and don't see 183 only 180 toward FPBX leg A
no 183, no early media, no way
Fusion must answer the (A leg) call BEFORE bridging to B leg and is Fusion that sends audio to SaraPhone imitating the early media so:
SaraPhone -> INVITE Fusion -> 200 OK Fusion-> sends audio ring tone
Fusion-> bridge the A leg to B leg (whatever) Fusion-> sends early media from B leg to A leg (if and when early media is received from B leg)
SaraPhone (that version of SIP.JS) is unable to get or play early media Audio can only flow AFTER the call is established (answered)
In term of signalling that exactly what I see.
check why Fusion do not sends audio to SaraPhone, if you do not get ringback
put a sleep after the answer in dialplan
or whatever, let me know
I tried many thing and can't make it work. Is newer library version support Earlier Media ? The calls are connecting no problem, but no ring back during call setup.
next days I will update here how I do for ringback, maybe I forgot smthg
please ping me if I do not do it :)
Thank you.
I see I used something similar to what follow.
So, maybe the trick is to set not only ringback, but also transfer_ringback and instant_ringback
session:setVariable("ringback", saraphone_ringback); session:setVariable("transfer_ringback", saraphone_ringback); session:setVariable("instant_ringback", "true");
would you check if it works for you?
I will test right now
I tested no luck.
@gmaruzz I tried different think, but fusion still send Earlier Media. I set ring_ready() in dialplan before saraphone.lua and I see it send 180 as expected, but latter in dialplan after the bridge freeswitch send earlier media. Not sure how to solve this completely yet.
This is 180
2021-01-19 21:13:46.508698 [INFO] switch_ivr_async.c:219 Digit parser DPTOOLS: Setting realm to 'local'
EXECUTE [depth=0] sofia/internal-proxy/[email protected] sleep(3000)
EXECUTE [depth=0] sofia/internal-proxy/[email protected] ring_ready(ringback=%(2000, 4000, 440.0, 480.0))
This bridge
EXECUTE [depth=0] sofia/internal-proxy/9999@ bridge(user/105@)
2021-01-19 21:13:49.548643 [NOTICE] switch_channel.c:1118 New Channel sofia/internal-proxy/105%[email protected]:5060 [6502b905-5438-4653-bd95-9e7be5c4c158]
2021-01-19 21:13:49.588665 [NOTICE] sofia.c:7401 Ring-Ready sofia/internal-proxy/105%[email protected]:5060!
2021-01-19 21:13:49.588665 [INFO] switch_ivr_originate.c:1246 Sending early media
hello Volga,
procedure is:
- SaraPhone send INVITE to FS
- FS answer() the INVITE 2a) 200, ACK, rtp is flowing
- call is established between SaraPhone and FS (exactly like SaraPhone has called *9664)
- FS play audio to SaraPhone (ringtone, music, whatever)
- FS sleep and have SaraPhone listen to audio
- FS bridge SaraPhone to legB while FS continue to send audio (ringtone, music, early from legB, whatever)
You must do it in FS dialplan.
This has nothing to do with SaraPhone
To SaraPhone is exactly the same as if it has called *9664 (music on hold)
Is this clear?
The point we use opensips proxy in between. And freeswitch fusion pbx always send 183 do to nature of they dialplan structure. Is the are plans to upgrade library of sip.js ?
we use opensips (and rtpengine) in the middle too
can you please try to do as I wrote?
if the call is coming from saraphone, FS ANSWER() the call and sends audio, just like an IVR. In this case the audio is the ringback tone.
saraphone->LB->FS INVITE FS->LB->saraphone 200 OK saraphone->LB->FS ACK FS play sound (ringtone) RTP (ringtone) flows
then FS bridge the Aleg (saraphone) to a Bleg (whatever)
Yes, there will be upgrade to SIP.js library in future, and will work to support early media But... future is future ;)