[OpenSER-Users] a c program behaves differently when called by openser than it does when called from the console.

Olivier Bontron bontron at telip.com
Fri Jul 13 14:16:59 CEST 2007


Hello Daniel,
Many thanks for your answer.

The point itself is solved.
There were two problems :
1. A problem was that a '$... ' parameter was faulty in the exec_msg when 
conveyed to the C program, which in turn did not exactly what it was 
supposed to do. On top of it, there was a poorly designed avp_db_query 
request.
2. But pb1 should not have taken place when manually writing the exec_msg 
request (and adding the right $... in due place) instead of relying on the 
avp_db_query result. Though, even manually written, the exec_msg failed. So 
there was another problem and I think you have provided the right 
explanation : openser can fake the environment variable.

I hope it can be useful to other readers, since, as there is no error 
message, it's not so easy to analyse.

Your suggestion of using avp_db_query : good idea, I 'll try to make a more 
extensive use of avp_db_query.

Again, many thanks,

Olivier






----- Original Message ----- 
From: "Daniel-Constantin Mierla" <daniel at voice-system.ro>
To: "Bontron" <bontron at telip.com>
Cc: <users at openser.org>
Sent: Friday, July 13, 2007 1:02 PM
Subject: Re: [OpenSER-Users] a c program behaves differently when called by 
openser than it does when called from the console.


> Hello,
>
> On 07/11/07 14:08, Bontron wrote:
>> Hello,
>>
>> I have this piece of code in my openser.cfg :
>> exec_msg("/usr/local/etc/openser/uri-folder/record '$fu' $$SIP_USER '$ft'
>> 'additionalinfo'");
>> The instruction 'record' is a c program.
>>
>> This is supposed to add a record in a mysql database  - new incoming 
>> call,
>> from caller , to called, date, and an additional info - and as the matter 
>> of
>> fact it almost does except that 'record' is unable to append the date. It
>> writes  '0000-00-00'.
>>
>> The strange thing is that when the 'record' instruction is being called 
>> from
>> the console, the set of instructions being manually written : record
>> 'joe at ....' etc ... it records everything including the right date and 
>> time.
>>
>> Did any one face a similar situation ? Thanks in advance.
>>
> I do not know how you get the date there, but if you rely on some 
> environment varibles, beware that openser fakes the environment when 
> executing the command. You may use date functions from the mysql.
>
> As side not, have a look at avp_db_query(), you may achieve same 
> functionality without the need of calling external commands.
>
> Cheers,
> Daniel
>
>> Olivier
>>
>>
>> ________________________________________________
>> Message sent using UebiMiau 2.7.8
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at openser.org
>> http://openser.org/cgi-bin/mailman/listinfo/users
>>
>>
> 





More information about the sr-users mailing list