[Freeswitch-users] simple fs commands taking inputs from awebpage

Cavalera Claudio Luigi Claudio.Cavalera at italtel.it
Tue Apr 29 07:59:13 PDT 2008


I like the idea of contribute actively to fs development, however at the
moment I can contribute only report my experience as user. In fact I am
a PHP newbie anyway, I post here my script in case it can be useful to
anyone.
It still needs a lot of work, but it's a rough start.

Caller is <?php echo htmlspecialchars($_POST['Caller']); ?>.<br>
Callee is <?php echo htmlspecialchars($_POST['Callee']); ?>.<br>
<br>

<?php
$Caller = htmlspecialchars($_POST['Caller']);
$Callee = htmlspecialchars($_POST['Callee']);
echo "Php now!<br>";
echo "Caller is: $Caller<br>";
echo "Callee is: $Callee<br>";

$handle = fsockopen('127.0.0.1', '8021', $erno, $errstr, 30);
if (!$handle) {
  //if connection fails exit and tell us what went wrong.
  die("Connect failed with erno $erno and errstr $errstr\n");
}
else {
  //read the first line the smtp server gives us (usually the version
string)
  //$responses = fgets($handle, 1024);
  $response= fread($handle, 1024);
  echo "connection opened, got response:<br> $response<br><br>";

  $authMessage = "auth ClueCon\r\n\r\n";
  fwrite($handle, "$authMessage");


  $response = fread($handle, 1024);
  echo "authMessage sent, got response:<br> $response<br>";


  $command = "api originate sofia/default/".$Caller."%131.132.133.134
&bridge(sofia/default/".$Callee."%131.132.133.134\r\n\r\n";
  echo "command is $command";
  fwrite($handle, $command);

 $response = fread($handle, 1024);
 echo "command sent, got response:<br> $response<br>";
 $response = fread($handle, 1024);
 echo "command sent, got response:<br> $response<br>";


  fclose($handle);
}
?>





________________________________

	From: freeswitch-users-bounces at lists.freeswitch.org
[mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of
Anthony Minessale
	Sent: Tuesday, April 29, 2008 3:22 PM
	To: freeswitch-users at lists.freeswitch.org
	Subject: Re: [Freeswitch-users] simple fs commands taking inputs
from awebpage
	
	
	The correct answer is "take your pick"
	
	Every mechanism you described is a thin layer on top of the same
core code so they all work the same way.
	The FSAPI interface is designed to be connected to any
lightweight control protocol.
	
	With all the time you saved not having to wrestle with a
solution to your goals, maybe you can collaborate with the guys on irc
and develop your PHP event socket code into a robust library that
everyone can use and we can check it into tree and give you all commit
access to it.
	
	
	On Tue, Apr 29, 2008 at 4:37 AM, Cavalera Claudio Luigi
<Claudio.Cavalera at italtel.it> wrote:
	

		Hello,
		I'm trying to realize a demo for this use case:
		1) a user inserts two sip users (e.g. 1001 and 1002)
into a web page
		2) fs calls the users (already registered to fs) and
bridge them
		
		I've succeeded to achieve 2) by a mix of commands such
as:
		
		originate sofia/default/1001%131.132.133.134 & park()
		originate sofia/default/1002%131.132.133.134 & park()
		show channels
		uuid_bridge uuid1001 uuid1002
		
		it works so well!
		
		Now concerning a robust (yet simple :-) method to
achieve 1) :
		which interface should I use?
		# mod_event socket
		# mod_xmpp event
		# mod_xml_rpc socket
		# any of the scripting interfaces such as mod_perl,
mod_spidermonkey,
		mod_python, etc.
		
		and which server side technology do you suggest to
implement the bit of
		logic (e.g. PHP or Perl with apache, Java with Tomcat)
		
		At the moment I'm going to write some PHP to talk
directly with
		mod_event socket, but any hints are welcome! :-)
		
		Thanks a lot,
		Claudio
		
		
		Internet Email Confidentiality Footer
	
------------------------------------------------------------------------
-----------------------------
		La presente comunicazione, con le informazioni in essa
contenute e ogni documento o file allegato, e' rivolta unicamente alla/e
persona/e cui e' indirizzata ed alle altre da questa autorizzata/e a
riceverla. Se non siete i destinatari/autorizzati siete avvisati che
qualsiasi azione, copia, comunicazione, divulgazione o simili basate sul
contenuto di tali informazioni e' vietata e potrebbe essere contro la
legge (art. 616 C.P., D.Lgs n. 196/2003 Codice in materia di protezione
dei dati personali). Se avete ricevuto questa comunicazione per errore,
vi preghiamo di darne immediata notizia al mittente e di distruggere il
messaggio originale e ogni file allegato senza farne copia alcuna o
riprodurne in alcun modo il contenuto.
		
		This e-mail and its attachments are intended for the
addressee(s) only and are confidential and/or may contain legally
privileged information. If you have received this message by mistake or
are not one of the addressees above, you may take no action based on it,
and you may not copy or show it to anyone; please reply to this e-mail
and point out the error which has occurred.
	
------------------------------------------------------------------------
-----------------------------
		
		
		_______________________________________________
		Freeswitch-users mailing list
		Freeswitch-users at lists.freeswitch.org
	
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
	
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
		http://www.freeswitch.org
		




	-- 
	Anthony Minessale II
	
	FreeSWITCH http://www.freeswitch.org/
	ClueCon http://www.cluecon.com/
	
	AIM: anthm
	MSN:anthony_minessale at hotmail.com
<mailto:MSN%3Aanthony_minessale at hotmail.com> 
	GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
<mailto:PAYPAL%3Aanthony.minessale at gmail.com> 
	IRC: irc.freenode.net #freeswitch
	
	FreeSWITCH Developer Conference
	sip:888 at conference.freeswitch.org
<mailto:sip%3A888 at conference.freeswitch.org> 
	iax:guest at conference.freeswitch.org/888
	googletalk:conf+888 at conference.freeswitch.org
<mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org> 
	pstn:213-799-1400 





More information about the FreeSWITCH-users mailing list