[OpenSER-Users] [FEATURE REQ] allow does_uri_exist() to test against other variables besides $ru
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Mon Mar 31 14:09:29 CEST 2008
Hi Mike,
If not already, please upload your request on the tracker - see the
"Feature requests" section.
Thanks and regards,
Bogdan
Mike Fedyk wrote:
> Hi,
>
> Is there a better way to test if a call is from a registered user without
> authentication than the code below? If not, then let me request that
> does_uri_exist() take an argument specifying the variable to test against.
>
> Mike
>
> if (src_ip != 'x.x.x.28' && !lookup("location"))
> {
> if (registered("location")) { xlog("L_NOTICE", "cs<$cs> si<$si:$sp>
> ci<$ci> route3: matched registered()\n"); }
> if (!registered("location")) { xlog("L_NOTICE", "cs<$cs> si<$si:$sp>
> ci<$ci> route3: matched !registered()\n"); }
>
> ### send DIDs to asterisk directly because it doesn't handle
> unauthenticated calls via a proxy properly
> #change request uri to from uri so that does_uri_exist() can test
> against it
> $var(orig_ru) = $ru;
> $ru = $fu;
> if (does_uri_exist()) { xlog("L_NOTICE", "cs<$cs> si<$si:$sp>
> ci<$ci> route3: matched does_uri_exist()\n"); }
> if (!does_uri_exist()) { xlog("L_NOTICE", "cs<$cs> si<$si:$sp>
> ci<$ci> route3: matched !does_uri_exist()\n"); }
>
> #10 digit DID and is not from one of our users
> if ($var(orig_ru) =~ "^sip:[0-9]{10}" && !does_uri_exist())
> {
> xlog("L_NOTICE", "cs<$cs> si<$si:$sp> ci<$ci> route3: 302
> redirect to asterisk\n");
> $var(dstredir) = "sip:" + $tU + "@x.x.x.28";
> $ru=$var(dstredir);
> sl_send_reply("302", "Moved Temporarily");
> exit;
> #route(1);
> };
> #END DIDs to asterisk and change request uri back
> $ru = $var(orig_ru);
> }
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.openser.org
> http://lists.openser.org/cgi-bin/mailman/listinfo/users
>
>
More information about the Users
mailing list