Send an e-mail to the asterisk to make it call extension [SOLVED]

I have to implement a feature that allows me to ring extensions and play a message as soon as an email arrives.

Before starting to write code and engage in various implementations … Is there something ready or something that is closer to my need?

Gezie at all for the collaboration

I doubt anyone here would torture their people like that, but you could do it using a pop3 monitoring program (there are hundreds around) running on the PBX server. The “output” would be a call file.

The specifics of this are all too tightly coupled to your specific situation, so getting much more than that is going to cost you.

To be clear - if you implemented this on my network, I’d walk over to your desk and hit you with a shovel, but to each his own. :grinning:

2 Likes

Not to be condescending but when the request arrived on my desk I thought about the one you thought about :slight_smile:
The point is that I have a superior a bit fixed with things twisted and offers them to customers who often do not even understand what he is saying …
But the world turns like this …
Thank you

I know.

Start with a PERL script to monitor new email using IMAP.
Install it on the phone server.
When a new mail comes in, convert the subject to speech file.
Set up a “standard” call file in some directory, or code it into the application.
Write the call file to a /tmp directory.
Move the call file to the /var/spool/…something…/callfile.somenumber
Call happens.

If you get this working, please share it here.

There are some pieces to this that are being missed and could impact how the solution can be rolled out.

Is this an alert/notification solution? As in when I get a new email in my mailbox on the mail server it’s going to ring my phone and tell me I have new mail? Because if that is the case then you have an existing mail server running and you will need to do what @cynjut suggested and get a program that can check the folder via IMAP for new messages and generate the call file from there.

If there is no existing mail server and you need to set that portion up then doing it on the PBX is going to require a POP/IMAP service like Dovecot to be installed. Then Postfix will need to be configured to accept incoming SMTP connections and be configured to work with Dovecot for mail storage/delivery to the user account. You’ll need to make sure the PBX’s firewall/security has the SMTP port setup properly.

I’m working intermittently on the project.
The part that reads the emails is that easy then I will give ducumentazione on what I used.
Instead to unleash the call at the moment I’m using AMI

Action: Originate
Channel: SIP/10
Application: playback
Extension: 10
Data: custom/msg-public-rif

Only at the moment I can not trigger a call to a group but only towards an extension …

Use a channel of this format to dial any digits including a ring group:

Channel: Local/600@from-internal

Thank you!
Clear simple and precise …

1 Like

Actually with “Channel: Local / 600 @ from-internal” it works
but it does not reproduce the audio
while if I call an interior everything goes
here is the AMI code
$ in = “Action: Originate \ r \ n”;
$ in. = “Channel: SIP / 10 \ r \ n”;
$ in. = “Application: playback \ r \ n”;
$ in. = “Extension: 10 \ r \ n”;
$ in. = “Date: custom / messages-clients \ r \ n \ r \ n”;
$ in. = “Action: Logoff \ r \ n \ r \ n”;

The project is working now I fix the details
As soon as possible place the examples and documentation

2 Likes

Finished…
I thought it was more difficult
I created a program that reads and deletes messages via php with imap functions
If the imap support is missing on the server:
yum install php-imap
service httpd restart

Here’s how to connect to the mail:
http://php.net/manual/en/book.imap.php

For the AMI part needed to make the call and play the message:

   $ fp = fsockopen ("localhost", 5038, $ errno, $ errstr, 30);
    $ out = "Action: Login \ r \ n";
    $ out. = "UserName: ****** \ r \ n";
    $ out. = "Secret: ******* \ r \ n \ r \ n";
    fwrite ($ fp, $ out);

    $ in = "Action: Originate \ r \ n";
    $ in. = "Channel: SIP / 10 \ r \ n";
    $ in. = "Application: playback \ r \ n";
    $ in. = "Extension: 10 \ r \ n";
    $ in. = "Date: custom / messages-clients \ r \ n \ r \ n";
    $ in. = "Action: Logoff \ r \ n \ r \ n";
    fwrite ($ fp, $ in);

    $ fo = "";
    while (! feof ($ fp)) {
            $ fo. = fgets ($ fp, 128);
    }
    fclose ($ fp);

If, on the other hand, we want to send text messages, it will be enough to rely on the examples of the service provider

Finally a nice line in the crontab type:

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