Re: [OpenSIPS-Users] REST Client

2021-06-22 Thread Alexander Perkins
Thank you so much for the help! On Tue, Jun 22, 2021 at 8:47 AM Liviu Chircu wrote: > On 15.06.2021 20:30, Alexander Perkins wrote: > > Where should we include the x-api-key header with using rest_client. > > I would suggest looking into the rest_append_hf() function [1], which > can be used to

Re: [OpenSIPS-Users] REST Client

2021-06-22 Thread Liviu Chircu
On 15.06.2021 20:30, Alexander Perkins wrote: Where should we include the x-api-key header with using rest_client. I would suggest looking into the rest_append_hf() function [1], which can be used to append as many HTTP headers to a request as you need. [1]: https://opensips.org/docs/module

[OpenSIPS-Users] REST Client

2021-06-15 Thread Alexander Perkins
Hi All. We are using the REST_Client to parse a web service. However, our provider requires an API key to be passed in the header. Can somebody point me in the right direction? Where should we include the x-api-key header with using rest_client. Thank you, Alex

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-27 Thread Ben Newlin
unexpected. Thanks for the time and quick responses! Ben Newlin From: Users on behalf of Liviu Chircu Reply-To: OpenSIPS users mailling list Date: Thursday, June 27, 2019 at 5:05 AM To: OpenSIPS users mailling list Subject: Re: [OpenSIPS-Users] Rest Client Async operation On 26.06.2019 17

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-27 Thread Liviu Chircu
I have updated the async docs [1], so everyone can read more about this limitation, along with a mitigation solution for it. Cheers, [1]: https://www.opensips.org/Documentation/Script-Async-3-0#toc8 Liviu Chircu OpenSIPS Developer http://www.opensips-solutions.com ___

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-27 Thread Liviu Chircu
On 26.06.2019 17:48, Ben Newlin wrote: Thanks again for the info. I think what you are saying is that the async operation is not launching a new process to handle the called function, but is performing the function in the original worker thread and only taking advantage of any suspend/resume

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-26 Thread Ben Newlin
-To: OpenSIPS users mailling list Date: Wednesday, June 26, 2019 at 9:23 AM To: "users@lists.opensips.org" Subject: Re: [OpenSIPS-Users] Rest Client Async operation It's the same process doing both the connect and the transfer. The problem is that libcurl, as it stands now, is n

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-26 Thread Liviu Chircu
That is exactly why we need to extract the connection/transfer fd in the first place: so we can throw it into epoll_wait() and have it act as an event generator :) Liviu Chircu OpenSIPS Developer http://www.opensips-solutions.com On 26.06.2019 16:38, SamyGo wrote: once we somehow get the event

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-26 Thread SamyGo
Hi Liviu, Is it possible to suspend the transaction and resume it once we somehow get the event from libcurl as soon as the connect is done? Im imagining the way usually APNS is done these days. The only thing missing here is the event from the rest_client ! Can this mechanism help with the probl

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-26 Thread Liviu Chircu
It's the same process doing both the connect and the transfer.  The problem is that libcurl, as it stands now, is not able to give me a file descriptor to poll on, until it connects [1].  See this section: "When libcurl returns -1 in max_fd, it is because libcurl currently does something that

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-25 Thread Ben Newlin
users mailling list Date: Tuesday, June 25, 2019 at 8:52 AM To: "users@lists.opensips.org" Subject: Re: [OpenSIPS-Users] Rest Client Async operation Hi Ben, Regarding the "blocking rest_get()" problem: due to the specifics of the libcurl API, there is no direct acces

Re: [OpenSIPS-Users] Rest Client Async operation

2019-06-25 Thread Liviu Chircu
Hi Ben, Regarding the "blocking rest_get()" problem: due to the specifics of the libcurl API, there is no direct access to the socket file descriptors during the initial TCP connect handshake.  Thus, this phase will be synchronous (blocking), while all transfers (send HTTP req, receive reply)

[OpenSIPS-Users] Rest Client Async operation

2019-06-24 Thread Ben Newlin
Hello all, During testing I have found behavior that I cannot explain based on our current understanding of the operation of the async and rest_client functionality. I have reproduced this behavior with a fairly simple script configuration, the relevant piece of which is below: children=8 loa

Re: [OpenSIPS-Users] Rest client for auth

2017-06-23 Thread Bogdan-Andrei Iancu
Hi Tito, yes, the calculate_ha1 must be correlated with how the password is kept in the DB - see https://blog.opensips.org/2016/11/11/how-to-avoid-plaintext-passwords/ In regards, to $var(username), usually it is just the username part ($fU) Regards, Bogdan-Andrei Iancu OpenSIPS Founder a

Re: [OpenSIPS-Users] Rest client for auth

2017-06-23 Thread Tito Cumpen
Bogdan, I found the solution to the issue I wasnt setting modparam("auth", "calculate_ha1", 1) which allows the password to be in plaintext in the pseudo var. In addition I had to join the $fU+"@"+$fd since the $fu carries sip: Thanks, TIto On Thu, Jun 22, 2017 at 8:49 PM, Tito Cumpen wrote:

Re: [OpenSIPS-Users] Rest client for auth

2017-06-22 Thread Tito Cumpen
Hey Bogdan, I see that the module params define the spec variables now and I tried the following in my register method block exec("php /etc/opensips/authenticate.php $var(input)","" , "$var(out)", "$var(err)", "$avp(env)"); this returns the text password $var(username)= $fu;

Re: [OpenSIPS-Users] Rest client for auth

2017-06-21 Thread Tito Cumpen
Bogdan, would I have to use the exec module to cast the into the username and password variables? Also I am not sure how the function expects those variables to be passed to it ? It is based on variables with these two names to be set prior to being called? $var(username)="abc"; $avp(password)="

Re: [OpenSIPS-Users] Rest client for auth

2017-05-26 Thread Bogdan-Andrei Iancu
Hi Tito, You can do that by fetching the password via an explicit DB query from script and pushing it for auth check using pv_www_authorize(): http://www.opensips.org/html/docs/modules/2.3.x/auth.html#idp5590848 Best regards, Bogdan-Andrei Iancu OpenSIPS Founder and Developer http://www.o

[OpenSIPS-Users] Rest client for auth

2017-05-25 Thread Tito Cumpen
Group, Is it possible to use a rest api for auth_db? Meaning can opensips authenticate a user based on a rest query against a rest api? I thought about using db http by fronting the request with a local http server but I don't see a way to pass a custom headers to the query. This custom header wou