Not able to send the verification number

piyush_rahate

Joined
Jul 30, 2009
Messages
7
Likes
0
Points
0
#1
Hi,
I am newbie to VOIP and asterisk. We have installed Elastix for a automated registration service. The issue I am facing is, I generate a random verification code and a phone number which i need to send to the automated system. The system than makes a call to the number and asks the receiver to type in the "Random" verification code.

However, currently I am unable to do so.
Following is the code I am using on the call genearting file
<?

$oSocket = fsockopen("localhost",5038,$errnum,$errdesc,20) or die("Connection to host failed" );
fputs($oSocket, "Action: login\r\n" );
fputs($oSocket, "Username: admin\r\n" );
fputs($oSocket, "Secret: palosanto\r\n\r\n" );
fputs($oSocket, "Events: off\r\n" );
sleep(1);
fputs($oSocket, "Action: originate\r\n" );
//fputs($oSocket, "Channel: SIP/". $x ."@fsdfdfdf\r\n" );
fputs($oSocket, "Channel: Local/". $x ."@ffdsf-internal\r\n" );


//CHANGE CALLERID IN NEXT LINE
fputs($oSocket, "CallerId: 23005551212\r\n" );


sleep(1);

fputs($oSocket, "Context: verify\r\n" );
fputs($oSocket, "Exten: $y\r\n" );
fputs($oSocket, "Priority: 1\r\n\r\n" );
fputs($oSocket, "Action: Logoff\r\n\r\n" );
sleep(2) ;
fclose($oSocket);
?>
and this code is the caller file
<?

$Ln_ID = $_GET['Ln_ID'];
$reg_phone = $_GET['phone'];


$ch = curl_init("https://mysite.com/call.php?phone=".$reg_phone);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);
$r=curl_exec($ch);
curl_close($ch);
?>
can anyone provide some pointers for the same?
 

bmacias

Joined
Sep 27, 2007
Messages
205
Likes
0
Points
0
#2
Hi,

hmm

I see that use directly socket.

In elastix, path /var/lib/asterisk/agi-bin/ exists the file: phpagi-asmanager.php. With this file implement the conecction and originate as a funcions.

I recomend you review this file.

Regards.
 

bmacias

Joined
Sep 27, 2007
Messages
205
Likes
0
Points
0
#3
Also recomend, review the module address book en elastix (Agenda). Review the /var/www/html/modules/address_book/index.php file and /var/www/html/modules/address_book/libs/paloSantoAdressBook.class.php. In this module there is a implementation with orginate.

;)
 

piyush_rahate

Joined
Jul 30, 2009
Messages
7
Likes
0
Points
0
#4
Thanks bmacias,
the files were very helpful

though I later found out the error was in my db :S
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,902
Messages
130,887
Members
17,565
Latest member
omarmenichetti
Top