All pastes #964955 Raw Edit

Someone

public text v1 · immutable
#964955 ·published 2008-03-31 17:59 UTC
rendered paste body
		### 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", "M=$rm RURI=$ru F=$fu IP=$si:$sp CS=$cs route3: matched does_uri_exist($fu)\n"); }
		if (!does_uri_exist()) { xlog("L_NOTICE", "M=$rm RURI=$ru F=$fu IP=$si:$sp CS=$cs route3: matched !does_uri_exist($fu)\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", "M=$rm RURI=$ru F=$fu IP=$si:$sp CS=$cs route3: 302 redirect to asterisk\n");
                         
                        #########I WOUDL USE (which is what worked for me)##########
                        subst_uri("/x\.x\.x\.28/$avp(s:ip):$avp(s:port)/");
                        subst_uri("/sip:/sip:$avp(s:prefix)/");
                        ############################################################

			$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);