[Kamailio-Devel] new http_query function

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 18 22:53:31 CET 2008



On 11/18/08 23:42, Klaus Darilion wrote:
> would it work if the http request is "hidden" behind an exported 
> pseudo variable?
yes, this works.

Cheers,
Daniel

>
> e.g $br = $http_request(....)
>
> that would be similar to functions in Asterisk
>
> regards
> klaus
>
> Daniel-Constantin Mierla wrote:
>> Hello Juha,
>>
>> On 11/16/08 00:52, Juha Heinanen wrote:
>>> Klaus Darilion writes:
>>>
>>>  > can you work around it by using pseudo variables?
>>>
>>> klaus,
>>>
>>> i tried to implement http_query function like this:
>>>
>>> http_query(page, params, pvar)
>>>
>>> where result of the query would be assigned to pvar.
>>> i could not do it, because i didn't find a function in pvar.h that 
>>> would
>>> allow me to assign a generic pvar (avp or script variable or core
>>> variable like $ru) a string value.
>>>
>>> also, i didn't find any example functions in modules that i use, where
>>> such a thing would have been done.
>>>
>>> so unless someone can give me a pointer to an example, i have to stick
>>> to the less generic version of this function that always assigns the
>>> result to request uri.
>>>
>>>  > e.g. $br = http_query(...);
>>>
>>> this won't work either, because according to my knowledge, module
>>> functions return an integer (status) value.
>>>   
>> indeed, the functions exported by modules return integers with 
>> special meanings:
>> http://www.asipto.com/pub/kamailio-devel-guide/#c16return_values
>>
>> The PV spec includes inside the structure the pointer to set 
>> function. The group modules has a function get_user_group() that sets 
>> to a PV an integer value -- just as example to start -- also, 
>> action.c has do_assign() using same mechanism.
>>
>> Cheers,
>> Daniel
>>
>

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the Devel mailing list