PostgresSQL generate_series

Posted: January 19, 2014 in PostgreSql

generate_series(start, stop, interval )

This function generate a series of values from start to stop

Ref URL

http://www.postgresql.org/docs/9.1/static/functions-srf.html

Many of time I face this issue while I am using Google’s XMPPHP file for sending message for one gmail user to another. After doing couple of testing I made few changes in my XMLStream.php file.

I hope this will help you guys!!!!!!!!!!!!!!!!!!

1. $read = array($this->socket);
To
$read = array();
if( is_resource( $this->socket)) {
$read = array($this->socket);
}

2. $updated = @stream_select($read, $write, $except, $secs, $usecs);
TO
$updated = ”;
if( 0 < count( $read ) ) {
$updated = stream_select($read, $write, $except, $secs, $usecs);
}

3.
if( false == is_null( $this->socket )) {
fclose($this->socket);
}
TO
if( is_resource($this->socket)) {
fclose($this->socket);
}

Sometime we are not able to get the Called phone number. After digging out I have found that the channel variable called as
SIP_HEADER(To) which has all the information regarding the called user

value of it ${SIP_HEADER(To)} is for e.x. <sip:1234567890@192.168.180.8>

So in Dial Plan we can get the value of called phone number

exten => s,1,Set(CALLEDNUMBER=${CUT(CUT(SIP_HEADER(To),@,1),:,2)})

you can get the CalledNumber value in varable ${CALLEDNUMBER}.

That’ IT DONE

Asterisk-Trixbox-fax-System

Posted: August 10, 2011 in Uncategorized

To Set up a fax System in Trixbox

To Save the tiff files  into PDF

Asterisk stores the fax in .tiff format  and there is one module called as tiff2pdf which converts .tiff files to PDF
Please have a look the link below to understand the tiff2pdf funtionality.
http://cameldung.org/man/index.cgi?query=tiff2pdf&sektion=1&apropos=0&manpath=FreeBSD+8.0-stable#end

Add this line
my $newfile = “/var/spool/asterisk/fax/shri.pdf”;
below

my $convert_status = 0;

change this code

open PDF, “tiff2pdf $file|”;
to this one
open PDF, system (“tiff2pdf”,”-o”,”$newfile”,”$file”); #Custom added to save the PDF file

That’s IT done!

Asterisk
In Trixbox/Asterisk Many of time we have seen the when we call a queue it call an Extension for some time and then goes to it’s voice mail.

I have faced this issue happened because of  Ringtime Default which comes in trixbox General Settings.

As per Ringtime Default  description
” Default number of seconds to ring phones before sending callers to voicemail. This can be set per extension/user and will have no effect on phones with no voicemail. ”
What it does is it actually dial an extension for specific this much amount of time and then send it to voicemail.

So there are two ways through which we can resolve this

Change the Ring Time in DialPlan at Run time, as Ring Time is Global Variable in Asterisks.conf

Some time we get this Error on Trixbox Call Logs  Table
YOU MUST ACCESS THE CDR THROUGH THE ASTERISK MANAGEMENT PORTAL!

To Resolve this issue  please go to your CLI command and type

service memcached start
and there you go

Using  php we can convert WAV to Binary and Binary to WAV format,  As below

WAV files are always in Binary format , so we dont require it to change in binary format.

WAV to binary

<?php
$filename = “test.wav”;
$handle = fopen($filename, “rb”);
$$binary_content = fread( $handle,  filesize($filename) );
fclose($handle);

print_r( $contents )
?>

Binary to WAV

<?php

file_put_contents(‘sound.wav’, $contents);

?>

daiict

Posted: April 28, 2009 in DA-IICT days, daiict, moments@DA-IICT
Tags:

DA-IICT -Dhirubhai Ambani Institute of Information & Communication technology. or Simple daiict.