How to save an answer from the dialplan to the database

after having listened to the ivr (for example type 1 for a or 2 for b), I would like that with each answer given by the user that it can store the value entered by him in my database. How to do that

You could use this I believe. @lgaetz is more seasoned here
https://wiki.freepbx.org/display/FPG/Dynamic+Routes+User+Guide

Another option is to build the IVR or destinations as a custom destination and write your own dialplan that does what you need it to do.
https://wiki.freepbx.org/display/FPG/Custom+Destinations+User+Guide

https://www.voip-info.org/asterisk-cmd-mysql/
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_SHELL

Dynroutes is the way to do this. Chain three of them together

Dynroute 1 plays prompt, collects dtmf input, validates and stores to channel var
Dynroute 2 makes the API call to store the value wherever
Dynroute 3 branches the call based on the value stored in dynroute 1

There are several threads showing how to perform these steps
https://community.freepbx.org/tag/dynroutes

1 Like