Re: [SR-Users] xHTTP module.
Hello, On 5/20/11 3:25 PM, David J. wrote: I was wondering if I can make an HTTP request to Kamailio; and then have kamailio do a lookup based on passed parameters to connect callers. I am trying to make a click-to-dial type application; I was looking at the HTTP server inside kamailio; It was interesting to me to try to use this as an alternative to php-asterisk; (I know kamailio is not a full blown application server;) If anyone could help me with this I would appreciate it; you can get the caller and callee from HTTP GET parameters and do click-to-dial (implemented with REFER) using dlg_bridge() function: http://kamailio.org/docs/modules/stable/modules_k/dialog.html#id2966104 Cheers, Daniel -- Daniel-Constantin Mierla -- http://www.asipto.com http://linkedin.com/in/miconda -- http://twitter.com/miconda ___ 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] xHTTP module.
Thanks Daniel; What creates the Initial Dialog and REFER method Just calling dlg_bridge("sip:m...@myproxy.com", "sip:y...@yourproxy.com", "sip:myproxy.com:5080"); When I get an HTTP event; On 5/20/11 9:32 AM, Daniel-Constantin Mierla wrote: Hello, On 5/20/11 3:25 PM, David J. wrote: I was wondering if I can make an HTTP request to Kamailio; and then have kamailio do a lookup based on passed parameters to connect callers. I am trying to make a click-to-dial type application; I was looking at the HTTP server inside kamailio; It was interesting to me to try to use this as an alternative to php-asterisk; (I know kamailio is not a full blown application server;) If anyone could help me with this I would appreciate it; you can get the caller and callee from HTTP GET parameters and do click-to-dial (implemented with REFER) using dlg_bridge() function: http://kamailio.org/docs/modules/stable/modules_k/dialog.html#id2966104 Cheers, Daniel ___ 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] xHTTP module.
On 5/20/11 3:44 PM, David J. wrote: Thanks Daniel; What creates the Initial Dialog and REFER method Just calling dlg_bridge("sip:m...@myproxy.com", "sip:y...@yourproxy.com", "sip:myproxy.com:5080"); When I get an HTTP event; not sure you ask something or not, but if you don't know where to handle the http request, then you have to define an event_route[xhttp:reques] block: event_route[xhttp:request] { ... } Here is an example of using the embedded http server for implementing xcap handling for presence: http://kb.asipto.com/kamailio:presence:k31-made-simple#configuration_file This presentation I did at Fosdem 2011 shows also an example of using the internal http server: http://www.kamailio.org/events/2011-fosdem/dcm-sip-web-lua.pdf Practically, if you use GET, then the URL is in $hu variable, then use transformations to get your desired parameters. Cheers, Daniel On 5/20/11 9:32 AM, Daniel-Constantin Mierla wrote: Hello, On 5/20/11 3:25 PM, David J. wrote: I was wondering if I can make an HTTP request to Kamailio; and then have kamailio do a lookup based on passed parameters to connect callers. I am trying to make a click-to-dial type application; I was looking at the HTTP server inside kamailio; It was interesting to me to try to use this as an alternative to php-asterisk; (I know kamailio is not a full blown application server;) If anyone could help me with this I would appreciate it; you can get the caller and callee from HTTP GET parameters and do click-to-dial (implemented with REFER) using dlg_bridge() function: http://kamailio.org/docs/modules/stable/modules_k/dialog.html#id2966104 Cheers, Daniel -- Daniel-Constantin Mierla -- http://www.asipto.com http://linkedin.com/in/miconda -- http://twitter.com/miconda ___ 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] xHTTP module.
Daniel; Sorry for not being clear; I understand the HTTP stuff; I was asking if it is a simple as just calling the dialog bridge method within the HTTP event route. for example; event_route[xhttp:request] { dlg_bridge("sip:m...@myproxy.com", "sip:y...@yourproxy.com", "sip:myproxy.com:5080"); ... } Thanks for the clarification ___ 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] xhttp Module Version 4.1
Hi Guys, I am able to do this using $rb , is this the best method for this if I want to capture the details and manipulate or store accordingly into variables? Thanks Jon From: hunter...@hotmail.com To: sr-users@lists.sip-router.org Date: Fri, 8 Aug 2014 10:31:44 + Subject: [SR-Users] xhttp Module Version 4.1 Hi All, I am using the xhttp module to receive and respond to HTTP requests to my kamailio instance, and I am trying to extract the body of the HTTP post sent into kamailio, so that I can store it in variables. Is this possible? I can send 200ok responses with content, this is working well, I just need to try and get details from the received POST, can this be done? Thanks Jon ___ 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] xhttp Module Version 4.1
Hello, yes, $rb is the way to get the body. If you have big bodies and you use it in other expressions, you may need to increase the value for pv_buffer_size global parameter. Cheers, Daniel On 08/08/14 12:56, Jonathan Hunter wrote: Hi Guys, I am able to do this using *$rb* , is this the best method for this if I want to capture the details and manipulate or store accordingly into variables? Thanks Jon From: hunter...@hotmail.com To: sr-users@lists.sip-router.org Date: Fri, 8 Aug 2014 10:31:44 + Subject: [SR-Users] xhttp Module Version 4.1 Hi All, I am using the xhttp module to receive and respond to HTTP requests to my kamailio instance, and I am trying to extract the body of the HTTP post sent into kamailio, so that I can store it in variables. Is this possible? I can send 200ok responses with content, this is working well, I just need to try and get details from the received POST, can this be done? Thanks Jon ___ 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 -- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Next Kamailio Advanced Trainings 2014 - http://www.asipto.com Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA ___ 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] xhttp Module Version 4.1
Hello Daniel, Thanks for that. Is the best way to manipulate the contents of $rb to use transformations to extract particular information? I just want to search or extract what I get in $rb and use it for subsequent routing. Jon Date: Fri, 8 Aug 2014 13:33:20 +0200 From: mico...@gmail.com To: sr-users@lists.sip-router.org Subject: Re: [SR-Users] xhttp Module Version 4.1 Hello, yes, $rb is the way to get the body. If you have big bodies and you use it in other expressions, you may need to increase the value for pv_buffer_size global parameter. Cheers, Daniel On 08/08/14 12:56, Jonathan Hunter wrote: Hi Guys, I am able to do this using $rb , is this the best method for this if I want to capture the details and manipulate or store accordingly into variables? Thanks Jon From: hunter...@hotmail.com To: sr-users@lists.sip-router.org Date: Fri, 8 Aug 2014 10:31:44 + Subject: [SR-Users] xhttp Module Version 4.1 Hi All, I am using the xhttp module to receive and respond to HTTP requests to my kamailio instance, and I am trying to extract the body of the HTTP post sent into kamailio, so that I can store it in variables. Is this possible? I can send 200ok responses with content, this is working well, I just need to try and get details from the received POST, can this be done? Thanks Jon ___ 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 -- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Next Kamailio Advanced Trainings 2014 - http://www.asipto.com Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA ___ 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] xhttp Module Version 4.1
Hello, yes, transformations are the way to parse/extract values from a variable. If it is something more complex, then using an embedded language such as Lua, Perl, Python ... can be a more convenient alternative. Cheers, Daniel On 08/08/14 13:41, Jonathan Hunter wrote: Hello Daniel, Thanks for that. Is the best way to manipulate the contents of $rb to use transformations to extract particular information? I just want to search or extract what I get in $rb and use it for subsequent routing. Jon Date: Fri, 8 Aug 2014 13:33:20 +0200 From: mico...@gmail.com To: sr-users@lists.sip-router.org Subject: Re: [SR-Users] xhttp Module Version 4.1 Hello, yes, $rb is the way to get the body. If you have big bodies and you use it in other expressions, you may need to increase the value for pv_buffer_size global parameter. Cheers, Daniel On 08/08/14 12:56, Jonathan Hunter wrote: Hi Guys, I am able to do this using *$rb* , is this the best method for this if I want to capture the details and manipulate or store accordingly into variables? Thanks Jon From: hunter...@hotmail.com <mailto:hunter...@hotmail.com> To: sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> Date: Fri, 8 Aug 2014 10:31:44 + Subject: [SR-Users] xhttp Module Version 4.1 Hi All, I am using the xhttp module to receive and respond to HTTP requests to my kamailio instance, and I am trying to extract the body of the HTTP post sent into kamailio, so that I can store it in variables. Is this possible? I can send 200ok responses with content, this is working well, I just need to try and get details from the received POST, can this be done? Thanks Jon ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto: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 <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda Next Kamailio Advanced Trainings 2014 -http://www.asipto.com Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA ___ 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 -- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Next Kamailio Advanced Trainings 2014 - http://www.asipto.com Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA ___ 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] xhttp module and IPv6
Can you try with the small patch from the commit? https://github.com/kamailio/kamailio/commit/5c1a9df4fc8bd72f44066bcef13f381f01cd9d07 If ok, I will backport. Cheers, Daniel On 20/02/15 20:30, Sergey Okhapkin wrote: > > It looks like when http request comes from ipv6 address, the module > inserts Via header without [] around the address: > > > > Feb 20 14:26:17 east /usr/local/sbin/kamailio[30965]: ERROR: > [parser/parse_via.c:2193]: parse_via(): ERROR:parse_via: bad port > > Feb 20 14:26:17 east /usr/local/sbin/kamailio[30965]: ERROR: > [parser/parse_via.c:2708]: parse_via(): ERROR: parse_via on: > > Host: sip1.callwithus.com:5060 > > Connection: Upgrade > > Pragma: no-cache > > Cache-Control: no-cache > > Upgrade: websocket > > Origin: http://www.callwithus.com > > Sec-WebSocket-Version: 13 > > User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, > like Gecko) Chrome/40.0.2214.93 Safari/537.36 > > Accept-Encoding: gzip, deflate, sdch > > Accept-Language: en-US,en;q=0.8 > > Sec-WebSocket-Key: nyAUyArASVRXTI+Nvx82/Q== > > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits > > Sec-WebSocket-Protocol: sip > > > > > > > Feb 20 14:26:17 east /usr/local/sbin/kamailio[30965]: ERROR: > [parser/parse_via.c:2712]: parse_via(): ERROR: parse_via parse error, > parsed so far: > > Feb 20 14:26:17 east /usr/local/sbin/kamailio[30965]: ERROR: > [parser/msg_parser.c:125]: get_hdr_field(): ERROR: get_hdr_field: bad via > > Feb 20 14:26:17 east /usr/local/sbin/kamailio[30965]: INFO: > [parser/msg_parser.c:338]: parse_headers(): ERROR: bad header field > [Via: SIP/2.0/TCP 260] > > Feb 20 14:26:17 east /usr/local/sbin/kamailio[30965]: ERROR: > [parser/msg_parser.c:688]: parse_msg(): ERROR: parse_msg: message= / HTTP/1.1 > > Via: SIP/2.0/TCP 2601:3:8840:A:172E:9CAD:6BB2:3F69:45306 > > Host: sip1.callwithus.com:5060 > > Connection: Upgrade > > Pragma: no-cache > > Cache-Control: no-cache > > Upgrade: websocket > > Origin: http://www.callwithus.com > > Sec-WebSocket-Version: 13 > > User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, > like Gecko) Chrome/40.0.2214.93 Safari/537.36 > > Accept-Encoding: gzip, deflate, sdch > > Accept-Language: en-US,en;q=0.8 > > Sec-WebSocket-Key: nyAUyArASVRXTI+Nvx82/Q== > > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits > > Sec-WebSocket-Protocol: sip > > > > > > > Feb 20 14:26:17 east /usr/local/sbin/kamailio[30965]: ERROR: xhttp > [xhttp_mod.c:264]: xhttp_process_request(): parse_msg failed > > > > > > ___ > 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 -- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, May 27-29, 2015 Berlin, Germany - http://www.kamailioworld.com ___ 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] xhttp module and IPv6
Works but something is still wrong: Feb 20 15:19:32 east /usr/local/sbin/kamailio[31935]: INFO:
Re: [SR-Users] xhttp module and IPv6
Here is web browser's log: Request URL:ws://sip1.callwithus.com:5060/ Request Method:GET Status Code:101 Switching Protocols Request Headers Accept-Encoding:gzip, deflate, sdch Accept-Language:en-US,en;q=0.8 Cache-Control:no-cache Connection:Upgrade Host:sip1.callwithus.com:5060 Origin:http://www.callwithus.com Pragma:no-cache Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits Sec-WebSocket-Key:ITH30EL8eWOPvyaqbIIFsA== Sec-WebSocket-Protocol:sip Sec-WebSocket-Version:13 Upgrade:websocket User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36 Response Headers Connection:upgrade Content-Length:0 Sec-WebSocket-Accept:AnL9/ez1KsQtmMjyM2/b4FDqQPE= Sec-WebSocket-Protocol:sip Server:CWU SIP GW Sia:SIP/2.0/TCP [2601:3:8840:A:172E:9CAD:6BB2:3F69]:45464 Upgrade:websocket On Friday 20 February 2015 15:24:09 Sergey Okhapkin wrote: > Works but something is still wrong: > > Feb 20 15:19:32 east /usr/local/sbin/kamailio[31935]: INFO:
Re: [SR-Users] xhttp module and IPv6
Do you have event route for local replies generated via sl module? The error log messages seems to come from a situation like that. If yes, then perhaps is good to restrict the event route to sip replies only, because the sip parser for http replies is not compatible always. Otherwise, the websocket connection seems established, the http reply goes to browser and sip register comes, so in this regard, the log message shows a harmless situation. Cheers, Daniel On 20/02/15 21:44, Sergey Okhapkin wrote: > Here is web browser's log: > > Request URL:ws://sip1.callwithus.com:5060/ > Request Method:GET > Status Code:101 Switching Protocols > > Request Headers > Accept-Encoding:gzip, deflate, sdch > Accept-Language:en-US,en;q=0.8 > Cache-Control:no-cache > Connection:Upgrade > Host:sip1.callwithus.com:5060 > Origin:http://www.callwithus.com > Pragma:no-cache > Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits > Sec-WebSocket-Key:ITH30EL8eWOPvyaqbIIFsA== > Sec-WebSocket-Protocol:sip > Sec-WebSocket-Version:13 > Upgrade:websocket > User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like > Gecko) Chrome/40.0.2214.93 Safari/537.36 > > Response Headers > Connection:upgrade > Content-Length:0 > Sec-WebSocket-Accept:AnL9/ez1KsQtmMjyM2/b4FDqQPE= > Sec-WebSocket-Protocol:sip > Server:CWU SIP GW > Sia:SIP/2.0/TCP [2601:3:8840:A:172E:9CAD:6BB2:3F69]:45464 > Upgrade:websocket > > On Friday 20 February 2015 15:24:09 Sergey Okhapkin wrote: >> Works but something is still wrong: >> >> Feb 20 15:19:32 east /usr/local/sbin/kamailio[31935]: INFO: