<?php
$extension_list=array(100=>100,101=>101,102=>102,103=>103,104=>104,105=>105,106=>106,107=>107,108=>108,109=>109);
foreach($extension_list as $key=> $extension) {
$output = shell_exec("asterisk -x \" core show hint $extension\" | awk '{print $4}' | awk 'NR==1'");
$state = substr("$output", -5);
$state=trim ($state);
if($state=="Idle") {
echo "agent $key $state\n";
}
else {
echo " $key $output\n";
}
}
?>
Soporte & Consultoria
Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita
martes, 21 de junio de 2016
lunes, 20 de junio de 2016
getting DID from invite
[custom-get-did-from-sip]
exten => s,1,Noop(Fixing DID using information from SIP TO header)
exten => s,n,Set(pseudodid=${SIP_HEADER(To)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,+,2)})
exten => s,n,Set(isuk=${REGEX("^44.*" ${pseudodid})})
exten => s,n,Set(pseudodid=${IF(${isuk}?0${pseudodid:2}:${pseudodid}))
exten => s,n,Set(pseudocid=${CALLERID(num)})
exten => s,n,Set(pseudocid=${CUT(pseudocid,+,2)})
exten => s,n,Set(isuk=${REGEX("^44.*" ${pseudocid})})
exten => s,n,Set(pseudocid=${IF(${isuk}?0${pseudocid:2}:${pseudocid}))
exten => s,n,Set(CALLERID(num)=${pseudocid})
exten => s,n,Set(CALLERID(name)=${pseudocid})
exten => s,n,Goto(from-trunk,${pseudodid},1)
domingo, 12 de junio de 2016
Bandwidth consumption
Business PBX Solutions

| Provider | Solution Details | |
|---|---|---|
![]() | Become an ITSP Now!
| Details |
![]() | 3CX Software PBX for Windows
| Details |
*Rates shown do not include E-911 charges or government mandated taxes. Providers offering unlimited calling plans may have restrictions. Read providers terms and conditions carefully before buying.
VOIP Bandwidth consumption naturally depends on the codec used.
When calculating bandwidth, one can't assume that every channel is used all the time. Normal conversation includes a lot of silence, which often means no packets are sent at all. So even if one voice call sets up two 64 Kbit RTP streams over UDP over IP over Ethernet (which adds overhead), the full bandwidth is not used at all times.
A codec that sends a 64kb stream results in a much larger IP network stream. The main cause of the extra bandwidth usage is IP and UDP headers. VoIP sends small packets and so, many times, the headers are actually much larger than the data part of the packet.
IAX2 trunking helps with the IP overhead, but only when you are sending more than 2 or so calls between the same Asterisk servers. John Todd has done some useful practical testing, named IAX2 trunking: codec bandwidth comparison notes and results.
The bandwidth used depends also on the datalink (layer2) protocols. Several things influence the bandwidth used, payload size, ATM cell headers, VPN headers, use of header compression and IAX2 Trunked. You can see the influence of some of this factors using the Asteriskguide bandwidth calculator.
Teracall has the table which shows how the codec's theoretical bandwidth usage expands with UDP/IP headers:
Codec BR NEB
G.711 64 Kbps 87.2 Kbps
G.729 8 Kbps 31.2 Kbps
G.723.1 6.4 Kbps 21.9 Kbps
G.723.1 5.3 Kbps 20.8 Kbps
G.726 32 Kbps 55.2 Kbps
G.726 24 Kbps 47.2 Kbps
G.728 16 Kbps 31.5 Kbps
iLBC 15 Kbps 27.7 Kbps
BR = Bit rate
NEB = Nominal Ethernet Bandwidth (one direct
When calculating bandwidth, one can't assume that every channel is used all the time. Normal conversation includes a lot of silence, which often means no packets are sent at all. So even if one voice call sets up two 64 Kbit RTP streams over UDP over IP over Ethernet (which adds overhead), the full bandwidth is not used at all times.
A codec that sends a 64kb stream results in a much larger IP network stream. The main cause of the extra bandwidth usage is IP and UDP headers. VoIP sends small packets and so, many times, the headers are actually much larger than the data part of the packet.
IAX2 trunking helps with the IP overhead, but only when you are sending more than 2 or so calls between the same Asterisk servers. John Todd has done some useful practical testing, named IAX2 trunking: codec bandwidth comparison notes and results.
The bandwidth used depends also on the datalink (layer2) protocols. Several things influence the bandwidth used, payload size, ATM cell headers, VPN headers, use of header compression and IAX2 Trunked. You can see the influence of some of this factors using the Asteriskguide bandwidth calculator.
Teracall has the table which shows how the codec's theoretical bandwidth usage expands with UDP/IP headers:
Codec BR NEB
G.711 64 Kbps 87.2 Kbps
G.729 8 Kbps 31.2 Kbps
G.723.1 6.4 Kbps 21.9 Kbps
G.723.1 5.3 Kbps 20.8 Kbps
G.726 32 Kbps 55.2 Kbps
G.726 24 Kbps 47.2 Kbps
G.728 16 Kbps 31.5 Kbps
iLBC 15 Kbps 27.7 Kbps
BR = Bit rate
NEB = Nominal Ethernet Bandwidth (one direct
viernes, 10 de junio de 2016
Adding Listen, Whisper, and Barge to FreePBX or Asterisk
Adding Listen, Whisper, and Barge to FreePBX or Asterisk
If you are running a call center on FreePBX or Asterisk, most likely you will want the ability to listen in on agents calls, also known as joining multiple calls, or connected two calls to a manager, or other variations of barging in on a bridged channel.
For the purpose of this article, we will define manager as the callee who is the spying channel, agent who is the spied-on channel, and client who is the bridged channel / 3rd party. We define listen, whisper, and barge as follows:
Listen: Monitor an agents call. The manager can hear both the agent and client channels, but no-one can hear the manager.
Whisper: Whisper to the agent. The manager can hear both the agent and client channels, and the agent can also hear the manager, but the client can only hear the agent, hence “whisper.”
Barge: Barge in on both channels. The manager channel is joined onto the agent and client channels, and all parties can hear each other. Be warned, if the original agent leaves the call, the call is dropped. This is not a 3-way call.
(However you can barge in, and when comfortable, initiate a 3way call to your extension so you can continue the call without the agent. This procedure varies from client to client (soft/hard phones))
(However you can barge in, and when comfortable, initiate a 3way call to your extension so you can continue the call without the agent. This procedure varies from client to client (soft/hard phones))
One more note: We can also provide 3-way calling [live transfer] services on the server side, however this is outside the scope of this document. Please contact us for details.
miércoles, 8 de junio de 2016
Setting up the CISCO 7940 with SIP/Asterisk
Introduction
This is another guide that was born out of extreem frustration. After spending weeks trying to get my CISCO 7940g to work with Asterisk, I decided to document the event for future generations.The phones can be picked up cheap on eBay and also work nicely with Asterisk after some fiddling. However, there are a few points to bear in mind:
Rebooting the phone
The first thing you probably want to know is how to reboot the phone. Hold down "*", "6" and "settings". The settings button is the bottom right of the group of four buttons around a circular, green question mark button. It has a box with a tick in it on the button.Upgrading to SIP firmware
I don't want to cover this in too much detail as it's repeatadly documented all over the Internet. There are a few points to bear in mind:Configuring the phone to connect to Asterisk or another SIP provider
Let's start by assuming that you have managed to get a firmware upgrade to the lastest version of the SIP firmware. Now you need to configure the phone. When the phone boots, it downloads the firmware from the TFTP server and also pulls down some config files. You need the following files on the TFTP server (assuming you are using 8.9):SIPDefault.cnf
#image_version shows the firmware image to get from the TFTP server. Note this shouls start P0S and not P00.image_version: P0S3-08-9-00
#Proxy server address should probably be more accuratly be called the SIP server
proxy1_address: x.x.x.x
#proxy_register tell it to connect to the SIP server (why would you want to set this to 0?!
proxy_register: 1
SIP<MAC>.cnf
#The following lines contain the authenication detailsline1_name: line1
line1_authname: "line1"
line1_displayname: "line1"
line1_password: "supersecret"
So now you should be able to boot your phone and make and receive calls. Good for you!
Setting the time
This is a bit of a mission. You set the NTP server and timezone but also have to set the details of when Daylight Saving Time starts and finishes. Fortunatly the rules are available here and it seems that DST is stardardised across the EU. The following example goes in SIPDefault.cnf and should get you going for the UK. Change the time zone for Europe. Change something else for the rest of the worldsntp_server: "pool.ntp.orgt"
sntp_mode: unicast
time_zone: GMT
dst_offset: 1
dst_start_month: March
dst_start_day_of_week: Sun
dst_start_week_of_month: 8
dst_start_time: 01
dst_stop_month: Oct
dst_stop_day_of_week: Sun
dst_stop_week_of_month: 8
dst_stop_time: 02
dst_auto_adjust: 1
time_format_24hr: 1
date_format : D/M/Y
Phone directory
The CISCO phone directory is stored in an XML file that can hold 32 numbers. You can either get the phone directory XML file directly or use a form to send a search criteria to a script that returns matching results. Firstly you have to assign a button to the phone directory. There are various programmable buttons on the phone that you could use but since one is marked "directory" it makes sense to use that. First you add an entry to the SIPDefault.cnf, telling it what to do when the directory button is pressed. In the example below, pressing the button will GET directory.xml via HTTP:SIPDefault.cnf
#The directory_url contains a URL to the directory XML filedirectory_url: "http://www.example.com/directory.xml"
directory.xml could just contain a phonebook in XML, like the example directory file below. This is fine if you don't want to search and don't have more than 32 entries. If you do, you have to do things a little differently. You can add the following to directory.xml:
<CiscoIPPhoneInput>
<Title>Phone book</Title>
<Prompt>Prompt text.</Prompt>
<URL>http://www.example.com/phonebook.pl</URL>
<InputItem>
<DisplayName>search</DisplayName>
<QueryStringParam>search</QueryStringParam>
<InputFlags></InputFlags>
<DefaultValue></DefaultValue>
</InputItem>
</CiscoIPPhoneInput>
Now, when you press the directory button, you will be presented with a search screen. You can enter a name and press search. It will then try to GET /phonebook.pl?search=name from the HTTP server. Thus you will have to write a script that searches for the string in your phone directory and returns the results using the CISCO XML format below. This is obviously a lot more work but hey, these are enterprise phones!Example directory file
<CiscoIPPhoneDirectory>
<Title>Directory</Title>
<Prompt>Who you gonna call?</Prompt>
<DirectoryEntry>
<Name>Tom</Name>
<Telephone>6905</Telephone>
</DirectoryEntry>
<DirectoryEntry>
<Name>Dick</Name>
<Telephone>6906</Telephone>
</DirectoryEntry>
</CiscoIPPhoneDirectory>
Voicemail number
The 7940 has a voicemail button that dials your viocemail. Sound clever? It's just a config directive that tells it which number to dial when thebutton is pressed. Add the following to your SIPDefault.cnf:messages_uri: "8500"So, when you hit the message button it dials 8500, which, as we all know is the default main voicemail number for Asterisk. We can also go a step further and create a number that dials the voice mail. Change the number in the mesasges_uri to 8501 and create the following extention in extentionss.conf:
exten => 8501,1,VoicemailMain(${CALLERID(number)})
exten => 8501,n,Hangup
This means that when you press the message button it will dial 8501 which Asterisk will call voicemail and pass the number of your phone to the Voicemail. This will go stagiht to that mailbox number without having to enter it. If the voicemail box for that phone does not match the phone's callerID num, you could pass it statically, of course.
Message Waiting Indicator
Asterisk can turn on and off the Message Waiting Indicator on phones. This is simply a case of adding "mailboxviernes, 13 de mayo de 2016
freepbx ami calling
- <?php
- $pbx="14.238.148.19";
- $trunk="commpeak";
- $timeout=45;
- $exten=$_GET['exten'];
- $cid=$_GET['cid'];
- $dest=$_GET['dest'];
- $socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
- fputs($socket, "Action: Login\r\n");
- fputs($socket, "UserName: admin\r\n"); //
- fputs($socket, "Secret: x3tss4\r\n\r\n"); //
- //
- $wrets=fgets($socket,128);
- echo $wrets;
- fputs($socket, "Action: Originate\r\n" );
- #fputs($socket, "Channel: Local/$dest@local\r\n" );
- fputs($socket, "Channel: SIP/$exten\r\n" );
- #fputs($socket, "Channel: SIP/$trunk/$exten\r\n" );
- fputs($socket, "Exten: $dest\r\n" );
- fputs($socket, "Context: from-internal\r\n" );
- fputs($socket, "Priority: 1\r\n" );
- fputs($socket, "CallerID: $cid\r\n" );
- fputs($socket, "Variable: __var1=$dest\r\n" );
- fputs($socket, "Variable: __var2=$exten\r\n" );
- fputs($socket, "Async: yes\r\n\r\n" );
- fputs($socket, "Action: Logoff\r\n\r\n");
- sleep (1);
- $wrets=fgets($socket,128);
- ?>
- URL de ejemplo
- exten numero a llamar
- dest numero de destino
- cid caller id
- http://5.181.118.22/dialer/dialer_test.php?exten=200&dest=18007143030&cid=18007143030
domingo, 8 de mayo de 2016
allowing access to specifc ip to spefic ports
- iptables -I INPUT 2 -m state --state NEW -m tcp -p tcp --dport 80 -s 177.44.7.14 -j ACCEPT
- iptables -I INPUT 2 -m state --state NEW -m udp -p udp --dport 5060 -s 177.44.7.14 -j ACCEPT
- iptables -I INPUT 2 -m state --state NEW -m udp -p udp --dport 10000:20000 -s 177.44.7.14 -j ACCEPT
- by range
- iptables -I INPUT 2 -m state --state NEW -m tcp -p tcp --dport 80 -s 186.150.197.0/24 -j ACCEPT
- iptables -I INPUT 2 -m state --state NEW -m udp -p udp --dport 5060 -s 186.150.197.0/24 -j ACCEPT
iptables -I INPUT 2 -m state --state NEW -m udp -p udp --dport 10000:20000 -s 186.150.197.0/24 -j ACCEPT
service iptables save
Suscribirse a:
Comentarios (Atom)

