<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>bahjons.com &#187; Asterisk PBX</title>
	<atom:link href="http://bahjons.com/stuff/category/asterisk-pbx/feed" rel="self" type="application/rss+xml" />
	<link>http://bahjons.com/stuff</link>
	<description></description>
	<lastBuildDate>Wed, 26 May 2010 23:34:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using ODBC with Asterisk &#8211; cdr_odbc</title>
		<link>http://bahjons.com/stuff/using-odbc-with-asterisk-cdr_odbc</link>
		<comments>http://bahjons.com/stuff/using-odbc-with-asterisk-cdr_odbc#comments</comments>
		<pubDate>Thu, 20 May 2010 17:16:26 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://bahjons.com/stuff/?p=186</guid>
		<description><![CDATA[So in my previous post, I wrote about how useful ODBC is to Asterisk and I showed how to install it. Now we will explore how we can use it within Asterisk. First we&#8217;ll quickly talk about cdr_odbc. This allows us to store our CDR data directly to a database. Most people are probably going [...]]]></description>
			<content:encoded><![CDATA[<p>So in my <a href="http://bahjons.com/stuff/sweethearts-asterisk-and-odbc">previous post</a>, I wrote about how useful ODBC is to Asterisk and I showed how to install it. Now we will explore how we can use it within Asterisk.</p>
<p>First we&#8217;ll quickly talk about cdr_odbc. This allows us to store our CDR data directly to a database. Most people are probably going to be using MySQL. And you probably thought that you had to install the Asterisk-Addons to be able to use MySQL (Due to licensing concerns.) Well, not anymore. Not with ODBC.<span id="more-186"></span> Okay, so I&#8217;m going to assume that you have already installed ODBC and recompiled Asterisk as per my <a href="http://bahjons.com/stuff/sweethearts-asterisk-and-odbc">previous post</a>.  In our /etc/odbc.ini file we created database connections. Hopefully you have already created the databases. If not, go ahead and do that now.   Here&#8217;s the table structure for CDR:</p>
<blockquote><p>CREATE TABLE IF NOT EXISTS `cdr` (<br />
`calldate` datetime NOT NULL default &#8217;0000-00-00 00:00:00&#8242;,<br />
`clid` varchar(80) NOT NULL default &#8221;,<br />
`src` varchar(80) NOT NULL default &#8221;,<br />
`dst` varchar(80) NOT NULL default &#8221;,<br />
`dcontext` varchar(80) NOT NULL default &#8221;,<br />
`channel` varchar(80) NOT NULL default &#8221;,<br />
`dstchannel` varchar(80) NOT NULL default &#8221;,<br />
`lastapp` varchar(80) NOT NULL default &#8221;,<br />
`lastdata` varchar(80) NOT NULL default &#8221;,<br />
`duration` int(11) NOT NULL default &#8217;0&#8242;,<br />
`billsec` int(11) NOT NULL default &#8217;0&#8242;,<br />
`disposition` varchar(45) NOT NULL default &#8221;,<br />
`amaflags` int(11) NOT NULL default &#8217;0&#8242;,<br />
`accountcode` varchar(20) NOT NULL default &#8221;,<br />
`uniqueid` varchar(32) NOT NULL default &#8221;,<br />
`userfield` varchar(255) NOT NULL default &#8221;,<br />
KEY `calldate` (`calldate`),<br />
KEY `dst` (`dst`),<br />
KEY `accountcode` (`accountcode`),<br />
KEY `dst_2` (`dst`),<br />
KEY `uniqueid` (`uniqueid`)<br />
) ENGINE=MyISAM DEFAULT CHARSET=latin1;</p></blockquote>
<p>There&#8217;s been so much talk about how the CDR system was going to be changed but I never saw any developments from that. ODBC doesn&#8217;t support &#8216;start&#8217;,'answer&#8217;,'end&#8217; for the CDR. &#8216;calldate&#8217; is going to be the time that the call hit the PBX.   Anyway, back to it&#8230;</p>
<p>You can edit your /etc/asterisk/cdr.conf to include the desired settings you want. I like to enable the following:</p>
<blockquote><p>[general]<br />
unanswered=yes<br />
loguniqueid=yes<br />
loguserfield=yes</p></blockquote>
<p>Okay, now edit your cdr_odbc.conf to match the settings from your previous created database and cdr table.</p>
<blockquote><p>[global]<br />
dsn=asterisk     ;&lt;= This matches your &#8216;context&#8217; from /etc/odbc.ini<br />
username=asterisk    ;&lt;= Don&#8217;t really need these due to the dsn already containing login details.<br />
password=yourpassword<br />
loguniqueid=yes<br />
dispositionstring=yes<br />
table=cdr               ;&#8221;cdr&#8221; is default table name<br />
usegmtime=no             ; set to &#8220;yes&#8221; to log in GMT</p></blockquote>
<p>Restart Asterisk and you should be logging CDR data to your database now. Pretty easy. And you didn&#8217;t even have to install Asterisk-Addons. <img src='http://bahjons.com/stuff/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/using-odbc-with-asterisk-cdr_odbc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk &#8211; Leaner is Meaner!</title>
		<link>http://bahjons.com/stuff/asterisk-leaner-is-meaner</link>
		<comments>http://bahjons.com/stuff/asterisk-leaner-is-meaner#comments</comments>
		<pubDate>Wed, 19 May 2010 00:38:55 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://bahjons.com/stuff/?p=144</guid>
		<description><![CDATA[This is my updated installation guide. This approach will be alot different than my previous installation guide.  What&#8217;s different? For one, I&#8217;m using the latest and greatest Asterisk version: 1.6.2.7. This will be the leanest, meanest install yet. I&#8217;ll be exploring the different applications and functions available within Asterisk, and my favoriate approach to using [...]]]></description>
			<content:encoded><![CDATA[<p>This is my updated installation guide. This approach will be alot different than my <a href="http://bahjons.com/stuff/asterisk-my-quick-installation-guide">previous installation guide</a>.  What&#8217;s different? For one, I&#8217;m using the latest and greatest Asterisk version: 1.6.2.7. This will be the leanest, meanest install yet.</p>
<p>I&#8217;ll be exploring the different applications and functions available within Asterisk, and my favoriate approach to using Asterisk.</p>
<p><span id="more-144"></span><br />
STEP ONE: Install CENTOS and Tools<br />
So we&#8217;re running the leanest install of CentOS. You probably will only need the first CD (1 of 6) for this install. I customized the installation and unchecked everything. I wanted just the bare install. Anything else we need we&#8217;ll be installing via YUM.  Leaner is meaner &#8211; right? <img src='http://bahjons.com/stuff/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  By the way, I&#8217;m installing the latest CentOS 5.x.</p>
<p>Once that&#8217;s done, we&#8217;ll install the tools that we know we&#8217;ll need. This is a nice little list, so I hope your internet connection is good. Or you can install from the CD these packages if you need. So here we go:</p>
<blockquote><p>rpm -import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5<br />
yum -y install nano setuptool ifconfig man nslookup traceroute dig chkconfig system-config-network-tui screen kernel-devel kernel-source bison openssl-devel mysql php-mysql mysql-server mysql-devel gcc libtermcap libtermcap devel newt newt-devel zlib-devel ncurses-devel gcc-c++ compat-gcc-32 compat-gcc-32-c++ unixODBC unixODBC-devel gtk+ libxml2-devel wget mlocate lynx tar nmap bzip2 mod_ssl crontabs vixie-cron libtool-ltdl libtool-ltdl-devel mysql-connector-odbc libidn curl libidn-devel curl-devel lame sox ntsysv httpd php mod_ssl php-mbstring php-mcrypt sudo vixie-cron</p></blockquote>
<p>Let&#8217;s do a quick yum -y update and update the whole system. Then reboot.</p>
<p>I&#8217;m a big fan of using a database to drive Asterisk. It gives alot more flexibility for configuring on the fly and can add more redundancy to the system by separating the database from Asterisk. So we&#8217;ll be installing ODBC. We&#8217;ve already yum installed the ODBC packages. Now we just need to set them up to interface with our database server. We need to do this before we compile Asterisk, so that we can compile func_ODBC, res_ODBC and cdr_ODBC, etc. Check out a <a href="http://bahjons.com/stuff/sweethearts-asterisk-and-odbc">previous article here</a> for how to setup ODBC.</p>
<p>The ODBC install tells us how to compile Asterisk, but I&#8217;ll note that again here:</p>
<blockquote><p>cd /usr/src/<br />
wget http://www.asterisk.org/downloads/asterisk/1.6.2.7<br />
tar -zxvf asterisk-1.6.2.7.tar.gz<br />
rm -f asterisk-1.6.2.7.tar.gz<br />
cd /usr/src/asterisk-1.6.2.7<br />
./configure<br />
make &amp;&amp; make install<br />
make config</p></blockquote>
<p>Because we&#8217;re using ODBC, there&#8217;s no reason that I would install the Asterisk-Addons. I mainly used it for the ability to connect to MySQL. Some others might want it for the MP3 Playback. If that&#8217;s you, here&#8217;s how you would do that:</p>
<blockquote><p>cd /usr/src/<br />
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-1.6.2.1.tar.gz<br />
tar -zxvf asterisk-addons-1.6.2.1.tar.gz<br />
rm -f asterisk-addons-1.6.2.1.tar.gz<br />
cd asterisk-addons-1.6.2.1<br />
./configure<br />
make menuselect</p>
<p>make &amp;&amp; make install</p></blockquote>
<p>Other things you might have to compile&#8230;<br />
DAHDI: http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.3.0+2.3.0.tar.gz<br />
LibPRI: http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.10.2.tar.gz</p>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
<p>For this example, I&#8217;m not installing anything but Asterisk. After all, the title is leaner is meaner. So we&#8217;re running the most basic of Asterisk. All connections to our carrier is purely SIP or IAX, so we only need a good Internet connection to make our PBX rock n&#8217; roll.</p>
<p>Okay, so let&#8217;s backtrack just a little bit. Let&#8217;s go back to before we compiled Asterisk. Let&#8217;s take a look at the &#8216;make menuselect&#8217; options and only get what we need. Obviously, that&#8217;s going to depend on your own personal requirements. I&#8217;m just going to list a couple that I didn&#8217;t need, and you probably aren&#8217;t going to need either:</p>
<p>APPLICATIONS:<br />
- app_adsiprog<br />
- app_alarmreceiver<br />
- app_festival</p>
<p>CHANNEL DRIVERS:<br />
- chan_oss<br />
- chan_skinny<br />
- chan_unistim</p>
<p>CODEC TRANSLATORS:<br />
- codec_adpcm<br />
- codec_g722<br />
- codec_g726<br />
- codec_ilbc<br />
- codec_lpc10</p>
<p>FORMAT INTERPRETERS:<br />
- format_g723<br />
- formet_g726<br />
- format_g729<br />
- format_h263<br />
- format_h264<br />
- format_ilbc<br />
- format_jpeg<br />
- format_pcm<br />
- format_siren14<br />
- format_siren7<br />
- format_sln16<br />
- format_sln<br />
- format_vox</p>
<p>There&#8217;s so much more than can be disabled. I like having some features around to play around with.</p>
<p>So that&#8217;s it. I hope that the leaner, meaner Asterisk is useful to you. <img src='http://bahjons.com/stuff/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/asterisk-leaner-is-meaner/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sweethearts : Asterisk and ODBC</title>
		<link>http://bahjons.com/stuff/sweethearts-asterisk-and-odbc</link>
		<comments>http://bahjons.com/stuff/sweethearts-asterisk-and-odbc#comments</comments>
		<pubDate>Wed, 19 May 2010 00:06:00 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://bahjons.com/stuff/?p=149</guid>
		<description><![CDATA[I love driving Asterisk with a database. It makes configuring Asterisk on the fly so much easier, and makes for easier development that interfaces with Asterisk in some form. What is ODBC? ODBC is an Open Database Connector. When talking about ODBC, I&#8217;m talking about UnixODBC &#8211; obviously.   In lame men&#8217;s terms, ODBC is [...]]]></description>
			<content:encoded><![CDATA[<p>I love driving Asterisk with a database. It makes configuring Asterisk on the fly so much easier, and makes for easier development that interfaces with Asterisk in some form.</p>
<p>What is ODBC? ODBC is an Open Database Connector. When talking about ODBC, I&#8217;m talking about UnixODBC &#8211; obviously. <img src='http://bahjons.com/stuff/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   In lame men&#8217;s terms, ODBC is a connector that allows me to connect to many different database interfaces. It can be MYSQL, PostgreSQL, MSSQL, and so on.  I configure my database types in one file, and configure the databases (with logins) in another file. Then I can much more easily connect to my database from my application. <span id="more-149"></span></p>
<p>So what does that mean to you? Maybe nothing. But for me, it&#8217;s awesome. Especially in terms of Asterisk. The Asterisk community understands the value of being able to interface with with the database. As mentioned above, I love it because I like to house my dialplans right within a database, so I can modify them without reloading Asterisk. This is especially important when the dialplan is several thousand lines long. Additional benefits include writing CDR data to databases (perhaps ones that aren&#8217;t natively supported by Asterisk &#8211; now you can with ODBC.)</p>
<p>So how do you install ODBC and get it working with Asterisk?  That&#8217;s the easy part.</p>
<p>I&#8217;m going to assume that you are running Asterisk on CentOS. If not, you&#8217;re on your own. CentOS is preferred.</p>
<p>To Install:</p>
<blockquote><p>yum install unixODBC unixODBC-devel</p></blockquote>
<p>Easy enough huh? Okay, let&#8217;s configure it.  Start by editing /etc/odbcinst.ini<br />
If you plan on using PostgreSQL it should be ready to go. You might have to adjust the socket path, depending on your system.  For MySQL, using the following:</p>
<blockquote><p>[MySQL]<br />
Description     = ODBC for MySQL<br />
Driver          = /usr/lib/libmyodbc3.so<br />
Setup           = /usr/lib/libodbcmyS.so<br />
FileUsage       = 1</p></blockquote>
<p>Again, you may have to adjust the Driver Path depending on your system.  Now we just need to setup the database connections. Do this by editing /etc/odbc.ini</p>
<blockquote><p>[asterisk]<br />
Description     = Asterisk realtime<br />
Driver          = MySQL<br />
Socket          = /var/lib/mysql/mysql.sock<br />
Server          = localhost<br />
User            = asterisk<br />
Pass            = yourpassword<br />
Database        = asterisk<br />
Option          = 3</p>
<p>[crazyapp]<br />
Description     = My Crazy Apps database<br />
Driver          = MySQL<br />
Socket          = /var/lib/mysql/mysql.sock<br />
Server          = 192.168.15.166<br />
User            = databaseuser<br />
Pass            = yourpassword<br />
Database        = crazyappdatabase<br />
Option          = 3</p></blockquote>
<p>Okay, you&#8217;re done!  But wait! How do I use it with Asterisk?  Oh yea, that part. Now we need to let Asterisk know that ODBC is available. If you have already compiled Asterisk, that&#8217;s not a problem. You will just have to recompile.</p>
<blockquote><p>cd /usr/src/asterisk-1.6.2.7<br />
./configure<br />
make menuselect<br />
make &amp;&amp; make install</p></blockquote>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
<p>If I can stress anything at all, it&#8217;s to make sure that you re-run ./configure  &#8212; this is what tells Asterisk ODBC is there.  &#8216;make menuselect&#8217; is another key part. Here&#8217;s where we select the functions and applications that would be using ODBC. A few off the top of my head:</p>
<p>&#8216;cdr_odbc&#8217;<br />
This one is for inputting CDR data into a database. If you were previously compiling Asterisk-Addons just to have CDR_MYSQL &#8211; no need now!</p>
<p>&#8216;res_config_odbc&#8217;<br />
This is for realtime over ODBC instead of MySQL. Again, if you were previously compiling Asterisk-Addons, no need now!</p>
<p>&#8216;ODBC Storage&#8217;<br />
This one is perfect. You can store voicemails in a database.</p>
<p>Okay, so we have recompiled Asterisk. Give Asterisk a quick restart. Now we can start using ODBC within Asterisk. I&#8217;ll be posting some more articles soon which will feature using ODBC for Asterisk Realtime, CDR, Voicemail Storage, and using it within the dialplan. So make sure you check back soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/sweethearts-asterisk-and-odbc/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Solving:Transferring Calls from Queues, Agents stay busy</title>
		<link>http://bahjons.com/stuff/solvingtransferring-calls-from-queues-agents-stay-busy</link>
		<comments>http://bahjons.com/stuff/solvingtransferring-calls-from-queues-agents-stay-busy#comments</comments>
		<pubDate>Sat, 24 Oct 2009 14:04:14 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://hostseries.com/?p=85</guid>
		<description><![CDATA[The subject doesn&#8217;t really describe the problem good enough. So here it is&#8230; basically you have agents (whether you are using AgentCallBackLogin, or a setup like my alternative.)  The problem was that if the Agent transferred the call to another agent, Asterisk qould still show the agent has &#8216;busy.&#8217; If you listed channels, it would [...]]]></description>
			<content:encoded><![CDATA[<p>The subject doesn&#8217;t really describe the problem good enough. So here it is&#8230; basically you have agents (whether you are using AgentCallBackLogin, or a setup like <a href="http://bahjons.com/stuff/agentcallbacklogin-alternative/">my alternative.</a>)  The problem was that if the Agent transferred the call to another agent, Asterisk qould still show the agent has &#8216;busy.&#8217; If you listed channels, it would even show the first Agent involved in the call. Keep in mind, which seemed to know be a problem if it was an attended transfer. (Or for us of us, we like to use the &#8216;xfer&#8217; botton on our IP Phones&#8230; it was a problem then too.)  Well, it&#8217;s no longer a problem. You can find the solution below&#8230;<span id="more-85"></span></p>
<p>Keep in mind this will only working with 1.4.23 or higher. It was originally only added to 1.6, but the community decided it was needed as a backport into 1.4.  I hope this is helpful to someone. It took me 3 days of googling to find a working solution. Suspense is killing you I know. The answer is state_interface. This basically allows you to set which device/extension to watch. With AgentCallBackLogin and my alternative using Local Extensions, you still have to tell everyone which SIP or IAX phone/device the agent is sitting at. When this value is placed in the state_interface, Asterisk will check that device to determine if the agent is indeed &#8216;busy.&#8217; Clever huh?  Here&#8217;s how to set it up&#8230;</p>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
<p><strong>Using Asterisk Realtime &#8211; Queue Members</strong><br />
If you using Asterisk Realtime queue_members, you will need to modify the table structure just a bit. You will need to add a column &#8216;state_interface&#8217; after the &#8216;pause&#8217; column. So your table will look something like this:</p>
<blockquote><p>CREATE TABLE IF NOT EXISTS `queue_members` (<br />
`uniqueid` int(10) unsigned NOT NULL auto_increment,<br />
`membername` varchar(40) default NULL,<br />
`queue_name` varchar(128) default NULL,<br />
`interface` varchar(128) default NULL,<br />
`penalty` int(11) default NULL,<br />
`paused` int(1) default NULL,<br />
`state_interface` varchar(128) NOT NULL,<br />
PRIMARY KEY  (`uniqueid`),<br />
UNIQUE KEY `queue_interface` (`queue_name`,`interface`)<br />
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;</p></blockquote>
<p>Then when you add your agents to the table, make sure you set the state_interface. Example:</p>
<blockquote><p>INSERT INTO `queue_members` (`uniqueid`, `membername`, `queue_name`, `interface`, `penalty`, `paused`, `state_interface`) VALUES<br />
(23, &#8216;Robert&#8217;, &#8216;CSR1&#8242;, &#8216;local/1005@agents/n&#8217;, 5, NULL, &#8216;SIP/100&#8242;);</p></blockquote>
<p>Robert is logged into CSR1 queue with his local extension being: local/1005@agents/n, but he&#8217;s on device SIP/100. Asterisk will be checking SIP/100 for the device status. Is he really &#8216;busy&#8217; after that call transfer? Probably not. <img src='http://bahjons.com/stuff/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>Using AddQueueMember</strong><br />
In my alternative and some of the examples on voip-info.org, you use AddQueueMember. Well, if you are already running the required version, you probably noted the additions. Layout looks like this:</p>
<blockquote><p><span style="font-family: monospace;">AddQueueMember(queuename[,interface[,penalty[,options[,membername[,stateinterface]]]]]))</span></p></blockquote>
<p>So, using the same info as my previous example, I would create the following in my dialplan:</p>
<blockquote><p>exten =&gt; 701, 1,AddQueueMember(CSR1|local/1005@agents/n|5||Robert|SIP/100)</p></blockquote>
<p><strong>Using Asterisk CLi</strong><br />
Of course, you can always add the member by CLi:</p>
<blockquote><p>add queue member local/1005@agents/n to CSR1 as Robert state_interface SIP/100</p></blockquote>
<p>I hope this has helped someone. I know it was a big pain for us for a long time. And I spent a good amount of time searching for a solution. Well, now you have a solution!</p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/solvingtransferring-calls-from-queues-agents-stay-busy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting Two Asterisk Servers via SIP</title>
		<link>http://bahjons.com/stuff/connecting-to-asterisk-servers-via-sip</link>
		<comments>http://bahjons.com/stuff/connecting-to-asterisk-servers-via-sip#comments</comments>
		<pubDate>Wed, 31 Dec 2008 02:00:07 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://hostseries.com/?p=51</guid>
		<description><![CDATA[You have two offices, each with their own Asterisk Server. And you want to be able to call between the two. How do you do this? How do you set this up with SIP? A few people have requested this article. Well, here it is. Actually, I hadn&#8217;t done this before myself, before writing this [...]]]></description>
			<content:encoded><![CDATA[<p>You have two offices, each with their own Asterisk Server. And you want to be able to call between the two. How do you do this? How do you set this up with SIP? A few people have requested this article. Well, here it is.<span id="more-65"></span></p>
<p>Actually, I hadn&#8217;t done this before myself, before writing this article. In my search of the web, I didn&#8217;t find many good tutorials. One useful resource that I did find was the <a href="http://bahjons.com/stuff/oreilly-asterisk-the-future-of-telephony-second-edition/">O&#8217;Reilly Asterisk: The Future of Telephony, Second Edition</a>.  This book is truly a great find. It&#8217;s a great addition to your library of &#8216;must haves.&#8217;  Okay, so let&#8217;s get right into it.</p>
<p>To keep things simple, I&#8217;m going to say that you have two locations: LocationA and LocationB. And at each of those locations, you have ServerA and ServerB. Now for this to work, each location must have it&#8217;s own set of employee extensions. So let&#8217;s say, ServerA has employee extensions: 1000-1999 and ServerB has employee extensions: 2000-2999. Now that we&#8217;ve setup the scenario, let&#8217;s get busy.</p>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
<p>On ServerA, let&#8217;s make the below additions to the sip.conf. Under the general context, we&#8217;ll add the following register line, which will register this server to ServerB, and we&#8217;ll setup the peer too.</p>
<pre><code>register =&gt; serverA:serverApass@<strong>&lt;hostname-or-ip-of-serverB&gt;</strong>/serverB

[serverB]
type=friend
secret=serverBpass
context=serverB_incoming
host=dynamic
disallow=all
allow=ulaw
</code></pre>
<p>We&#8217;ll make the following additions to the extensions.conf on ServerA as well:</p>
<pre><code>[agents]
exten =&gt; 1050,1,Set(AGENT_SIP=${DB(agent_sip/1050)})
exten =&gt; 1050,n,Dial(SIP/${AGENT_SIP})

exten =&gt; 1100,1,Set(AGENT_SIP=${DB(agent_sip/1100)})
exten =&gt; 1100,n,Dial(SIP/${AGENT_SIP})

exten =&gt; 1150,1,Set(AGENT_SIP=${DB(agent_sip/1150)})
exten =&gt; 1150,n,Dial(SIP/${AGENT_SIP})

[phones]
include =&gt; agents
include =&gt; remote

[remote]
exten =&gt; _2XXX,1,Dial(SIP/serverB/${EXTEN},30)
exten =&gt; _2XXX,2,Hangup()

[serverB_incoming]
include =&gt; agents
</code></pre>
<p>Okay, so I&#8217;ll explain all of the above.  We have a &#8216;phones&#8217; context, which we have all of our SIP Phones apart of.  The &#8216;phones&#8217; context also includes our &#8216;agents&#8217; context and &#8216;remote&#8217; context.  The  &#8216;agents&#8217; context is where we have our agent extensions, and they dial the SIP Phones.  (I&#8217;m assuming that you have your agents context created based on my article discussed <a href="http://bahjons.com/stuff/agentcallbacklogin-alternative/">here.</a>)  We also have a &#8216;remote&#8217; context which is what makes the connection to ServerB if we dial one of the 2XXX extensions.  If we dial a 1XXX extension, it will ring the local (ServerA) agent.  We have the &#8216;serverB_incoming&#8217; context including the &#8216;agents&#8217; context, because this is where calls are routed to if dialed from ServerB</p>
<p>Now let&#8217;s setup ServerB. The sip.conf will have the following additions:</p>
<pre><code>
register =&gt; serverB:serverBpass@<strong><strong>&lt;hostname-or-ip-of-serverA&gt;</strong></strong>/serverA

[serverA]
type=friend
secret=serverApass
context=serverA_incoming
host=dynamic
disallow=all
allow=ulaw
</code></pre>
<p>And the extensions.conf:</p>
<pre><code>[phones]
include =&gt; agents
include =&gt; remote

[agents]
exten =&gt; 2050,1,Set(AGENT_SIP=${DB(agent_sip/2050)})
exten =&gt; 2050,n,Dial(SIP/${AGENT_SIP})
exten =&gt; 2100,1,Set(AGENT_SIP=${DB(agent_sip/2100)})
exten =&gt; 2100,n,Dial(SIP/${AGENT_SIP})

exten =&gt; 2150,1,Set(AGENT_SIP=${DB(agent_sip/2150)})
exten =&gt; 2150,n,Dial(SIP/${AGENT_SIP})
[remote]
exten =&gt; _1XXX,1,Dial(SIP/serverA/${EXTEN})
exten =&gt; _1XXX,2,Hangup()

[serverA_incoming]
include =&gt; agents
</code></pre>
<p>So for explaination, we have basically the reversed on ServerB. We have the same contexts. If someone on ServerA dials a 2XXX extension, it will route through the &#8216;remote&#8217; context to ServerB, which will ring the local extension on ServerB.</p>
<p>Boy, that can look confusing. But it does work, and works rather well. You can do the samething with IAX for connecting two Asterisk Servers together. You simply need to setup your peers and register lines within iax.conf, and change the &#8216;remote&#8217; context within extensions.conf</p>
<p>I hope this is useful to everyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/connecting-to-asterisk-servers-via-sip/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>LookupBlackList Alternative</title>
		<link>http://bahjons.com/stuff/lookupblacklist-alternative</link>
		<comments>http://bahjons.com/stuff/lookupblacklist-alternative#comments</comments>
		<pubDate>Tue, 09 Dec 2008 21:17:42 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://hostseries.com/?p=49</guid>
		<description><![CDATA[In a previous post, I mentioned that I came up with a solution for the disadvantages to the LookupBlackList Application. This could also be viewed as an alternative solution, seeing how the LookupBlackList has been depreciated, and set to be removed for a future release of Asterisk. Let&#8217;s not waste any time. Let&#8217;s get right [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://bahjons.com/stuff/using-lookupblacklist-application/">previous post</a>, I mentioned that I came up with a solution for the disadvantages to the LookupBlackList Application. This could also be viewed as an alternative solution, seeing how the LookupBlackList has been depreciated, and set to be removed for a future release of Asterisk.  Let&#8217;s not waste any time. Let&#8217;s get right into it.<br />
<span id="more-64"></span></p>
<p>I previous mentioned a disadvantage being that you can&#8217;t block calls per destination DID or phone number. This was a problem for me. I wanted to be able to block callers from calling one of the phone numbers in my PBX, but not another number. So I came up with the following solution. You can modify the solution according to your requirements. I&#8217;ll give two ways of doing this, in addition to simple alternative for LookupBlackList &#8211; so it functions the same way.</p>
<p>First off, we can store our numbers to be blocked within a SQL database or AstDB. This will determine which method we&#8217;ll be using. We&#8217;ll start with AstDB.We also need to determine how we want to filter the callers: By caller id name, or caller id number? I personally like the number. This is generally the most unique caller id characteristic.</p>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
<p>In this example, we have given each DID an unique id. For this example, I&#8217;m going to call it a &#8216;company&#8217; (assuming each DID is a different company.)</p>
<p>Let&#8217;s add our callers to be blocked into AstDB:</p>
<pre><code>
database put &lt;companyid&gt; &lt;numberblocked&gt; 1
database put 100 4801115432 1
database put 150 6023321444 1
</code></pre>
<p>Now, let&#8217;s put together our dialplans:</p>
<pre><code>
exten =&gt; 18003337123,1,Set(COMPANY=100)
exten =&gt; 18003337123,2,Set(CID=${CALLERID(num)})
exten =&gt; 18003337123,3,Gotoif($["${DB(${COMPANY}/${CID})}" = "1"]?goaway,1,1)
exten =&gt; 18003337123,4,Queue(CSR1)

exten =&gt; 18004447123,1,Set(COMPANY=150)
exten =&gt; 18004447123,2,Set(CID=${CALLERID(num)})
exten =&gt; 18004447123,3,Gotoif($["${DB(${COMPANY}/${CID})}" = "1"]?goaway,1,1)
exten =&gt; 18004447123,4,Queue(CSR1)

[goaway]
exten =&gt; 1,1,Playback(not-taking-your-call)
exten =&gt; 1,2,Playback(vm-goodbye)
exten =&gt; 1,3,Hangup()
</code></pre>
<p>Now, to example the above dialplan example&#8230; We first create a variable &#8216;COMPANY&#8217; &#8211; this is where we set a Company ID for this DID. Second priority, we set the CallerID Number. We are only taking the number from the caller id, because that&#8217;s what we&#8217;res blocked based on. If we were blocking based on the name, we would change that to show: CALLERID(nam)  &#8211; I have not successfully got it to work with CALLERID(all). Third priority, we check to see if the calling party is added to the AstDB for blocking. If so, it will jump to the &#8216;goaway&#8217; context, to playback a message telling the caller they are blocked. Otherwise it will continue to the 4th priority, where it enters the caller in the queue.   The important thing is, that it&#8217;s only looking for blocked calls setup in AstDB for that Company ID. This gives you more control over the blocking per phone number (DID.)  That&#8217;s it. Pretty simple.</p>
<p>Now, let&#8217;s assume that we want to use MySQL for doing the samething. We can do the same thing. I&#8217;m one of those that likes to use MySQL for everything. This allows me to create a PHP/MySQL GUI for easy management. I haven&#8217;t tested how resource intense this is, so use at your own risk.</p>
<p>Let&#8217;s create our database and table first:</p>
<pre><code>
CREATE DATABASE asterisk;
GRANT ALL PRIVILEGES ON asterisk.* TO 'asterisk'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;

CREATE TABLE IF NOT EXISTS `blacklist` (
`company_id` varchar(3) NOT NULL,
`phonenum` varchar(30) NOT NULL,
PRIMARY KEY  (`company_id`,`phonenum`),
FULLTEXT KEY `phonenum` (`phonenum`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
</code></pre>
<p>Now, we can add our blocked numbers. Again, this relies on the company id for it to function.</p>
<pre><code>
INSERT INTO `asterisk`.`blacklist` (`company_id`, `phonenum`) VALUES ('100', '16021231141');
INSERT INTO `asterisk`.`blacklist` (`company_id`, `phonenum`) VALUES ('150', '14801231141');

</code></pre>
<p>Now let&#8217;s setup the dialplan:</p>
<pre><code>
[incoming]
exten =&gt; 18003337123,1,Set(DID=${EXTEN})
exten =&gt; 18003337123,2,Set(CID=100)
exten =&gt; 18003337123,3,Goto(cblock,1,1)
exten =&gt; 18003337123,5,Queue(CSR1)

exten =&gt; 18004447123,1,Set(DID=${EXTEN})
exten =&gt; 18004447123,2,Set(CID=150)
exten =&gt; 18004447123,3,Goto(cblock,1,1)
exten =&gt; 18004447123,5,Queue(CSR1)

[cblock]
exten =&gt; 1,1,MYSQL(Connect connid localhost asterisk yourpassword asterisk)
exten =&gt; 1,2,MYSQL(Query resultid ${connid} SELECT\ 'phonenum'\ FROM\ 'blacklist'\ WHERE\ 'company_id'\='${CID}'\ AND 'phonenum'\='${CALLERID(num)}'\)
exten =&gt; 1,3,MYSQL(Fetch fetchid ${resultid} BLACKLIST)
exten =&gt; 1,4,MYSQL(Clear ${resultid})
exten =&gt; 1,5,MYSQL(Disconnect ${connid})
exten =&gt; 1,6,GotoIf($["${CALLERID(num)}" = "${BLACKLIST}"]?goaway,1,1:cblock,1,8)
exten =&gt; 1,7,Goto(incoming,${DID},5)

[goaway]
exten =&gt; 1,1,Playback(not-taking-your-call)
exten =&gt; 1,2,Playback(vm-goodbye)
exten =&gt; 1,3,Hangup()
</code></pre>
<p>So in the above example we first set the company extension or DID in a variable, so we can redirect our dialplan back to it later. Then we set the company id as a variable. Next we forward to the call blocking context to see if the caller is allowed through. We query the MySQL database for the phone number. If it appears in the database for the company id, we forward them to the &#8216;go away&#8217; message/context. If it doesn&#8217;t appear, we redirect them back to the next step in the DID&#8217;s dialplan.</p>
<p>What if you want to filter for all the phone numbers (DIDs) coming into Asterisk? Okay, so you can simply use the following:</p>
<p>Use AstDB &#8211; it will be quicker. Use the following to input the numbers into the blacklist:</p>
<pre><code>
database put blacklist &lt;blockednumber&gt; 1
database put blacklist 4801115432 1
database put blacklist 6023321444 1
</code></pre>
<p>And your dialplan will be as follows:</p>
<pre><code>
exten =&gt; 18003337123,1,Set(CID=${CALLERID(num)})
exten =&gt; 18003337123,2,Gotoif($["${DB(blacklist/${CID})}" = "1"]?goaway,1,1)
exten =&gt; 18003337123,3,Queue(CSR1)

exten =&gt; 18004447123,1,Set(CID=${CALLERID(num)})
exten =&gt; 18004447123,2,Gotoif($["${DB(blacklist/${CID})}" = "1"]?goaway,1,1)
exten =&gt; 18004447123,3,Queue(CSR1)

[goaway]
exten =&gt; 1,1,Playback(not-taking-your-call)
exten =&gt; 1,2,Playback(vm-goodbye)
exten =&gt; 1,3,Hangup()
</code></pre>
<p>I hope this is useful to someone. I would like to hear your comments. <img src='http://bahjons.com/stuff/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/lookupblacklist-alternative/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using LookupBlackList() Application</title>
		<link>http://bahjons.com/stuff/using-lookupblacklist-application</link>
		<comments>http://bahjons.com/stuff/using-lookupblacklist-application#comments</comments>
		<pubDate>Tue, 09 Dec 2008 16:03:04 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://hostseries.com/?p=47</guid>
		<description><![CDATA[At times we get those annoying callers. They usually end up being a waste of our time and resources. So what can you do? You can block them from calling in. Asterisk has an application in place to make this an easy task. It&#8217;s called: LookupBlackList() It&#8217;s actually an older application. But in trying to [...]]]></description>
			<content:encoded><![CDATA[<p>At times we get those annoying callers. They usually end up being a waste of our time and resources. So what can you do? You can block them from calling in. Asterisk has an application in place to make this an easy task. It&#8217;s called: LookupBlackList()<br />
<span id="more-63"></span></p>
<p>It&#8217;s actually an older application. But in trying to use it, I didn&#8217;t see many examples for using it, or the options that can be used with it. And for good reason. It seems it&#8217;s depreciated, in favor of using the GotoIf application. However, I did find it will available with Asterisk 1.4.x so I thought I would give a quick writeup, in the event someone wants to use it.   I&#8217;ll also be posting about it&#8217;s limitations, and soon will post an article with my quick &#8216;solution&#8217; to the problems I faced with LookupBlackList app.  So let&#8217;s dive right in.</p>
<p>First thing is first. We need to setup our table of callers to block. It&#8217;s going to be using AstDB for this. So from the Asterisk CLi:</p>
<pre><code>
database put blacklist &lt;blockednumber&gt; 1
database put blacklist 4801115432 1
database put blacklist John Smith 1</code></pre>
<p>Okay, so the tables are set. Once we have the rest of our dialplan setup, any calls coming from the callerid &#8217;4801115432&#8242; or from &#8216;John Smith&#8217; will be blocked.</p>
<p>Okay, so let&#8217;s switch over to our dialplan. I&#8217;ll assume that you are using extensions.conf for your dialplans.</p>
<pre><code>exten =&gt; 18003337123,1,Answer()
exten =&gt; 18003337123,2,LookupBlacklist(j)
exten =&gt; 18003337123,3,Queue(CSR1)

exten =&gt; 18003337123,103,Playback(not-taking-your-call)
exten =&gt; 18003337123,104,Playback(vm-goodbye)
exten =&gt; 18003337123,105,Hangup()</code></pre>
<p>To explain the above, 18003337123 is of course, my incoming phone number. First it answers the call, and then runs the LookupBlacklist app. There&#8217;s only one option for this app that I could fine &#8211; the &#8216;j&#8217; option, which will jump the dialplan if the callerid is found in the blacklist database. Otherwise, it will take the caller into a queue that I have created. When it comes to jumping, it will always jump within the same context, and extension. It just jumps priorities. It will add 101 priority to whatever the current priority is. So in this case: priority 2 + 101 = 103 as the starting priority. Here I can tell Asterisk want to do with the blocked caller. In the above example, I&#8217;m playing an audio file that informs them that I&#8217;m not accepting their call, it says goodbye, and then hangs up.</p>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
<p>If you are like me, you hate recording your own messages. Luckily there&#8217;s already one there. The default Asterisk install doesn&#8217;t have it in the sounds directory. But I found one in an older Asterisk Sounds zip. Here&#8217;s the file I used above in gsm format. Download it <a href="http://bahjons.com/stuff/wp-content/uploads/2008/12/not-taking-your-call.gsm">here.</a></p>
<p>Disadvantages to this application is that it doesn&#8217;t allow you to block callers on a per DID bases. What I mean by that, is this&#8230; Say you have multiple phone numbers coming into your PBX. You want to allow John Smith to call this phone number, but not another number coming into the PBX. This isn&#8217;t so easy with this application &#8211; in fact it doesn&#8217;t have this ability.  What to do this? Check back shortly for a followup article of my little &#8216;alternative&#8217; solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/using-lookupblacklist-application/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AgentLogin powered by MySQL</title>
		<link>http://bahjons.com/stuff/agentlogin-powered-by-mysql</link>
		<comments>http://bahjons.com/stuff/agentlogin-powered-by-mysql#comments</comments>
		<pubDate>Mon, 11 Aug 2008 17:15:14 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://hostseries.com/?p=45</guid>
		<description><![CDATA[In a previous article, I showed an alternative method of AgentCallBackLogin. In that example, the agents were authenticated via voicemail.conf. I made a comment that I would create a dialplan with it authenticating against a MySQL database. So let&#8217;s start by creating our database: CREATE TABLE IF NOT EXISTS `asterisk`.`agent_users` ( `id` int(11) NOT NULL [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous <a href="http://bahjons.com/stuff/agentcallbacklogin-alternative/">article,</a> I showed an alternative method of AgentCallBackLogin. In that example, the agents were authenticated via voicemail.conf. I made a <a href="http://bahjons.com/stuff/agentcallbacklogin-alternative/#comment-535">comment</a> that I would create a dialplan with it authenticating against a MySQL database.</p>
<p><span id="more-61"></span>So let&#8217;s start by creating our database:</p>
<pre><code>CREATE TABLE IF NOT EXISTS `asterisk`.`agent_users` (
`id` int(11) NOT NULL auto_increment,
`user` varchar(10) NOT NULL default '',
`pass` varchar(32) NOT NULL default '',
`name` varchar(50) NOT NULL default '',
PRIMARY KEY  (`id`)
) ENGINE=MyISAM</code></pre>
<p>And I&#8217;ll go ahead and drop same data into that database:</p>
<pre><code>INSERT INTO `asterisk`.`agent_users` (`id`, `user`, `pass`, `name`) VALUES
(1, '1050', '1234', 'Robert');</code></pre>
<p>Now for our dialplan:</p>
<pre><code>exten =&gt; login,1,Answer()
exten =&gt; login,2,Read(user|/home/Sounds/user-id)  ; I created an audio file which asks for the user id.
exten =&gt; login,3,Read(pass|/home/Sounds/user-pass) ; I created an audio file which asks for the user password.
exten =&gt; login,4,MYSQL(Connect connid localhost dbuser dbpassword asterisk)
exten =&gt; login,5,MYSQL(Query resultid ${connid} SELECT\ 'pass'\ FROM\ 'agent_users'\ WHERE\ 'user'\='${user}'\)
exten =&gt; login,6,MYSQL(Fetch fetchid ${resultid} password)
exten =&gt; login,7,NoOp(Password is: ${password}) ; This line isn't required, but I have it here to output the results of our query.
exten =&gt; login,8,MYSQL(Clear ${resultid})
exten =&gt; login,9,MYSQL(Disconnect ${connid})
exten =&gt; login,10,GotoIf($["${password}" = "${pass}"]?incorrect,1:login,11)
exten =&gt; login,11,AddQueueMember(SALES|local/${user}@agents/n)
exten =&gt; login,12,AddQueueMember(SUPPORT|local/${user}@agents/n)
exten =&gt; login,13,Playback(goodbye)
exten =&gt; login,14,Hangup()

exten =&gt; incorrect,1,Playback(/home/Sounds/incorrect-pass) ; This is an audio file to tell that the password is incorrect
exten =&gt; incorrect,2,Goto(login,1)</code></pre>
<p>Yes, this dialplan is a little longer. But you won&#8217;t have to worry with voicemail.conf being your authentication method, or of VMAuthenticate depreciating.</p>
<p>In addition to the above, you can always port voicemail.conf to MySQL via Asterisk Realtime. You can learn more Asterisk Realtime <a href="http://bahjons.com/stuff/asterisk-realtime-installation-guide/">here.</a></p>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/agentlogin-powered-by-mysql/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Asterisk Apps: OrderlyStats</title>
		<link>http://bahjons.com/stuff/asterisk-apps-orderlystats</link>
		<comments>http://bahjons.com/stuff/asterisk-apps-orderlystats#comments</comments>
		<pubDate>Fri, 07 Mar 2008 14:07:15 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://hostseries.com/asterisk-apps-orderlystats/</guid>
		<description><![CDATA[In my previous article, I made mention of using the CDR Database to generate reports. Unless you have the time, resources, and skills to develop some killer apps, you might begin looking at 3rd party applications to make your reports &#8220;pretty&#8221; and presentation worthy. OrderlyQ has put together some rather great software. OrderlyStats is a [...]]]></description>
			<content:encoded><![CDATA[<p>In my previous article, I made mention of using the CDR Database to generate reports. Unless you have the time, resources, and skills to develop some killer apps, you might begin looking at 3rd party applications to make your reports &#8220;pretty&#8221; and presentation worthy.</p>
<p><a href="http://orderlyq.com" target="_blank">OrderlyQ</a> has put together some rather great software.<span id="more-37"></span></p>
<p>OrderlyStats is a free product that they offer, kinda as a lost leader, in hopes that you will signup for their paid service: OrderlyQ. OrderlyStats basically connects via Asterisk Manager, and intelligently discovers your agents and queues. You have a realtime monitor of the queues, agents logged into the queues, and calls being answered and waiting to be answered. You can also generate reports for each queue. Reports give you details like: holdtimes, percentage of answered calls, average call lengths, number of repeat calls, etc. You even get a daily email with the number of answered calls for that day, etc.</p>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
<p>Sounds almost too good to be true right? Well it is to some degree. It&#8217;s a free application, but you will find OrderlyQ bugging you about signing up for their paid service. And rightfully so, but still&#8230;.  Another disadvantage is that it&#8217;s connecting to your server. If you have your Asterisk box running on the LAN, you are hopeless. And depending on how secure you have your system, (and how secure OrderlyQ&#8217;s system is), you open yourself up to security risks. OrderlyQ COULD have complete control over your phone system.</p>
<p>Nonetheless, it&#8217;s great for the reports. I like making use of OrderlyQ. Give it a try!</p>
<p><a href="http://bahjons.com/stuff/wp-content/uploads/2008/03/orderlyq_queue.jpg" title="OrderlyQ Queue"><img src="http://bahjons.com/stuff/wp-content/uploads/2008/03/orderlyq_queue.jpg" alt="OrderlyQ Queue" height="130" width="662" /></a></p>
<p><a href="http://bahjons.com/stuff/wp-content/uploads/2008/03/orderlyq_reports.jpg" title="OrderlyQ Report"><img src="http://bahjons.com/stuff/wp-content/uploads/2008/03/orderlyq_reports.jpg" alt="OrderlyQ Report" height="366" width="519" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/asterisk-apps-orderlystats/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Asterisk &#8211; Getting Results from CDR Database!</title>
		<link>http://bahjons.com/stuff/asterisk-getting-results-from-cdr-database</link>
		<comments>http://bahjons.com/stuff/asterisk-getting-results-from-cdr-database#comments</comments>
		<pubDate>Tue, 05 Feb 2008 00:32:15 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Asterisk PBX]]></category>

		<guid isPermaLink="false">http://hostseries.com/asterisk-getting-results-from-cdr-database/</guid>
		<description><![CDATA[So in my previous article, I said I would provide some sample scripts to view information from our CDR database. My script is written in PHP, and we&#8217;re just going to do a quick query of the database for answered calls. To make things neat, I like to write the mysql connection string and variables [...]]]></description>
			<content:encoded><![CDATA[<p>So in my <a href="http://bahjons.com/stuff/asterisk-cdr-logging-in-mysql/">previous article</a>, I said I would provide some sample scripts to view information from our CDR database.  My script is written in PHP, and we&#8217;re just going to do a quick query of the database for answered calls.  <span id="more-33"></span></p>
<p>To make things neat, I like to write the mysql connection string and variables in seperate files. So my config.php will maintain the database connection information:</p>
<pre class="code"><code>&lt;?php
// This is an example of config.php
$dbhost = 'localhost';
$dbuser = 'asterisk';
$dbpass = 'yourpassword';
$dbname = 'asterisk';
?&gt;</code></pre>
<p>Now the mysql connection strings, first to open the connection, the second to close the connection:</p>
<pre class="code"><code>&lt;?php
// This is an example opendb.php
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die
('Error connecting to mysql');
mysql_select_db($dbname);
?&gt;</code></pre>
<pre class="code"><code>&lt;?php
// an example of closedb.php
// it does nothing but closing
// a mysql database connection
mysql_close($conn);
?&gt;</code></pre>
<p>The above files will be included or used in any script we use to query the database. Now let&#8217;s get to the queries&#8230;<br />
To gather the information of what I&#8217;m querying for, I put together a simple HTML form.  You can view the form <a href="http://bahjons.com/stuff/wp-content/uploads/2008/02/cdr_html.html">here.</a> And download it&#8217;s code <a href="http://bahjons.com/stuff/wp-content/uploads/2008/02/cdr_html.txt">here.</a>   The form will POST to our process.php which will be discussed in a moment.  You will notice several fields on the html form. The only fields that are required are the start date/time and the end date/time.</p>
<p><br><script type="text/javascript"><!--
google_ad_client = "pub-3979383890570932";
/* 468x60, created 5/18/10 */
google_ad_slot = "8833382667";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br></p>
<p>The PHP that queries the database and outputs the results can be found <a href="http://bahjons.com/stuff/wp-content/uploads/2008/02/process.php.txt">here.</a></p>
<p>And the results are something like this:</p>
<p><a href="http://bahjons.com/stuff/wp-content/uploads/2008/02/cdr_results.png" title="CDR Results"><img src="http://bahjons.com/stuff/wp-content/uploads/2008/02/cdr_results.png" alt="CDR Results" height="383" width="749" /></a></p>
<p>That&#8217;s it! You can download the files mentioned in this article <a href="http://bahjons.com/stuff/wp-content/uploads/2008/02/cdr_script.zip">here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bahjons.com/stuff/asterisk-getting-results-from-cdr-database/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
