Hello Andrei, Thanks for pointing out to the documentation. It is working as expected now. Also, I got the optional parameters to work.
Thanks, Ovidiu On Thu, Jun 24, 2010 at 3:59 AM, Andrei Pelinescu-Onciul <[email protected]> wrote: > On Jun 24, 2010 at 08:32, Andrei Pelinescu-Onciul <[email protected]> wrote: >> On Jun 23, 2010 at 18:32, Ovidiu Sas <[email protected]> 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. > > On second thought, you could modify the rpc function to take both > integers and string as parameters, For that you need to add '.' in front > of the parameter type ('S'), e.g.: > rpc->scan(c, ".S", &string) > (see > http://sip-router.org/docbook/sip-router/branch/master/rpc/ser_rpc.html#rpc.data_types > (Table 1. Data Type Overview) > > Andrei > _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
