Convert DTMF result into speech and announce it back to caller

Hello,
I’m new to the freepbx system, and I’ve set up siptruck for a toll-free number. Setting up the server was a breeze thanks to wiki.freepbx.com. I have a case in which the caller provides input, which is processed by the dynamic route URL method, which returns a float result. I’d like the outcome to be announced to the caller who is listening. I’m not sure how I’m going to accomplish it. Polly is my tts engine, and it is currently operational.

I am attaching my log the dynroute result is saved in __DYNROUTE_Result

-- Accepting a maximum of 12 digits.
-- <PJSIP/outward-bridgetrunk-00000037> Playing 'custom/pleaseenteryournumber.slin' (language 'en')
-- User entered 'XXXXXXX'
-- Executing [[email protected]:3] Set("PJSIP/outward-bridgetrunk-00000037", "__DYNROUTE_Number=XXXXXXXXX") in new stack
-- Executing [[email protected]:4] Set("PJSIP/outward-bridgetrunk-00000037", "CURLOPT(dnstimeout)=5") in new stack
-- Executing [[email protected]:5] Set("PJSIP/outward-bridgetrunk-00000037", "CURLOPT(conntimeout)=5") in new stack
-- Executing [[email protected]:6] Set("PJSIP/outward-bridgetrunk-00000037", "CURLOPT(ftptimeout)=5") in new stack
-- Executing [[email protected]:7] Set("PJSIP/outward-bridgetrunk-00000037", "CURLOPT(httptimeout)=5") in new stack
-- Executing [[email protected]:8] Set("PJSIP/outward-bridgetrunk-00000037", "dynroute=1000.0") in new stack
-- Executing [[email protected]:9] GotoIf("PJSIP/outward-bridgetrunk-00000037", "0?dynroute-1,1,1") in new stack
-- Executing [[email protected]:10] Set("PJSIP/outward-bridgetrunk-00000037", "__DYNROUTE_Result=1000.0") in new stack
-- Executing [[email protected]:11] Goto("PJSIP/outward-bridgetrunk-00000037", "dynroute-1,1,1") in new stack
-- Goto (dynroute-1,1,1)

You need to create some custom dialplan in extensions_custom.conf that looks like this

[number-playback]
exten => s,1,Noop(Entering user defined context number-playback in extensions_custom.conf with ARG1=${ARG1})
exten => s,n,SayDigits(${ARG1})
exten => s,n,Return

Then create a Custom Destination, enable return and use gosub string of:

number-playback,s,1(${DYNROUTE_Result})

Thanks for reaching out .
This works but it is saydigits separately what i need is complete announcement which can work for both strings and float data types

Goto (dynroute-1,1,1)
    -- Executing [[email protected]:1] Goto("PJSIP/outward-bridgetrunk-00000039", "customdests,dest-1,1") in new stack
    -- Goto (customdests,dest-1,1)
    -- Executing [[email protected]:1] NoOp("PJSIP/outward-bridgetrunk-00000039", "Entering Custom Destination Playback The Result") in new stack
    -- Executing [[email protected]:2] Gosub("PJSIP/outward-bridgetrunk-00000039", "number-playback,s,2(1000.0)") in new stack
    -- Executing [[email protected]:2] SayDigits("PJSIP/outward-bridgetrunk-00000039", "1000.0") in new stack
    -- <PJSIP/outward-bridgetrunk-00000039> Playing 'digits/1.ulaw' (language 'en')
    -- <PJSIP/outward-bridgetrunk-00000039> Playing 'digits/0.ulaw' (language 'en')
freepbx*CLI> 
    -- <PJSIP/outward-bridgetrunk-00000039> Playing 'digits/0.ulaw' (language 'en')
    -- <PJSIP/outward-bridgetrunk-00000039> Playing 'digits/0.ulaw' (language 'en')
    -- <PJSIP/outward-bridgetrunk-00000039> Playing 'digits/0.ulaw' (language 'en')
    -- Executing [[email protected]:3] Return("PJSIP/outward-bridgetrunk-00000039", "") in new stack

There are a few text to speech options, but for proof of concept you can use flite since it should be ready to go with no config:

exten => 4510,n,flite(${ARG1})

You might find this useful

https://gtts.readthedocs.io/en/latest/

Thanks lorne ,Flite is really helping it is what i expected result . But it has only one Voice it is very raw , is it possible to use polly in here or any chance to change voice in to female.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.