[sr-dev] rpc scan behavior

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Jun 24 08:32:10 CEST 2010


On Jun 23, 2010 at 18:32, Ovidiu Sas <osas at voipembedded.com> wrote:
> What is the proper way to scan a string via the rpc interface?
> 
> <code_snippet>
> str string = {NULL,0};
> 
> if (rpc->scan(c, "S", &string) < 1) return;
> </code_snippet>
> 
> If I use the above code and I pass a string that is made out of
> digits, I get the following error:
> "error: 400 - error at parameter 0: expected string type but record
> doesn't match type"
> 
> I would like to have the argument interpreted as a string no matter
> what I pass as an argument via rpc:
> sercmd> some_cmd abcd
> the above will work ok
> sercmd> some_cmd 1234
> the above will give the 400 error

It's not rpc_scan is sercmd that automatically converts to int.
Use some_cmd s:1234 to force string.


Andrei



More information about the sr-dev mailing list