Re: [SR-Users] http_async_query - How to Allow SIP transaction to continue

2016-09-16 Thread Federico Cabiddu
Hi this should be better documented. I'll update the documentation
accordingly.
On the other hand I see that you are using in the config http_set* and
http_append_header
functions.
I'd suggest to use the $http_req pseudovariable for the same purpouse (
http://www.kamailio.org/docs/modules/4.4.x/modules/http_async_client.html#idp32731036),
since those functions will be removed in master branch (so in future 5.0).

Cheers,

Federico

On Thu, Sep 15, 2016 at 10:16 PM, Jonathan Hunter 
wrote:

> Hi Federico,
>
> Hope you are well?
>
> Thanks for the reply, t_newtran()  before http_async_query works
> perfectly!
>
> Many thanks
>
> Jon
>
>
> --
> From: federico.cabi...@gmail.com
> Date: Thu, 15 Sep 2016 19:47:31 +0200
> To: sr-users@lists.sip-router.org
> Subject: Re: [SR-Users] http_async_query - How to Allow SIP transaction to
> continue
>
>
> Hi,
> did you create the transaction before calling http_async_query?
> If not, the function switch to non-transactional context, the script
> execution is not stopped (you should notice it in your logs if the log line
> after the function call is printed) and the callback function creates a
> fake message to be processed in the callback route.
> You should call t_newtran() before calling http_async_query.
>
> Cheers,
>
> Federico
>
> On Thu, Sep 15, 2016 at 5:44 PM, Jonathan Hunter 
> wrote:
>
> Hi Guys,
>
> I am just testing with jansson and http_async_query.
>
> Essentially I sent an INVITE into kamailio ,it hits CALL_START_REQUEST
> (see below) and the query allows the http site I send to, to provide
> routing details for kamailio.
>
> Logging the $rm that hits CALL_START_ REQUEST, it shows as INVITE, however
> when CALL_START_REQUEST_REPLY is hit, the message type is OPTIONS, is this
> expected behaviour?
>
> Essentially I want it to continue in the script with the same $ci,$rm so I
> can onwards route it for termination, but all I get are options messages
> being sent, any hints please?
>
> As Ideally I want the transaction to continue to a route where I can
> forward on modified request for termination.
>
> Thanks
>
> Jon
>
>
>
> Routes;
>
>
> # Send to FreeSWITCH
> route[CALL_START_REQUEST]{
> xlog("L_INFO","route[CALL_START_REQUEST] Call received
> $ci,$rm,$ru,$du\n");
>
> ###Build JSON request to send to MAP
> $var(params) = $null;
> jansson_set("string", "username", "xxx", "$var(params)");
> jansson_set("string", "password", "xxx", "$var(params)");
> jansson_set("string", "source", "$fU", "$var(params)");
> jansson_set("string", "route", "$var(carriername)", "$var(params)");
> jansson_set("string", "destination", "$rU", "$var(params)");
> /// other fields set here
> http_set_timeout(5000);
> http_set_method("POST");
> http_append_header("Content-Type: application/json");
> http_async_query("http://test.com";, "$var(params)",
> "CALL_START_REQUEST_REPLY");
> xlog("L_INFO", "Checking here we have status=$var(status)\n");
> xlog("L_INFO", "Current Destination is $du\n");
> #return;
> #exit;
> }
> #
> route[CALL_START_REQUEST_REPLY]{
> xlog("L_INFO", "route[CALL_START_REQUEST_REPLY]: $ci,$rm,$ru,$du\n");
>
>
> Logs show;
>
>  route[CALL_START_REQUEST] Call received b087fa53-f5fc-1234-94ac-f68eb8
> da94f7,INVITE,sip:441624891676@8.8.8.8:5060 <http://8.8.8.8:5060>
> ;user=phone,
>
>  route[CALL_START_REQUEST_REPLY]: 123,OPTIONS,sip:G711A-28295120
> 0...@kamailio.org,sip:G711A-282951200@8.8.8.8:5080 <http://8.8.8.8:5080>
>
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
>
> ___ SIP Express Router (SER)
> and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org http://lists.sip-router.org/
> cgi-bin/mailman/listinfo/sr-users
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] http_async_query - How to Allow SIP transaction to continue

2016-09-15 Thread Jonathan Hunter
Hi Federico,
Hope you are well?
Thanks for the reply, t_newtran()  before http_async_query works perfectly!
Many thanks
Jon

From: federico.cabi...@gmail.com
Date: Thu, 15 Sep 2016 19:47:31 +0200
To: sr-users@lists.sip-router.org
Subject: Re: [SR-Users] http_async_query - How to Allow SIP transaction to  
continue

Hi,did you create the transaction before calling http_async_query?If not, the 
function switch to non-transactional context, the script execution is not 
stopped (you should notice it in your logs if the log line after the function 
call is printed) and the callback function creates a fake message to be 
processed in the callback route. 
You should call t_newtran() before calling http_async_query.
Cheers,
Federico
On Thu, Sep 15, 2016 at 5:44 PM, Jonathan Hunter  wrote:



Hi Guys,
I am just testing with jansson and http_async_query.
Essentially I sent an INVITE into kamailio ,it hits CALL_START_REQUEST (see 
below) and the query allows the http site I send to, to provide routing details 
for kamailio.
Logging the $rm that hits CALL_START_ REQUEST, it shows as INVITE, however when 
CALL_START_REQUEST_REPLY is hit, the message type is OPTIONS, is this expected 
behaviour?
Essentially I want it to continue in the script with the same $ci,$rm so I can 
onwards route it for termination, but all I get are options messages being 
sent, any hints please?
As Ideally I want the transaction to continue to a route where I can forward on 
modified request for termination.
Thanks
Jon


Routes;

# Send to 
FreeSWITCHroute[CALL_START_REQUEST]{xlog("L_INFO","route[CALL_START_REQUEST] 
Call received $ci,$rm,$ru,$du\n");
###Build JSON request to send to MAP$var(params) = $null;jansson_set("string", 
"username", "xxx", "$var(params)");jansson_set("string", "password", "xxx", 
"$var(params)");jansson_set("string", "source", "$fU", 
"$var(params)");jansson_set("string", "route", "$var(carriername)", 
"$var(params)");jansson_set("string", "destination", "$rU", "$var(params)");/// 
other fields set 
herehttp_set_timeout(5000);http_set_method("POST");http_append_header("Content-Type:
 application/json");http_async_query("http://test.com";, "$var(params)", 
"CALL_START_REQUEST_REPLY");xlog("L_INFO", "Checking here we have 
status=$var(status)\n");xlog("L_INFO", "Current Destination is 
$du\n");#return;#exit;}#route[CALL_START_REQUEST_REPLY]{xlog("L_INFO",
 "route[CALL_START_REQUEST_REPLY]: $ci,$rm,$ru,$du\n");

Logs show;
 route[CALL_START_REQUEST] Call received 
b087fa53-f5fc-1234-94ac-f68eb8da94f7,INVITE,sip:441624891676@8.8.8.8:5060;user=phone,
 route[CALL_START_REQUEST_REPLY]: 
123,OPTIONS,sip:g711a-282951...@kamailio.org,sip:G711A-282951200@8.8.8.8:5080
  

___

SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list

sr-users@lists.sip-router.org

http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users





___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users   
  ___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] http_async_query - How to Allow SIP transaction to continue

2016-09-15 Thread Federico Cabiddu
Hi,
did you create the transaction before calling http_async_query?
If not, the function switch to non-transactional context, the script
execution is not stopped (you should notice it in your logs if the log line
after the function call is printed) and the callback function creates a
fake message to be processed in the callback route.
You should call t_newtran() before calling http_async_query.

Cheers,

Federico

On Thu, Sep 15, 2016 at 5:44 PM, Jonathan Hunter 
wrote:

> Hi Guys,
>
> I am just testing with jansson and http_async_query.
>
> Essentially I sent an INVITE into kamailio ,it hits CALL_START_REQUEST
> (see below) and the query allows the http site I send to, to provide
> routing details for kamailio.
>
> Logging the $rm that hits CALL_START_ REQUEST, it shows as INVITE, however
> when CALL_START_REQUEST_REPLY is hit, the message type is OPTIONS, is this
> expected behaviour?
>
> Essentially I want it to continue in the script with the same $ci,$rm so I
> can onwards route it for termination, but all I get are options messages
> being sent, any hints please?
>
> As Ideally I want the transaction to continue to a route where I can
> forward on modified request for termination.
>
> Thanks
>
> Jon
>
>
>
> Routes;
>
>
> # Send to FreeSWITCH
> route[CALL_START_REQUEST]{
> xlog("L_INFO","route[CALL_START_REQUEST] Call received
> $ci,$rm,$ru,$du\n");
>
> ###Build JSON request to send to MAP
> $var(params) = $null;
> jansson_set("string", "username", "xxx", "$var(params)");
> jansson_set("string", "password", "xxx", "$var(params)");
> jansson_set("string", "source", "$fU", "$var(params)");
> jansson_set("string", "route", "$var(carriername)", "$var(params)");
> jansson_set("string", "destination", "$rU", "$var(params)");
> /// other fields set here
> http_set_timeout(5000);
> http_set_method("POST");
> http_append_header("Content-Type: application/json");
> http_async_query("http://test.com";, "$var(params)",
> "CALL_START_REQUEST_REPLY");
> xlog("L_INFO", "Checking here we have status=$var(status)\n");
> xlog("L_INFO", "Current Destination is $du\n");
> #return;
> #exit;
> }
> #
> route[CALL_START_REQUEST_REPLY]{
> xlog("L_INFO", "route[CALL_START_REQUEST_REPLY]: $ci,$rm,$ru,$du\n");
>
>
> Logs show;
>
>  route[CALL_START_REQUEST] Call received b087fa53-f5fc-1234-94ac-
> f68eb8da94f7,INVITE,sip:441624891676@8.8.8.8:5060;user=phone,
>
>  route[CALL_START_REQUEST_REPLY]: 123,OPTIONS,sip:G711A-
> 282951...@kamailio.org,sip:G711A-282951200@8.8.8.8:5080
>
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users