[Serusers] Re: Calling External Script from Ser.cfg

mkumar at mantragroup.com mkumar at mantragroup.com
Mon Feb 20 10:55:30 CET 2006


Hi,

I am facing a problem returning a value from shell script for ser.cfg. I could
not even get working with exec_msg. I added a line like this

if(exec_msg('x=1; if [ $x == 0 ];then exit 1 ;fi'))

ERROR: exec_msg: cmd x=1; if [ $x == 0 ];then exit 1 ;fi failed. 
exit_status=-1,
errno=32: Broken pipe

I am getting this error but If I include this

if(exec_msg('x=0; if [ $x == 0 ];then exit 1 ;fi'))

it works. Please tell me what can I do? As described below my plan is to call
java program from shell script and use it's output.

Thanks,
M.

Quoting mkumar at mantragroup.com:

> After some search I found exec_msg return false, if return value of 
> script does
> not equals zero, so from shell script I must collect java program output and
> based on that I must return some value.
>
> Quoting mkumar at mantragroup.com:
>
>> Hi All,
>>
>> I am trying to call a external script from Ser.cfg using exec_msg. 
>> It calls a
>> shell script and from shell script I am running a java program which 
>> connects
>> to Database and makes some queries for getting number of minutes 
>> dialled out by
>> a customer. My problem is that how can I get the output of the java 
>> programme
>> value to ser.cfg? I am doing like this
>>
>> exec_msg("sh -a /usr/local/ser/mobi.sh $SIP_USER;Some more commands 
>> required")
>>
>> I tried one approach, if the user crossed number of minutes then I 
>> am calling
>> system.out(-1); telling unix OS that something went wrong and  
>> system.out(0);
>> if user did not croos his number of minutes, but it is sometimes 
>> successful and
>> fails sometimes. So please tell me how can get the output of java program,
>> should I use system.out.print in java and grep for that but I do not 
>> know how
>> can I do this ? I also have no idea whether this approach can be 
>> used or not?
>> Please tell what should be used to acheive this?
>>
>> Any help will be sincerely appreciated.
>>
>> Thanks,
>> Manoj.
>>
>>
>
>
>






More information about the sr-users mailing list