<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<STYLE type=text/css> <!--@import url(scrollbar.css); --></STYLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE>                        body{FONT-SIZE:12pt; FONT-FAMILY:宋体,serif;}                </STYLE>
<META name=GENERATOR content="MSHTML 11.00.9600.17041"><BASE
target=_blank></HEAD>
<BODY
style="BORDER-LEFT-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN: 12px; LINE-HEIGHT: 1.3; BORDER-TOP-WIDTH: 0px"
marginheight="0" marginwidth="0">
<DIV><FONT color=#000000 size=3 face=宋体>Thanks!</FONT></DIV>
<DIV> </DIV>
<DIV>I will review it firstly. If there is more question, I will trouble you
again.:-)</DIV>
<DIV> </DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 face=Verdana>2014-04-18</FONT></DIV>
<DIV align=left><FONT size=2 face=Verdana>
<HR id=SignNameHR style="HEIGHT: 2px; WIDTH: 122px" align=left SIZE=2>
</FONT></DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 face=Verdana><SPAN
id=_FlashSignName>sparklezou</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Verdana>
<HR>
</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>发件人:</STRONG>Nathan Neulinger
<nneul@mst.edu></FONT></DIV>
<DIV><FONT size=2
face=Verdana><STRONG>发送时间:</STRONG>2014-04-17 20:09</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>主题:</STRONG>Re: [Freeswitch-users]
[Freeswitch-dev] How to check the "fax_result_code" in the script? such as php
script?</FONT></DIV>
<DIV><FONT size=2
face=Verdana><STRONG>收件人:</STRONG>"sparklezou"<sparklezou@163.com></FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>抄送:</STRONG>"FreeSWITCH Users
Help"<freeswitch-users@lists.freeswitch.org></FONT></DIV>
<DIV><FONT size=2 face=Verdana></FONT> </DIV>
<DIV><FONT size=2 face=Verdana>
<DIV>Only thing in there is a pair of routines to bump up the stack size limit to the hard limit: </DIV>
<DIV> </DIV>
<DIV>--------------------------- </DIV>
<DIV>#!/usr/bin/perl </DIV>
<DIV>use strict; </DIV>
<DIV>use BSD::Resource; </DIV>
<DIV> </DIV>
<DIV>my $saved_stack = 0; </DIV>
<DIV>my $saved_stack_soft; </DIV>
<DIV>my $saved_stack_hard; </DIV>
<DIV> </DIV>
<DIV>sub stack_max { </DIV>
<DIV> my ( $rss_soft, $rss_hard ) = getrlimit("RLIMIT_STACK"); </DIV>
<DIV> if ( !$saved_stack ) { </DIV>
<DIV> $saved_stack_soft = $rss_soft; </DIV>
<DIV> $saved_stack_hard = $rss_hard; </DIV>
<DIV> $saved_stack = 1; </DIV>
<DIV> } </DIV>
<DIV> freeswitch::console_log( "info", "rlimit_stack ($rss_soft, $rss_hard)\n" ); </DIV>
<DIV> </DIV>
<DIV> my $rstat = setrlimit( "RLIMIT_STACK", $rss_hard, $rss_hard ); </DIV>
<DIV> freeswitch::console_log( "info", "rlimit_stack set res = $rstat\n" ); </DIV>
<DIV> </DIV>
<DIV> ( $rss_soft, $rss_hard ) = getrlimit("RLIMIT_STACK"); </DIV>
<DIV> freeswitch::console_log( "info", "rlimit_stack now ($rss_soft, $rss_hard)\n" ); </DIV>
<DIV>} </DIV>
<DIV> </DIV>
<DIV>sub stack_restore { </DIV>
<DIV> if ($saved_stack) { </DIV>
<DIV> my $rstat = setrlimit( "RLIMIT_STACK", $saved_stack_soft, $saved_stack_hard ); </DIV>
<DIV> freeswitch::console_log( "info", "rlimit_stack set res = $rstat\n" ); </DIV>
<DIV> </DIV>
<DIV> my ( $rss_soft, $rss_hard ) = getrlimit("RLIMIT_STACK"); </DIV>
<DIV> freeswitch::console_log( "info", "rlimit_stack now ($rss_soft, $rss_hard)\n" ); </DIV>
<DIV> } </DIV>
<DIV> else { </DIV>
<DIV> freeswitch::console_log( "info", "rlimit_stack not saved, cannot restore\n" ); </DIV>
<DIV> } </DIV>
<DIV>} </DIV>
<DIV> </DIV>
<DIV>1; </DIV>
<DIV>------------------------------------- </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>On 04/17/2014 03:47 AM, sparklezou wrote: </DIV>
<DIV>> Hi Nathan, </DIV>
<DIV>> Thanks very much! </DIV>
<DIV>> Could you please provide the 'require "/local/freeswitch/bin/hook-libs.pl";' file to me for review? </DIV>
<DIV>> For PHP or Perl, it's similar for me. </DIV>
<DIV>> much more guidline is much helpful. </DIV>
<DIV>> Thanks! </DIV>
<DIV>> 2014-04-17 </DIV>
<DIV>> ------------------------------------------------------------------------------------------------------------------------ </DIV>
<DIV>> sparklezou </DIV>
<DIV>> ------------------------------------------------------------------------------------------------------------------------ </DIV>
<DIV>> *发件人:*Nathan Neulinger <nneul@mst.edu> </DIV>
<DIV>> *发送时间:*2014-04-15 20:48 </DIV>
<DIV>> *主题:*Re: [Freeswitch-users] [Freeswitch-dev] How to check the "fax_result_code" in the script? such as php script? </DIV>
<DIV>> *收件人:*"FreeSWITCH Users Help"<freeswitch-users@lists.freeswitch.org> </DIV>
<DIV>> *抄送:* </DIV>
<DIV>> Can't help you on the PHP side, but I do this with sending a fax with perl based web page. If you're wanting to do it </DIV>
<DIV>> inline, I think you'd have to listen for events as you've described... </DIV>
<DIV>> ... </DIV>
<DIV>> push( @args, "fax_notify_address='" . $ENV{REMOTE_USER} . "\@mst.edu'" ); </DIV>
<DIV>> push( @args, "api_hangup_hook='perl /local/freeswitch/bin/notify-fax-status-hook.pl'" ); </DIV>
<DIV>> ... </DIV>
<DIV>> and then the attached script. </DIV>
<DIV>> Key parts: </DIV>
<DIV>> our $env; </DIV>
<DIV>> our $session; </DIV>
<DIV>> my $addr = $session->getVariable("fax_notify_address"); </DIV>
<DIV>> my $to = $session->getVariable("destination_number"); </DIV>
<DIV>> ... </DIV>
<DIV>> my $fax_status = $session->getVariable("fax_success"); </DIV>
<DIV>> my $status_msg = "Sent OK"; </DIV>
<DIV>> if ( $fax_status != 1 ) { </DIV>
<DIV>> $status_msg = "Failed"; </DIV>
<DIV>> } </DIV>
<DIV>> my $result = $session->getVariable("fax_result_text"); </DIV>
<DIV>> On 04/15/2014 01:00 AM, sparklezou wrote: </DIV>
<DIV>> > Hi All, </DIV>
<DIV>> > I checked and find two possible solution. But still NOT clear. </DIV>
<DIV>> > 1. Run "fs_cli" in PHP script. But NOT find to correct command to show the channel variables. Nor the data for Mod_spandsp. </DIV>
<DIV>> > https://wiki.freeswitch.org/wiki/Fs_cli#Simple </DIV>
<DIV>> > 2. get info from "Mod event socket". But still NOT very clear how to get the Mod_spandsp event. </DIV>
<DIV>> > https://wiki.freeswitch.org/wiki/Mod_event_socket#api </DIV>
<DIV>> > https://wiki.freeswitch.org/wiki/Event_Socket_Library#events </DIV>
<DIV>> > https://wiki.freeswitch.org/wiki/Event_List#Event-Name </DIV>
<DIV>> > https://wiki.freeswitch.org/wiki/Mod_spandsp </DIV>
<DIV>> > Please share your idea, how to handle such issue? </DIV>
<DIV>> > Hope there is direct way to get the result code, then it will be easy to handle fax step in the script. </DIV>
<DIV>> > Thanks! </DIV>
<DIV>> > 2014-04-15 </DIV>
<DIV>> > ------------------------------------------------------------------------------------------------------------------------ </DIV>
<DIV>> > sparklezou </DIV>
<DIV>> > ------------------------------------------------------------------------------------------------------------------------ </DIV>
<DIV>> > *发件人:*Michael Jerris <mike@jerris.com> </DIV>
<DIV>> > *发送时间:*2014-04-14 20:08 </DIV>
<DIV>> > *主题:*Re: [Freeswitch-users] How to check the "fax_result_code" in the script? such as php script? </DIV>
<DIV>> > *收件人:*"FreeSWITCH Users Help"<freeswitch-users@lists.freeswitch.org> </DIV>
<DIV>> > *抄送:* </DIV>
<DIV>> > you could use an api hangup hook, or possibly do it in cdr processing. </DIV>
<DIV>> > </DIV>
<DIV>> > On Apr 10, 2014, at 10:39 PM, sparklezou <sparklezou@163.com <mailto:sparklezou@163.com>> wrote: </DIV>
<DIV>> > </DIV>
<DIV>> >> Hi Buddies, </DIV>
<DIV>> >> Reviewed the wiki,https://wiki.freeswitch.org/wiki/Mod_spandsp </DIV>
<DIV>> >> How to check the "fax_result_code" in the php script? </DIV>
<DIV>> >> Also other result info, such as*fax_result_text,*then could provide more detail response info to the client. </DIV>
<DIV>> >> Thanks! </DIV>
<DIV>> >> 2014-03-03 </DIV>
<DIV>> >> ------------------------------------------------------------------------------------------------------------------------ </DIV>
<DIV>> >> sparklezou </DIV>
<DIV>> >> _________________________________________________________________________ </DIV>
<DIV>> > </DIV>
<DIV>> > </DIV>
<DIV>> > </DIV>
<DIV>> > _________________________________________________________________________ </DIV>
<DIV>> > Professional FreeSWITCH Consulting Services: </DIV>
<DIV>> > consulting@freeswitch.org </DIV>
<DIV>> > http://www.freeswitchsolutions.com </DIV>
<DIV>> > </DIV>
<DIV>> > FreeSWITCH-powered IP PBX: The CudaTel Communication Server </DIV>
<DIV>> > http://www.cudatel.com </DIV>
<DIV>> > </DIV>
<DIV>> > Official FreeSWITCH Sites </DIV>
<DIV>> > http://www.freeswitch.org </DIV>
<DIV>> > http://wiki.freeswitch.org </DIV>
<DIV>> > http://www.cluecon.com </DIV>
<DIV>> > </DIV>
<DIV>> > FreeSWITCH-dev mailing list </DIV>
<DIV>> > FreeSWITCH-dev@lists.freeswitch.org </DIV>
<DIV>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev </DIV>
<DIV>> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev </DIV>
<DIV>> > http://www.freeswitch.org </DIV>
<DIV>> > </DIV>
<DIV>> -- </DIV>
<DIV>> ------------------------------------------------------------ </DIV>
<DIV>> Nathan Neulinger nneul@mst.edu </DIV>
<DIV>> Missouri S&T Information Technology (573) 612-1412 </DIV>
<DIV>> System Administrator - Architect </DIV>
<DIV> </DIV>
<DIV>-- </DIV>
<DIV>------------------------------------------------------------ </DIV>
<DIV>Nathan Neulinger nneul@mst.edu </DIV>
<DIV>Missouri S&T Information Technology (573) 612-1412 </DIV>
<DIV>System Administrator - Architect </DIV></FONT></DIV></BODY></HTML>