I am glad that you sorted out your program. Good job.
You can send to the bash script three parameters: QCALLER_ID, ANSWERED_BY and Q_MESSAGE
[queue-answer-handler]
exten => _X.,1,Log(NOTICE, An incoming call to Queue from CLI:${CALLERID(num)})
;Set after answer sub routine
same => n,Set(__QGOSUB=sub-queue-answer)
;Set Caller ID for the queue
same => n,Set(__QCALLER_ID=${CALLERID(num)})
;Dial the misc app extension of the queue
same => n,Goto(from-internal,3300,1)
[sub-queue-answer]
exten => s,1,Set(__ANSWERED_BY=${CUT(CUT(CHANNEL(name),/,2),@,1)})
same => n,Set(__Q_MESSAGE=An incoming call from ${QCALLER_ID} has been answered by ${ANSWERED_BY})
;Send the message to the Telegram API
same => n,System(/var/www/html/sm.sh ${QCALLER_ID} ${ANSWERED_BY} ${Q_MESSAGE})
same => n,Return()
You need to send the call to the custom destination that you configured in the inbound route for this to work. Announcement -> custom-destination -> custom-context
I did so, in the console it gives "WARNING[29211][C-0000000b]: pbx.c:4467 __ast_pbx_run: Channel ‘SIP/multifon_chesma_in-00000013’ sent to invalid extension but no invalid handler: context,exten,priority=queue-answer-handler,s,1"and then resets.
Please configure another custom destination: queue-answer-handler,[put-here-the-queue-number],1
and change the destination on the Announcement module to this custom destination.
Please configure another custom destination: queue-answer-handler,201,1
and change the destination on the Announcement module to this custom destination.
Yes, it worked that way. And how to make it so that for each operator of the queue, there is a telegram bot and works only for this operator? So that you don’t get confused in the chat?
If you want to distinguish the Telegram bots, you can do it in your bash helper script. You have the ANSWERED_BY variable, so it will not be a problem to generate if-elseif-else statements and send a different message to any agent.