<div dir="ltr">The important part is this:<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">wrong char [U/85]</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">in [$hdr(</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">Upgrade)] at [5 (5)]</span><br></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">You have a unicode newline character after the opening parenthesis. You should remove this and any other instances of weird characters which have become inserted in your config.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 24 October 2014 18:50, Nolan Darilek <span dir="ltr"><<a href="mailto:nolan@thewordnerd.info" target="_blank">nolan@thewordnerd.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Having a hard time piecing together lots of pieces out of context.<br>
Here's what I want:<br>
<br>
1. User logs in to my web app via its own authentication mechanisms.<br>
2. Via an authenticated REST endpoint, my web app connects to the<br>
ephemeral auth service and returns a temporary username/password to the<br>
client.<br>
3. The client connects to a web socket SIP interface, authenticating<br>
with the username/password it was given.<br>
4. I'd also like to support authentication via standard SIP client using<br>
the user's default username/password, but that's a bit down the road still.<br>
<br>
Here is my kamailio-local.cfg. I'm using the web socket example copied<br>
from the docs, with a little cleanup and a few optional checks removed<br>
for now.<br>
<br>
loadmodule "db_mongodb.so"<br>
<br>
#!define DBURL "mongodb://mongo/perceptron"<br>
<br>
#!define WITH_AUTH<br>
<br>
#!define WITH_NAT<br>
<br>
loadmodule "xhttp.so"<br>
<br>
#modparam("xhttp", "url_match", "^/sip/")<br>
<br>
tcp_accept_no_cl=yes<br>
<br>
loadmodule "msrp.so"  # Only required if using MSRP over WebSockets<br>
loadmodule "websocket.so"<br>
<br>
loadmodule "auth_ephemeral.so"<br>
<br>
modparam("auth_ephemeral", "secret", "Kamailio rulez!!11")<br>
<br>
event_route[xhttp:request] {<br>
  set_reply_close();<br>
  set_reply_no_connect();<br>
<br>
  # xlog("L_DBG", "HTTP Request Received\n");<br>
<br>
  if ($hdr(Upgrade) =~ "websocket" && $hdr(Connection) =~ "Upgrade" &&<br>
$rm=~ "GET" ) {<br>
    # Validate Host - make sure the client is using the correct<br>
    # alias for WebSockets<br>
    if ($hdr(Host) == $null || !is_myself("sip:" + $hdr(Host))) {<br>
      # xlog("L_WARN", "Bad host $hdr(Host)\n");<br>
      xhttp_reply("403", "Forbidden", "", "");<br>
      exit;<br>
    }<br>
<br>
    if (ws_handle_handshake()) {<br>
      exit;<br>
    }<br>
  }<br>
<br>
  xhttp_reply("404", "Not found", "", "");<br>
<br>
}<br>
<br>
<br>
When I attempt to validate this, I get:<br>
<br>
 0(1) ERROR: <core> [pvapi.c:790]: pv_parse_spec2(): error searching<br>
pvar "hdr"<br>
 0(1) ERROR: <core> [pvapi.c:994]: pv_parse_spec2(): wrong char [U/85]<br>
in [$hdr(<br>
Upgrade)] at [5 (5)]<br>
 0(1) : <core> [cfg.y:3436]: yyerror_at(): parse error in config file<br>
/usr/local<br>
/etc/kamailio/kamailio-local.cfg, line 28, column 7-19: Can't get from<br>
cache: $h<br>
dr(Upgrade)<br>
ERROR: bad config file (1 errors)<br>
<br>
I don't know what that means. I've copied the config directly from the<br>
website.<br>
<br>
I tried quoting "Upgrade" and such in the $hdr lines, but that gives me:<br>
<br>
 0(1) ERROR: <core> [pvapi.c:790]: pv_parse_spec2(): error searching<br>
pvar "hdr"<br>
 0(1) ERROR: <core> [pvapi.c:994]: pv_parse_spec2(): wrong char ["/34]<br>
in [$hdr(<br>
"Upgrade")] at [5 (5)]<br>
 0(1) : <core> [cfg.y:3436]: yyerror_at(): parse error in config file<br>
/usr/local<br>
/etc/kamailio/kamailio-local.cfg, line 28, column 7-21: Can't get from<br>
cache: $h<br>
dr("Upgrade")<br>
ERROR: bad config file (1 errors)<br>
<br>
<br>
What am I missing here?<br>
<br>
I also had to comment out the xlog lines because those gave me errors.<br>
Do I need another module loaded to use xlog?<br>
<br>
Finally, does anyone have a working, complete example of SIP over web<br>
sockets with ephemeral auth integrated? I'm not sure if I should be<br>
checking the ephemeral auth credentials in the web sockets code, the SIP<br>
routes or somewhere else. I'm also not sure how I should set up<br>
authentication such that users can log in with both their standard<br>
credentials or those retrieved via the ephemeral auth module.<br>
<br>
Thanks.<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a 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><br>
</blockquote></div><br></div>