Thursday, June 18, 2009

Sunday, June 14, 2009

IMG00103-20090614-1549.jpg

بعد الغداء
Sent from my BlackBerry® smartphone from Zain Kuwait

Saturday, June 13, 2009

IMG00098-20090613-2310.jpg

Shatha
Sent from my BlackBerry® smartphone from Zain Kuwait

First Blackberry post

This is the requirement for دعم العماله
Sent from my BlackBerry® smartphone from Zain Kuwait

First Blackberry post

This is the requirement for دعم العماله
Sent from my BlackBerry® smartphone from Zain Kuwait

Tuesday, February 24, 2009

تجربة لمحمد مصطفى


الاستاذ محمد مصطفى هو الذي اكل الكيكه وبلع البيزه

Sunday, February 1, 2009

How to import csv data into mysql

first go to the mysql prompt
mysql -u DBUSERNAME -h DBSERVER -p DBNAME

default password for root user in Trixbox envirement is passw0rd


then

LOAD DATA LOCAL INFILE '/importfile.csv'
INTO TABLE test_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(field1, filed2, field3);

Friday, January 23, 2009

ver 0.9 of PrayerTime.php

For testing I called the php from from from-internal-custom
[from-internal-custom]
exten => 311,1,Wait(1)
exten => 311,n,AGI(PrayerTime.php)

Code from here------------------------------------------------------------
#!/usr/bin/php -q

set_time_limit(30);
require('/var/lib/asterisk/agi-bin/phpagi.php');
error_reporting(E_ALL);


$agi = new AGI();
$agi->answer();

// get todays date in array format and printing the resulting array
$today = getdate();
// this is for testing to specify a date
//$today = getdate(mktime(0,0,0,10,30,2008));
$agi->verbose($today);

// open database
if (!$link = mysql_connect('localhost', 'user', 'password')) {
$agi->verbose('Could not connect to mysql');
exit;
}

if (!mysql_select_db('MyTest', $link)) {
$agi->verbose('Could not select database');
exit;
}

// query table for todays date
$sql = "SELECT Fajr,Maghrb,Dhahr FROM TestTable WHERE Day =
{$today['mday']} AND Month = {$today['mon']}";
$result = mysql_query($sql, $link);

if (!$result) {
$agi->verbose("DB Error, could not query the database\n");
$agi->verbose('MySQL Error: ' . mysql_error());
exit;
}

// get todays prayer row
while ($row = mysql_fetch_assoc($result)) {
$agi->verbose($row['Fajr']);
$agi->verbose($row['Dhahr']);
$agi->verbose($row['Maghrb']);
$Fajr=$row['Fajr'];
$Dhahr=$row['Dhahr'];
$Maghrb=$row['Maghrb'];
}


mysql_free_result($result);

mysql_close($link);

// Say todays date
$outtext = "Prayyar time for today {$today['weekday']} the
{$today['mday']} {$today['month']} {$today['year']}";
$agi->text2wav($outtext);

// Say todays Fajr Prayer Time
$outtext = "Fajeer prayer is at";
$agi->text2wav($outtext);
$t = mktime (intval(Substr($Fajr,0,2)),intval(Substr($Fajr,3,2)));
$agi->verbose($t);
$agi->say_time ($t);

// Say todays Dhahr Prayer Time
$outtext = "Zohar prayer is at";
$agi->text2wav($outtext);
$t = mktime (intval(Substr($Dhahr,0,2)),intval(Substr($Dhahr,3,2)));
$agi->verbose($t);
$agi->say_time ($t);

// Say todays Dhahr Prayer Time
$outtext = "Magaarrab prayer is at";
$agi->text2wav($outtext);
$t = mktime (intval(Substr($Maghrb,0,2))+12,intval(Substr($Maghrb,3,2)));
$agi->verbose($t);
$agi->say_time ($t);

$agi->text2wav('Goodbye');

$agi->hangup();
?>

Thursday, January 22, 2009

A2billing number of minutes half the expected number

The problem turns out to be by design. Or by lack of documentation outside the code. I found this in the a2billing.php:
// DIVIDE THE AMOUNT OF CREDIT BY 2 IN ORDER TO AVOID NEGATIVE BALANCE IF THE USER USE ALL HIS CREDIT
$orig_credit = $A2B -> credit;
$A2B -> credit = $A2B->credit / 2;

by changing the second line to:
$A2B -> credit = $A2B->credit;

The problem was solved. It seems that the designed it this way to remove the possiblty of overstating the credit available if there are two legs of a call.

Sunday, January 18, 2009

First Agi code in trixbox using text2wav

first text2wav must be installed
yum install festival

find / -name phpagi.conf
find / -name text2wave
These should give you /etc/asterisk/phpagi.conf and /usr/bin/text2wave

Now nano /etc/asterisk/phpagi.conf and change text2wave=/usr/src/festival/bin/text2wave to text2wave=/usr/bin/text2wave and Voila! It works!


----php code------------

#!/usr/local/bin/php -q

$agi = new AGI();
$agi->answer();
$cid = $agi->parse_callerid();
$agi->text2wav("Hello, {$cid['name']}. Let's enter some text.");
$text = $agi->text_input('UPPERCASE');
$agi->text2wav("You entered $text");
$agi->text2wav('Goodbye');
$agi->hangup();
?>



------extensions_custom.php------------
exten => 311,1,Answer
exten => 311,2 Wait(1)
exten => 311,3,DigitTimeout(7)
exten => 311,4,ResponseTimeout(10)

exten => 311,5,AGI(input.php





Saturday, January 17, 2009

How to setup LDAP on SPA942 (with 6.1.3a firmware)

This taken from

LDAP_Dir_Enable: Yes
LDAP_Corp_Dir_Name: Corporate Directory
LDAP_Server: FQDN
LDAP_Auth_Method: DIGEST-MD5
LDAP_Client_DN: dc=domain,dc=com
LDAP_Username: username
LDAP_Password: password
LDAP_Search_Base: ou=nvg,dc=domain,dc=com
LDAP_Last_Name_Filter: sn:(sn=*$VALUE*)
LDAP_First_Name_Filter: cn:(cn=*$VALUE*)
LDAP_Search_Item_3: Phone
LDAP_Item_3_Filter: mobile:(mobile=*$VALUE*)
LDAP_Display_Attrs: a=cn;a=telephoneNumber,n=mobile,t=p;
you can change the mobile attribute to the correct phone attribute

Monday, January 5, 2009

how to install callback in a2billing

install --owner=root --group=root --mode=700 a2billing-callback-daemon.rc /etc/rc.d/init.d/a2billing-callback-daemonchkconfig --add a2billing-callback-daemon && chkconfig a2billing-callback-daemon onservice a2billing-callback-daemon start

Sunday, January 4, 2009

installing G729 codec in tribox

download the needed codec from
to the folder
/usr/lib/asterisk/modules

How to send calls to A2billing from Trixbox

After setting up A2billing on trixbox and adding an extension under from-internal-custom context. we faced a problem that it will not send trunk calls to the "225" extension. only internally from another extension that we reach the A2billing IVR.
To correct this problem install Custom Destination Freepbx Module and add a Custom destination:
from-internal-custom,225,1
Description: A2billing
Then from Inbound Routes select destination to be Custom application (Destination) that was created.
After this calls should be answered by A2billing IVR.

Saturday, January 3, 2009

How to install A2billing on Trixbox

To do that I used a script made by a2billing2asterisk.googlepages.com
with the following instructions from the author (for 6$):


cd /usr/src
wget a2billing2asterisk.googlepages.com/a2
chmod +x a2
./a2
afterward I did the procedure from http://www.sureteq.com/asterisk/a2bv1.2.3.htm#3.0_-_a2billing_understood to get the IVR menu
The first thing we need to do is create an extension for a2billing. SSH to your Trixbox and do the following:

nano /etc/asterisk/extensions_custom.conf

Under the [from-internal-custom] context, add the following:

exten => 225,1,Answerexten => 225,2,Wait,2exten => 225,3,DeadAGI,a2billing.phpexten => 225,4,Wait,2exten => 225,5,Hangup

CTRL+X to exit nano, and then press Y when asked to save.

This creates extension 225 which answers the call, waits 2 seconds, and then passes the call to the a2billing application. You can change the 225 to whatever extension you prefer, but make sure it is an unused extension in your dial plan.

Type 'asterisk -r' to connect to Asterisk and do an 'extensions reload' to reload your extension files. You can now dial extension 225. You should hear a lady asking for your complete PIN number. The PIN number is one of your created customer's card number. Enter in the 10 digit number, and it now asks you for the number you would like to dial followed by the # key.

How to enable Netflow top talkers

MyRouter(config)#ip flow-export version 5
MyRouter(config)#ip flow-export source e0
MyRouter(config)#ip flow-cache timeout active 1
MyRouter(config)#ip flow-top-talkers
MyRouter(config-flow-top-talkers)#cache-timeout 360000
MyRouter(config-flow-top-talkers)#match output-interface
MyRouter(config-flow-top-talkers)#sort-by bytes
MyRouter(config-flow-top-talkers)#top 10
MyRouter(config-flow-top-talkers)#exit
MyRouter(config)#int e0
MyRouter(config-if)#ip route-cache flow
MyRouter(config-if)#ip flow egress
MyRouter(config-if)#exit
MyRouter(config)#exit
MyRouter#show ip flow top-talkers