[SR-Users] Add websocket header to SIP

Daniel-Constantin Mierla miconda at gmail.com
Thu Aug 28 12:11:04 CEST 2014


Hello,

the header Origin is inside the http request used for opening the 
websocket connection. It is no longer available at invite time.

You can use htable module to store the origin header using connection id.

The logic in the config file should be like:
- in event_route during the handling of websocket connection, store the 
origin header like:

$sht(origin=>$conid) = $hdr(Origin);

in request route, while handling the invite, do:

if((proto==WS || proto==WSS) && $sht(origin=>$conid)!=$null) {
    append_hf("Origin: $sht(origin=>$conid)\r\n");
}

See readme of htable module about how to define origin hash table.

Cheers,
Daniel

On 28/08/14 01:16, Kamrul Khan wrote:
> Hi,
>
> I want to append the origin header of my incoming websockets to the 
> SIP INVITES. I tried something like the below but didnt work:
>
>  if (ws_handle_handshake())
> {
>                         if(method=="INVITE"){
>                              insert_hf("Origin: $hdr(Origin)");
>                         }
> exit;
> }
>
> Is there any other way to do it ?
>
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140828/fb85c8ef/attachment.html>


More information about the sr-users mailing list