<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2627" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=484494119-14072005><FONT face=Arial
color=#0000ff size=2>of course you can do this. you need to read up more on the
exec module, I have a script that decides which outgoing trunk to
use</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=484494119-14072005><FONT face=Arial
color=#0000ff size=2>based on the from number, the prepends digits so the
gateway knows which way to send it. i use something like
this.</FONT></SPAN></DIV>
<DIV><SPAN class=484494119-14072005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=484494119-14072005><FONT face=Arial color=#0000ff
size=2> if ( method == "INVITE" )
{<BR> </FONT></SPAN><SPAN
class=484494119-14072005><FONT face=Arial color=#0000ff size=2>if
(!exec_dset("/usr/local/sbin/npanxx_lookup"))
{<BR>
sl_reply_error();<BR>
};<BR>
};<BR></FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=484494119-14072005>from
the script you can use specific environment variables to get the FROM and TO
numbers among other things.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=484494119-14072005></SPAN></FONT> </DIV>
<DIV align=left><SPAN class=484494119-14072005></SPAN><FONT face=Arial><FONT
color=#0000ff><FONT size=2>l<SPAN class=484494119-14072005>ike
URI</SPAN>=$SIP_RURI<SPAN class=484494119-14072005> and
FROM=$SIP_HF_FROM</SPAN></FONT></FONT></FONT></DIV>
<DIV align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=484494119-14072005></SPAN></FONT></FONT></FONT> </DIV>
<DIV align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=484494119-14072005>after you run through your logic simply "echo" or
"print" your new URI and you're done.</SPAN></FONT></FONT></FONT></DIV>
<DIV align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=484494119-14072005></SPAN></FONT></FONT></FONT> </DIV>
<DIV align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=484494119-14072005>Ray</SPAN></FONT></FONT></FONT></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Tahoma
size=2><B>From:</B> serusers-bounces@lists.iptel.org
[mailto:serusers-bounces@lists.iptel.org] <B>On Behalf Of </B>andrew
matthews<BR><B>Sent:</B> Thursday, July 14, 2005 12:01 PM<BR><B>To:</B>
serusers@lists.iptel.org<BR><B>Subject:</B> [Serusers] Complex
routing<BR></FONT><BR></DIV>
<DIV></DIV>I'm looking for a way to look up a phone number and then prepending a
prefix to the number then forwarding it to a host...<BR><BR><BR>Basicly
something like this<BR><BR>result=exec('/home/scripts/lookup.pl
800-555-1212')<BR><BR><BR>
if(result)<BR>
# Lookup failed, assume that this is a phonenumber URL until I setup pattern
matching<BR>
# Send to the
TNT<BR>
xlog("L_INFO", "Sending URI (%ru) to
TNT");<BR>
prefix(result);<BR>
rewritehostport("<A
href="http://10.1.1.5:5060">10.1.1.5:5060</A>")<BR>
};<BR><BR><BR><BR>basicly then result would contain 333, or 555, or 777.
Depending on then number that was returned from lookup.pl<BR><BR><BR>is there
anyway to do this? Or any other way to do
it?<BR><BR>Thanks<BR><BR>Andrew<BR></BODY></HTML>