Running a python script when call is answered

I am doing a semester project,in which On answering the call a python script should start running.I I want to call from one softphone to another. I cannot figure out a way to do that.I have tried the following code in extensions.conf file but nothing happens.
exten => 1,1,system(python3 audio.py);
exten => 1,n,Hangup()

Following is displayed on the asterisk cli
console dial 1
– Executing [1@default:1] Playback(“Console/default”, “vm-goodbye”) in new stack
— <("<) — Call from Console has been Answered — (>")> —
– <Console/default> Playing ‘vm-goodbye.slin16’ (language ‘en’)
– Executing [1@default:2] NoOp(“Console/default”, “ERROR: FreePBX Does not use the [default] context, confguration error”) in new stack
– Executing [1@default:3] Macro(“Console/default”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“Console/default”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] ExecIf(“Console/default”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [s@macro-hangupcall:4] NoOp(“Console/default”, " montior file= “) in new stack
– Executing [s@macro-hangupcall:5] GotoIf(“Console/default”, “1?skipagi”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] Hangup(“Console/default”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘Console/default’ in macro ‘hangupcall’
== Spawn extension (default, 1, 3) exited non-zero on ‘Console/default’
– Executing [h@default:1] Playback(“Console/default”, “vm-goodbye”) in new stack
– <Console/default> Playing ‘vm-goodbye.slin16’ (language ‘en’)
– Executing [h@default:2] NoOp(“Console/default”, “ERROR: FreePBX Does not use the [default] context, confguration error”) in new stack
– Executing [h@default:3] Macro(“Console/default”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“Console/default”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] ExecIf(“Console/default”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [s@macro-hangupcall:4] NoOp(“Console/default”, " montior file= “) in new stack
– Executing [s@macro-hangupcall:5] GotoIf(“Console/default”, “1?skipagi”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] Hangup(“Console/default”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘Console/default’ in macro ‘hangupcall’
== Spawn extension (default, h, 3) exited non-zero on ‘Console/default’
— <(”<) — Hangup on Console — (>”)> —

It’s not appropriate to edit extensions.conf on a FreePBX system, and you’ve included no useful details. Are you even using FreePBX?

Can you please tell how should I achieve my target functionality if I dont edit my extensions.conf file?

If you are using FreePBX distro, Google the extensions_custom.conf & extensions_override.conf for more direction.

I have installed freepbx and asterisk using a computing for geeks link to ‘Install FreePBX 15 on Ubuntu 20.04/18.04/16.04 & Debian 10/9’. It is not freepbx distro. I only have extensions.conf and extensions.conf.sample file.There are no files such as extensions_custom.conf & extensions_override.conf

The install did not complete correctly. You are seeing files from the Asterisk install, but something went wrong installing FreePBX. With luck your logs will provide a clue.

If the primary aspect of your project is what the python script will do, I strongly suggest starting from the Distro, to avoid having to learn a lot about a complex system that you won’t be messing with.

If you must do a custom install, get that working first. Set up two extensions and confirm that you can call between them. If the project involves PSTN calls, set up the trunk and confirm that you can make and receive external calls. Then, start work on your project.

So far the freepbx and asterisk that I have installed allows me to make extensions.I have made two extensions. I can call from my phone to laptop using softphones on both the devices successfully.Now the next step is to invoke the python script upon answering the call.

Please post the output of
ls -l /etc/asterisk

total 1004
-rw-rw-r-- 1 asterisk asterisk 2816 اپریل 14 15:17 acl.conf
-rw-rw-r-- 1 asterisk asterisk 140 اپریل 14 15:17 adsi.conf
-rw-rw-r-- 1 asterisk asterisk 2097 اپریل 14 15:17 agents.conf
-rw-rw-r-- 1 asterisk asterisk 2328 اپریل 14 15:17 alarmreceiver.conf
-rw-rw-r-- 1 asterisk asterisk 3497 اپریل 14 15:17 alsa.conf
-rw-r–r-- 1 asterisk asterisk 881 مئی 18 17:28 amd.conf
-rw-rw-r-- 1 asterisk asterisk 1196 اپریل 14 15:17 amd.conf.backup
-rw-rw-r-- 1 asterisk asterisk 1044 اپریل 14 15:17 app_mysql.conf
-rw-rw-r-- 1 asterisk asterisk 338 اپریل 14 15:17 app_skel.conf
-rw-rw-r-- 1 asterisk asterisk 1434 اپریل 14 15:17 ari.conf
-rw-rw-r-- 1 asterisk asterisk 2276 اپریل 14 15:17 ast_debug_tools.conf
-rw-rw-r-- 1 asterisk asterisk 3253 اپریل 14 15:17 asterisk.adsi
-rw-rw-r-- 1 asterisk asterisk 6119 اپریل 14 15:24 asterisk.conf
drwxrwxr-x 2 asterisk asterisk 4096 اپریل 15 15:01 backup
-rw-rw-r-- 1 asterisk asterisk 5261 اپریل 14 15:17 calendar.conf
-rw-rw-r-- 1 asterisk asterisk 8827 اپریل 14 15:17 ccss.conf
-rw-rw-r-- 1 asterisk asterisk 90 مئی 18 17:28 cdr_adaptive_odbc.conf
-rw-rw-r-- 1 asterisk asterisk 1052 اپریل 14 15:17 cdr_beanstalkd.conf
-rw-rw-r-- 1 asterisk asterisk 8210 اپریل 14 15:28 cdr.conf
-rw-rw-r-- 1 asterisk asterisk 1617 اپریل 14 15:17 cdr_custom.conf
-rw-rw-r-- 1 asterisk asterisk 418 اپریل 14 15:17 cdr_manager.conf
-rw-rw-r-- 1 asterisk asterisk 2395 اپریل 14 15:17 cdr_mysql.conf
-rw-rw-r-- 1 asterisk asterisk 357 اپریل 14 15:17 cdr_odbc.conf
-rw-rw-r-- 1 asterisk asterisk 597 اپریل 14 15:17 cdr_pgsql.conf
-rw-rw-r-- 1 asterisk asterisk 971 اپریل 14 15:17 cdr_sqlite3_custom.conf
-rw-rw-r-- 1 asterisk asterisk 3301 اپریل 14 15:17 cdr_syslog.conf
-rw-rw-r-- 1 asterisk asterisk 2067 اپریل 14 15:17 cdr_tds.conf
-rw-rw-r-- 1 asterisk asterisk 819 اپریل 14 15:17 cel_beanstalkd.conf
lrwxrwxrwx 1 asterisk asterisk 44 اپریل 15 15:01 cel.conf -> /var/www/html/admin/modules/cel/etc/cel.conf
-rw-rw-r-- 1 asterisk asterisk 2035 اپریل 14 15:17 cel_custom.conf
-rw-r–r-- 1 asterisk asterisk 0 اپریل 15 15:01 cel_custom_post.conf
-rw-r–r-- 1 asterisk asterisk 794 مئی 18 17:28 cel_general_additional.conf
-rw-r–r-- 1 asterisk asterisk 0 اپریل 15 15:01 cel_general_custom.conf
-rw-rw-r-- 1 asterisk asterisk 766 مئی 18 17:28 cel_odbc.conf
-rw-r–r-- 1 asterisk asterisk 0 اپریل 15 15:01 cel_odbc_custom.conf
-rw-rw-r-- 1 asterisk asterisk 1597 اپریل 14 15:17 cel_pgsql.conf
-rw-rw-r-- 1 asterisk asterisk 1547 اپریل 14 15:17 cel_sqlite3_custom.conf
-rw-rw-r-- 1 asterisk asterisk 1883 اپریل 14 15:17 cel_tds.conf
-rw-rw-r-- 1 asterisk asterisk 664 مئی 18 17:28 chan_dahdi_additional.conf
-rw-rw-r-- 1 asterisk asterisk 68550 اپریل 14 15:17 chan_dahdi.conf
-rw-rw-r-- 1 asterisk asterisk 2226 اپریل 14 15:17 chan_mobile.conf
-rw-rw-r-- 1 asterisk asterisk 7226 اپریل 14 15:17 cli_aliases.conf
-rw-rw-r-- 1 asterisk asterisk 264 اپریل 14 15:17 cli.conf
-rw-rw-r-- 1 asterisk asterisk 2452 اپریل 14 15:17 cli_permissions.conf
-rw-rw-r-- 1 asterisk asterisk 7657 اپریل 14 15:17 codecs.conf
-rw-rw-r-- 1 asterisk asterisk 29836 اپریل 14 15:17 confbridge.conf
-rw-rw-r-- 1 asterisk asterisk 812 اپریل 14 15:17 config_test.conf
-rw-rw-r-- 1 asterisk asterisk 4456 اپریل 14 15:17 console.conf
-rw-rw-r-- 1 asterisk asterisk 1163 اپریل 14 15:17 dbsep.conf
-rw-rw-r-- 1 asterisk asterisk 41 اپریل 14 22:01 dnsmgr.conf
-rw-rw-r-- 1 asterisk asterisk 1732 اپریل 14 15:17 dsp.conf
-rw-rw-r-- 1 asterisk asterisk 9680 اپریل 14 15:17 dundi.conf
-rw-rw-r-- 1 asterisk asterisk 50 اپریل 14 22:01 enum.conf
-rw-rw-r-- 1 asterisk asterisk 4191 اپریل 14 15:17 extconfig.conf
-rw-rw-r-- 1 asterisk asterisk 176264 مئی 18 17:28 extensions_additional.conf
-rw-rw-r-- 1 asterisk asterisk 12776 اپریل 14 15:17 extensions.ael
lrwxrwxrwx 1 asterisk asterisk 52 اپریل 14 21:59 extensions.conf -> /var/www/html/admin/modules/core/etc/extensions.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 extensions_custom.conf
-rw-rw-r-- 1 asterisk asterisk 7022 اپریل 14 15:17 extensions.lua
-rw-rw-r-- 1 asterisk asterisk 7420 اپریل 14 15:17 extensions_minivm.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 extensions_override_freepbx.conf
-rw-rw-r-- 1 asterisk asterisk 708 مئی 18 17:28 features_applicationmap_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 features_applicationmap_custom.conf
lrwxrwxrwx 1 asterisk asterisk 50 اپریل 14 21:59 features.conf -> /var/www/html/admin/modules/core/etc/features.conf
-rw-rw-r-- 1 asterisk asterisk 701 مئی 18 17:28 features_featuremap_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 features_featuremap_custom.conf
-rw-rw-r-- 1 asterisk asterisk 679 مئی 18 17:28 features_general_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 features_general_custom.conf
-rw-rw-r-- 1 asterisk asterisk 922 اپریل 14 15:17 festival.conf
-rw-rw-r-- 1 asterisk asterisk 4538 اپریل 14 15:17 followme.conf
-rw-rw-r-- 1 asterisk asterisk 730 اپریل 14 22:01 freepbx_module_admin.conf
-rw-rw-r-- 1 asterisk asterisk 6829 اپریل 14 15:17 func_odbc.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 globals_custom.conf
-rw-rw-r-- 1 asterisk asterisk 1792 اپریل 14 15:17 hep.conf
-rw-rw-r-- 1 asterisk asterisk 963 مئی 18 17:28 http_additional.conf
lrwxrwxrwx 1 asterisk asterisk 46 اپریل 14 21:59 http.conf -> /var/www/html/admin/modules/core/etc/http.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 15 14:03 http_custom.conf
-rw-rw-r-- 1 asterisk asterisk 664 مئی 18 17:28 iax_additional.conf
lrwxrwxrwx 1 asterisk asterisk 45 اپریل 14 21:59 iax.conf -> /var/www/html/admin/modules/core/etc/iax.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 iax_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 iax_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 746 مئی 18 17:28 iax_general_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 iax_general_custom.conf
-rw-rw-r-- 1 asterisk asterisk 2401 اپریل 14 15:17 iaxprov.conf
-rw-rw-r-- 1 asterisk asterisk 664 مئی 18 17:28 iax_registrations.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 iax_registrations_custom.conf
-rw-rw-r-- 1 asterisk asterisk 1150 مئی 18 17:28 indications_additional.conf
-rw-rw-r-- 1 asterisk asterisk 499 مئی 18 17:28 indications.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 indications_custom.conf
-rw-rw-r-- 1 asterisk asterisk 675 مئی 18 17:28 indications_general_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 indications_general_custom.conf
drwxr-xr-x 3 asterisk asterisk 4096 اپریل 15 14:17 keys
-rw-rw-r-- 1 asterisk asterisk 664 مئی 18 17:28 localprefixes.conf
lrwxrwxrwx 1 asterisk asterisk 52 اپریل 14 21:59 logger.conf -> /var/www/html/admin/modules/logfiles/etc/logger.conf
-rw-rw-r-- 1 asterisk asterisk 735 مئی 18 17:28 logger_general_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 logger_general_custom.conf
-rw-rw-r-- 1 asterisk asterisk 763 مئی 18 17:28 logger_logfiles_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 logger_logfiles_custom.conf
-rw-rw-r-- 1 asterisk asterisk 665 مئی 18 17:28 manager_additional.conf
-rw-rw-r-- 1 asterisk asterisk 971 مئی 16 13:15 manager.conf
-rw-rw-r-- 1 asterisk asterisk 971 مئی 16 13:15 manager.conf.bak
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 manager_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 meetme_additional.conf
-rw-rw-r-- 1 asterisk asterisk 126 اپریل 14 22:01 meetme.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 meetme_general_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 meetme_general_custom.conf
-rw-rw-r-- 1 asterisk asterisk 5835 اپریل 14 15:17 mgcp.conf
-rw-rw-r-- 1 asterisk asterisk 9925 اپریل 14 15:17 minivm.conf
-rw-rw-r-- 1 asterisk asterisk 14752 اپریل 14 15:17 misdn.conf
-rw-rw-r-- 1 asterisk asterisk 1563 مئی 18 17:28 modules.conf
-rw-rw-r-- 1 asterisk asterisk 4668 اپریل 14 15:17 motif.conf
-rw-rw-r-- 1 asterisk asterisk 840 مئی 18 17:28 musiconhold_additional.conf
-rw-rw-r-- 1 asterisk asterisk 208 اپریل 14 22:01 musiconhold.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 musiconhold_custom.conf
-rw-rw-r-- 1 asterisk asterisk 1285 اپریل 14 15:17 muted.conf
-rw-rw-r-- 1 asterisk asterisk 5911 اپریل 14 15:17 ooh323.conf
-rw-rw-r-- 1 asterisk asterisk 3900 اپریل 14 15:17 osp.conf
-rw-rw-r-- 1 asterisk asterisk 7460 اپریل 14 15:17 oss.conf
-rw-rw-r-- 1 asterisk asterisk 1577 اپریل 14 15:17 phone.conf
-rw-rw-r-- 1 asterisk asterisk 7839 اپریل 14 15:17 phoneprov.conf
-rw-rw-r-- 1 asterisk asterisk 90 اپریل 14 22:01 phpagi.conf
-rw-rw-r-- 1 asterisk asterisk 2683 اپریل 14 15:17 pjproject.conf
-rw-rw-r-- 1 asterisk asterisk 1202 مئی 18 17:28 pjsip.aor.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.aor_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.aor_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 980 مئی 18 17:28 pjsip.auth.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.auth_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.auth_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 1332 مئی 18 17:28 pjsip.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 3754 مئی 18 17:28 pjsip.endpoint.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.endpoint_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.endpoint_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 701 مئی 18 17:28 pjsip.identify.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.identify_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.identify_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 733 مئی 18 17:28 pjsip_notify.conf
-rw-rw-r-- 1 asterisk asterisk 705 مئی 18 17:28 pjsip.registration.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.registration_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.registration_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 874 مئی 18 17:28 pjsip.transports.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.transports_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 pjsip.transports_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 6845 اپریل 14 15:17 pjsip_wizard.conf
-rw-rw-r-- 1 asterisk asterisk 81 اپریل 14 22:01 privacy.conf
-rw-rw-r-- 1 asterisk asterisk 2868 اپریل 14 15:17 queuerules.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 queues_additional.conf
-rw-rw-r-- 1 asterisk asterisk 522 اپریل 14 22:01 queues.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 queues_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 queues_custom_general.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 queues_general_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:57 queues_post_custom.conf
-rw-rw-r-- 1 asterisk asterisk 2060 اپریل 14 15:17 res_config_mysql.conf
-rw-rw-r-- 1 asterisk asterisk 1494 اپریل 14 15:17 res_config_sqlite3.conf
-rw-rw-r-- 1 asterisk asterisk 380 اپریل 14 15:17 res_config_sqlite.conf
-rw-rw-r-- 1 asterisk asterisk 876 اپریل 14 15:17 res_corosync.conf
-rw-rw-r-- 1 asterisk asterisk 186 اپریل 14 15:17 res_curl.conf
-rw-rw-r-- 1 asterisk asterisk 1071 اپریل 14 15:17 res_fax.conf
-rw-rw-r-- 1 asterisk asterisk 7107 اپریل 14 15:17 res_ldap.conf
-rw-rw-r-- 1 asterisk asterisk 844 مئی 18 17:28 res_odbc_additional.conf
lrwxrwxrwx 1 asterisk asterisk 50 اپریل 14 21:59 res_odbc.conf -> /var/www/html/admin/modules/core/etc/res_odbc.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 res_odbc_custom.conf
-rw-rw-r-- 1 asterisk asterisk 1526 اپریل 14 15:17 resolver_unbound.conf
-rw-rw-r-- 1 asterisk asterisk 11042 اپریل 14 15:17 res_parking.conf
-rw-rw-r-- 1 asterisk asterisk 1089 اپریل 14 15:17 res_pgsql.conf
-rw-rw-r-- 1 asterisk asterisk 713 اپریل 14 15:17 res_pktccops.conf
-rw-rw-r-- 1 asterisk asterisk 833 اپریل 14 15:17 res_snmp.conf
-rw-rw-r-- 1 asterisk asterisk 1350 اپریل 14 15:17 res_stun_monitor.conf
-rw-rw-r-- 1 asterisk asterisk 776 مئی 18 17:28 rtp_additional.conf
lrwxrwxrwx 1 asterisk asterisk 45 اپریل 14 21:59 rtp.conf -> /var/www/html/admin/modules/core/etc/rtp.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 rtp_custom.conf
-rw-rw-r-- 1 asterisk asterisk 17039 اپریل 14 15:17 say.conf
-rw-rw-r-- 1 asterisk asterisk 664 مئی 18 17:28 sip_additional.conf
lrwxrwxrwx 1 asterisk asterisk 45 اپریل 14 21:59 sip.conf -> /var/www/html/admin/modules/core/etc/sip.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 sip_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 sip_custom_post.conf
-rw-rw-r-- 1 asterisk asterisk 1541 مئی 18 17:28 sip_general_additional.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 sip_general_custom.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 sip_nat.conf
-rw-rw-r-- 1 asterisk asterisk 664 مئی 18 17:28 sip_notify_additional.conf
lrwxrwxrwx 1 asterisk asterisk 52 اپریل 14 21:59 sip_notify.conf -> /var/www/html/admin/modules/core/etc/sip_notify.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 sip_notify_custom.conf
-rw-rw-r-- 1 asterisk asterisk 664 مئی 18 17:28 sip_registrations.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 sip_registrations_custom.conf
-rw-rw-r-- 1 asterisk asterisk 10064 اپریل 14 15:17 skinny.conf
-rw-rw-r-- 1 asterisk asterisk 7090 اپریل 14 15:17 sla.conf
-rw-rw-r-- 1 asterisk asterisk 2669 اپریل 14 15:17 smdi.conf
-rw-rw-r-- 1 asterisk asterisk 2501 اپریل 14 15:17 sorcery.conf
-rw-rw-r-- 1 asterisk asterisk 1503 اپریل 14 15:17 ss7.timers
-rw-rw-r-- 1 asterisk asterisk 5056 اپریل 14 15:17 stasis.conf
-rw-rw-r-- 1 asterisk asterisk 370 اپریل 14 15:17 statsd.conf
-rw-rw-r-- 1 asterisk asterisk 1600 اپریل 14 15:17 stir_shaken.conf
-rw-rw-r-- 1 asterisk asterisk 1384 اپریل 14 15:17 telcordia-1.adsi
-rw-rw-r-- 1 asterisk asterisk 152 اپریل 14 15:17 test_sorcery.conf
-rw-rw-r-- 1 asterisk asterisk 259 اپریل 14 22:01 ucc_restrict.conf
lrwxrwxrwx 1 asterisk asterisk 47 اپریل 14 21:59 udptl.conf -> /var/www/html/admin/modules/core/etc/udptl.conf
-rw-rw-r-- 1 asterisk asterisk 0 اپریل 14 21:59 udptl_custom.conf
-rw-rw-r-- 1 asterisk asterisk 5850 اپریل 14 15:17 unistim.conf
-rw-rw-r-- 1 asterisk asterisk 2570 اپریل 14 15:17 users.conf
-rw-rw-r-- 1 asterisk asterisk 1914 مئی 18 17:28 voicemail.conf
-rw-rw-r-- 1 asterisk asterisk 689 اپریل 14 22:01 voicemail.conf.template
-rw-rw-r-- 1 asterisk asterisk 5938 اپریل 14 15:17 vpb.conf
-rw-rw-r-- 1 asterisk asterisk 3734 اپریل 14 15:17 xmpp.conf

So you do have extensions_custom.conf (for adding functionality to FreePBX) and extensions_override_freepbx.conf (for replacing existing contexts, macros, etc.)

These files are empty by default and are where your custom code should go.

oh yeah.Thank you so much for the help. Can you please refer to any link that will help me set up the functionality that I want to achieve in my project.

As mentioned in the Asterisk Community Running a python script when call is answered, if you want to run a script as soon as the called party answered, use the U dial option.

  • U ( x^arg ) - Execute via Gosub the routine x for the called channel before connecting to the calling channel. Arguments can be specified to the Gosub using ^ as a delimiter. The Gosub routine can set the variable GOSUB_RESULT to specify the following actions after the Gosub returns.
    NOTE: You cannot use any additional action post answer options in conjunction with this option. Also, pbx services are run on the called channel, so you will not be able to set timeouts via the TIMEOUT() function in this routine.
    • GOSUB_RESULT
      • ABORT - Hangup both legs of the call.
      • CONGESTION - Behave as if line congestion was encountered.
      • BUSY - Behave as if a busy signal was encountered.
      • CONTINUE - Hangup the called party and allow the calling party to continue dialplan execution at the next priority.
      • GOTO:[[<CONTEXT>^]<EXTEN>^]<PRIORITY> - Transfer the call to the specified destination.
    • x - Name of the subroutine context to execute via Gosub . The subroutine execution starts in the named context at the s exten and priority 1.
    • arg [^ arg …] - Arguments for the Gosub routine

You would probably want to change the dial options using the predial hook. Hooking for fun and income

1 Like

Okay I will try this.Thankyou.

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