Thanks for the hint with System. The script is executed now, but over and over again.
This is a excerpt from the log (I cut out hundreds of equal lines):
[2020-10-06 14:17:08] VERBOSE[2553][C-00000029] netsock2.c: Using SIP RTP TOS bits 184
[2020-10-06 14:17:08] VERBOSE[2553][C-00000029] netsock2.c: Using SIP RTP CoS mark 5
[2020-10-06 14:17:08] SECURITY[2577] res_security_log.c: SecurityEvent=“SuccessfulAuth”,EventTV=“2020-10-06T14:17:08.613+0200”,Severity=“Informational”,Service=“SIP”,EventVersion=“1”,AccountID=“4123456789011”,SessionID=“0x7f7444046d20”,LocalAddress=“IPV4/UDP/188.23.124.40/5160”,RemoteAddress=“IPV4/UDP/213.185.165.114/5060”,UsingPassword=“0”
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:1] System(“SIP/ 41234567890-00000020”, "/usr/sbin/bla.sh ") in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:2] Goto(“SIP/ 41234567890-00000020”, “from-trunk,4123456789011,1”) in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx_builtins.c: Goto (from-trunk,4123456789011,1)
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:1] System(“SIP/ 41234567890-00000020”, "/usr/sbin/bla.sh ") in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:2] Goto(“SIP/ 41234567890-00000020”, “from-trunk,4123456789011,1”) in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx_builtins.c: Goto (from-trunk,4123456789011,1)
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:1] System(“SIP/ 41234567890-00000020”, "/usr/sbin/bla.sh ") in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:2] Goto(“SIP/ 41234567890-00000020”, “from-trunk,4123456789011,1”) in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx_builtins.c: Goto (from-trunk,4123456789011,1)
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:1] System(“SIP/ 41234567890-00000020”, "/usr/sbin/bla.sh ") in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:2] Goto(“SIP/ 41234567890-00000020”, “from-trunk,4123456789011,1”) in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx_builtins.c: Goto (from-trunk,4123456789011,1)
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:1] System(“SIP/ 41234567890-00000020”, "/usr/sbin/bla.sh ") in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:2] Goto(“SIP/ 41234567890-00000020”, “from-trunk,4123456789011,1”) in new stack
[2020-10-06 14:17:08] VERBOSE[3730][C-00000029] pbx_builtins.c: Goto (from-trunk,4123456789011,1)
…
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx.c: Executing [4123456789011@from-trunk:1] System(“SIP/ 41234567890-00000020”, "/usr/sbin/bla.sh ") in new stack
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx.c: Executing [h@from-trunk:1] Macro(“SIP/ 41234567890-00000020”, “hangupcall,”) in new stack
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx.c: Executing [s@macro-hangupcall:1] GotoIf(“SIP/ 41234567890-00000020”, “1?theend”) in new stack
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx.c: Executing [s@macro-hangupcall:3] ExecIf(“SIP/ 41234567890-00000020”, “0?Set(CDR(recordingfile)=)”) in new stack
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx.c: Executing [s@macro-hangupcall:4] NoOp(“SIP/ 41234567890-00000020”, " montior file= ") in new stack
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx.c: Executing [s@macro-hangupcall:5] GotoIf(“SIP/ 41234567890-00000020”, “1?skipagi”) in new stack
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx_builtins.c: Goto (macro-hangupcall,s,7)
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx.c: Executing [s@macro-hangupcall:7] Hangup(“SIP/ 41234567890-00000020”, “”) in new stack
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] app_macro.c: Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘SIP/ 41234567890-00000020’ in macro ‘hangupcall’
[2020-10-06 14:17:16] VERBOSE[3730][C-00000029] pbx.c: Spawn extension (from-trunk, h, 1) exited non-zero on ‘SIP/ 41234567890-00000020’
Also the argument does not seem to get passed (what this is what you already thought):
[from-trunk]
exten => _X.,1,System(/usr/sbin/bla.sh ${ARG1})
exten => _X.,n,Goto(from-trunk,${EXTEN},1)
Just for information: I am going trying to pass incoming numbers to mqtt as soon as I found out how to pass incoming numbers to a script. The mqtt-script for agi does not work anymore, so I want to write something new…