[ilay_calls]
exten => 0441234567,1,NoOp(“Ringing”)
same => n,Answer()
same => n,Set(sender_id=${RAND(1000,9999)}-${UNIQUEID}) ; Generate a random sender_id
same => n,agi(aravindh-speech.agi, en-US, 3)
same => n,Verbose(1,You said Is : ${utterance})
same => n,Verbose(1,Speech Recognation Status: ${confidence})
same => n,Verbose(1,“Sending API Data to API”)
same => n,System(rm /tmp/api_response.txt /tmp/extracted_text.txt)
same => n,Verbose(1,“Generated sender_id: ${sender_id}”)
same => n,System(curl -X POST https://analytics.twixor.com/analytics_apis/chat -H “Content-Type: application/json” -d ‘{“message”:“${utterance}”,“sender_id”:“${sender_id}”}’> /tmp/api_response.txt)
same => n,System(cat /tmp/api_response.txt | jq -r ‘map(.text) | join(", ")’ > /tmp/extracted_text.txt)
same => n,Set(language=en)
;same => n,Set(text=“Greetings! I’m Twilight. How may I be of service to you today?”)
same => n,ExecIf($[${STAT(s,/tmp/extracted_text.txt)}]?Set(API_RESPONSE=${FILE(/tmp/extracted_text.txt)}):Set(API_RESPONSE=“Sorry, I couldn’t Reach You.”))
same => n,Set(API_RESPONSE_STR=(${API_RESPONSE})); Explicitly set to ensure it’s handled as a string
same => n,Verbose(1,API: “${API_RESPONSE_STR}”)
;same => n,agi(googletts.agi,“${text}”,en)
same => n,agi(googletts.agi,“${API_RESPONSE_STR}”,${language})
same => n,System(rm /tmp/api_response.txt /tmp/extracted_text.txt);
same => n,agi(aravindh-speech.agi, en-US)
same => n,Verbose(1,You said Is : ${utterance})
same => n,Verbose(1,Speech Recognation Status: ${confidence})
same => n,Verbose(1,“Sending API Data to API”)
same => n,System(rm /tmp/api_response.txt /tmp/extracted_text.txt)
same => n,Verbose(1,“Generated sender_id: ${sender_id}”)
same => n,System(curl -X POST https://analytics.twixor.com/analytics_apis/chat -H “Content-Type: application/json” -d ‘{“message”:“${utterance}”,“sender_id”:“${sender_id}”}’> /tmp/api_response.txt)
same => n,System(cat /tmp/api_response.txt | jq -r ‘map(.text) | join(", ")’ > /tmp/extracted_text.txt)
same => n,Set(language=en)
;same => n,Set(text=“Greetings! I’m Twilight. How may I be of service to you today?”)
same => n,ExecIf($[${STAT(s,/tmp/extracted_text.txt)}]?Set(API_RESPONSE=${FILE(/tmp/extracted_text.txt)}):Set(API_RESPONSE=“Sorry, I couldn’t Reach You.”))
same => n,Set(API_RESPONSE_STR=(${API_RESPONSE})); Explicitly set to ensure it’s handled as a string
same => n,Verbose(1,API: “${API_RESPONSE_STR}”)
;same => n,agi(googletts.agi,“${text}”,en)
same => n,agi(googletts.agi,“${API_RESPONSE_STR}”,${language})
same => n,System(rm /tmp/api_response.txt /tmp/extracted_text.txt);
same => n,agi(aravindh-speech.agi, en-US)
same => n,Verbose(1,You said Is : ${utterance})
same => n,Verbose(1,Speech Recognation Status: ${confidence})
same => n,Verbose(1,“Sending API Data to API”)
same => n,System(rm /tmp/api_response.txt /tmp/extracted_text.txt)
same => n,Verbose(1,“Generated sender_id: ${sender_id}”)
same => n,System(curl -X POST https://analytics.twixor.com/analytics_apis/chat -H “Content-Type: application/json” -d ‘{“message”:“${utterance}”,“sender_id”:“${sender_id}”}’> /tmp/api_response.txt)
same => n,System(cat /tmp/api_response.txt | jq -r ‘map(.text) | join(", ")’ > /tmp/extracted_text.txt)
same => n,Set(language=en)
;same => n,Set(text=“Greetings! I’m Twilight. How may I be of service to you today?”)
same => n,ExecIf($[${STAT(s,/tmp/extracted_text.txt)}]?Set(API_RESPONSE=${FILE(/tmp/extracted_text.txt)}):Set(API_RESPONSE=“Sorry, I couldn’t Reach You.”))
same => n,Set(API_RESPONSE_STR=(${API_RESPONSE})); Explicitly set to ensure it’s handled as a string
same => n,Verbose(1,API: “${API_RESPONSE_STR}”)
;same => n,agi(googletts.agi,“${text}”,en)
same => n,agi(googletts.agi,“${API_RESPONSE_STR}”,${language})
same => n,System(rm /tmp/api_response.txt /tmp/extracted_text.txt);
this is my extension.conf file. but one thing i dont know why websocket connection is closed when i am speaking after one time