<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div><span style="font-size: 12pt;">Worked perfectly. Thanks a lot!</span></div><div><br><div><hr id="stopSpelling">Date: Thu, 28 Aug 2014 12:11:04 +0200<br>From: miconda@gmail.com<br>To: sr-users@lists.sip-router.org<br>Subject: Re: [SR-Users] Add websocket header to SIP<br><br>
  
    
  
  
    Hello,<br>
    <br>
    the header Origin is inside the http request used for opening the
    websocket connection. It is no longer available at invite time.<br>
    <br>
    You can use htable module to store the origin header using
    connection id.<br>
    <br>
    The logic in the config file should be like:<br>
    - in event_route during the handling of websocket connection, store
    the origin header like:<br>
    <br>
    $sht(origin=>$conid) = $hdr(Origin);<br>
    <br>
    in request route, while handling the invite, do:<br>
    <br>
    if((proto==WS || proto==WSS) &&
    $sht(origin=>$conid)!=$null) {<br>
       append_hf("Origin: $sht(origin=>$conid)\r\n");<br>
    }<br>
    <br>
    See readme of htable module about how to define origin hash table.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="ecxmoz-cite-prefix">On 28/08/14 01:16, Kamrul Khan wrote:<br>
    </div>
    <blockquote cite="mid:BLU180-W69E4A893388EA0087ECB32D5DD0@phx.gbl">
      <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>I want to append the origin header of my incoming
          websockets to the SIP INVITES. I tried something like the
          below but didnt work:</div>
        <div><br>
        </div>
        <div> if (ws_handle_handshake())</div>
        <div><span class="ecxApple-tab-span" style="white-space:pre;"> </span>{</div>
        <div>                        if(method=="INVITE"){</div>
        <div>                             insert_hf("Origin:
          $hdr(Origin)");</div>
        <div>                        }</div>
        <div><span class="ecxApple-tab-span" style="white-space:pre;"> </span>exit;</div>
        <div><span class="ecxApple-tab-span" style="white-space:pre;"> </span>}</div>
        <div><br>
        </div>
        <div>Is there any other way to do it ?</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="ecxmimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="ecxmoz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="ecxmoz-signature">-- 
Daniel-Constantin Mierla
<a class="ecxmoz-txt-link-freetext" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a class="ecxmoz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Next Kamailio Advanced Trainings 2014 - <a class="ecxmoz-txt-link-freetext" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA</pre>
  

<br>_______________________________________________
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</div></div>                                     </div></body>
</html>