<!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,&nbsp;I have a script that decides which&nbsp;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&nbsp;so the 
gateway knows which way to send it.&nbsp;i use something like 
this.</FONT></SPAN></DIV>
<DIV><SPAN class=484494119-14072005><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=484494119-14072005><FONT face=Arial color=#0000ff 
size=2>&nbsp;if ( method == "INVITE" ) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></SPAN><SPAN 
class=484494119-14072005><FONT face=Arial color=#0000ff size=2>if 
(!exec_dset("/usr/local/sbin/npanxx_lookup")) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
sl_reply_error();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
};<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
};<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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if(result)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
# Lookup failed, assume that this is a phonenumber URL until I setup pattern 
matching<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
# Send to the 
TNT<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
xlog("L_INFO", "Sending URI (%ru) to 
TNT");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
prefix(result);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
rewritehostport("<A 
href="http://10.1.1.5:5060">10.1.1.5:5060</A>")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
};<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>