asterisk emailing status update - email

i am running asterisk in my system and i would like to get an email everytime that changes the status of the
asterisk -rx "sip show peers" | grep trunk_name
i do not want to poll the script in a periodic way to ask for the status. I would like to get an email everytime the status changes.
i can send messages from my system with the following:
echo "This is Content" | mail -s "This is subject" userA#ISPmail.org
at the moment all i do is to periodically ask the system (cron, bashscript) to send me an email with the current status.

Simplest way to get it is use specialized software like fail2ban or nagios/centreon.
You just need create filter(for fail2ban - regexp and remove banning part) and say program to watch asterisk log.

John,
The best way to do with is with a Ruby or PHP application that loops once a second and taps the AMI port for the status information. You then parse and issue a status email if required.
Checkout:
https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=4817239
http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-AMI.html
That should give you the info to get started.

Related

Mail stay in queue when i use Sendgrid in symfony6

I have set my Sendgrid single sender and validate it ( status = verified).
I use SMTP, create my key that i paste in my code (.env file of my app):
MAILER_DSN=sendgrid+smtp://#default
Then i try to test integration in Sendgrid by clicking on button and refresh my localhost/ page (of course the controller's route is "/" and it contains the code using mailer to send a mail as explain in mailer documentation).
On my vue i don't have error code but mail stay in queue status...
Here the screenshot taken of the profiler:
Can someone tell me why my mail stay queued?
Of course the From email address is mine ( the verified one) and the To is anotherone of mine.
Maybe i have to configure something in my outlook mail (the From one) ?
Sendgrid never match the verification, it stay in checking status until message :
Hmm, we haven't seen your email yet.
Please check your code, run it again, then click "Retry".
Thanks for reply,
Regards,
In your question you said that your MAILER_DSN environment variable is set to:
MAILER_DSN=sendgrid+smtp://#default
That is missing your API Key though. You need to create an API key in the SendGrid dashboard and then add the API key to the MAILER_DSN variable, between the // and the #default like this:
MAILER_DSN=sendgrid+smtp://API_KEY#default
One other thing, ensure that you have installed the SendGrid transport with this command:
composer require symfony/sendgrid-mailer
Yes, thanks you a lot for reply.
Of course all was set as you notify me.
I now have fix my issue, in fact the problem for me with the mail that remains in queued is that the messenger was installed so in asynchronous by default.
I had to add the option message_bus: false in my config/packages/mailer.yaml file not to have the asynchronous option used.
Hopefully this is useful for some people.
add the option message_bus: false in my config/packages/mailer.yaml:
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
message_bus: false

Power automate - is there a way to bypass Send email with options?

I am trying to work out a scenario where a mail should get triggered for every ListItem in a SharePoint List.
Sharepoint List as follows
ID   Name   Email
1    JimC     Jim#gmail.com
2    KimJ     Kim#gmail.com
3    SimK     Sim#gmail.com
I have created a Power Automate workflow, which gets triggered based on a recurrence schedule.
When it does get triggered, it checks a SharePoint list, that contains a list of individuals. Flow is suppose to process each individual,
trigger mail using "Send email with options".
wait for response (Approve / Reject / Need some details)
log the response received from the individual
But issue here is if a person doesn't respond, the flow gets stuck & doesn't send mail to next individual. Seems, that's how "Send email with options" behave.
Is there a way, where we can wait for few hours / days for response to arrive? Else process the next individual in the SharePoint list by sending an email using "Send email with options"?
You can set the timeout period and by
Add try scope and add the "send email with options" step inside this scope.
Click 3 dots at the "send email with options" step.
Click Settings
In the Timeout, enter the timeout period in ISO 8601 format e.g. PT3H means that this step will be timeout in 3 hours.
Add the catch scope and set the configure run after.
Select timed out and failed and add any step that you would like to do after timed out inside the catch scope.
Hope this help.

telegram bots, how to request input from user?

I know how to use telegram commands, and know how to read what command has been executed. What I would like to do is something like this:
User: /send_address
Bot: Hello, please type your address..
User: my address...
so far, i can read the /send_address command and reply with "hello,...." and obviously I can also read the answer of the user, just like I have read the /send_address command. Question is, how do i know if the answer he sends is in response to my "hello, please type your address.." request, or if he sent it just because? I could have 100 users chatting with the bot, would i have to store a variable for each user remembering that he sent the /send_address cmd?
As I known, telegram has no way to save state for user. I use a table in database for saving comands of user.
How it works:
User say /command
Store /command for User.
User say "something" we try to get data from database for this user. If we find out that previos message is command /command than do some action and save nowly added data (if you have multiple steps for some command)

How to use applescript to tell Mail to keep a copy of sent message

I use AppleScript and can send messages without any problem, but the "Sent" box does not get a copy of what I sent. However, if I use Mail Application to send messages, the "Sent" box gets a copy of what I sent. So I guess my AppleScript may miss a command or so to tell Mail to keep a copy of the sent messages. What's the command that I missed? Thanks.
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return, visible:true}
tell theNewMessage
set visibile to false
set sender to theSender
make new to recipient at end of to recipients with properties {address:theAddress}
make new attachment with properties {file name:theAttachment} at after the last paragraph
send
delay 5
end tell
end tell
I don’t think you’re missing any command. I copied your script to Script Editor on my iMac, set values for theSubject, theBody, theAddress, theSender, and theAttachment, and ran it. It (a) successfully sent the message, and (b) I was able to view the message it sent in my Sent mailbox.
I tried this both with a known sender and with a random example.com sender. In both cases, it was saved in the default Sent box.
So the issue most likely lies elsewhere. Make sure that the value you’re currently using for theSender maps to an account in Mail that saves sent messages. (If it’s an IMAP account, it may be saving sent messages on the server, and server behavior may be affecting what you see.)
If that doesn’t work, set up some test values for all of the variables in the script except theAddress (using example.com for theSender), and include those (except theAddress) in your question. (If you can use example.com for theAddress, too, do that, but some servers will simply refuse the message immediately, which makes it worthless for testing this particular case.)
Note that you have an error that does not change this behavior; you have “visible” misspelled as “visibile”. However, I tried it both ways and in both cases the outgoing message does get stored in the appropriate Sent box.
Try adding this after you send the message...
set accountReference to first account whose name = "my account name"
synchronize with accountReference

Stop Hubot (with Flowdock) from responding to itself?

I'm using Hubot with the Hubot-Flowdock adapter.
I'm using robot.hear to respond to messages with a certain string in them (e.g. "chocolate").
I then call msg.send with a message, which also happens to contain the trigger string ("chocolate") in it.
This causes Hubot to hear itself, and then just loop endlessly, triggering over and over again.
I'm trying to find a way to get Hubot to not respond to itself.
From what I gather, the Hubot Campfire adapter seems to include a specific check to prevent Hubot from listening to itself:
https://github.com/github/hubot/blob/b96ea30654ef2dbf93f710c6e310c909fa1bdd65/src/adapters/campfire.coffee#L71
However, other adapters don't seem to have this.
Is there another way to write a Hubot script with robot.hear and msg.send such that it will not respond to itself?
I found the answer to this - Hubot is not meant to respond/hear itself.
It's the responsibility of each adapter to handle filtering these messages out.
Some adapter (e.g. hubot-hipchat) will actually set the hubot bot name to the name of the user you authenticate in Hubot as.
In the case of hubot-flowdock, it will check the hubot bot name against the Flowdock "Display name" of the user you authenticate as - so you just need to make sure those match up (either by changing the "Display name" on the Flowdock account page, or using the -n flag or HUBOT_NAME environment variable to set the bot name).