Are you trying to figure out how to set up click to call from a webpage using the Asterisk AMI? Well look no further, this is an easy to follow guide on exactly how to do it.
So before we start a couple of things you have to know about my environment. First I am hosting the webpage on the Asterisk server for the click to call so I have Apache installed and running, second I have port 80 open on the Asterisk server firewall so I can allow external requests.
So first thing you need to do is configure your Asterisk manager config file with a username who can originate the call.
/etc/asterisk/manager.conf [general] displaysystemname = yes enabled = yes webenabled = yes port = 5038 [clickadmin] secret=asdf1234S3 permit=127.0.0.0/255.255.255.0 ; Authorization for various classes read = system,call,log,verbose,command,agent,user,config write = system,call,log,verbose,command,agent,user,config
Once you create a user and password, in this case I have the username “clickadmin” then you can start writing the php code.
/var/www/html/clickcall/index.php $extension = $_REQUEST['internalnum']; $dialphonenumber = $_REQUEST['outboundnum']; $timeout = 10; $asterisk_ip = "127.0.0.1"; $socket = fsockopen($asterisk_ip,"5038", $errno, $errstr, $timeout); fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: clickadmin\r\n"); fputs($socket, "Secret: asdf1234S3\r\n\r\n"); $wrets=fgets($socket,128); echo $wrets; fputs($socket, "Action: Originate\r\n" ); fputs($socket, "Channel: SIP/$extension\r\n" ); fputs($socket, "Exten: $dialphonenumber\r\n" ); fputs($socket, "Context: dial-outbound\r\n" ); // very important to change to your outbound context fputs($socket, "Priority: 1\r\n" ); fputs($socket, "Async: yes\r\n\r\n" ); $wrets=fgets($socket,128); echo $wrets;
So that webpage will respond to url post of http://[ip address]/clickcall/index.php?internalnum=101&outboundnum=4075551234
It will first place a phone call to the extension number, in the example case would be 101. Once extension 101 answers that call it will then place the outbound leg of the call to phone number 4075551234.
I love to hear from my students so today I am posting a survey for you to fill me in on what you want more of. Tell me what you like and what you don’t like, or what you want to see more of. Say whatever you want, I am here to listen to you.
I just created a video of how to install Asterisk 13 on CentOS 7 64bit so anyone can follow along. I take this step by step to make it very easy to install the latest version of Asterisk. See the commands below the video.
yum install automake bluez-libs-devel bzip2 corosynclib-devel gcc gcc-c++ git gsm-devel jansson-devel libcurl-devel libedit-devel libical-devel libogg-devel libsrtp-devel libtool-ltdl-devel libuuid-devel libvorbis-devel libxml2-devel libxslt-devel lua-devel mariadb-devel nano ncurses-devel neon-devel net-snmp-devel newt-devel openldap-devel openssl-devel perl popt-devel postgresql-devel speex-devel sqlite-devel subversion unixODBC-devel uuid-devel wget cd /usr/src/ wget http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-13.1-current.tar.gz wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2 bzip2 -d pjproject-2.4.tar.bz2 tar xvf pjproject-2.4.tar cd pjproject-2.4 ./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr make dep make make install ldconfig cd /usr/src tar zxfv certified-asterisk-13.1-current.tar.gz cd certified-asterisk-13.1-cert2/ ./bootstrap.sh ./configure --libdir=/usr/lib64 make menuselect make make install make samples make config service asterisk start asterisk -rvvv
One of my clients AstLinux PBX’s was acting up a couple weeks ago by going into after hours mode in the middle of the day. Upon further investigation it turned out the PBX had lost power and rebooted so I realized the date/time was very wrong. The date command revealed the operating system believed it was 1999 so I figured the CR2032 battery on the board had gone bad. After replacing the battery I was expecting NTP to set the correct time for me, well that was a wrong assumption.
I restarted the NTP service many times only to continue getting an error of:
pbx ~ # service ntpd start Starting ntpd... sntp firstname.lastname@example.org Sat Feb 7 06:51:14 UTC 2015 (1) 2015-08-15 05:06:36.118274 (+0500) -8696498.478863 +/- 5797665.661695 north-america.pool.ntp.org 22.214.171.124 s2 adj_systime: Invalid argument
I checked the logs which reported the same issue:
pbx ~ # date Sat Jan 22 15:59:53 EST 2000 pbx ~ # cat /var/log/messages Jan 22 16:07:48 pbx daemon.notice ntpd: ntpd email@example.com Sat Feb 7 06:49:37 UTC 2015 (1): Starting Jan 22 16:07:48 pbx daemon.info ntpd: Command line: ntpd ? Jan 22 16:07:48 pbx daemon.info ntpd: proto: precision = 11.734 usec (-16) Jan 22 16:07:48 pbx daemon.info ntpd: getconfig: Couldn't open Jan 22 16:07:48 pbx daemon.info ntpd: Listen and drop on 0 v4wildcard 0.0.0.0:123 Jan 22 16:07:48 pbx daemon.info ntpd: Listen normally on 1 lo 127.0.0.1:123 Jan 22 16:07:48 pbx daemon.info ntpd: Listen normally on 2 eth0 192.168.247.10:123 Jan 22 16:07:48 pbx daemon.info ntpd: Listening on routing socket on fd #19 for interface updates Jan 22 16:09:03 pbx user.info sntp: sntp firstname.lastname@example.org Sat Feb 7 06:51:14 UTC 2015 (1) Jan 22 16:09:03 pbx user.info sntp: 2000-01-22 16:09:03.294382 (+0500) +482356762.551 +/- 321571175.034339 ntp.myfloridacity.us 126.96.36.199 s1 Jan 22 16:09:03 pbx user.err sntp: adj_systime: Invalid argument
At this point I figured the date was so far off that the system could not calculate the correct time based on the Invalid argument log entry. So I went ahead and manually set the date/time using the date command.
pbx ~ # date -s 2015.05.17-13:28:00 Sun May 17 13:28:00 EDT 2015
Then I did a restart on the NTP service which restored NTP to working order.
pbx ~ # service ntpd restart
All was back to normal after that, just make sure to manually set the time to be as close as possible then restart the ntpd service.
If your like me and use an iPhone to do a lot of you’re emailing then it is imperative to have a gmail account connected to it. Below are the quick and easy steps to configure a Gmail account on your iPhone or iPad using the latest version of Apple IOS8.
Good luck and let me know if you have any questions or feedback.
Do you want to build your own cloud phone system?
Do you want a get your own dedicated phone number?
How would you like to do all of this for less than the cost of a cup of coffee?
I recently finished another udemy training course where I walk you through step by step to building a cloud phone system and ordering a phone number. If you are looking to stop using your cell phone for all your work and personal phone calls this class is for you and for being a visitor of my blog get 60% off the original price.
There are many times when I would like to present my iPhone on a projector or large computer screen to show others an app or something on my phone. This has been a challenge in the past using tools like airplay or some third-party apps. Well not anymore, with OS X Yosemite there is now a native tool to display your iPhone or iPad right on your computer screen. QuickTime player now has an easy to use option to make your phone the video source. See below for how to set up the screen sharing option.
1. Plug your iPhone or iPad into your Mac using the usb lightning cable.
2. Open iTunes and click Trust on your iPhone/iPad pop-up to allow your computer access to the device.
3. Open QuickTime Player from Applications menu.
4. From the QuickTime file menu select New Movie Recording.
5. By default the movie screen will open using the computers FaceTime camera. Click the down arrow next to the record button then select your iPhone/iPad.
6. Now your phone will appear in the QuickTime movie window which will allow you to display to others or start a recording.
I just posted my first Udemy course on learning Linux and Asterisk. If you are having problems getting started with Asterisk and Linux this is an easy step by step video series where I walk my students all the way through installing Linux and compiling Asterisk. I have included a link to the course below.
So my past post about using ssmtp to do voicemail to email with a Gmail account no longer works as some commenters pointed out. This sent me back to the drawing board to write an updated post to help all of you. This time I used postfix, included by default with CentOS installs making it easier.
Follow along below for your Asterisk voicemail to email with a Gmail account using the postfix application.
1. We do need to install a couple of extra packages even if postfix is already installed. I also am installing postfix just in case you didn’t have it installed.
yum -y install postfix mailx cyrus-sasl-plain
2. You need to create a new file with your Gmail account smtp server and credentials in the following format.
Paste in the below text and change the email address to your gmail email and enter in your password.
3. Once done doing that we want to hash your password file so it is not human readable.
4. The next step is to configure postfix to use this new password file. Open the /etc/postfix/main.cf file using a text editor then scroll down to the bottom and paste in the following code.
smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous # Secure channel TLS with exact nexthop name match. smtp_tls_security_level = secure smtp_tls_mandatory_protocols = TLSv1 smtp_tls_mandatory_ciphers = high smtp_tls_secure_cert_match = nexthop smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt relayhost = smtp.gmail.com:587
5. Restart the postfix service.
service postfix restart
6. Now you can send a test email using the mail command in the following format.
mail email@example.com Subject: Hello World . (followed by enter key to send and exit) EOT
7. Once you send that check your email to see if you received the email and as long as that is the case you can go ahead and remove the text password file.
8. Now you are all set, by default Asterisk will use the default mailing program so my voicemail.conf file looks like so.
[root@localhost ~]# cat /etc/asterisk/voicemail.conf [general] format = wav serveremail = asterisk attach = yes skipms = 3000 maxsilence = 10 maxmessage = 300 review = yes silencethreshold = 128 maxlogins = 3 emaildateformat = %A, %B %d, %Y at %r sendvoicemail = yes exitcontext = vm-operator operator = yes fromstring = PBX Voicemail
Hope you find this helpful and it works for you. Please let me know if there are any issues so I can correct my tutorial. I like my visitors to get their questions answered with a single visit, not having to bounce around from website to website trying to solve a problem.
Happy New Year! Onto 2015!
I am in the process of adding surveillance cameras to the exterior of my home so I started looking at ONVIF cameras. The ONVIF cameras are great since a lot of network video recorders compatible with the ONVIF standard. My camera search started on Ebay trying to find affordable cameras, sub $125, and what I ended up with was an Anran AR-24NW-POE. The camera specs make it look really good and being ONVIF 2.0 compatible.
It is a 1.3 Megapixel HD camera with a 3.6mm lens supporting 960p. It supports the 802.3af PoE standard and powers up the first time it’s plugged in. Documentation suggests it will work with Synology, QNAP, iSpy, and Blue Iris NVR’s. I can’t confirm or deny that statement but I wouldn’t go out and buy a lot of these without testing one first. I started by testing it with the open source ONVIF configuration tool. It didn’t work as easy as I expected and after wasting a lot of time an email from the seller helped me get it working since the ONVIF interface runs on port 8899 instead of the default http port 80. After making that change it worked right away, although not 100% of the menus were working. The url for the ONVIF tool is in the following format: http://192.168.115.101:8899/onvif/device_service.
So based on this I don’t believe the camera is ONVIF 2.0 compatible. While the infrared vision and picture quality is amazing for the price something else had to suffer. I was able to stream the video stream easily to VLC using the following url: rtsp://192.168.115.101/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp.