Sending the caller's number in a Telegram

Through the script.

1 Like

Hello @Vital174,

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()

Thank you,

Daniel Friedman
Trixton LTD.

Does not work… I have, first Announcement, then the queue. Resets, does not reach the queue…

Hello @Vital174,

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

Thank you,

Daniel Friedman
Trixton LTD.

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.

Hello @Vital174,

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.

Let me know if this works for you.

Thank you,

Daniel Friedman
Trixton LTD.

I didn’t understand how to implement this?

Hello @Vital174,

What is your queue number?

Thank you,

Daniel Friedman
Trixton LTD.

quote 201

Hello @Vital174,

Please configure another custom destination: queue-answer-handler,201,1
and change the destination on the Announcement module to this custom destination.

Let me know if this works for you.

Thank you,

Daniel Friedman
Trixton LTD.

Trying to figure out what is going on here. @danielf is the ONLY requirement here to set 2 channel vars before an external call hits a queue?

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?

Hi @lgaetz,

Actually the work is done and @Vital174 is able to send a message to the telegram API.

Thank you,

Daniel Friedman
Trixton LTD.

1 Like

Hello @Vital174,

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.

Thank you,

Daniel Friedman
Trixton LTD.

1 Like

Thank you very much!!! You are the best :+1::+1::+1::+1::+1::+1::+1::+1::+1::+1::+1::

1 Like

Much Simpler - Using Dynamic Routes to run a dialplan sub when queue agent answers

Thanks. I will try it.

And what’s wrong with the option that danielf and I implemented?

Nothing.

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