[SR-Users] SIP Trunks

Klaus Darilion klaus.mailinglists at pernau.at
Wed Oct 9 18:37:46 CEST 2013


Am 09.10.2013 17:56, schrieb Keith:
> Hi,
> Can anyone point me in the right direction for setting up SIP trunks? 
> Whenever I send a call to a registered user on a trunk it just sends 
> to destination s at x.x.x.x. Is there anyway to say "these extensions are 
> location at this destination IP and port".
 From Kamailio point of view you do not have a trunk yet. You are having 
an Asterisk server registering on you Kamailio. If sombeody calls this 
registered user, the call gets forwarded to Asterisk and the RURI will 
be identical to the contact registered by Asterisk "s at .....".

So to make a trunk, you need some logic in your Kamailio which:
1. check the called number
2. matches the called to a user
3. lookup the registration of this user
4. somehow signal the called number to this user

This 4th step can be done by adding a dedicated header and inspect the 
header on Asterisk, or use the usual (non standard conform way) to 
signal the original called number in the user part of the request URI, eg:

# save the called number
$var(did)=$rU;
# look up the did and get the respective user, e.g. use sqlops and 
SELECT ......
.....
# asume the associated user of the DID is in $var(user)
$rU=$var(user);
lookup("location");
# overwrite the user part with the DID
$rU=$var(did);
t_relay();

klaus



More information about the sr-users mailing list